wallet_getAssets
Fetches the user's token balances and portfolio across all supported chains. This provides a unified view of the user's holdings with USD values when available. Use this to display wallet balances or to check if the user has sufficient funds for a transaction.
Asset reads require the same app JWT setup as intent flows. Configure
OneAuthClient with sponsorship so the SDK can fetch your app access token
and forward it to the 1auth provider.
When you are already using OneAuthClient, prefer the native SDK helper:
const assets = await client.getAssets({
accountAddress: "0x1111111111111111111111111111111111111111",
});Try it
Parameters
Optional. Connected EIP-1193 apps can call with no params. Apps that already have a verified account address can pass it explicitly:
await provider.request({
method: "wallet_getAssets",
params: [{ accountAddress: "0x1111111111111111111111111111111111111111" }],
});Returns
Returns the user's portfolio data including token balances across all supported chains.
interface AssetsResponse {
balances: Array<{
chainId: number;
token: string;
symbol: string;
decimals: number;
balance: string;
usdValue?: number;
isTestnet?: boolean;
}>;
mainnets: { balances: AssetsResponse["balances"] };
testnets: { balances: AssetsResponse["balances"] };
}Example
const assets = await provider.request({
method: 'wallet_getAssets',
});
console.log('Portfolio:', assets);
// Display balances
for (const balance of assets.balances) {
const amount = Number(balance.balance) / 10 ** balance.decimals;
console.log(`${balance.symbol}: ${amount} (${balance.usdValue})`);
}
console.log("Mainnet balances:", assets.mainnets.balances);
console.log("Testnet balances:", assets.testnets.balances);Notes
- Requires the user to be connected
- Requires
OneAuthClient.sponsorshipso the SDK can send an app JWT - Fetches data from the 1auth portfolio API
- Returns balances across all supported chains
- Also returns
mainnets.balancesandtestnets.balancesso apps can render network-specific views without changing SDK configuration - USD values are fetched from price feeds when available