@ar.io/sdk 2.5.0-alpha.1 → 2.5.0-alpha.10

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.
@@ -14,9 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { z } from 'zod';
17
- import { AntBalancesSchema, AntControllersSchema, AntInfoSchema, AntRecordSchema, AntRecordsSchema, AntStateSchema, } from '../types/ant.js';
17
+ import { AntBalancesSchema, AntControllersSchema, AntEntriesSchema, AntInfoSchema, AntRecordSchema, AntStateSchema, } from '../types/ant.js';
18
18
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/index.js';
19
- import { createAoSigner } from '../utils/ao.js';
19
+ import { createAoSigner, parseAntRecords } from '../utils/ao.js';
20
20
  import { parseSchemaResult } from '../utils/schema.js';
21
21
  import { AOProcess, InvalidContractConfigurationError } from './index.js';
22
22
  export class ANT {
@@ -92,7 +92,7 @@ export class AoANTReadable {
92
92
  return record;
93
93
  }
94
94
  /**
95
- * @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
95
+ * @returns {Promise<AoANTRecordEntry[]>} All the undernames managed by the ANT.
96
96
  * @example
97
97
  * Get the current records
98
98
  * ```ts
@@ -104,9 +104,10 @@ export class AoANTReadable {
104
104
  const records = await this.process.read({
105
105
  tags,
106
106
  });
107
+ const result = parseAntRecords(records);
107
108
  if (strict)
108
- parseSchemaResult(AntRecordsSchema, records);
109
- return records;
109
+ parseSchemaResult(AntEntriesSchema, result);
110
+ return result;
110
111
  }
111
112
  /**
112
113
  * @returns {Promise<string>} The owner of the ANT.
@@ -199,6 +200,18 @@ export class AoANTReadable {
199
200
  parseSchemaResult(z.number(), balance);
200
201
  return balance;
201
202
  }
203
+ /**
204
+ * @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
205
+ * @example
206
+ * Get the handlers of the ANT.
207
+ * ```ts
208
+ * const handlers = await ant.getHandlers();
209
+ * ```
210
+ */
211
+ async getHandlers() {
212
+ const info = await this.getInfo();
213
+ return (info.Handlers ?? info.HandlerNames);
214
+ }
202
215
  }
203
216
  export class AoANTWriteable extends AoANTReadable {
204
217
  signer;
@@ -375,6 +388,25 @@ export class AoANTWriteable extends AoANTReadable {
375
388
  signer: this.signer,
376
389
  });
377
390
  }
391
+ /**
392
+ * @param txId @type {string} - Arweave transaction id of the logo we want to set
393
+ * @param options @type {WriteOptions} - additional options to add to the write interaction (optional)
394
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
395
+ * @example
396
+ * ```ts
397
+ * ant.setLogo({ logo: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f" });
398
+ * ```
399
+ */
400
+ async setLogo({ txId }, options) {
401
+ return this.process.send({
402
+ tags: [
403
+ ...(options?.tags ?? []),
404
+ { name: 'Action', value: 'Set-Logo' },
405
+ { name: 'Logo', value: txId },
406
+ ],
407
+ signer: this.signer,
408
+ });
409
+ }
378
410
  /**
379
411
  * @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
412
  * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
@@ -418,4 +450,30 @@ export class AoANTWriteable extends AoANTReadable {
418
450
  signer: this.signer,
419
451
  });
420
452
  }
453
+ /**
454
+ * Approves a primary name request for a given name or address.
455
+ */
456
+ async approvePrimaryNameRequest({ name, address, ioProcessId, }, options) {
457
+ return this.process.send({
458
+ tags: [
459
+ ...(options?.tags ?? []),
460
+ { name: 'Action', value: 'Approve-Primary-Name' },
461
+ { name: 'Name', value: name },
462
+ { name: 'Recipient', value: address },
463
+ { name: 'IO-Process-Id', value: ioProcessId },
464
+ ],
465
+ signer: this.signer,
466
+ });
467
+ }
468
+ async removePrimaryNames({ names, ioProcessId }, options) {
469
+ return this.process.send({
470
+ tags: [
471
+ ...(options?.tags ?? []),
472
+ { name: 'Action', value: 'Remove-Primary-Names' },
473
+ { name: 'Names', value: names.join(',') },
474
+ { name: 'IO-Process-Id', value: ioProcessId },
475
+ ],
476
+ signer: this.signer,
477
+ });
478
+ }
421
479
  }
