To fetch the balance of a certain token for a wallet, you need to call the function getTokenBalance
which will return a promise containing a TokenBalance
object. If you need the entire balance a certain wallet holds, it is recommended to use the getTokenBalances
function.
arkaneConnect.api.getTokenBalance("<WALLET_ID>", "<TOKEN_ADDRESS>");
const arkaneConnect = new ArkaneConnect('YOUR_CLIENT_ID');arkaneConnect.api.getTokenBalance("c8ec9954-fa1a-4682-9cf8-ef5c1015d1d1","0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0").then((tokenBalance) => {console.log("The balance of",tokenBalance.symbol,"is",tokenBalance.balance);})
{balance: 392.10420561176494decimals: 18logo: "https://raw.githubusercontent.com/ArkaneNetwork/content-management/master/tokens/ethereum/mainnet/logos/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0.png"rawBalance: "392104205611764916095"symbol: "MATIC"tokenAddress: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"transferable: truetype: "ERC20"}
The function reference describes the different functions that are available in the Widget. For each function you can find the signature, its parameters, and possible options documented.