Get All Owned NFTs
Returns the ID of all the NFTs currently owned by an account.
await api.query.getOwnedNfts(avn_account);
important
You can get the AVN_GATEWAY_URL here.
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<node_url>";
const options = {
suri: "<account_suri>",
};
const API = new AVN_API(AVN_GATEWAY_URL, options);
async function main() {
await api.init();
//replace "acct" with the public key or SS58 address of the Aventus account.
let result = await api.query.getOwnedNfts(acct);
console.log(result);
}
(async () => {
await main();
})();
[
"28864026131317024858047047269769811198288654753166303480645299416724748836052", "52485804728864026131317047269769811478198288650645299416724748836052531663034", "24748836288624858047402047269769863034806451119828865475316299416705261313170"
]
REQUEST
POST https://AVN_GATEWAY_URL/query
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
- accountId [required] - This can be an Aventus address or public key.
JSON-RPC Example
curl https://AVN_GATEWAY_URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getOwnedNfts", "params":{"accountId":"5asd...adf"}, "id":1}'
note
result - hex string value representing the NFT ID
{
"jsonrpc": "2.0",
"id": 1,
"result": [
"28864026131317024858047047269769811198288654753166303480645299416724748836052",
"52485804728864026131317047269769811478198288650645299416724748836052531663034",
"24748836288624858047402047269769863034806451119828865475316299416705261313170"
]
}
Production Example
Multiple NFTs have been minted on the AVN and HERE is a link to the AVN Explorer that provides more detail on the minted NFT. Click on the Advanced tab on the page to view more details on the transaction.