@@ -47,11 +47,12 @@ export class AOProcess {
47
47
  this.logger.debug(`Process ${this.processId} does not support provided action.`, result, tags);
48
48
  throw new Error(`Process ${this.processId} does not support provided action.`);
49
49
  }
50
- const tagsOutput = result.Messages[0].Tags;
51
- const messageData = result.Messages[0].Data;
52
- const error = tagsOutput.find((tag) => tag.name === 'Error');
50
+ const tagsOutput = result.Messages?.[0]?.Tags;
51
+ const messageData = result.Messages?.[0]?.Data;
52
+ const errorData = result.Error;
53
+ const error = errorData || tagsOutput?.find((tag) => tag.name === 'Error')?.value;
53
54
  if (error) {
54
- throw new Error(`${error.value}${messageData ? `: ${messageData}` : ''}`);
55
+ throw new Error(`${error}${messageData ? `: ${messageData}` : ''}`);
55
56
  }
56
57
  // return empty object if no data is returned
57
58
  if (messageData === undefined) {
@@ -106,17 +107,17 @@ export class AOProcess {
106
107
  messageId,
107
108
  processId: this.processId,
108
109
  });
110
+ const errorData = output.Error;
111
+ const error = errorData ||
112
+ output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')
113
+ ?.value;
114
+ if (error) {
115
+ throw new WriteInteractionError(error);
116
+ }
109
117
  // check if there are any Messages in the output
110
118
  if (output.Messages?.length === 0 || output.Messages === undefined) {
111
119
  return { id: messageId };
112
120
  }
113
- const tagsOutput = output.Messages[0].Tags;
114
- const error = tagsOutput.find((tag) => tag.name === 'Error');
115
- // if there's an Error tag, throw an error related to it
116
- if (error) {
117
- const result = output.Messages[0].Data;
118
- throw new WriteInteractionError(`${error.Value}: ${result}`);
119
- }
120
121
  if (output.Messages.length === 0) {
121
122
  throw new Error(`Process ${this.processId} does not support provided action.`);
122
123
  }
@@ -1,7 +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 { getCurrentBlockUnixTimestampMs, pruneTags } from '../utils/arweave.js';
4
+ import { getCurrentBlockUnixTimestampMs, paginationParamsToTags, pruneTags, } from '../utils/arweave.js';
5
5
  import { defaultArweave } from './arweave.js';
6
6
  import { AOProcess } from './contracts/ao-process.js';
7
7
  import { InvalidContractConfigurationError } from './error.js';
@@ -92,20 +92,19 @@ export class IOReadable {
92
92
  });
93
93
  }
94
94
  async getArNSRecords(params) {
95
- const allTags = [
96
- { name: 'Action', value: 'Paginated-Records' },
97
- { name: 'Cursor', value: params?.cursor?.toString() },
98
- { name: 'Limit', value: params?.limit?.toString() },
99
- { name: 'Sort-By', value: params?.sortBy },
100
- { name: 'Sort-Order', value: params?.sortOrder },
101
- ];
102
95
  return this.process.read({
103
- tags: pruneTags(allTags),
96
+ tags: [
97
+ { name: 'Action', value: 'Paginated-Records' },
98
+ ...paginationParamsToTags(params),
99
+ ],
104
100
  });
105
101
  }
106
- async getArNSReservedNames() {
102
+ async getArNSReservedNames(params) {
107
103
  return this.process.read({
108
- tags: [{ name: 'Action', value: 'Reserved-Names' }],
104
+ tags: [
105
+ { name: 'Action', value: 'Reserved-Names' },
106
+ ...paginationParamsToTags(params),
107
+ ],
109
108
  });
110
109
  }
111
110
  async getArNSReservedName({ name, }) {
@@ -125,15 +124,11 @@ export class IOReadable {
125
124
  });
126
125
  }
127
126
  async getBalances(params) {
128
- const allTags = [
129
- { name: 'Action', value: 'Paginated-Balances' },
130
- { name: 'Cursor', value: params?.cursor?.toString() },
131
- { name: 'Limit', value: params?.limit?.toString() },
132
- { name: 'Sort-By', value: params?.sortBy },
133
- { name: 'Sort-Order', value: params?.sortOrder },
134
- ];
135
127
  return this.process.read({
136
- tags: pruneTags(allTags),
128
+ tags: [
129
+ { name: 'Action', value: 'Paginated-Balances' },
130
+ ...paginationParamsToTags(params),
131
+ ],
137
132
  });
138
133
  }
