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
  • Gasless transactions with RLY token
  • Getting started with your chosen ERC-20 token
  • Contract requirements
  • Gasless transactions with your chosen ERC-20 token
  1. Gasless Transactions

Transfer tokens gaslessly

PreviousRead balancesNextDeploy a contract 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.

Gasless transactions with RLY token

In this section, we leverage the RLY token () and our faucet to enable developers to complete a gasless token transfer in just seconds. Use the following code to claim test RLY tokens and transfer it to a destination wallet of your choosing.

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

const rlyNetwork: Network = RlyAmoyNetwork;

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

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

//destination address for testing
const destinationAddress = "0x8D9F6c7Ab1316B613BDdcD1fDbac6025A1323569"

//transfer 5 RLY token expressed in wei using executeMetaTransaction
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    MetaTxMethod.ExecuteMetaTransaction
); 

Getting started with your chosen ERC-20 token

Contract requirements

  1. Contract is compatible with the RallyMobile SDK

  2. Contract natively supports gasless transactions

Gasless transactions with your chosen ERC-20 token

Use the following code to transfer your chosen token gaslessly.

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

const rlyNetwork: Network = RlyAmoyNetwork;

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

//destination address for testing
const destinationAddress = "0x...."

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

//transfer 5 ERC20 token expressed in wei using executeMetaTransaction
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    erc20TokenAddress,
    MetaTxMethod.ExecuteMetaTransaction
); 

//transfer 5 ERC20 token expressed in wei using permit
await rlyNetwork.transferExact(
    destinationAddress, 
    5000000000000000000, 
    erc20TokenAddress,
    MetaTxMethod.Permit
); 

Contracts that are are natively supported by the RallyMobile SDK. Those that are not ERC2771 compatible must be whitelisted,

Contracts that have the executeMetaTransaction or Permit method for gasless transactions are natively supported by our SDK. To determine which method is supported by your contract, .

View our to see if your chosen token is already supported.

https://app.rallyprotocol.com/
polygonscan
view the guide here
supported tokens list
ERC2771 compatible
view the guide here.