setRecord
setRecord
is a method on the ANT
class that updates or creates a record in the ANT process.
setRecord
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
undername | String | Undername to set record for. `@` represents the top level name. | false |
transactionId | String | Arweave transaction Id to set as record. | false |
ttlSeconds | number | Number of seconds for DNS TTL. | false |
tags | array | An array of GQL tag objects to attach to the transfer AO message. | true |
Examples
setRecord
const fs = require("fs");
const { ANT, ArweaveSigner } = require("@ar.io/sdk");
async function main() {
const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
const ant = ANT.init({
signer: new ArweaveSigner(jwk),
processId: "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM"
});
const { id: txId } = await ant.setRecord(
{
undername: '@',
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM'
ttlSeconds: 3600
},
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
}
main();