Skip to main content
Version: 0.5

Transfer AVT

Transfer an amount of AVT from the sender account to the destination account.

await api.send.transferAvt(avnRelayerAddress, recipientAddress, amount);
info

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

Contact us here to request a relayer address.

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 recipientAddress = "5DA...gxV";
const amount = "123400000";

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

const result = await api.send.transferAvt(
avnRelayerAddress,
recipientAddress,
amount
);
// Returns a request id
console.log(result);
}

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

You have now successfully submitted a transaction to the AVN.

Example Output

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

JSON-RPC

Transfers the specified amount of AVT from the sender account to the destination account, using a relayer account

REQUEST POST https://AVN-API-URL/send

HEADERS Content-Type: application/json Authorization': bearer <awtToken>

REQUEST PARAMS relayer [required] - a string representing the relayer's SS58 address
signer [required] - a string representing the sender's SS58 address
recipient [required] - a string representing the recipient's SS58 address
token [required] - a hex string representing the token ID (20 bytes) of the AVT contract
amount [required] - a string integer value representing the amount (in atto AVT) being transferred
proxySignature [required] - a proof signed by the sender/signer account allowing the transaction to be proxied
feePaymentSignature [required] - a proof signed by the sender/signer account allowing the relayer fees to be paid
paymentNonce [required] - string integer value of the current account payment nonce

Example

curl https://AVN-API-URL/send \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"proxyAvtTransfer", "params":{"relayer":"5FbUQ2kJWLoqHuSTSNNqBwKwdQnBVe4HF3TeGyu6UoZaryTh", "signer":"5DAgxVxKmnJ7hfhDEB9UetZm4jR2MPjGZGrmJZjirSVJDdMr", "recipient":"5FgyNN84CzQfwHBUJWvQkr36hiQYEXjDhcUYVx9tCTdgqosF", "token":"0x405df1b38510c455ef81500a3dc7e9ae599e18f6", "amount":"20000", "proxySignature":"0xc2f5deeede54698bffd1779532cf66590ff5302ea624b5d3b8e72d5a949e90027eed2a19f2a12161c293204dbb1ccc4032e4248760f6385a83d5e44188cf9d8b", "feePaymentSignature":"0xde49e7ab095debda05f86a122d064d24bc9c31360d1e5ebc1357076918ca78465a5428f77507f966531e29eee43070611d07f5a1632c11ff1741c3c12b22db83", "paymentNonce":"200"}, "id":1}'
note

result - a request ID that can be queried for the transaction's status

Example Result

{
"jsonrpc": "2.0",
"id": 1,
"result": "540aef9d-5798-41c0-8f43-a6eb3986a3e0"
}

Query Transaction State

tip

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