buyRecord
buyRecord
is a method on the ARIO
class that purchases a new ArNS record with the specified name, type, and duration.
buyRecord
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
name | string | The ArNS name to purchase | false |
type | string - 'lease' || 'permabuy' | Whether the purchase is a lease or permabuy. | false |
years | number | The number of years a lease is being purchased for. | 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();