buyRecord

buyRecord is a method on the ARIO class that purchases an ArNS record with a specified name. The record can be purchased either as a temporary lease or as a permanent record.

buyRecord requires authentication.

Parameters

ParameterTypeDescriptionOptional
namestringThe ArNS name to purchasefalse
typestring - 'lease' | 'permabuy'The purchase type: either a temporary lease or permanent ownershipfalse
yearsnumberThe duration of the lease in years (required for lease type only)true
tagsarrayAn array of GQL tag objects to attach to the transfer AO message.true

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 record = await ario.buyRecord(
         { name: 'ardrive', type: 'lease', years: 1 },
         {
             // optional tags
             tags: [{ name: 'App-Name', value: 'ArNS-App' }],
         },
     );
 }

 main();