Retrieve token balance
How to retrieve the balance of a token for a wallet
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.


venlyConnect.api.getTokenBalance("<WALLET_ID>", "<TOKEN_ADDRESS>");
venlyConnect.api.getTokenBalanceByAddress("<SECRET_TYPE", "<WALLET_ADDRESS>", "<TOKEN_ADDRESS>");


const venlyConnect = new VenlyConnect('YOUR_CLIENT_ID');
venlyConnect.api.getTokenBalance("c8ec9954-fa1a-4682-9cf8-ef5c1015d1d1","0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0").then((tokenBalance) => {
console.log("The balance of",tokenBalance.symbol,"is",tokenBalance.balance);


balance: 392.10420561176494
decimals: 18
logo: ""
rawBalance: "392104205611764916095"
symbol: "MATIC"
tokenAddress: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"
transferable: true
type: "ERC20"

Function Reference

The function reference describes the different functions that are available in the Widget. For each function you can find the signature, it's parameters, and possible options documented.
Copy link
On this page
Function Reference