getBalances

Call this function to get the current token balances (erc20 and native token) for the user across all chains.

Example Usage

/**
 * Returns the player's ERC20s and native tokens.
 */
const balances = await hallidayClient.getBalances();

Inputs

There are no inputs needed to call this function.

Outputs

A SmartAccountBalances object, with the following fields:

NameTypeDescription
numErc20TokensnumberNumber of different erc20 tokens in user's wallet
erc20TokensArray of ERC-20 Token DataDetails of erc20 tokens owned by user
numNativeTokensnumberNumber of different native tokens in user's wallet
nativeTokensArray of Native token DataDetails of native tokens owned by user

ERC-20 Token Data Format

NameTypeDescription
blockchainTypestringBlockchain this token exists on
tokenAddressstringContract address of this token
balancestringQuantity of this token in user's wallet
decimalsnumberNumber of decimals used in balance (i.e 18 for wei)

Native Token Data Format

NameTypeDescription
blockchainTypestringBlockchain this token exists on
balancestringQuantity of this token in user's wallet
decimalsnumberNumber of decimals used in balance (i.e 18 for wei)