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
Name | Type | Description |
---|---|---|
userInAppId | string | User's id in your application (must be unique) |
Outputs
Promise to a GetWalletResponse object.
Name | Type | Description |
---|---|---|
num_erc20_tokens | number | Number of different erc20 tokens in user's wallet |
erc20_tokens | Array of ERC-20 Token Data | Details of erc20 tokens owned by user |
num_native_tokens | number | Number of different native tokens in user's wallet |
native_tokens | Array of Native token Data | Details of native tokens owned by user |
ERC-20 Token Data Format
Name | Type | Description |
---|---|---|
blockchain_type | string | Blockchain this token exists on |
token_address | string | Contract address of this token |
balance | string | Quantity of this token in user's wallet |
decimals | number | Number of decimals used in balance (i.e 18 for wei) |
Native Token Data Format
Name | Type | Description |
---|---|---|
blockchain_type | string | Blockchain this token exists on |
balance | string | Quantity of this token in user's wallet |
decimals | number | Number of decimals used in balance (i.e 18 for wei) |
Updated about 15 hours ago
What’s Next