buyRecord

buyRecord is a method on the ARIO class that purchases a record in the ArNS registry for a specified name and duration.

buyRecord requires authentication.

Parameters

← Swipe to see more →
ParameterTypeDescriptionOptional
namestringThe ArNS name to purchasefalse
yearsnumberThe number of years to lease the name for (1-5)false
processIdstringThe ANT process ID to set for this namefalse
typestringThe type of purchase: 'lease' or 'permabuy'true
fundFromstring

The source of funds: 'balance', 'stakes', 'any', or 'turbo'

true
tagsarray

An array of GQL tag objects to attach to the transfer AO message

true
← Swipe to see more →

Examples

buyRecord

 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.buyRecord(
         {
             name: 'ardrive',
             years: 1,
             processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
             type: 'lease'
         },
         // optional additional tags
         { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
     );
 }

 main();