Skip to main content
Version: 4.0.0

The End to End Guide For Transferring VOW between accounts on the VL

This guide will walk you through successfully submitting a transaction to the VL and verifying the state of the transaction.

The first thing we need to do is ensure that you have npm installed. You'll find instructions on how to do this here. You'll also find instructions on how to install the avn-api library.

Note, all transactions on the VL must be paid for using VOW, so going forward it's important for you to have some VOW in your account. There are multiple ways to purchase VOW and this page provides instructions on how to get some. Note: If you haven't submitted a transaction on the VL previously, you need a minimum of 1 VOW in your account to use the API. The VOW needs to be lifted (moved) to the Voucher Ledger, and there are also instructions for that too here. If you have a designated account registered on the Gateway to pay your fees, your account is not subject to pay transaction fees or have the 1 VOW balance requirement.

Once you have some VOW in your account, of which you can check your account balance by using the explorer here, let's get to the exciting bit, submitting a transaction to the VL. For this guide, we'll show a simple transaction submitting 10 VOW from one account to another.

important

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

You can get the VL_GATEWAY_URL and VL_RELAYER here.

const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const VL_GATEWAY_URL = "gateway url of your chosen network";
const options = {
suri: "suri of your account",
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
hasPayer: true,
};

// Amount to Transfer (10 with 18 decimals)
const AMOUNT = "10000000000000000000";

// The VL address or public key of the recipient account.
const RECIPIENT_ACCOUNT = "5ab310..."; //the SS58 address or public key of the recipient on the Voucher Ledger.

async function main() {
const avnSdk = new AvnApi(VL_GATEWAY_URL, options);
await avnSdk.init();
const api = await avnSdk.apis();

const requestId = await api.send.transferAvt(RECIPIENT_ACCOUNT, AMOUNT);
// returns a request id
console.log(requestId);
}

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

Expected Transaction Submission Output

f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a

Congratulations! You've now successfully submitted a transaction to the VL.

State of the Transaction

To query the VL on the state of the transaction, you can poll the state.

Expected State Output

{
"txHash": "0x37b5aa6...ae1c773c0acbc63dc90",
"status": "Processed",
"blockNumber": "125412",
"transactionIndex": "2"
}