How to get the balance of a Non-Fungible token?

  • getBalance

Gets the balance of an NFT token for a specific address.

import { L1XProvider, NFTTokenGetBalanceArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation"
});

let params: NFTTokenGetBalanceArg = {
  contract_address: "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
  address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
};

l1xProvider.tokens.NFT.getBalance(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

The attribute for getting the token balance.

{
    "contract_address": "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
    "address": "346fb07c43e88b58c058e8d6c4bf2f5080a01999"
}

Returns:

The response contains the token balance.

{
    "value": "344344544"
}

Last updated