Skip to main content
Version: 2.0

Lower Tokens

Triggers a "lower" of an amount of ETH or any available ERC20 or ERC777 token, deducting the amount from the sender's AvN account.

The process is completed on Ethereum by calling the AvN tier1 contract's lower method after a summary containing the transaction has been published, in order for the recipient to receive the lowered amount.

await api.send.lowerToken(
RECIPIENT_ETHEREUM_ADDRESS,
TOKEN_ETHEREUM_ADDRESS,
TOKEN_AMOUNT
)
important

This operation uses a relayer account that the sender authorizes to submit the transfer transaction. You can learn more about relayers HERE.

important

You can get the AVN_GATEWAY_URL and Relayer here.

const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<node_url>";
const options = {
suri: "<account_suri>",
};
const API = new AVN_API(AVN_GATEWAY_URL, options);

// The recipient's ethereum address
const RECIPIENT_ETHEREUM_ADDRESS = '0xfA2...a46';

const TOKEN_ETHEREUM_ADDRESS = 0

// The amount of the ERC token to be lowered in 18 decimals.
const TOKEN_AMOUNT = '300';

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

let result = await api.send.lowerToken(
RECIPIENT_ETHEREUM_ADDRESS,
TOKEN_ETHEREUM_ADDRESS,
TOKEN_AMOUNT
);
// Returns a request id
console.log(result);
}

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


tip

You can query the state of your transaction here using the returned request id.