@ar.io/sdk 2.4.0-alpha.1 → 2.4.0-alpha.11

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.
@@ -326,7 +326,7 @@ export class AoANTWriteable extends AoANTReadable {
326
326
  * @returns {Promise<AoMessageResult>} The result of the interaction.
327
327
  * @example
328
328
  * ```ts
329
- * ant.setName({ name: "ships at sea" });
329
+ * ant.setName({ name: "test" }); // results in the resolution of `test_<apexName>.ar.io`
330
330
  * ```
331
331
  */
332
332
  async setName({ name }, options) {
@@ -339,4 +339,83 @@ export class AoANTWriteable extends AoANTReadable {
339
339
  signer: this.signer,
340
340
  });
341
341
  }
342
+ /**
343
+ * @param description @type {string} Sets the ANT Description.
344
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
345
+ * @example
346
+ * ```ts
347
+ * ant.setDescription({ description: "This name is used for the ArDrive" });
348
+ * ```
349
+ */
350
+ async setDescription({ description }, options) {
351
+ return this.process.send({
352
+ tags: [
353
+ ...(options?.tags ?? []),
354
+ { name: 'Action', value: 'Set-Description' },
355
+ { name: 'Description', value: description },
356
+ ],
357
+ signer: this.signer,
358
+ });
359
+ }
360
+ /**
361
+ * @param keywords @type {string[]} Sets the ANT Keywords.
362
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
363
+ * @example
364
+ * ```ts
365
+ * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
366
+ * ```
367
+ */
368
+ async setKeywords({ keywords }, options) {
369
+ return this.process.send({
370
+ tags: [
371
+ ...(options?.tags ?? []),
372
+ { name: 'Action', value: 'Set-Keywords' },
373
+ { name: 'Description', value: JSON.stringify(keywords) },
374
+ ],
375
+ signer: this.signer,
376
+ });
377
+ }
378
+ /**
379
+ * @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.
380
+ * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
381
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
382
+ * @example
383
+ * ```ts
384
+ * ant.releaseName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID });
385
+ * ```
386
+ */
387
+ async releaseName({ name, ioProcessId }, options) {
388
+ return this.process.send({
389
+ tags: [
390
+ ...(options?.tags ?? []),
391
+ { name: 'Action', value: 'Release-Name' },
392
+ { name: 'Name', value: name },
393
+ { name: 'IO-Process-Id', value: ioProcessId },
394
+ ],
395
+ signer: this.signer,
396
+ });
397
+ }
398
+ /**
399
+ * Sends a message to the IO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
400
+ * @param name @type {string} The name you want to reassign.
401
+ * @param ioProcessId @type {string} The processId of the IO contract.
402
+ * @param antProcessId @type {string} The processId of the ANT contract.
403
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
404
+ * @example
405
+ * ```ts
406
+ * ant.reassignName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
407
+ * ```
408
+ */
409
+ async reassignName({ name, ioProcessId, antProcessId, }, options) {
410
+ return this.process.send({
411
+ tags: [
412
+ ...(options?.tags ?? []),
413
+ { name: 'Action', value: 'Reassign-Name' },
414
+ { name: 'Name', value: name },
415
+ { name: 'IO-Process-Id', value: ioProcessId },
416
+ { name: 'Process-Id', value: antProcessId },
417
+ ],
418
+ signer: this.signer,
419
+ });
420
+ }
342
421
  }
@@ -1,6 +1,7 @@
1
1
  import { IO_TESTNET_PROCESS_ID } from '../constants.js';
2
2
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/io.js';
3
3
  import { createAoSigner } from '../utils/ao.js';
4
+ import { pruneTags } from '../utils/arweave.js';
4
5
  import { defaultArweave } from './arweave.js';
5
6
  import { AOProcess } from './contracts/ao-process.js';
6
7
  import { InvalidContractConfigurationError } from './error.js';
@@ -68,9 +69,8 @@ export class IOReadable {
68
69
  value: params?.epochIndex?.toString(),
69
70
  },
