Skip to main content

Send Native/ERC20 Transactions

To transfer an ERC20/FUSE with a relay, use the transferToken() method. This method relays the transaction and covers the gas fees for the user, so they don't need to worry about those fees.

You can also subscribe to events related to the token transfer to track its progress. The method takes the following parameters as inputs:

ParameterTypeDescription
tokenAddressaddressThe contract address of the ERC20 token or FUSE
recipientAddressaddressThe recipient's wallet address
amountnumberThe amount to transfer
const tokenAddress = "YOUR_TOKEN";
const to = "RECEIVER_ADDRESS";
const amount = parseEther("0.001");
const res = await fuseSDK.transferToken(tokenAddress, to, amount);

console.log(`UserOpHash: ${res?.userOpHash}`);
console.log("Waiting for transaction...");

const receipt = await res?.wait();
console.log("Transaction Hash:", receipt?.transactionHash);