Token Balance
Wander Injected API tokenBalance() function
Argument
Type
Description
Result
export type TokenBalanceResult = string;Example usage
// Connect to the extension and request access to the ACCESS_TOKENS permission
await window.arweaveWallet.connect(["ACCESS_TOKENS"]);
// Retrieve the list of tokens owned by the user
const tokens = await window.arweaveWallet.userTokens();
console.log("Tokens owned by the user:", tokens);
try {
// Retrieve the balance of a user token
const tokenId = tokens[0].processId
const balance = await window.arweaveWallet.tokenBalance(tokenId);
console.log(`Balance of the token with ID ${tokenId}:`, balance);
} catch (error) {
console.error("Error fetching token balance:", error);
}Last updated
Was this helpful?