Fungible Tokens

View all SPL tokens owned by a wallet using the getAssetsByOwner DAS API with showFungible: true. Includes balances and price data.

Try It

Code Example

// Get all fungible tokens for a wallet address
import { Helius } from 'helius-sdk';

const helius = new Helius('YOUR_API_KEY');

async function getFungibleTokens(ownerAddress: string) {
const response = await helius.rpc.getAssetsByOwner({
ownerAddress,
page: 1,
limit: 1000,
displayOptions: {
showFungible: true,
showNativeBalance: false,
showZeroBalance: false,
},
});

// Filter for fungible interfaces only
const fungibleInterfaces = ['FungibleToken', 'FungibleAsset'];

return response.items
.filter(asset => fungibleInterfaces.includes(asset.interface))
.map(asset => {
const balance = asset.token_info?.balance ?? 0;
const decimals = asset.token_info?.decimals ?? 0;

return {
mint: asset.id,
name: asset.content?.metadata?.name || 'Unknown Token',
symbol: asset.content?.metadata?.symbol || '???',
balance,
uiAmount: (balance / Math.pow(10, decimals)).toFixed(decimals),
priceInfo: asset.token_info?.price_info,
};
});
}

// Usage
const tokens = await getFungibleTokens('86xCnPeV69n...');
tokens.forEach(t => console.log(`${t.uiAmount} ${t.symbol}`));

API Tips

  • Important: Set showFungible: true in displayOptions to include tokens.
  • Interface filtering: Fungible tokens use FungibleToken or FungibleAsset interfaces.
  • Zero balances: Use showZeroBalance: false to exclude tokens with 0 balance.

Frequently Asked Questions

How do I list all tokens in a Solana wallet?
Use getAssetsByOwner with showFungible: true in displayOptions. Filter the response for FungibleToken or FungibleAsset interfaces to get only fungible tokens.
How do I exclude tokens with zero balance?
Add showZeroBalance: false to displayOptions. This filters out token accounts that have been emptied but still exist on-chain.
Does the API return token prices?
Yes, price data is included in token_info.price_info for tokens with sufficient liquidity. Prices are cached with a 10-minute TTL.