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

ParameterTypeDescriptionOptional
qtynumberThe amount of ARIO tokens to lock in the vault (in mARIO)false
lockLengthnumberThe duration to lock tokens in blocks (minimum 14 days, maximum 4 years)false
tagsarrayAn array of GQL tag objects to attach to the vault creation AO messagetrue

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();

Was this page helpful?