Get Assets by Owner

Get a list of assets owned by an 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. We also display native balances if you enable the showNativeBalance flag. For richer options, consider using Search Assets.

Inscriptions & SPL-20

You can optionally display inscription and SPL-20 token data with the showInscription flag. You can learn more about inscriptions and SPL-20 here.

Please note that this is an experimental feature.

The Helius API does not verify SPL-20 tokens. Trade at your own risk. For more information, please use the validator tool or join the Libreplex Discord channel.

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(); 

Searching for all assets (including native balance):

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

const getAssetsWithNativeBalance = 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',
                displayOptions: {
                    showFungible: true,
                    showNativeBalance: true,
                },
            },
        }),
    });

    const { result } = await response.json();
    console.log(result.nativeBalance.lamports); // 1479920100
};
getAssetsWithNativeBalance();

Show inscriptions & SPL-20 data

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

const getAssetsWithInscriptions = 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: '6GmTFg5SCs4zGfDEidUAJjS5pSrXEPwW8Rpfs3RHrbc5',
                displayOptions: {
                    showInscription: true, // display inscription & spl-20 data
                },
            },
        }),
    });

    const { result } = await response.json();
    console.log(result.items.map((i) => [i.id, i.inscription, i.spl20]));
};
getAssetsWithInscriptions();

// Example output:
// [
//     [
//         'AKo9P7S8FE9NYeAcrtZEpimwQAXJMp8Lrt8p4dMkHkY2',
//         {
//             order: 308332,
//             size: 52,
//             contentType: 'application/text',
//             encoding: 'base64',
//             validationHash: '907e00a18f952ade319c21b90764e5d0a08ec31c92e792f806a995e8524535ca',
//             inscriptionDataAccount: '9qM9ThkVPxjq4TyBjCs1qpY15VYVim2Qh7uR5yG1Da3T',
//         },
//         { p: 'spl-20', op: 'mint', tick: 'helius', amt: '1' },
//     ],
// ];

Last updated