Transfer ERC20 Tokens
As a game developer, you may need to transfer ERC20 tokens between gamers or to a game wallet for transactions. The Leap Wallet SDK provides the necessary methods for this.

To transfer an ERC20 token, use the following code:
const txApi = new Tx(wallet, provider);
// Native Transactions
const nativeTx = await txApi.createNativeTx(wallet.address, receiver_wallet_address, amount);
const txHash = await txApi.signAndBroadcastTx(nativeTx);
// ERC20 Transactions
const nativeTx = await txApi.createERC20Tx(
wallet.address,
receiver_wallet_address,
amount,
erc20_token_contract_address,
);
const txHash = await txApi.signAndBroadcastTx(nativeTx);
Last updated