Records
setBaseNameRecord()
Adds or updates the base name record for the ANT. This is the top level name of the ANT (e.g. ardrive.ar.io). Supports undername ownership delegation and metadata.
Note: Requires signer
to be provided on ANT.init
to sign the transaction.
// get the ant for the base name
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
const ant = await ANT.init({ processId: arnsName.processId });
// Basic usage
const { id: txId } = await ant.setBaseNameRecord({
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
ttlSeconds: 3600,
});
// With ownership delegation and metadata
const { id: txId } = await ant.setBaseNameRecord({
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
ttlSeconds: 3600,
owner: 'user-wallet-address-123...', // delegate ownership to another address
displayName: 'ArDrive', // display name
logo: 'logo-tx-id-123...', // logo transaction ID
description: 'Decentralized storage application',
keywords: ['storage', 'decentralized', 'web3'],
});
// ardrive.ar.io will now resolve to the provided transaction id and include metadata
setUndernameRecord()
Adds or updates an undername record for the ANT. An undername is appended to the base name of the ANT (e.g. dapp_ardrive.ar.io). Supports undername ownership delegation and metadata.
Note: Requires signer
to be provided on ANT.init
to sign the transaction.
Records, or
undernames
are configured with thetransactionId
- the arweave transaction id the record resolves - andttlSeconds
, the Time To Live in the cache of client applications.
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
const ant = await ANT.init({ processId: arnsName.processId });
// Basic usage
const { id: txId } = await ant.setUndernameRecord(
{
undername: 'dapp',
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
ttlSeconds: 900,
},
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
// With ownership delegation and metadata
const { id: txId } = await ant.setUndernameRecord(
{
undername: 'alice',
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
ttlSeconds: 900,
owner: 'alice-wallet-address-123...', // delegate ownership to Alice
displayName: "Alice's Site", // display name
logo: 'avatar-tx-id-123...', // avatar/logo transaction ID
description: 'Personal portfolio and blog',
keywords: ['portfolio', 'personal', 'blog'],
},
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
// dapp_ardrive.ar.io will now resolve to the provided transaction id
// alice_ardrive.ar.io will be owned by Alice and include metadata
removeUndernameRecord()
Removes an undername record from the ANT process.
Note: Requires signer
to be provided on ANT.init
to sign the transaction.
const { id: txId } = await ant.removeUndernameRecord(
{ undername: 'dapp' },
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
// dapp_ardrive.ar.io will no longer resolve to the provided transaction id
setRecord()
Deprecated: Use setBaseNameRecord
or setUndernameRecord
instead.
Adds or updates a record for the ANT process. The undername
parameter is used to specify the record name. Use @
for the base name record.
Note: Requires signer
to be provided on ANT.init
to sign the transaction.
Records, or
undernames
are configured with thetransactionId
- the arweave transaction id the record resolves - andttlSeconds
, the Time To Live in the cache of client applications.
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' }] },
);
removeRecord()
Deprecated: Use removeUndernameRecord
instead.
Removes a record from the ANT process.
Note: Requires signer
to be provided on ANT.init
to sign the transaction.
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
const ant = await ANT.init({ processId: arnsName.processId });
const { id: txId } = await ant.removeRecord(
{ undername: 'dapp' },
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
// dapp_ardrive.ar.io will no longer resolve to the provided transaction id
How is this guide?