πŸ’°Token Balances API

Get a list of assets owned by a Solana address.

Overview

This will return a list of assets for the specified owner. Supported assets include NFTs and compressed NFTs (regular DAS), as well as fungible tokens and Token22 (Helius extension).

This method is the fastest way to return all assets belonging to a wallet.

The page parameter in starts at 1 .

Fungible Token Extension

DAS API traditionally has returned data for NFTs β€” at Helius, we've also added support for all tokens. To learn more, please visit Fungible Token Extension (Beta).

This feature can be enabled via the showFungible filter. When enabled, the response will include fungible tokens and their associated information (supply, balance, and price). Token22 tokens are supported and their extensions are parsed. For richer options, consider using Search Assets.

Suggested Use Cases

The Fungible Token Extension also returns the USD prices of token holdings.

Using 'Get Assets by Owner' to return all tokens from a user wallet enables the creation of::

  • A wallet tracker.

  • A portfolio viewer for both fungible and non-fungible tokens.

  • A token-gated dApp.

Example

Get NFTs & compressed NFTs from the toly.sol wallet:

const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`

const getAssetsByOwner = async () => {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 'my-id',
      method: 'getAssetsByOwner',
      params: {
        ownerAddress: '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY',
        page: 1, // Starts at 1
        limit: 1000,
      },
    }),
  });
  const { result } = await response.json();
  console.log("Assets by Owner: ", result.items);
};
getAssetsByOwner(); 

Get ALL assets from the toly.sol wallet:


const getAssetsByOwner = async () => {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 'my-id',
      method: 'getAssetsByOwner',
      params: {
        ownerAddress: '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY',
        page: 1, // Starts at 1
        limit: 1000,
	displayOptions: {
	    showFungible: true //return both fungible and non-fungible tokens
	}
      },
    }),
  });
  const { result } = await response.json();
  console.log("Assets by Owner: ", result.items);
};
getAssetsByOwner(); 

Last updated