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
Parameter | Type | Description | Optional |
---|---|---|---|
name | string | The ArNS name to purchase | false |
type | string - 'lease' | 'permabuy' | The purchase type: either a temporary lease or permanent ownership | false |
years | number | The duration of the lease in years (required for lease type only) | true |
tags | array | An 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();