70
71
  ];
71
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
72
72
  return this.process.read({
73
- tags: prunedTags,
73
+ tags: pruneTags(allTags),
74
74
  });
75
75
  }
76
76
  async getEpoch(epoch) {
@@ -93,9 +93,8 @@ export class IOReadable {
93
93
  value: epoch?.epochIndex?.toString(),
94
94
  },
95
95
  ];
96
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
97
96
  return this.process.read({
98
- tags: prunedTags,
97
+ tags: pruneTags(allTags),
99
98
  });
100
99
  }
101
100
  async getArNSRecord({ name, }) {
@@ -106,17 +105,16 @@ export class IOReadable {
106
105
  ],
107
106
  });
108
107
  }
109
- async getArNSRecords(pageParams) {
108
+ async getArNSRecords(params) {
110
109
  const allTags = [
111
110
  { name: 'Action', value: 'Paginated-Records' },
112
- { name: 'Cursor', value: pageParams?.cursor?.toString() },
113
- { name: 'Limit', value: pageParams?.limit?.toString() },
114
- { name: 'Sort-By', value: pageParams?.sortBy },
115
- { name: 'Sort-Order', value: pageParams?.sortOrder },
111
+ { name: 'Cursor', value: params?.cursor?.toString() },
112
+ { name: 'Limit', value: params?.limit?.toString() },
113
+ { name: 'Sort-By', value: params?.sortBy },
114
+ { name: 'Sort-Order', value: params?.sortOrder },
116
115
  ];
117
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
118
116
  return this.process.read({
119
- tags: prunedTags,
117
+ tags: pruneTags(allTags),
120
118
  });
121
119
  }
122
120
  async getArNSReservedNames() {
@@ -140,17 +138,16 @@ export class IOReadable {
140
138
  ],
141
139
  });
142
140
  }
143
- async getBalances(pageParams) {
141
+ async getBalances(params) {
144
142
  const allTags = [
145
143
  { name: 'Action', value: 'Paginated-Balances' },
146
- { name: 'Cursor', value: pageParams?.cursor?.toString() },
147
- { name: 'Limit', value: pageParams?.limit?.toString() },
148
- { name: 'Sort-By', value: pageParams?.sortBy },
149
- { name: 'Sort-Order', value: pageParams?.sortOrder },
144
+ { name: 'Cursor', value: params?.cursor?.toString() },
145
+ { name: 'Limit', value: params?.limit?.toString() },
146
+ { name: 'Sort-By', value: params?.sortBy },
147
+ { name: 'Sort-Order', value: params?.sortOrder },
150
148
  ];
151
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
152
149
  return this.process.read({
153
- tags: prunedTags,
150
+ tags: pruneTags(allTags),
154
151
  });
155
152
  }
156
153
  async getGateway({ address, }) {
@@ -161,6 +158,32 @@ export class IOReadable {
161
158
  ],
162
159
  });
163
160
  }
