Skip to main content
Version: 1.0

Split-Fee Transaction as a User

This feature is used by defining the payer details in the options field when creating an instance of the API.

Options can include:

  • suri (optional): The mnemonic or secret seed of the user i.e. sender of the transaction. If it's empty, the value is read from the AVN_SURI environment variable.
  • hasPayer (optional): A user specified flag used to determine if there is a configured payer for this user. If not defined, this defaults to false and the api will treat this transaction as a "self pay" transaction, requiring the signer to pay for the gateway fees.
  • payerAddress (optional): The payer address for this user. Defaults to the first payer configured for this user.
const options = 
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24",
hasPayer: true,
payerAddress: "5EYzWhGxbogEfwNKL52ZRDCgBxu4t8oWDFAsXXVYvH6dMQTo",

Initialise the API by passing those values as options.

const API = new AVN_API("", options);

Example Implementation

const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "";

// Do not use this account to handle funds.
const options = {
suri: "0x226beb8ff69a053e0f101944d4c917819f7b9e44f1d915f3cf30dc97844262e0",
hasPayer: true,

const API = new AVN_API(AVN_GATEWAY_URL, options);

const AVN_RELAYER = "5Fb...yTh";

// This can be the address or public key.
const RECIPIENT_ADDRESS = "5DA...gxV";

// The token address on Ethereum.
const TOKEN_ETHEREUM_ADDRESS = "0x2a...b0e";

//amount of the token in 18 decimals.
const TOKEN_AMOUNT = "1234000000000000000"; //i.e. 1.234 of a token

async function main() {
await API.init();

let result = await API.send.transferToken(
// Returns a request id

(async () => {
await main();