All Token Balances
Get a complete portfolio view with SOL and all token balances using the getAssetsByOwner DAS API. Includes price data and total portfolio value.
Try It
Code Example
// Get all token balances + SOL for a wallet
import { Helius } from 'helius-sdk';
const helius = new Helius('YOUR_API_KEY');
async function getAllBalances(address: string) {
const response = await helius.getAssetsByOwner({
ownerAddress: address,
page: 1,
limit: 1000,
displayOptions: {
showFungible: true,
showNativeBalance: true
}
});
return {
nativeBalance: response.nativeBalance,
tokens: response.items.filter(
item => item.interface === 'FungibleToken'
)
};
}
// Usage
const balances = await getAllBalances('86xCnPeV69n...');
console.log(`SOL: ${balances.nativeBalance.lamports / 1e9}`);
console.log(`Tokens: ${balances.tokens.length}`);API Tips
- Display options: Use
showFungible: trueandshowNativeBalance: trueto get complete balance data. - Price data: Token prices are cached with a 10-minute TTL. Not all tokens have price data available.
- Pagination: For wallets with many tokens, use pagination with
pageandlimitparameters.
Frequently Asked Questions
How do I get all token balances for a Solana wallet?
Use the getAssetsByOwner DAS API with showFungible: true and showNativeBalance: true in displayOptions. This returns all SPL tokens plus native SOL balance in a single call.
Does getAssetsByOwner include price data?
Yes, token prices are included when available. Prices are cached with a 10-minute TTL. Not all tokens have price data - mainly established tokens with sufficient liquidity.
How do I handle wallets with many tokens?
Use pagination with the page and limit parameters. Set limit up to 1000 per page and increment the page number to fetch more results.