161
+ async getGatewayDelegates({ address, ...pageParams }) {
162
+ const allTags = [
163
+ { name: 'Action', value: 'Paginated-Delegates' },
164
+ { name: 'Address', value: address },
165
+ { name: 'Cursor', value: pageParams?.cursor?.toString() },
166
+ { name: 'Limit', value: pageParams?.limit?.toString() },
167
+ { name: 'Sort-By', value: pageParams?.sortBy },
168
+ { name: 'Sort-Order', value: pageParams?.sortOrder },
169
+ ];
170
+ return this.process.read({
171
+ tags: pruneTags(allTags),
172
+ });
173
+ }
174
+ async getGatewayDelegateAllowList({ address, ...pageParams }) {
175
+ const allTags = [
176
+ { name: 'Action', value: 'Paginated-Allowed-Delegates' },
177
+ { name: 'Address', value: address },
178
+ { name: 'Cursor', value: pageParams?.cursor?.toString() },
179
+ { name: 'Limit', value: pageParams?.limit?.toString() },
180
+ { name: 'Sort-Order', value: pageParams?.sortOrder },
181
+ // note: sortBy is omitted because it's not supported for this action as table is an of addresses
182
+ ];
183
+ return this.process.read({
184
+ tags: pruneTags(allTags),
185
+ });
186
+ }
164
187
  async getGateways(pageParams) {
165
188
  const allTags = [
166
189
  { name: 'Action', value: 'Paginated-Gateways' },
@@ -169,9 +192,8 @@ export class IOReadable {
169
192
  { name: 'Sort-By', value: pageParams?.sortBy },
170
193
  { name: 'Sort-Order', value: pageParams?.sortOrder },
171
194
  ];
172
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
173
195
  return this.process.read({
174
- tags: prunedTags,
196
+ tags: pruneTags(allTags),
175
197
  });
176
198
  }
177
199
  async getCurrentEpoch() {
@@ -212,9 +234,8 @@ export class IOReadable {
212
234
  value: epoch?.epochIndex?.toString(),
213
235
  },
214
236
  ];
215
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
216
237
  return this.process.read({
217
- tags: prunedTags,
238
+ tags: pruneTags(allTags),
218
239
  });
219
240
  }
220
241
  async getPrescribedNames(epoch) {
@@ -237,9 +258,8 @@ export class IOReadable {
237
258
  value: epoch?.epochIndex?.toString(),
238
259
  },
239
260
  ];
240
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
241
261
  return this.process.read({
242
- tags: prunedTags,
262
+ tags: pruneTags(allTags),
243
263
  });
244
264
  }
245
265
  async getObservations(epoch) {
@@ -262,9 +282,8 @@ export class IOReadable {
262
282
  value: epoch?.epochIndex?.toString(),
263
283
  },
264
284
  ];
265
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
266
285
  return this.process.read({
267
- tags: prunedTags,
286
+ tags: pruneTags(allTags),
268
287
  });
269
288
  }
270
289
  async getDistributions(epoch) {
@@ -287,12 +306,11 @@ export class IOReadable {
287
306
  value: epoch?.epochIndex?.toString(),
288
307
  },
289
308
  ];
290
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
291
309
  return this.process.read({
292
- tags: prunedTags,
310
+ tags: pruneTags(allTags),
293
311
  });
294
312
  }
295
- async getTokenCost({ intent, purchaseType, years, name, quantity, }) {
313
+ async getTokenCost({ intent, type, years, name, quantity, }) {
296
314
  const allTags = [
297
315
  { name: 'Action', value: 'Token-Cost' },
298
316
  {
@@ -313,7 +331,7 @@ export class IOReadable {
313
331
  },
314
332
  {
315
333
  name: 'Purchase-Type',
316
- value: purchaseType,
334
+ value: type,
317
335
  },
318
336
  {
319
337
  name: 'Timestamp',
@@ -327,9 +345,8 @@ export class IOReadable {
327
345
  })).timestamp.toString(),
328
346
  },
329
347
  ];
330
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
331
348
  return this.process.read({
332
- tags: prunedTags,
349
+ tags: pruneTags(allTags),
333
350
  });
334
351
  }
335
352
  async getRegistrationFees() {
@@ -342,6 +359,63 @@ export class IOReadable {
342
359
  tags: [{ name: 'Action', value: 'Demand-Factor' }],
343
360
  });
344
361
  }
