Skip to content

Commit

Permalink
feat(ant): support releasing of name of ANTs
Browse files Browse the repository at this point in the history
Permabought names can be released by the ANT owner. They will go into auction and if a bid is received, it will be split between the owner at the time of the release and the protocol balance. Otherwise, the name will be returned and can be reregistered by anyone.
  • Loading branch information
dtfiedler committed Oct 24, 2024
1 parent 2d4325b commit f6da424
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/common/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.setName({ name: "ships at sea" });
* ant.setName({ name: "test" }); // results in the resolution of `test_<apexName>.ar.io`
* ```
*/
async setName(
Expand All @@ -473,4 +473,28 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
signer: this.signer,
});
}

/**
* @param name @type {string} The name you want to release. The name will be put up for auction on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
* @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.releaseName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID });
* ```
*/
async releaseName(
{ name, ioProcessId }: { name: string; ioProcessId: string },
options?: WriteOptions,
): Promise<AoMessageResult> {
return this.process.send({
tags: [
...(options?.tags ?? []),
{ name: 'Action', value: 'Release-Name' },
{ name: 'Name', value: name },
{ name: 'IO-Process-Id', value: ioProcessId },
],
signer: this.signer,
});
}
}
4 changes: 4 additions & 0 deletions src/types/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,8 @@ export interface AoANTWrite extends AoANTRead {
{ name }: { name: string },
options?: WriteOptions,
): Promise<AoMessageResult>;
releaseName(
{ name, ioProcessId }: { name: string; ioProcessId: string },
options?: WriteOptions,
): Promise<AoMessageResult>;
}

0 comments on commit f6da424

Please sign in to comment.