139
134
  async getVault({ address, vaultId, }) {
@@ -146,15 +141,11 @@ export class IOReadable {
146
141
  });
147
142
  }
148
143
  async getVaults(params) {
149
- const allTags = [
150
- { name: 'Action', value: 'Paginated-Vaults' },
151
- { name: 'Cursor', value: params?.cursor?.toString() },
152
- { name: 'Limit', value: params?.limit?.toString() },
153
- { name: 'Sort-By', value: params?.sortBy },
154
- { name: 'Sort-Order', value: params?.sortOrder },
155
- ];
156
144
  return this.process.read({
157
- tags: pruneTags(allTags),
145
+ tags: [
146
+ { name: 'Action', value: 'Paginated-Vaults' },
147
+ ...paginationParamsToTags(params),
148
+ ],
158
149
  });
159
150
  }
160
151
  async getGateway({ address, }) {
@@ -166,41 +157,29 @@ export class IOReadable {
166
157
  });
167
158
  }
168
159
  async getGatewayDelegates({ address, ...pageParams }) {
169
- const allTags = [
170
- { name: 'Action', value: 'Paginated-Delegates' },
171
- { name: 'Address', value: address },
172
- { name: 'Cursor', value: pageParams?.cursor?.toString() },
173
- { name: 'Limit', value: pageParams?.limit?.toString() },
174
- { name: 'Sort-By', value: pageParams?.sortBy },
175
- { name: 'Sort-Order', value: pageParams?.sortOrder },
176
- ];
177
160
  return this.process.read({
178
- tags: pruneTags(allTags),
161
+ tags: [
162
+ { name: 'Action', value: 'Paginated-Delegates' },
163
+ { name: 'Address', value: address },
164
+ ...paginationParamsToTags(pageParams),
165
+ ],
179
166
  });
180
167
  }
181
168
  async getGatewayDelegateAllowList({ address, ...pageParams }) {
182
- const allTags = [
183
- { name: 'Action', value: 'Paginated-Allowed-Delegates' },
184
- { name: 'Address', value: address },
185
- { name: 'Cursor', value: pageParams?.cursor?.toString() },
186
- { name: 'Limit', value: pageParams?.limit?.toString() },
187
- { name: 'Sort-Order', value: pageParams?.sortOrder },
188
- // note: sortBy is omitted because it's not supported for this action as table is an of addresses
189
- ];
190
169
  return this.process.read({
191
- tags: pruneTags(allTags),
170
+ tags: [
171
+ { name: 'Action', value: 'Paginated-Allowed-Delegates' },
172
+ { name: 'Address', value: address },
173
+ ...paginationParamsToTags(pageParams),
174
+ ],
192
175
  });
193
176
  }
194
177
  async getGateways(pageParams) {
195
- const allTags = [
196
- { name: 'Action', value: 'Paginated-Gateways' },
197
- { name: 'Cursor', value: pageParams?.cursor?.toString() },
198
- { name: 'Limit', value: pageParams?.limit?.toString() },
199
- { name: 'Sort-By', value: pageParams?.sortBy },
200
- { name: 'Sort-Order', value: pageParams?.sortOrder },
201
- ];
202
178
  return this.process.read({
203
- tags: pruneTags(allTags),
179
+ tags: [
180
+ { name: 'Action', value: 'Paginated-Gateways' },
181
+ ...paginationParamsToTags(pageParams),
182
+ ],
204
183
  });
205
184
  }
206
185
  async getCurrentEpoch() {
@@ -209,14 +188,7 @@ export class IOReadable {
209
188
  { name: 'Action', value: 'Epoch' },
210
189
  {
211
190
  name: 'Timestamp',
212
- value: (await this.arweave.blocks
213
- .getCurrent()
214
- .then((block) => {
215
- return { timestamp: block.timestamp * 1000 };
216
- })
217
- .catch(() => {
218
- return { timestamp: Date.now() }; // fallback to current time
219
- })).timestamp.toString(),
191
+ value: (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
220
192
  },
221
193
  ],
222
194
  });