362
+ // Auctions
363
+ async getArNSAuctions(params) {
364
+ const allTags = [
365
+ { name: 'Action', value: 'Auctions' },
366
+ { name: 'Cursor', value: params?.cursor?.toString() },
367
+ { name: 'Limit', value: params?.limit?.toString() },
368
+ { name: 'Sort-By', value: params?.sortBy },
369
+ { name: 'Sort-Order', value: params?.sortOrder },
370
+ ];
371
+ return this.process.read({
372
+ tags: pruneTags(allTags),
373
+ });
374
+ }
375
+ async getArNSAuction({ name, }) {
376
+ const allTags = [
377
+ { name: 'Action', value: 'Auction-Info' },
378
+ { name: 'Name', value: name },
379
+ ];
380
+ return this.process.read({
381
+ tags: allTags,
382
+ });
383
+ }
384
+ /**
385
+ * Get auction prices for a given auction at the provided intervals
386
+ *
387
+ * @param {Object} params - The parameters for fetching auction prices
388
+ * @param {string} params.name - The name of the auction
389
+ * @param {('permabuy'|'lease')} [params.type='lease'] - The type of purchase
390
+ * @param {number} [params.years=1] - The number of years for lease (only applicable if type is 'lease')
391
+ * @param {number} [params.timestamp=Date.now()] - The timestamp to fetch prices for
392
+ * @param {number} [params.intervalMs=900000] - The interval in milliseconds between price points (default is 15 minutes)
393
+ * @returns {Promise<AoAuctionPriceData>} The auction price data
394
+ */
395
+ async getArNSAuctionPrices({ name, type, years, timestamp, intervalMs, }) {
396
+ const prunedPriceTags = [
397
+ { name: 'Action', value: 'Auction-Prices' },
398
+ { name: 'Name', value: name },
399
+ {
400
+ name: 'Timestamp',
401
+ value: timestamp?.toString() ?? Date.now().toString(),
402
+ },
403
+ { name: 'Purchase-Type', value: type ?? 'lease' },
404
+ {
405
+ name: 'Years',
406
+ value: type == undefined || type === 'lease'
407
+ ? years?.toString() ?? '1'
408
+ : undefined,
409
+ },
410
+ {
411
+ name: 'Price-Interval-Ms',
412
+ value: intervalMs?.toString() ?? '900000',
413
+ },
414
+ ].filter((tag) => tag.value !== undefined);
415
+ return this.process.read({
416
+ tags: prunedPriceTags,
417
+ });
418
+ }
345
419
  }
346
420
  export class IOWriteable extends IOReadable {
347
421
  signer;
@@ -388,7 +462,7 @@ export class IOWriteable extends IOReadable {
388
462
  signer: this.signer,
389
463
  });
390
464
  }
