This function is used to retrieve the balance of a token for a specific address.
import { L1XProvider, FTTokenGetBalanceArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: FTTokenGetBalanceArg = {
contract_address: "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
address: "346fb07c43e88b58c058e8d6c4bf2f5080a01999",
};
l1xProvider.tokens.FT.getBalance(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
Token balance query parameters.
{
"contract_address": "2e15a979ebc2de6ebafb373dae52e0c1809096c9",
"address": "346fb07c43e88b58c058e8d6c4bf2f5080a01999"
}
Token balance response.
{
"value": "34253522",
"decimals": 12,
"normalized_value": "253826612223"
}