Read balances

An API key is required to use the infrastructure to power gasless transactions. Visit https://app.rallyprotocol.com/ to generate both Amoy and Mainnet Polygon API keys.

Check balances with RLY token

import { 
    Network,
    RlyAmoyNetwork, 
    getAccount, 
} from '@rly-network/mobile-sdk';

//get Amoy config
const rlyNetwork: Network = RlyAmoyNetwork;

//add your API Key
rlyNetwork.setApiKey(YourAPIKey...)

//claim 10 test RLY tokens gaslessly for testing
await rlyNetwork.claimRly();

//get balance of RLY token on Amoy testnet for display purposes
const balance = await rlyNetwork.getDisplayBalance(); 

//get exact balance of RLY token on Amoy testnet for transfer purposes
const balance = await rlyNetwork.getExactBalance(); 

Check balances with your chosen ERC-20 token

Use the following code to check the chosen token balance of wallets.

import { 
    Network,
    RlyAmoyNetwork, 
    getAccount, 
} from '@rly-network/mobile-sdk';

//get Amoy config
const rlyNetwork: Network = RlyAmoyNetwork;

//add your API Key
rlyNetwork.setApiKey(YourAPIKey...)

//hex address of token contract
const tokenAddress = "0x...." 

//get balance of RLY token on Amoy testnet for display purposes
const balance = await rlyNetwork.getDisplayBalance(tokenAddress); 

//get exact balance of RLY token on Amoy testnet for transfer purposes
const balance = await rlyNetwork.getExactBalance(tokenAddress); 

Last updated