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 →
Parameter | Type | Description | Optional |
---|---|---|---|
name | string | The ArNS name to purchase | false |
years | number | The number of years to lease the name for (1-5) | false |
processId | string | The ANT process ID to set for this name | false |
type | string | The type of purchase: 'lease' or 'permabuy' | true |
fundFrom | string | The source of funds: 'balance', 'stakes', 'any', or 'turbo' | true |
tags | array | 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();