@@ -261,14 +233,7 @@ export class IOReadable {
261
233
  {
262
234
  name: 'Timestamp',
263
235
  value: epoch?.timestamp?.toString() ??
264
- (await this.arweave.blocks
265
- .getCurrent()
266
- .then((block) => {
267
- return { timestamp: block.timestamp * 1000 };
268
- })
269
- .catch(() => {
270
- return { timestamp: `${Date.now()}` }; // fallback to current time
271
- })).timestamp.toString(),
236
+ (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
272
237
  },
273
238
  {
274
239
  name: 'Epoch-Index',
@@ -347,15 +312,11 @@ export class IOReadable {
347
312
  }
348
313
  // Auctions
349
314
  async getArNSAuctions(params) {
350
- const allTags = [
351
- { name: 'Action', value: 'Auctions' },
352
- { name: 'Cursor', value: params?.cursor?.toString() },
353
- { name: 'Limit', value: params?.limit?.toString() },
354
- { name: 'Sort-By', value: params?.sortBy },
355
- { name: 'Sort-Order', value: params?.sortOrder },
356
- ];
357
315
  return this.process.read({
358
- tags: pruneTags(allTags),
316
+ tags: [
317
+ { name: 'Action', value: 'Auctions' },
318
+ ...paginationParamsToTags(params),
319
+ ],
359
320
  });
360
321
  }
361
322
  async getArNSAuction({ name, }) {
@@ -384,7 +345,8 @@ export class IOReadable {
384
345
  { name: 'Name', value: name },
385
346
  {
386
347
  name: 'Timestamp',
387
- value: timestamp?.toString() ?? Date.now().toString(),
348
+ value: timestamp?.toString() ??
349
+ (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
388
350
  },
389
351
  { name: 'Purchase-Type', value: type ?? 'lease' },
390
352
  {
@@ -405,16 +367,64 @@ export class IOReadable {
405
367
  async getDelegations(params) {
406
368
  const allTags = [
407
369
  { name: 'Action', value: 'Paginated-Delegations' },
408
- { name: 'Cursor', value: params.cursor?.toString() },
409
- { name: 'Limit', value: params.limit?.toString() },
410
- { name: 'Sort-By', value: params.sortBy },
411
- { name: 'Sort-Order', value: params.sortOrder },
412
370
  { name: 'Address', value: params.address },
371
+ ...paginationParamsToTags(params),
372
+ ];
373
+ return this.process.read({
374
+ tags: pruneTags(allTags),
375
+ });
376
+ }
377
+ async getGatewayVaults(params) {
378
+ return this.process.read({
379
+ tags: [
380
+ { name: 'Action', value: 'Paginated-Gateway-Vaults' },
381
+ { name: 'Address', value: params.address },
382
+ ...paginationParamsToTags(params),
383
+ ],
384
+ });
385
+ }
386
+ async getPrimaryNameRequest(params) {
387
+ const allTags = [
388
+ { name: 'Action', value: 'Primary-Name-Request' },
389
+ { name: 'Name', value: params.name },
390
+ {
391
+ name: 'Initiator',
392
+ value: params.initiator,
393
+ },
394
+ ];
395
+ return this.process.read({
396
+ tags: allTags,
397
+ });
398
+ }
399
+ async getPrimaryNameRequests(params) {
400
+ return this.process.read({
401
+ tags: [
402
+ { name: 'Action', value: 'Primary-Name-Requests' },
403
+ ...paginationParamsToTags(params),
404
+ ],
405
+ });
406
+ }
407
+ async getPrimaryName(params) {
408
+ const allTags = [
409
+ { name: 'Action', value: 'Primary-Name' },
410
+ {
411
+ name: 'Address',
412
+ value: params?.address,
413
+ },
414
+ { name: 'Name', value: params?.name },
413
415
  ];
414
416
  return this.process.read({
415
417
  tags: pruneTags(allTags),
416
418
  });
417
419
  }
420
+ async getPrimaryNames(params) {
421
+ return this.process.read({
422
+ tags: [
423
+ { name: 'Action', value: 'Primary-Names' },
424
+ ...paginationParamsToTags(params),
425
+ ],
426
+ });
427
+ }
418
428
  }
419
429
  export class IOWriteable extends IOReadable {
420
430
  signer;
@@ -757,4 +767,13 @@ export class IOWriteable extends IOReadable {
757
767
  tags: pruneTags(allTags),
758
768
  });
759
769
  }
770
+ async requestPrimaryName(params) {
771
+ return this.process.send({
772
+ signer: this.signer,
773
+ tags: [
774
+ { name: 'Action', value: 'Primary-Name-Request' },
775
+ { name: 'Name', value: params.name },
776
+ ],
777
+ });
778
+ }
760
779
  }
@@ -27,5 +27,5 @@ export const IO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdi
27
27
  export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
28
28
  export const MIO_PER_IO = 1_000_000;
29
29
  export const AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
30
- export const ANT_LUA_ID = 'pOh2yupSaQCrLI_-ah8tVTiusUdVNTxxeWTQQHNdf30';
30
+ export const ANT_LUA_ID = 'AWO2a2lVfQnjPFThjE4Uuw4ZFAd9EsCHBEgDYkJA-kk'; // v8 id test - remove comment when updated with actual v8 id.
31
31
  export const DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
@@ -48,7 +48,9 @@ export const AntRecordSchema = z.object({
48
48
  transactionId: ArweaveTxIdSchema.describe('The Target ID of the undername'),
49
49
  ttlSeconds: z.number(),
50
50
  });
51
+ export const AntEntrySchema = z.intersection(AntRecordSchema, z.object({ name: z.string() }));
51
52
  export const AntRecordsSchema = z.record(z.string(), AntRecordSchema);
53
+ export const AntEntriesSchema = z.array(AntEntrySchema);
52
54
  export const AntControllersSchema = z.array(ArweaveTxIdSchema.describe('Controller address'));
53
55
  export const AntBalancesSchema = z.record(ArweaveTxIdSchema.describe('Holder address'), z.number());
54
56
  export const AntStateSchema = z.object({
@@ -72,33 +74,36 @@ export const AntStateSchema = z.object({
72
74
  Initialized: z
73
75
  .boolean()
74
76
  .describe('Flag indicating whether the ANT has been initialized.'),
75
- ['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
76
77
  });
77
- export const AntHandlerNames = [
78
- 'evolve',
79
- '_eval',
80
- '_default',
81
- 'transfer',
78
+ export const AntReadHandlers = [
82
79
  'balance',
83
80
  'balances',
84
81
  'totalSupply',
85
82
  'info',
83
+ 'controllers',
84
+ 'record',
85
+ 'records',
86
+ 'state',
87
+ ];
88
+ export const AntWriteHandlers = [
89
+ 'evolve',
90
+ '_eval',
91
+ '_default',
92
+ 'transfer',
86
93
  'addController',
87
94
  'removeController',
88
- 'controllers',
89
95
  'setRecord',
90
96
  'removeRecord',
91
- 'record',
92
- 'records',
93
97
  'setName',
94
98
  'setTicker',
95
99
  'setDescription',
96
100
  'setKeywords',
101
+ 'setLogo',
97
102
  'initializeState',
98
- 'state',
99
103
  'releaseName',
100
104
  'reassignName',
101
105
  ];
106
+ export const AntHandlerNames = [...AntReadHandlers, ...AntWriteHandlers];
102
107
  export const AntHandlersSchema = z
103
108
  .array(z.string({ description: 'Handler Name' }))
104
109
  .refine((antHandlers) => {
@@ -109,7 +114,6 @@ export const AntHandlersSchema = z
109
114
  export const AntInfoSchema = z.object({
110
115
  Name: z.string().describe('The name of the ANT.'),
111
116
  Owner: ArweaveTxIdSchema.describe('The Owners address.'),
112
- ['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
113
117
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
114
118
  ['Total-Supply']: IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
115
119
  Description: AntDescriptionSchema.describe('The description for the ANT.'),
@@ -42,6 +42,10 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
42
42
  name: 'ANT-Registry-Id',
43
43
  value: antRegistryId,
44
44
  },
45
+ {
46
+ name: 'Source-Code-TX-ID', // utility for understanding what the original source id of the lua code was
47
+ value: luaCodeTxId,
48
+ },
45
49
  ],
46
50
  });
47
51
  const aosClient = new AOProcess({
@@ -170,3 +174,28 @@ export function createAoSigner(signer) {
170
174
  };
171
175
  return aoSigner;
172
176
  }
177
+ /**
178
+ * @param records @type {AoANTRecordEntry[] | Record<string, AoANTRecord>} - the records returned by an ANT
179
+ * @returns @type {AoANTRecordEntry[]} - the alphabetically sorted records
180
+ */
181
+ export function parseAntRecords(records) {
182
+ const result = Array.isArray(records)
183
+ ? records // assumes if records is an array that its AoANTRecordEntry[]
184
+ : // backwards compatibility for when ANTs returned as Record<string, AoANTRecord>
185
+ Object.keys(records) // sort the keys since string indexed maps in lua do not retain order
186
+ .sort((a, b) => {
187
+ if (a == '@')
188
+ return -1;
189
+ if (b == '@')
190
+ return 1;
191
+ return a.localeCompare(b);
192
+ })
193
+ .reduce((acc, undername) => {
194
+ acc.push({
195
+ ...records[undername],
196
+ name: undername,
197
+ });
198
+ return acc;
199
+ }, []);
200
+ return result;
201
+ }
@@ -18,3 +18,12 @@ export const getCurrentBlockUnixTimestampMs = async (arweave) => {
18
18
  return Date.now(); // fallback to current time
19
19
  });
20
20
  };
21
+ export const paginationParamsToTags = (params) => {
22
+ const tags = [
23
+ { name: 'Cursor', value: params?.cursor?.toString() },
24
+ { name: 'Limit', value: params?.limit?.toString() },
25
+ { name: 'Sort-By', value: params?.sortBy?.toString() },
26
+ { name: 'Sort-Order', value: params?.sortOrder?.toString() },
27
+ ];
28
+ return pruneTags(tags);
29
+ };
@@ -1,5 +1,4 @@
1
1
  /**
2
- *
3
2
  * @param schema - zod schema
4
3
  * @param v - value to parse
5
4
  * @throws {z.SafeParseError<any>} - if the value fails to parse
@@ -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.5.0-alpha.1';
17
+ export const version = '2.5.0-alpha.10';
@@ -1,4 +1,4 @@
1
- import { AntReadOptions, AoANTInfo, AoANTRead, AoANTRecord, AoANTState, AoANTWrite } from '../types/ant.js';
1
+ import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTRecordEntry, 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
  export declare class ANT {
@@ -31,14 +31,14 @@ export declare class AoANTReadable implements AoANTRead {
31
31
  undername: string;
32
32
  }, { strict }?: AntReadOptions): Promise<AoANTRecord>;
33
33
  /**
34
- * @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
34
+ * @returns {Promise<AoANTRecordEntry[]>} All the undernames managed by the ANT.
35
35
  * @example
36
36
  * Get the current records
37
37
  * ```ts
38
38
  * ant.getRecords();
39
39
  * ````
40
40
  */
41
- getRecords({ strict }?: AntReadOptions): Promise<Record<string, AoANTRecord>>;
41
+ getRecords({ strict }?: AntReadOptions): Promise<AoANTRecordEntry[]>;
42
42
  /**
43
43
  * @returns {Promise<string>} The owner of the ANT.
44
44
  * @example
@@ -96,6 +96,15 @@ export declare class AoANTReadable implements AoANTRead {
96
96
  getBalance({ address }: {
97
97
  address: string;
98
98
  }, { strict }?: AntReadOptions): Promise<number>;
99
+ /**
100
+ * @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
101
+ * @example
102
+ * Get the handlers of the ANT.
103
+ * ```ts
104
+ * const handlers = await ant.getHandlers();
105
+ * ```
106
+ */
107
+ getHandlers(): Promise<AoANTHandler[]>;
99
108
  }
100
109
  export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite {
101
110
  private signer;
@@ -205,6 +214,18 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
205
214
  setKeywords({ keywords }: {
206
215
  keywords: string[];
207
216
  }, options?: WriteOptions): Promise<AoMessageResult>;
217
+ /**
218
+ * @param txId @type {string} - Arweave transaction id of the logo we want to set
219
+ * @param options @type {WriteOptions} - additional options to add to the write interaction (optional)
220
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
221
+ * @example
222
+ * ```ts
223
+ * ant.setLogo({ logo: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f" });
224
+ * ```
225
+ */
226
+ setLogo({ txId }: {
227
+ txId: string;
228
+ }, options?: WriteOptions): Promise<AoMessageResult>;
208
229
  /**
209
230
  * @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
231
  * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
@@ -234,4 +255,16 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
234
255
  ioProcessId: string;
235
256
  antProcessId: string;
236
257
  }, options?: WriteOptions): Promise<AoMessageResult>;
258
+ /**
259
+ * Approves a primary name request for a given name or address.
260
+ */
261
+ approvePrimaryNameRequest({ name, address, ioProcessId, }: {
262
+ name: string;
263
+ address: WalletAddress;
264
+ ioProcessId: string;
265
+ }, options?: WriteOptions): Promise<AoMessageResult>;
266
+ removePrimaryNames({ names, ioProcessId }: {
267
+ names: string[];
268
+ ioProcessId: string;
269
+ }, options?: WriteOptions): Promise<AoMessageResult>;
237
270
  }