RallyProtocol
React Native / Expo
React Native / Expo
  • Getting Started
    • Overview
    • Installation
  • Embedded wallets
    • Getting started
    • Create wallets
    • Manage wallets
    • How it works
  • Gasless Transactions
    • Getting Started
    • Read balances
    • Transfer tokens gaslessly
    • Deploy a contract gaslessly
    • Transact with a contract gaslessly
    • Using without embedded wallets
      • Getting started
      • Typescript Example
  • Resources
    • Full API Reference
    • Guides
    • Example dapps
    • Videos
    • Supported tokens
    • Community libraries
    • FAQs
  • Links
    • Twitter
    • Warpcast
    • Discord
    • Github
    • Blog
    • Youtube
Powered by GitBook
On this page
  • Check balances with RLY token
  • Check balances with your chosen ERC-20 token
  1. Gasless Transactions

Read balances

PreviousGetting StartedNextTransfer tokens gaslessly

Last updated 8 months ago

An API key is required to use the infrastructure to power gasless transactions. Visit to generate both Amoy and Mainnet Polygon API keys.

Check balances with RLY token

In this section, we leverage the RLY token () 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.

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); 

https://app.rallyprotocol.com/
polygonscan