@ar.io/sdk 3.4.0-alpha.1 → 3.4.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ export class ANT {
30
30
  }
31
31
  export class AoANTReadable {
32
32
  process;
33
+ processId;
33
34
  strict;
34
35
  constructor(config) {
35
36
  this.strict = config.strict || false;
@@ -44,6 +45,7 @@ export class AoANTReadable {
44
45
  else {
45
46
  throw new InvalidContractConfigurationError();
46
47
  }
48
+ this.processId = this.process.processId;
47
49
  }
48
50
  async getState({ strict } = { strict: this.strict }) {
49
51
  const tags = [{ name: 'Action', value: 'State' }];
@@ -280,16 +282,15 @@ export class AoANTWriteable extends AoANTReadable {
280
282
  });
281
283
  }
282
284
  /**
285
+ * Sets the transactionId and ttlSeconds of a record (for updating the top level name, use undername "@".)
286
+ *
287
+ * @deprecated Use setUndernameRecord instead for undernames, and setBaseNameRecord instead for the top level name (e.g. "@")
283
288
  * @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
284
289
  * @param transactionId @type {string} The transactionId of the record.
285
290
  * @param ttlSeconds @type {number} The time to live of the record.
286
291
  * @returns {Promise<AoMessageResult>} The result of the interaction.
287
- * @example
288
- * ```ts
289
- * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
290
- * ```
291
292
  */
292
- async setRecord({ undername, transactionId, ttlSeconds, }, options) {
293
+ async setRecord({ undername, transactionId, ttlSeconds }, options) {
293
294
  return this.process.send({
294
295
  tags: [
295
296
  ...(options?.tags ?? []),
@@ -302,11 +303,64 @@ export class AoANTWriteable extends AoANTReadable {
302
303
  });
303
304
  }
304
305
  /**
306
+ * Sets the top level name of the ANT. This is the name that will be used to resolve the ANT (e.g. ardrive.ar.io)
307
+ *
308
+ * @param transactionId @type {string} The transactionId of the record.
309
+ * @param ttlSeconds @type {number} The time to live of the record.
310
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
311
+ * @example
312
+ * ```ts
313
+ * ant.setBaseNameRecord({ transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
314
+ * ```
315
+ */
316
+ async setBaseNameRecord({ transactionId, ttlSeconds }, options) {
317
+ return this.setRecord({
318
+ transactionId,
319
+ ttlSeconds,
320
+ undername: '@',
321
+ }, options);
322
+ }
323
+ /**
324
+ * Adds or updates an undername of the ANT. An undername is appended to the base name of the ANT (e.g. ardrive.ar.io) to form a fully qualified name (e.g. dapp_ardrive.ar.io)
325
+ *
326
+ * @param undername @type {string} The undername of the ANT.
327
+ * @param transactionId @type {string} The transactionId of the record.
328
+ * @param ttlSeconds @type {number} The time to live of the record.
329
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
330
+ * @example
331
+ * ```ts
332
+ * ant.setUndernameRecord({ undername: "dapp", transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // dapp_ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
333
+ * ```
334
+ */
335
+ async setUndernameRecord({ undername, transactionId, ttlSeconds }, options) {
336
+ return this.setRecord({
337
+ undername,
338
+ transactionId,
339
+ ttlSeconds,
340
+ }, options);
341
+ }
342
+ /**
343
+ * Removes an undername from the ANT. This will remove the undername from the ANT.
344
+ *
345
+ * @param undername @type {string} The undername you want to remove.
346
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
347
+ * @example
348
+ * ```ts
349
+ * ant.removeUndernameRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
350
+ * ```
351
+ */
352
+ async removeUndernameRecord({ undername, }) {
353
+ return this.removeRecord({ undername });
354
+ }
355
+ /**
356
+ * Removes a record from the ANT. This will remove the record from the ANT. If '@' is provided, the top level name will be removed.
357
+ *
358
+ * @deprecated Use removeUndernameRecord instead.
305
359
  * @param undername @type {string} The record you want to remove.
306
360
  * @returns {Promise<AoMessageResult>} The result of the interaction.
307
361
  * @example
308
362
  * ```ts
309
- * ant.removeRecord({ subDomain: "shorts" });
363
+ * ant.removeRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
310
364
  * ```
311
365
  */
312
366
  async removeRecord({ undername, }, options) {
@@ -320,6 +374,8 @@ export class AoANTWriteable extends AoANTReadable {
320
374
  });
321
375
  }
322
376
  /**
377
+ * Sets the ticker of the ANT. This is the abbreviation displayed in ecosystem apps.
378
+ *
323
379
  * @param ticker @type {string} Sets the ANT Ticker.
324
380
  * @returns {Promise<AoMessageResult>} The result of the interaction.
325
381
  * @example
@@ -338,6 +394,8 @@ export class AoANTWriteable extends AoANTReadable {
338
394
  });
339
395
  }
340
396
  /**
397
+ * Sets the name of the ANT. This is the display name of the ANT. This is NOT the base name record.
398
+ *
341
399
  * @param name @type {string} Sets the Name of the ANT.
342
400
  * @returns {Promise<AoMessageResult>} The result of the interaction.
343
401
  * @example
@@ -356,6 +414,8 @@ export class AoANTWriteable extends AoANTReadable {
356
414
  });
357
415
  }
358
416
  /**
417
+ * Sets the description of the ANT. This is the description of the ANT displayed in ecosystem apps.
418
+ *
359
419
  * @param description @type {string} Sets the ANT Description.
360
420
  * @returns {Promise<AoMessageResult>} The result of the interaction.
361
421
  * @example
@@ -374,6 +434,8 @@ export class AoANTWriteable extends AoANTReadable {
374
434
  });
375
435
  }
376
436
  /**
437
+ * Sets the keywords of the ANT. This is the keywords of the ANT displayed in ecosystem apps.
438
+ *
377
439
  * @param keywords @type {string[]} Sets the ANT Keywords.
378
440
  * @returns {Promise<AoMessageResult>} The result of the interaction.
379
441
  * @example
@@ -392,6 +454,8 @@ export class AoANTWriteable extends AoANTReadable {
392
454
  });
393
455
  }
394
456
  /**
457
+ * Sets the logo of the ANT. This is the logo of the ANT displayed in ecosystem apps. Additionally, this logo is displayed for any primary names affiliated with the ANT.
458
+ *
395
459
  * @param txId @type {string} - Arweave transaction id of the logo we want to set
396
460
  * @param options @type {WriteOptions} - additional options to add to the write interaction (optional)
397
461
  * @returns {Promise<AoMessageResult>} The result of the interaction.
@@ -411,6 +475,9 @@ export class AoANTWriteable extends AoANTReadable {
411
475
  });
412
476
  }
413
477
  /**
478
+ * Releases an ArNS name associated with the ANT. This will release the name to the public and allow anyone to register it. All primary names must be removed before the name can be released.
479
+ *
480
+ *
414
481
  * @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the ARIO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
415
482
  * @param arioProcessId @type {string} The processId of the ARIO contract. This is where the ANT will send the message to release the name.
416
483
  * @returns {Promise<AoMessageResult>} The result of the interaction.
@@ -432,7 +499,8 @@ export class AoANTWriteable extends AoANTReadable {
432
499
  });
433
500
  }
434
501
  /**
435
- * Sends a message to the ARIO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
502
+ * Sends a message to the ARIO contract to reassign the the base ArNS name to a new ANT. This can only be done by the current owner of the ANT.
503
+ *
436
504
  * @param name @type {string} The name you want to reassign.
437
505
  * @param arioProcessId @type {string} The processId of the ARIO contract.
438
506
  * @param antProcessId @type {string} The processId of the ANT contract.
@@ -457,6 +525,15 @@ export class AoANTWriteable extends AoANTReadable {
457
525
  }
458
526
  /**
459
527
  * Approves a primary name request for a given name or address.
528
+ *
529
+ * @param name @type {string} The name you want to approve.
530
+ * @param address @type {WalletAddress} The address you want to approve.
531
+ * @param arioProcessId @type {string} The processId of the ARIO contract.
532
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
533
+ * @example
534
+ * ```ts
535
+ * ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_TESTNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
536
+ * ```
460
537
  */
461
538
  async approvePrimaryNameRequest({ name, address, arioProcessId, }, options) {
462
539
  return this.process.send({
@@ -471,6 +548,18 @@ export class AoANTWriteable extends AoANTReadable {
471
548
  signer: this.signer,
472
549
  });
473
550
  }
551
+ /**
552
+ * Removes primary names from the ANT. This will remove the primary names associated with the base ArNS name controlled by this ANT. All primary names must be removed before the name can be released.
553
+ *
554
+ * @param names @type {string[]} The names you want to remove.
555
+ * @param arioProcessId @type {string} The processId of the ARIO contract.
556
+ * @param notifyOwners @type {boolean} Whether to notify the owners of the primary names.
557
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
558
+ * @example
559
+ * ```ts
560
+ * ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId: ARIO_TESTNET_PROCESS_ID, notifyOwners: true }); // removes the primary names and associated wallet addresses assigned to "ardrive" and "dapp_ardrive"
561
+ * ```
562
+ */
474
563
  async removePrimaryNames({ names, arioProcessId, notifyOwners = false, }, options) {
475
564
  return this.process.send({
476
565
  tags: [
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.4.0-alpha.1';
17
+ export const version = '3.4.0-alpha.3';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams } from '../../types/ant.js';
17
+ import { CLIWriteOptionsFromAoAntParams } from '../types.js';
18
+ /** @deprecated -- use set-ant-base-name and set-ant-undername */
19
+ export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
20
+ export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
21
+ export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
@@ -333,3 +333,11 @@ export declare const antStateOptions: {
333
333
  alias: string;
334
334
  description: string;
335
335
  }[];
336
+ export declare const setAntBaseNameOptions: {
337
+ alias: string;
338
+ description: string;
339
+ }[];
340
+ export declare const setAntUndernameOptions: {
341
+ alias: string;
342
+ description: string;
343
+ }[];
@@ -49,6 +49,9 @@ export type CLIOptionsFromAoParams<T> = {
49
49
  };
50
50
  export type CLIReadOptionsFromAoParams<T> = CLIOptionsFromAoParams<T> & GlobalCLIOptions;
51
51
  export type CLIWriteOptionsFromAoParams<T> = WriteActionCLIOptions & CLIOptionsFromAoParams<T>;
52
+ export type CLIWriteOptionsFromAoAntParams<T> = CLIWriteOptionsFromAoParams<T & {
53
+ processId: string;
54
+ }>;
52
55
  export type PaginationCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<PaginationParams>;
53
56
  export type AddressCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoAddressParams>;
54
57
  export type ProcessIdCLIOptions = GlobalCLIOptions & {
@@ -2,6 +2,7 @@ import { JWKInterface } from 'arweave/node/lib/wallet.js';
2
2
  import { Command, OptionValues } from 'commander';
3
3
  import { ARIOToken, AoANTRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
4
4
  import { ANTStateCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, GlobalCLIOptions, InitiatorCLIOptions, JsonSerializable, PaginationCLIOptions, ProcessIdCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WalletCLIOptions, WriteActionCLIOptions } from './types.js';
5
+ export declare const defaultTtlSecondsCLI = 3600;
5
6
  export declare function stringifyJsonForCLIDisplay(json: JsonSerializable | unknown): string;
6
7
  export declare function runCommand<O extends OptionValues>(command: Command, action: (options: O) => Promise<JsonSerializable>): Promise<void>;
7
8
  export interface CommanderOption {
@@ -1,4 +1,4 @@
1
- import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTState, AoANTWrite } from '../types/ant.js';
1
+ import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams, AoANTState, AoANTWrite } from '../types/ant.js';
2
2
  import { AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
3
3
  import { AOProcess } from './index.js';
4
4
  type ANTConfigOptionalStrict = Required<ProcessConfiguration> & {
@@ -12,6 +12,7 @@ export declare class ANT {
12
12
  }
13
13
  export declare class AoANTReadable implements AoANTRead {
14
14
  protected process: AOProcess;
15
+ readonly processId: string;
15
16
  private strict;
16
17
  constructor(config: ANTConfigOptionalStrict);
17
18
  getState({ strict }?: AntReadOptions): Promise<AoANTState>;
@@ -147,32 +148,70 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
147
148
  controller: string;
148
149
  }, options?: WriteOptions): Promise<AoMessageResult>;
149
150
  /**
151
+ * Sets the transactionId and ttlSeconds of a record (for updating the top level name, use undername "@".)
152
+ *
153
+ * @deprecated Use setUndernameRecord instead for undernames, and setBaseNameRecord instead for the top level name (e.g. "@")
150
154
  * @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
151
155
  * @param transactionId @type {string} The transactionId of the record.
152
156
  * @param ttlSeconds @type {number} The time to live of the record.
153
157
  * @returns {Promise<AoMessageResult>} The result of the interaction.
158
+ */
159
+ setRecord({ undername, transactionId, ttlSeconds }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
160
+ /**
161
+ * Sets the top level name of the ANT. This is the name that will be used to resolve the ANT (e.g. ardrive.ar.io)
162
+ *
163
+ * @param transactionId @type {string} The transactionId of the record.
164
+ * @param ttlSeconds @type {number} The time to live of the record.
165
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
154
166
  * @example
155
167
  * ```ts
156
- * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
168
+ * ant.setBaseNameRecord({ transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
157
169
  * ```
158
170
  */
159
- setRecord({ undername, transactionId, ttlSeconds, }: {
171
+ setBaseNameRecord({ transactionId, ttlSeconds }: AoANTSetBaseNameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
172
+ /**
173
+ * Adds or updates an undername of the ANT. An undername is appended to the base name of the ANT (e.g. ardrive.ar.io) to form a fully qualified name (e.g. dapp_ardrive.ar.io)
174
+ *
175
+ * @param undername @type {string} The undername of the ANT.
176
+ * @param transactionId @type {string} The transactionId of the record.
177
+ * @param ttlSeconds @type {number} The time to live of the record.
178
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
179
+ * @example
180
+ * ```ts
181
+ * ant.setUndernameRecord({ undername: "dapp", transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // dapp_ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
182
+ * ```
183
+ */
184
+ setUndernameRecord({ undername, transactionId, ttlSeconds }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
185
+ /**
186
+ * Removes an undername from the ANT. This will remove the undername from the ANT.
187
+ *
188
+ * @param undername @type {string} The undername you want to remove.
189
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
190
+ * @example
191
+ * ```ts
192
+ * ant.removeUndernameRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
193
+ * ```
194
+ */
195
+ removeUndernameRecord({ undername, }: {
160
196
  undername: string;
161
- transactionId: string;
162
- ttlSeconds: number;
163
- }, options?: WriteOptions): Promise<AoMessageResult>;
197
+ }): Promise<AoMessageResult>;
164
198
  /**
199
+ * Removes a record from the ANT. This will remove the record from the ANT. If '@' is provided, the top level name will be removed.
200
+ *
201
+ * @deprecated Use removeUndernameRecord instead.
165
202
  * @param undername @type {string} The record you want to remove.
166
203
  * @returns {Promise<AoMessageResult>} The result of the interaction.
167
204
  * @example
168
205
  * ```ts
169
- * ant.removeRecord({ subDomain: "shorts" });
206
+ * ant.removeRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
170
207
  * ```
171
208
  */
172
209
  removeRecord({ undername, }: {
173
210
  undername: string;
174
211
  }, options?: WriteOptions): Promise<AoMessageResult>;
175
212
  /**
213
+ * Sets the ticker of the ANT. This is the abbreviation displayed in ecosystem apps.
214
+ *
176
215
  * @param ticker @type {string} Sets the ANT Ticker.
177
216
  * @returns {Promise<AoMessageResult>} The result of the interaction.
178
217
  * @example
@@ -184,6 +223,8 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
184
223
  ticker: string;
185
224
  }, options?: WriteOptions): Promise<AoMessageResult>;
186
225
  /**
226
+ * Sets the name of the ANT. This is the display name of the ANT. This is NOT the base name record.
227
+ *
187
228
  * @param name @type {string} Sets the Name of the ANT.
188
229
  * @returns {Promise<AoMessageResult>} The result of the interaction.
189
230
  * @example
@@ -195,6 +236,8 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
195
236
  name: string;
196
237
  }, options?: WriteOptions): Promise<AoMessageResult>;
197
238
  /**
239
+ * Sets the description of the ANT. This is the description of the ANT displayed in ecosystem apps.
240
+ *
198
241
  * @param description @type {string} Sets the ANT Description.
199
242
  * @returns {Promise<AoMessageResult>} The result of the interaction.
200
243
  * @example
@@ -206,6 +249,8 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
206
249
  description: string;
207
250
  }, options?: WriteOptions): Promise<AoMessageResult>;
208
251
  /**
252
+ * Sets the keywords of the ANT. This is the keywords of the ANT displayed in ecosystem apps.
253
+ *
209
254
  * @param keywords @type {string[]} Sets the ANT Keywords.
210
255
  * @returns {Promise<AoMessageResult>} The result of the interaction.
211
256
  * @example
@@ -217,6 +262,8 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
217
262
  keywords: string[];
218
263
  }, options?: WriteOptions): Promise<AoMessageResult>;
219
264
  /**
265
+ * Sets the logo of the ANT. This is the logo of the ANT displayed in ecosystem apps. Additionally, this logo is displayed for any primary names affiliated with the ANT.
266
+ *
220
267
  * @param txId @type {string} - Arweave transaction id of the logo we want to set
221
268
  * @param options @type {WriteOptions} - additional options to add to the write interaction (optional)
222
269
  * @returns {Promise<AoMessageResult>} The result of the interaction.
@@ -229,6 +276,9 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
229
276
  txId: string;
230
277
  }, options?: WriteOptions): Promise<AoMessageResult>;
231
278
  /**
279
+ * Releases an ArNS name associated with the ANT. This will release the name to the public and allow anyone to register it. All primary names must be removed before the name can be released.
280
+ *
281
+ *
232
282
  * @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the ARIO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
233
283
  * @param arioProcessId @type {string} The processId of the ARIO contract. This is where the ANT will send the message to release the name.
234
284
  * @returns {Promise<AoMessageResult>} The result of the interaction.
@@ -242,7 +292,8 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
242
292
  arioProcessId: string;
243
293
  }, options?: WriteOptions): Promise<AoMessageResult>;
244
294
  /**
245
- * Sends a message to the ARIO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
295
+ * Sends a message to the ARIO contract to reassign the the base ArNS name to a new ANT. This can only be done by the current owner of the ANT.
296
+ *
246
297
  * @param name @type {string} The name you want to reassign.
247
298
  * @param arioProcessId @type {string} The processId of the ARIO contract.
248
299
  * @param antProcessId @type {string} The processId of the ANT contract.
@@ -259,12 +310,33 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
259
310
  }, options?: WriteOptions): Promise<AoMessageResult>;
260
311
  /**
261
312
  * Approves a primary name request for a given name or address.
313
+ *
314
+ * @param name @type {string} The name you want to approve.
315
+ * @param address @type {WalletAddress} The address you want to approve.
316
+ * @param arioProcessId @type {string} The processId of the ARIO contract.
317
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
318
+ * @example
319
+ * ```ts
320
+ * ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_TESTNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
321
+ * ```
262
322
  */
263
323
  approvePrimaryNameRequest({ name, address, arioProcessId, }: {
264
324
  name: string;
265
325
  address: WalletAddress;
266
326
  arioProcessId: string;
267
327
  }, options?: WriteOptions): Promise<AoMessageResult>;
328
+ /**
329
+ * Removes primary names from the ANT. This will remove the primary names associated with the base ArNS name controlled by this ANT. All primary names must be removed before the name can be released.
330
+ *
331
+ * @param names @type {string[]} The names you want to remove.
332
+ * @param arioProcessId @type {string} The processId of the ARIO contract.
333
+ * @param notifyOwners @type {boolean} Whether to notify the owners of the primary names.
334
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
335
+ * @example
336
+ * ```ts
337
+ * ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId: ARIO_TESTNET_PROCESS_ID, notifyOwners: true }); // removes the primary names and associated wallet addresses assigned to "ardrive" and "dapp_ardrive"
338
+ * ```
339
+ */
268
340
  removePrimaryNames({ names, arioProcessId, notifyOwners, }: {
269
341
  names: string[];
270
342
  arioProcessId: string;
@@ -161,6 +161,7 @@ export type AntReadOptions = {
161
161
  strict?: boolean;
162
162
  };
163
163
  export interface AoANTRead {
164
+ processId: string;
164
165
  getState(opts?: AntReadOptions): Promise<AoANTState>;
165
166
  getInfo(opts?: AntReadOptions): Promise<AoANTInfo>;
166
167
  getRecord({ undername }: {
@@ -179,55 +180,67 @@ export interface AoANTRead {
179
180
  getHandlers(): Promise<AoANTHandler[]>;
180
181
  }
181
182
  export interface AoANTWrite extends AoANTRead {
182
- transfer({ target }: {
183
+ transfer: WriteAction<{
183
184
  target: WalletAddress;
184
- }, options?: WriteOptions): Promise<AoMessageResult>;
185
- addController({ controller, }: {
185
+ }>;
186
+ addController: WriteAction<{
186
187
  controller: WalletAddress;
187
- }, options?: WriteOptions): Promise<AoMessageResult>;
188
- removeController({ controller, }: {
188
+ }>;
189
+ removeController: WriteAction<{
189
190
  controller: WalletAddress;
190
- }, options?: WriteOptions): Promise<AoMessageResult>;
191
- setRecord({ undername, transactionId, ttlSeconds, }: {
191
+ }>;
192
+ /** @deprecated Use setUndernameRecord instead for undernames, and setBaseNameRecord instead for the top level name (e.g. "@") */
193
+ setRecord: WriteAction<AoANTSetUndernameRecordParams>;
194
+ removeRecord: WriteAction<{
192
195
  undername: string;
193
- transactionId: string;
194
- ttlSeconds: number;
195
- }, options?: WriteOptions): Promise<AoMessageResult>;
196
- removeRecord({ undername }: {
196
+ }>;
197
+ setBaseNameRecord: WriteAction<AoANTSetBaseNameRecordParams>;
198
+ setUndernameRecord: WriteAction<AoANTSetUndernameRecordParams>;
199
+ removeUndernameRecord: WriteAction<{
197
200
  undername: string;
198
- }, options?: WriteOptions): Promise<AoMessageResult>;
199
- setTicker({ ticker }: {
201
+ }>;
202
+ setTicker: WriteAction<{
200
203
  ticker: string;
201
- }, options?: WriteOptions): Promise<AoMessageResult>;
202
- setDescription({ description }: {
204
+ }>;
205
+ setDescription: WriteAction<{
203
206
  description: string;
204
- }, options?: WriteOptions): Promise<AoMessageResult>;
205
- setKeywords({ keywords }: {
207
+ }>;
208
+ setKeywords: WriteAction<{
206
209
  keywords: string[];
207
- }, options?: WriteOptions): Promise<AoMessageResult>;
208
- setName({ name }: {
210
+ }>;
211
+ setName: WriteAction<{
209
212
  name: string;
210
- }, options?: WriteOptions): Promise<AoMessageResult>;
211
- setLogo({ txId }: {
213
+ }>;
214
+ setLogo: WriteAction<{
212
215
  txId: string;
213
- }, options?: WriteOptions): Promise<AoMessageResult>;
214
- releaseName({ name, arioProcessId }: {
216
+ }>;
217
+ releaseName: WriteAction<{
215
218
  name: string;
216
219
  arioProcessId: string;
217
- }, options?: WriteOptions): Promise<AoMessageResult>;
218
- reassignName({ name, arioProcessId, antProcessId, }: {
220
+ }>;
221
+ reassignName: WriteAction<{
219
222
  name: string;
220
223
  arioProcessId: string;
221
224
  antProcessId: string;
222
- }, options?: WriteOptions): Promise<AoMessageResult>;
223
- approvePrimaryNameRequest({ name, address, arioProcessId, }: {
225
+ }>;
226
+ approvePrimaryNameRequest: WriteAction<{
224
227
  name: string;
225
- address: WalletAddress;
228
+ address: string;
226
229
  arioProcessId: string;
227
- }, options?: WriteOptions): Promise<AoMessageResult>;
228
- removePrimaryNames({ names, arioProcessId, notifyOwners, }: {
230
+ }>;
231
+ removePrimaryNames: WriteAction<{
229
232
  names: string[];
230
233
  arioProcessId: string;
231
234
  notifyOwners?: boolean;
232
- }, options?: WriteOptions): Promise<AoMessageResult>;
235
+ }>;
233
236
  }
237
+ /** utility type to ensure WriteOptions are appended to each parameter set */
238
+ type WriteAction<P, R = AoMessageResult> = (params: P, options?: WriteOptions) => Promise<R>;
239
+ export type AoANTSetBaseNameRecordParams = {
240
+ transactionId: string;
241
+ ttlSeconds: number;
242
+ };
243
+ export type AoANTSetUndernameRecordParams = AoANTSetBaseNameRecordParams & {
244
+ undername: string;
245
+ };
246
+ export {};
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.3.1-alpha.4";
16
+ export declare const version = "3.4.0-alpha.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.4.0-alpha.1",
3
+ "version": "3.4.0-alpha.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"