391
- async joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
465
+ async joinNetwork({ operatorStake, allowDelegatedStaking, allowedDelegates, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
392
466
  const { tags = [] } = options || {};
393
467
  const allTags = [
394
468
  ...tags,
@@ -401,6 +475,10 @@ export class IOWriteable extends IOReadable {
401
475
  name: 'Allow-Delegated-Staking',
402
476
  value: allowDelegatedStaking?.toString(),
403
477
  },
478
+ {
479
+ name: 'Allowed-Delegates',
480
+ value: allowedDelegates?.join(','),
481
+ },
404
482
  {
405
483
  name: 'Delegate-Reward-Share-Ratio',
406
484
  value: delegateRewardShareRatio?.toString(),
@@ -442,10 +520,9 @@ export class IOWriteable extends IOReadable {
442
520
  value: observerAddress,
443
521
  },
444
522
  ];
445
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
446
523
  return this.process.send({
447
524
  signer: this.signer,
448
- tags: prunedTags,
525
+ tags: pruneTags(allTags),
449
526
  });
450
527
  }
451
528
  async leaveNetwork(options) {
@@ -455,7 +532,7 @@ export class IOWriteable extends IOReadable {
455
532
  tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
456
533
  });
457
534
  }
458
- async updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
535
+ async updateGatewaySettings({ allowDelegatedStaking, allowedDelegates, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
459
536
  const { tags = [] } = options || {};
460
537
  const allTags = [
461
538
  ...tags,
@@ -471,6 +548,10 @@ export class IOWriteable extends IOReadable {
471
548
  name: 'Allow-Delegated-Staking',
472
549
  value: allowDelegatedStaking?.toString(),
473
550
  },
551
+ {
552
+ name: 'Allowed-Delegates',
553
+ value: allowedDelegates?.join(','),
554
+ },
474
555
  {
475
556
  name: 'Delegate-Reward-Share-Ratio',
476
557
  value: delegateRewardShareRatio?.toString(),
@@ -481,10 +562,9 @@ export class IOWriteable extends IOReadable {
481
562
  },
482
563
  { name: 'Auto-Stake', value: autoStake?.toString() },
483
564
  ];
484
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
485
565
  return this.process.send({
486
566
  signer: this.signer,
487
- tags: prunedTags,
567
+ tags: pruneTags(allTags),
488
568
  });
489
569
  }
490
570
  async delegateStake(params, options) {
@@ -512,16 +592,25 @@ export class IOWriteable extends IOReadable {
512
592
  ],
513
593
  });
514
594
  }
515
- async instantDelegateWithdrawal(params, options) {
595
+ /**
596
+ * Initiates an instant withdrawal from a gateway.
597
+ *
598
+ * @param {Object} params - The parameters for initiating an instant withdrawal
599
+ * @param {string} params.address - The gateway address of the withdrawal, if not provided, the signer's address will be used
600
+ * @param {string} params.vaultId - The vault ID of the withdrawal
601
+ * @returns {Promise<AoMessageResult>} The result of the withdrawal
602
+ */
603
+ async instantWithdrawal(params, options) {
516
604
  const { tags = [] } = options || {};
605
+ const allTags = [
606
+ ...tags,
607
+ { name: 'Action', value: 'Instant-Withdrawal' },
608
+ { name: 'Vault-Id', value: params.vaultId },
609
+ { name: 'Address', value: params.gatewayAddress },
610
+ ];
517
611
  return this.process.send({
518
612
  signer: this.signer,
519
- tags: [
520
- ...tags,
521
- { name: 'Action', value: 'Decrease-Delegate-Stake' },
522
- { name: 'Target', value: params.target },
523
- { name: 'Vault-Id', value: params.vaultId },
524
- ],
613
+ tags: pruneTags(allTags),
525
614
  });
526
615
  }
527
616
  async increaseOperatorStake(params, options) {
@@ -574,12 +663,39 @@ export class IOWriteable extends IOReadable {
574
663
  { name: 'Process-Id', value: params.processId },
575
664
  { name: 'Purchase-Type', value: params.type || 'lease' },
576
665
  ];
577
- const prunedTags = allTags.filter((tag) => tag.value !== undefined);
578
666
  return this.process.send({
579
667
  signer: this.signer,
580
- tags: prunedTags,
668
+ tags: pruneTags(allTags),
669
+ });
670
+ }
671
+ /**
672
+ * Upgrades an existing leased record to a permabuy.
673
+ *
674
+ * @param {Object} params - The parameters for upgrading a record
675
+ * @param {string} params.name - The name of the record to upgrade
676
+ * @param {Object} [options] - The options for the upgrade
677
+ * @returns {Promise<AoMessageResult>} The result of the upgrade
678
+ */
679
+ async upgradeRecord(params, options) {
680
+ const { tags = [] } = options || {};
681
+ return this.process.send({
682
+ signer: this.signer,
683
+ tags: [
684
+ ...tags,
685
+ { name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
686
+ { name: 'Name', value: params.name },
687
+ ],
581
688
  });
582
689
  }
690
+ /**
691
+ * Extends the lease of an existing leased record.
692
+ *
693
+ * @param {Object} params - The parameters for extending a lease
694
+ * @param {string} params.name - The name of the record to extend
695
+ * @param {number} params.years - The number of years to extend the lease
696
+ * @param {Object} [options] - The options for the extension
697
+ * @returns {Promise<AoMessageResult>} The result of the extension
698
+ */
583
699
  async extendLease(params, options) {
584
700
  const { tags = [] } = options || {};
585
701
  return this.process.send({
@@ -604,16 +720,42 @@ export class IOWriteable extends IOReadable {
604
720
  ],
605
721
  });
606
722
  }
607
- async cancelDelegateWithdrawal(params, options) {
723
+ /**
724
+ * Cancel a withdrawal from a gateway.
725
+ *
726
+ * @param {Object} params - The parameters for cancelling a withdrawal
727
+ * @param {string} [params.address] - The address of the withdrawal (optional). If not provided, the signer's address will be used.
728
+ * @param {string} params.vaultId - The vault ID of the withdrawal.
729
+ * @param {Object} [options] - The options for the cancellation
730
+ * @returns {Promise<AoMessageResult>} The result of the cancellation
731
+ */
732
+ async cancelWithdrawal(params, options) {
608
733
  const { tags = [] } = options || {};
734
+ const allTags = [
735
+ ...tags,
736
+ { name: 'Action', value: 'Cancel-Withdrawal' },
737
+ { name: 'Vault-Id', value: params.vaultId },
738
+ { name: 'Address', value: params.gatewayAddress },
739
+ ];
609
740
  return this.process.send({
610
741
  signer: this.signer,
611
- tags: [
612
- ...tags,
613
- { name: 'Action', value: 'Cancel-Delegate-Withdrawal' },
614
- { name: 'Address', value: params.address },
615
- { name: 'Vault-Id', value: params.vaultId },
616
- ],
742
+ tags: pruneTags(allTags),
743
+ });
744
+ }
745
+ async submitAuctionBid(params, options) {
746
+ const { tags = [] } = options || {};
747
+ const allTags = [
748
+ ...tags,
749
+ { name: 'Action', value: 'Auction-Bid' },
750
+ { name: 'Name', value: params.name },
751
+ { name: 'Process-Id', value: params.processId },
752
+ { name: 'Quantity', value: params.quantity?.toString() ?? undefined },
753
+ { name: 'Purchase-Type', value: params.type || 'lease' },
754
+ { name: 'Years', value: params.years?.toString() ?? undefined },
755
+ ];
756
+ return this.process.send({
757
+ signer: this.signer,
758
+ tags: pruneTags(allTags),
617
759
  });
618
760
  }
619
761
  }
@@ -42,6 +42,8 @@ export const IntegerStringSchema = z
42
42
  const num = parseInt(val);
43
43
  return Number.isInteger(num) && num >= 0;
44
44
  }, { message: 'Must be a non negative integer string' });
45
+ export const AntDescriptionSchema = z.string(); // TODO: add specific limits for description ie max length
46
+ export const AntKeywordsSchema = z.array(z.string()); // TODO: add specific limits for keywords ie max amount and max length
45
47
  export const AntRecordSchema = z.object({
46
48
  transactionId: ArweaveTxIdSchema.describe('The Target ID of the undername'),
47
49
  ttlSeconds: z.number(),
@@ -52,6 +54,8 @@ export const AntBalancesSchema = z.record(ArweaveTxIdSchema.describe('Holder add
52
54
  export const AntStateSchema = z.object({
53
55
  Name: z.string().describe('The name of the ANT.'),
54
56
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
57
+ Description: z.string().describe('The description for the ANT.'),
58
+ Keywords: AntKeywordsSchema.describe('The keywords for the ANT.'),
55
59
  Denomination: z
56
60
  .number()
57
61
  .describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.')
@@ -88,8 +92,12 @@ export const AntHandlerNames = [
88
92
  'records',
89
93
  'setName',
90
94
  'setTicker',
95
+ 'setDescription',
96
+ 'setKeywords',
91
97
  'initializeState',
92
98
  'state',
99
+ 'releaseName',
100
+ 'reassignName',
93
101
  ];
94
102
  export const AntHandlersSchema = z
95
103
  .array(z.string({ description: 'Handler Name' }))
@@ -104,6 +112,8 @@ export const AntInfoSchema = z.object({
104
112
  ['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
105
113
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
106
114
  ['Total-Supply']: IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
115
+ Description: AntDescriptionSchema.describe('The description for the ANT.'),
116
+ Keywords: AntKeywordsSchema.describe('The keywords for the ANT.'),
107
117
  Logo: ArweaveTxIdSchema.describe('Transaction ID of the ANT logo.'),
108
118
  Denomination: IntegerStringSchema.describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.'),
109
119
  Handlers: AntHandlersSchema.optional().describe('List of handlers for the ANT.'),
@@ -20,3 +20,6 @@ export const validateArweaveId = (id) => {
20
20
  export function isBlockHeight(height) {
21
21
  return height !== undefined && !isNaN(parseInt(height.toString()));
22
22
  }
23
+ export const pruneTags = (tags) => {
24
+ return tags.filter((tag) => tag.value !== undefined);
25
+ };
@@ -48,14 +48,16 @@ export class ArNSEventEmitter extends EventEmitter {
48
48
  timeoutMs; // timeout for each request to 3 seconds
49
49
  throttle;
50
50
  logger;
51
+ strict;
51
52
  constructor({ contract = IO.init({
52
53
  processId: IO_TESTNET_PROCESS_ID,
53
- }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, } = {}) {
54
+ }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = true, } = {}) {
54
55
  super();
55
56
  this.contract = contract;
56
57
  this.timeoutMs = timeoutMs;
57
58
  this.throttle = pLimit(concurrency);
58
59
  this.logger = logger;
60
+ this.strict = strict;
59
61
  }
60
62
  async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ANTRegistry.init(), }) {
61
63
  const uniqueContractProcessIds = {};
@@ -94,7 +96,7 @@ export class ArNSEventEmitter extends EventEmitter {
94
96
  }
95
97
  const ant = ANT.init({
96
98
  processId,
97
- strict: true,
99
+ strict: this.strict,
98
100
  });
99
101
  const state = (await timeout(this.timeoutMs, ant.getState()).catch((e) => {
100
102
  this.emit('error', `Error getting state for process ${processId}: ${e}`);
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '2.4.0-alpha.1';
17
+ export const version = '2.4.0-alpha.11';
@@ -177,10 +177,61 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
177
177
  * @returns {Promise<AoMessageResult>} The result of the interaction.
178
178
  * @example
179
179
  * ```ts
180
- * ant.setName({ name: "ships at sea" });
180
+ * ant.setName({ name: "test" }); // results in the resolution of `test_<apexName>.ar.io`
181
181
  * ```
182
182
  */
183
183
  setName({ name }: {
184
184
  name: string;
185
185
  }, options?: WriteOptions): Promise<AoMessageResult>;
186
+ /**
187
+ * @param description @type {string} Sets the ANT Description.
188
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
189
+ * @example
190
+ * ```ts
191
+ * ant.setDescription({ description: "This name is used for the ArDrive" });
192
+ * ```
193
+ */
194
+ setDescription({ description }: {
195
+ description: string;
196
+ }, options?: WriteOptions): Promise<AoMessageResult>;
197
+ /**
198
+ * @param keywords @type {string[]} Sets the ANT Keywords.
199
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
200
+ * @example
201
+ * ```ts
202
+ * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
203
+ * ```
204
+ */
205
+ setKeywords({ keywords }: {
206
+ keywords: string[];
207
+ }, options?: WriteOptions): Promise<AoMessageResult>;
208
+ /**
209
+ * @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.
210
+ * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
211
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
212
+ * @example
213
+ * ```ts
214
+ * ant.releaseName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID });
215
+ * ```
216
+ */
217
+ releaseName({ name, ioProcessId }: {
218
+ name: string;
219
+ ioProcessId: string;
220
+ }, options?: WriteOptions): Promise<AoMessageResult>;
221
+ /**
222
+ * Sends a message to the IO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
223
+ * @param name @type {string} The name you want to reassign.
224
+ * @param ioProcessId @type {string} The processId of the IO contract.
225
+ * @param antProcessId @type {string} The processId of the ANT contract.
226
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
227
+ * @example
228
+ * ```ts
229
+ * ant.reassignName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
230
+ * ```
231
+ */
232
+ reassignName({ name, ioProcessId, antProcessId, }: {
233
+ name: string;
234
+ ioProcessId: string;
235
+ antProcessId: string;
236
+ }, options?: WriteOptions): Promise<AoMessageResult>;
186
237
  }