Read balances
Check balances with RLY token
In this section, we leverage the RLY token (polygonscan) and our faucet to enable developers to read on-chain balances in just seconds. Use the following code to claim test RLY tokens and check the RLY balance of wallets.
//get amoy config
var amoy = NetworkProvider.RlyAmoy;
//add your API Key (can also be chained)
amoy.WithApiKey(env.API_KEY);
//claim 10 test RLY tokens gaslessly for testing
await amoy.ClaimRly();
// get balance of RLY token
await amoy.GetBalance()
//get exact balance of RLY token on Amoy testnet for transfer purposes
await amoy.GetExactBalance();
Check balances with your chosen ERC-20 token
Use the following code to check the chosen token balance of wallets.
//get amoy config
var amoy = NetworkProvider.RlyAmoy;
//add your API Key (can also be chained)
amoy.WithApiKey(env.API_KEY);
//hex address of token contract.
var tokenAddress = "0x...."
// get balance of specified token
await amoy.GetBalance(tokenAddress)
//get exact balance of specified token on Amoy testnet for transfer purposes
await amoy.GetExactBalance(tokenAddress);
Last updated