getBalances

Call this function to get the current token balances (erc20 and native token) for the user across all chains. The user must be logged in for this call to succeed. You can confirm a user has been logged in by calling hallidayClient.getUserInfo().

Example Usage

import {Halliday} from "halliday-sdk";

/**
 * Returns the player's ERC20s.
 *
 */
const getBalancesResponse = await hallidayClient.getBalances(userInGameId)

Inputs

NameTypeDescription
userInAppIdstringUser's id in your application (must be unique)

Outputs

Promise to a GetWalletResponse object.

NameTypeDescription
num_erc20_tokensnumberNumber of different erc20 tokens in user's wallet
erc20_tokensArray of ERC-20 Token DataDetails of erc20 tokens owned by user
num_native_tokensnumberNumber of different native tokens in user's wallet
native_tokensArray of Native token DataDetails of native tokens owned by user

ERC-20 Token Data Format

NameTypeDescription
blockchain_typestringBlockchain this token exists on
token_addressstringContract 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
blockchain_typestringBlockchain this token exists on
balancestringQuantity of this token in user's wallet
decimalsnumberNumber of decimals used in balance (i.e 18 for wei)