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.
Try it
Parameters
None.
Returns
Returns the user's portfolio data including token balances across all supported chains.
interface AssetsResponse {
// Portfolio data structure varies - check API response
balances: Array<{
chainId: number;
token: string;
symbol: string;
decimals: number;
balance: string;
usdValue?: number;
}>;
}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})`);
}Notes
- Requires the user to be connected
- Fetches data from the 1auth portfolio API
- Returns balances across all supported chains
- USD values are fetched from price feeds when available