Get All Owned NFTs
Returns the NFT ID of all the NFTs currently owned by an account.
// This can be an Aventus address or public key.
await API.query.getOwnedNfts(avn_account);
Example
const AVN_API = require("avn-api");
//Replace the endpoint_url with the url received from Aventus.
const AVN_GATEWAY_URL = "<endpoint_url>";
const API = new AVN_API(AVN_GATEWAY_URL);
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();
})();
Example Result
[
"28864026131317024858047047269769811198288654753166303480645299416724748836052", "52485804728864026131317047269769811478198288650645299416724748836052531663034", "24748836288624858047402047269769863034806451119828865475316299416705261313170"
]
JSON-RPC
REQUEST
POST https://AVN-API-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-API-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
Example Output
{
"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.