Get Assets by Owner
Get a list of assets owned by an address.
Last updated
Was this helpful?
Get a list of assets owned by an address.
Last updated
Was this helpful?
This method is the fastest way to return all assets belonging to a wallet. Supported assets include NFTs, compressed NFTs (regular DAS), fungible tokens, and Token22.
The page
parameter in starts at 1
Using getAssetsByOwner 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.
The Fungible Token Extension also returns the USD prices of token holdings.
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();
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();
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();
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' },
// ],
// ];
/?api-key=<api-key>
An ID to identify the request.
The version of the JSON-RPC protocol.
2.0
The name of the DAS method to invoke.
getAssetsByOwner
curl -L \
--request POST \
--url 'https://mainnet.helius-rpc.com/?api-key=<api-key>' \
--header 'Content-Type: application/json' \
--data '{"id":"text","jsonrpc":"2.0","method":"getAssetsByOwner","params":{"ownerAddress":"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY","page":1,"limit":100,"before":"string","after":"string","options":{"showUnverifiedCollections":false,"showCollectionMetadata":false,"showGrandTotal":false,"showFungible":false,"showNativeBalance":false,"showInscription":false,"showZeroBalance":false},"sortBy":{"sortBy":"created","sortDirection":"asc"}}}'
{
"jsonrpc": "2.0",
"id": "text",
"result": {
"total": 1,
"limit": 1,
"page": 1,
"items": [
{
"interface": "V1_NFT",
"id": "JCfTS6dmJZY4NXhjMwHqayGGHUwxp59pzcYhZrYqMBce",
"mutable": true,
"burnt": false,
"compression": {
"eligible": false,
"compressed": true,
"data_hash": "7zquDVS1VKu9HDh4WS4ray5ozLThiK6xrnFNhJtusj65",
"creator_hash": "6v7GeYRiVML5mG1kJqi6eujN9sPB3ziCZJF4Vartj1qd",
"asset_hash": "8gQZkgZ1L91qkNPtsiRGkRzpNcEfhBABEQr1D3wquB8H",
"tree": "BZNn9zX1MysbSvqyGZ33Seb8bvimaiE9fxmLKwX2Euae",
"seq": 251133,
"leaf_id": 250758
},
"royalty": {
"royalty_model": "creators",
"target": null,
"percent": 0,
"basis_points": 0,
"primary_sale_happened": false,
"locked": false
},
"ownership": {
"frozen": false,
"delegated": true,
"delegate": "GVKwqsEC5YQZX4hG7Fdy6m7cJUi4DA3ezYx1CC9wkj34",
"ownership_model": "single",
"owner": "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY"
},
"supply": {
"print_max_supply": 0,
"print_current_supply": 0,
"edition_nonce": 0
},
"grouping": [
{
"group_key": "collection",
"group_value": "723Vxwr6aYZHNqc8dVQVwchDHUR3cEwZA8zkejdYWKaS"
}
],
"creators": [
{
"address": "GVKwqsEC5YQZX4hG7Fdy6m7cJUi4DA3ezYx1CC9wkj34",
"share": 100,
"verified": true
}
],
"authorities": [
{
"address": "2iVwwSHr7hGR6wxNuQM8ArQYnX6Mzy2yeFnhBGgQetRw",
"scopes": [
"full"
]
}
],
"content": {
"$schema": "https://schema.metaplex.com/nft1.0.json",
"json_uri": "https://www.hi-hi.vip/json/5000wif.json",
"files": [
{
"uri": "https://img.hi-hi.vip/json/img/5000wif.png",
"cdn_uri": "https://cdn.helius-rpc.com/cdn-cgi/image//https://img.hi-hi.vip/json/img/5000wif.png",
"mime": "image/png"
}
]
}
}
]
}
}
Successful response