createVault
createVault
is a method on the ARIO
class that creates a new vault to lock ARIO tokens for a specified duration. Vaulted tokens earn rewards but cannot be transferred until the lock period expires.
createVault
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
qty | number | The amount of ARIO tokens to lock in the vault (in mARIO) | false |
lockLength | number | The duration to lock tokens in blocks (minimum 14 days, maximum 4 years) | false |
tags | array | An array of GQL tag objects to attach to the vault creation AO message | true |
Examples
createVault
const fs = require("fs");
const { ARIO, ArweaveSigner } = require("@ar.io/sdk");
async function main() {
const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
const ario = ARIO.init({
signer: new ArweaveSigner(jwk),
});
const { id: txId } = await ario.createVault(
{
qty: 10000000000, // 10,000 ARIO (6 decimal places)
lockLength: 720 // 720 blocks (approximately 30 days)
},
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
console.log(txId);
}
main();