Transfer Token
Transfer an amount of ERC20 or ERC777 token from the sender account to the recipient account.
await api.send.transferToken(
avnRelayerAddress,
senderAddress,
recipientAddress,
tokenContractAddress,
amount
);
info
Example
const AvnApi = require("avn-api");
const GATEWAY = "<endpoint_url>"; //Replace the endpoint_url with the url received from Aventus.
const api = new AvnApi(GATEWAY);
const avnRelayerAddress = "5Fb...yTh"; //Please, request from Aventus.
const senderAddress = "bDB...9MH";
const recipientAddress = "5DA...gxV";
const tokenContractAddress = "0x2a...b0e";
const amount = "123400000";
async function main() {
await api.init();
const result = await api.send.transferToken(
avnRelayerAddress,
senderAddress,
recipientAddress,
tokenContractAddress,
amount
);
// Returns a request id
console.log(result);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN.
Expected Output
f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a