transfer
transfer
is a method on the ARIO
class that transfers mARIO
to the designated target
recipient address.
transfer
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
target | String - WalletAddress | Recipient wallet address to send `mARIO` to. | false |
qty | number | The number of `mARIO` tokens to transfer. | false |
tags | array | An array of GQL tag objects to attach to the transfer AO message. | true |
Examples
transfer
const fs = require("fs");
const { ARIO, ArweaveSigner, ARIOToken } = require("@ar.io/sdk");
async function main() {
const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
const ario = ARIO.init({
signer: new ArweaveSigner(jwk),
});
const result = await ario.transfer(
{
target: "nszYSUJvtlFXssccPaQWZaVpkXgJHcVM7XhcP5NEt7w",
qty: new ARIOToken(1000).toMARIO(), //converts ARIO to mARIO
},
// Optional tags
{
tags: [{ name: "App-Name", value: "My-Awesome-App" }],
}
);
console.log(result);
}
main();
Output
{
id: 'Q44fpJLfq8wt-3RXA5a7ReiN7wmwkgxQA2jPYW51R-Q',
result: 'You transferred 1000000000 to nszYSUJvtlFXssccPaQWZaVpkXgJHcVM7XhcP5NEt7w'
}