@ar.io/sdk 2.1.0-alpha.1 → 2.1.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.
Files changed (43) hide show
  1. package/README.md +103 -22
  2. package/bundles/web.bundle.min.js +105 -105
  3. package/lib/cjs/common/ant-registry.js +87 -0
  4. package/lib/cjs/common/ant.js +3 -9
  5. package/lib/cjs/common/contracts/ao-process.js +2 -19
  6. package/lib/cjs/common/index.js +1 -0
  7. package/lib/cjs/common/io.js +14 -12
  8. package/lib/cjs/constants.js +2 -1
  9. package/lib/cjs/io.js +2 -1
  10. package/lib/cjs/types.js +0 -1
  11. package/lib/cjs/utils/ao.js +43 -3
  12. package/lib/cjs/utils/json.js +3 -2
  13. package/lib/cjs/utils/processes.js +24 -43
  14. package/lib/cjs/version.js +1 -1
  15. package/lib/esm/common/ant-registry.js +81 -0
  16. package/lib/esm/common/ant.js +3 -9
  17. package/lib/esm/common/contracts/ao-process.js +2 -19
  18. package/lib/esm/common/index.js +1 -0
  19. package/lib/esm/common/io.js +14 -12
  20. package/lib/esm/constants.js +1 -0
  21. package/lib/esm/io.js +2 -1
  22. package/lib/esm/types.js +0 -1
  23. package/lib/esm/utils/ao.js +43 -4
  24. package/lib/esm/utils/json.js +1 -0
  25. package/lib/esm/utils/processes.js +24 -43
  26. package/lib/esm/version.js +1 -1
  27. package/lib/types/common/ant-registry.d.ts +26 -0
  28. package/lib/types/common/ant.d.ts +4 -4
  29. package/lib/types/common/contracts/ao-process.d.ts +4 -17
  30. package/lib/types/common/index.d.ts +1 -0
  31. package/lib/types/common/io.d.ts +9 -12
  32. package/lib/types/common.d.ts +2 -25
  33. package/lib/types/constants.d.ts +1 -0
  34. package/lib/types/io.d.ts +180 -116
  35. package/lib/types/token.d.ts +13 -0
  36. package/lib/types/types.d.ts +0 -1
  37. package/lib/types/utils/ao.d.ts +14 -6
  38. package/lib/types/utils/processes.d.ts +11 -5
  39. package/lib/types/version.d.ts +1 -1
  40. package/package.json +8 -3
  41. package/lib/cjs/contract-state.js +0 -68
  42. package/lib/esm/contract-state.js +0 -65
  43. package/lib/types/contract-state.d.ts +0 -201
@@ -15,6 +15,7 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types.js';
18
+ import { createAoSigner } from '../utils/ao.js';
18
19
  import { AOProcess, InvalidContractConfigurationError } from './index.js';
19
20
  export class ANT {
20
21
  static init({ signer, ...config }) {
@@ -77,7 +78,7 @@ export class AoANTReadable {
77
78
  return record;
78
79
  }
79
80
  /**
80
- * @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
81
+ * @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
81
82
  * @example
82
83
  * Get the current records
83
84
  * ```ts
@@ -181,7 +182,7 @@ export class AoANTWriteable extends AoANTReadable {
181
182
  signer;
182
183
  constructor({ signer, ...config }) {
183
184
  super(config);
184
- this.signer = signer;
185
+ this.signer = createAoSigner(signer);
185
186
  }
186
187
  /**
187
188
  * @param target @type {string} The address of the account you want to transfer the ANT to.
@@ -198,7 +199,6 @@ export class AoANTWriteable extends AoANTReadable {
198
199
  ];
199
200
  return this.process.send({
200
201
  tags,
201
- data: {},
202
202
  signer: this.signer,
203
203
  });
204
204
  }
@@ -217,7 +217,6 @@ export class AoANTWriteable extends AoANTReadable {
217
217
  ];
218
218
  return this.process.send({
219
219
  tags,
220
- data: {},
221
220
  signer: this.signer,
222
221
  });
223
222
  }
@@ -236,7 +235,6 @@ export class AoANTWriteable extends AoANTReadable {
236
235
  ];
237
236
  return this.process.send({
238
237
  tags,
239
- data: {},
240
238
  signer: this.signer,
241
239
  });
242
240
  }
@@ -258,7 +256,6 @@ export class AoANTWriteable extends AoANTReadable {
258
256
  { name: 'Transaction-Id', value: transactionId },
259
257
  { name: 'TTL-Seconds', value: ttlSeconds.toString() },
260
258
  ],
261
- data: { transactionId, ttlSeconds },
262
259
  signer: this.signer,
263
260
  });
264
261
  }
@@ -276,7 +273,6 @@ export class AoANTWriteable extends AoANTReadable {
276
273
  { name: 'Action', value: 'Remove-Record' },
277
274
  { name: 'Sub-Domain', value: undername },
278
275
  ],
279
- data: { undername },
280
276
  signer: this.signer,
281
277
  });
282
278
  }
@@ -294,7 +290,6 @@ export class AoANTWriteable extends AoANTReadable {
294
290
  { name: 'Action', value: 'Set-Ticker' },
295
291
  { name: 'Ticker', value: ticker },
296
292
  ],
297
- data: { ticker },
298
293
  signer: this.signer,
299
294
  });
300
295
  }
@@ -312,7 +307,6 @@ export class AoANTWriteable extends AoANTReadable {
312
307
  { name: 'Action', value: 'Set-Name' },
313
308
  { name: 'Name', value: name },
314
309
  ],
315
- data: { name },
316
310
  signer: this.signer,
317
311
  });
318
312
  }
@@ -15,7 +15,6 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import { connect } from '@permaweb/aoconnect';
18
- import { createData } from 'arbundles';
19
18
  import { safeDecode } from '../../utils/json.js';
20
19
  import { version } from '../../version.js';
21
20
  import { WriteInteractionError } from '../error.js';
@@ -29,22 +28,6 @@ export class AOProcess {
29
28
  this.logger = logger;
30
29
  this.ao = ao;
31
30
  }
32
- // TODO: could abstract into our own interface that constructs different signers
33
- static async createAoSigner(signer) {
34
- // ensure appropriate permissions are granted with injected signers.
35
- if (signer.publicKey === undefined && 'setPublicKey' in signer) {
36
- await signer.setPublicKey();
37
- }
38
- const aoSigner = async ({ data, tags, target, anchor }) => {
39
- const dataItem = createData(data, signer, { tags, target, anchor });
40
- const signedData = dataItem.sign(signer).then(async () => ({
41
- id: await dataItem.id,
42
- raw: await dataItem.getRaw(),
43
- }));
44
- return signedData;
45
- };
46
- return aoSigner;
47
- }
48
31
  async read({ tags, retries = 3, }) {
49
32
  let attempts = 0;
50
33
  let lastError;
@@ -105,8 +88,8 @@ export class AOProcess {
105
88
  process: this.processId,
106
89
  // TODO: any other default tags we want to add?
107
90
  tags: [...tags, { name: 'AR-IO-SDK', value: version }],
108
- data: typeof data !== 'string' ? JSON.stringify(data) : data,
109
- signer: await AOProcess.createAoSigner(signer),
91
+ data,
92
+ signer,
110
93
  });
111
94
  this.logger.debug(`Sent message to process`, {
112
95
  messageId,
@@ -17,6 +17,7 @@
17
17
  export * from './error.js';
18
18
  export * from './logger.js';
19
19
  export * from './ant.js';
20
+ export * from './ant-registry.js';
20
21
  // ao
21
22
  export * from './io.js';
22
23
  export * from './contracts/ao-process.js';
@@ -1,5 +1,6 @@
1
1
  import { IO_TESTNET_PROCESS_ID } from '../constants.js';
2
2
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../io.js';
3
+ import { createAoSigner } from '../utils/ao.js';
3
4
  import { defaultArweave } from './arweave.js';
4
5
  import { AOProcess } from './contracts/ao-process.js';
5
6
  import { InvalidContractConfigurationError } from './error.js';
@@ -42,6 +43,11 @@ export class IOReadable {
42
43
  tags: [{ name: 'Action', value: 'Info' }],
43
44
  });
44
45
  }
46
+ async getTokenSupply() {
47
+ return this.process.read({
48
+ tags: [{ name: 'Action', value: 'Total-Token-Supply' }],
49
+ });
50
+ }
45
51
  async getEpochSettings(params) {
46
52
  const allTags = [
47
53
  { name: 'Action', value: 'Epoch-Settings' },
@@ -336,11 +342,11 @@ export class IOWriteable extends IOReadable {
336
342
  processId: IO_TESTNET_PROCESS_ID,
337
343
  }),
338
344
  });
339
- this.signer = signer;
345
+ this.signer = createAoSigner(signer);
340
346
  }
341
347
  else if (isProcessConfiguration(config)) {
342
348
  super({ process: config.process });
343
- this.signer = signer;
349
+ this.signer = createAoSigner(signer);
344
350
  }
345
351
  else if (isProcessIdConfiguration(config)) {
346
352
  super({
@@ -348,7 +354,7 @@ export class IOWriteable extends IOReadable {
348
354
  processId: config.processId,
349
355
  }),
350
356
  });
351
- this.signer = signer;
357
+ this.signer = createAoSigner(signer);
352
358
  }
353
359
  else {
354
360
  throw new InvalidContractConfigurationError();
@@ -383,11 +389,11 @@ export class IOWriteable extends IOReadable {
383
389
  },
384
390
  {
385
391
  name: 'Allow-Delegated-Staking',
386
- value: allowDelegatedStaking.toString(),
392
+ value: allowDelegatedStaking?.toString(),
387
393
  },
388
394
  {
389
395
  name: 'Delegate-Reward-Share-Ratio',
390
- value: delegateRewardShareRatio.toString(),
396
+ value: delegateRewardShareRatio?.toString(),
391
397
  },
392
398
  {
393
399
  name: 'FQDN',
@@ -399,7 +405,7 @@ export class IOWriteable extends IOReadable {
399
405
  },
400
406
  {
401
407
  name: 'Min-Delegated-Stake',
402
- value: minDelegatedStake.valueOf().toString(),
408
+ value: minDelegatedStake?.valueOf().toString(),
403
409
  },
404
410
  {
405
411
  name: 'Note',
@@ -407,7 +413,7 @@ export class IOWriteable extends IOReadable {
407
413
  },
408
414
  {
409
415
  name: 'Port',
410
- value: port.toString(),
416
+ value: port?.toString(),
411
417
  },
412
418
  {
413
419
  name: 'Properties',
@@ -419,7 +425,7 @@ export class IOWriteable extends IOReadable {
419
425
  },
420
426
  {
421
427
  name: 'Auto-Stake',
422
- value: autoStake.toString(),
428
+ value: autoStake?.toString(),
423
429
  },
424
430
  {
425
431
  name: 'Observer-Address',
@@ -533,10 +539,6 @@ export class IOWriteable extends IOReadable {
533
539
  value: params.failedGateways.join(','),
534
540
  },
535
541
  ],
536
- data: {
537
- reportTxId: params.reportTxId,
538
- failedGateways: params.failedGateways,
539
- },
540
542
  });
541
543
  }
542
544
  async buyRecord(params, options) {
@@ -25,6 +25,7 @@ export const IO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc
25
25
  // backwards compatibility - TODO: remove in v2.0.0
26
26
  export const ioDevnetProcessId = IO_DEVNET_PROCESS_ID;
27
27
  export const IO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
28
+ export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
28
29
  export const MIO_PER_IO = 1_000_000;
29
30
  export const AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
30
31
  export const ANT_LUA_ID = 'Flwio4Lr08g6s6uim6lEJNnVGD9ylvz0_aafvpiL8FI';
package/lib/esm/io.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { validateArweaveId } from './utils/arweave.js';
2
+ // Typeguard functions
2
3
  export function isProcessConfiguration(config) {
3
4
  return 'process' in config;
4
5
  }
@@ -8,5 +9,5 @@ export function isProcessIdConfiguration(config) {
8
9
  validateArweaveId(config.processId) === true);
9
10
  }
10
11
  export function isLeasedArNSRecord(record) {
11
- return record.type === 'lease' && record.endTimestamp !== undefined;
12
+ return record.type === 'lease';
12
13
  }
package/lib/esm/types.js CHANGED
@@ -14,7 +14,6 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export * from './contract-state.js';
18
17
  export * from './common.js';
19
18
  export * from './token.js';
20
19
  export * from './io.js';
@@ -14,11 +14,17 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- import { connect } from '@permaweb/aoconnect';
17
+ import { connect, createDataItemSigner } from '@permaweb/aoconnect';
18
+ import { createData } from 'arbundles';
18
19
  import { defaultArweave } from '../common/arweave.js';
19
20
  import { AOProcess } from '../common/index.js';
20
- import { ANT_LUA_ID, AOS_MODULE_ID, DEFAULT_SCHEDULER_ID, } from '../constants.js';
21
- export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = ANT_LUA_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, stateContractTxId, }) {
21
+ import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, DEFAULT_SCHEDULER_ID, } from '../constants.js';
22
+ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = ANT_LUA_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, stateContractTxId, antRegistryId = ANT_REGISTRY_ID, }) {
23
+ // AoSigner is not a Contract Signer - should probably add that to the contract signer type
24
+ const registryClient = new AOProcess({
25
+ processId: antRegistryId,
26
+ ao,
27
+ });
22
28
  //TODO: cache locally and only fetch if not cached
23
29
  const luaString = (await defaultArweave.transactions.getData(luaCodeTxId, {
24
30
  decode: true,
@@ -27,7 +33,13 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
27
33
  const processId = await ao.spawn({
28
34
  module,
29
35
  scheduler,
30
- signer: await AOProcess.createAoSigner(signer),
36
+ signer,
37
+ tags: [
38
+ {
39
+ name: 'ANT-Registry-Id',
40
+ value: antRegistryId,
41
+ },
42
+ ],
31
43
  });
32
44
  const aosClient = new AOProcess({
33
45
  processId,
@@ -54,6 +66,13 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
54
66
  signer,
55
67
  });
56
68
  }
69
+ await registryClient.send({
70
+ tags: [
71
+ { name: 'Action', value: 'Register' },
72
+ { name: 'Process-Id', value: processId },
73
+ ],
74
+ signer,
75
+ });
57
76
  return processId;
58
77
  }
59
78
  export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect(), }) {
@@ -77,3 +96,23 @@ export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, a
77
96
  });
78
97
  return id;
79
98
  }
99
+ export function createAoSigner(signer) {
100
+ if (!('publicKey' in signer)) {
101
+ return createDataItemSigner(signer);
102
+ }
103
+ const aoSigner = async ({ data, tags, target, anchor }) => {
104
+ // ensure appropriate permissions are granted with injected signers.
105
+ if (signer.publicKey === undefined &&
106
+ 'setPublicKey' in signer &&
107
+ typeof signer.setPublicKey === 'function') {
108
+ await signer.setPublicKey();
109
+ }
110
+ const dataItem = createData(data, signer, { tags, target, anchor });
111
+ const signedData = dataItem.sign(signer).then(async () => ({
112
+ id: await dataItem.id,
113
+ raw: await dataItem.getRaw(),
114
+ }));
115
+ return signedData;
116
+ };
117
+ return aoSigner;
118
+ }
@@ -14,6 +14,7 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
18
  export function safeDecode(data) {
18
19
  try {
19
20
  return JSON.parse(data);
@@ -16,37 +16,17 @@
16
16
  */
17
17
  import { EventEmitter } from 'eventemitter3';
18
18
  import { pLimit } from 'plimit-lit';
19
+ import { ANTRegistry } from '../common/ant-registry.js';
19
20
  import { ANT } from '../common/ant.js';
20
21
  import { IO } from '../common/io.js';
21
22
  import { Logger } from '../common/logger.js';
22
23
  import { IO_TESTNET_PROCESS_ID } from '../constants.js';
23
- export const getANTProcessesOwnedByWallet = async ({ address, contract = IO.init({
24
- processId: IO_TESTNET_PROCESS_ID,
25
- }), }) => {
26
- const throttle = pLimit(50);
27
- // get the record names of the registry - TODO: this may need to be paginated
28
- const records = await fetchAllArNSRecords({
29
- contract: contract,
30
- });
31
- const uniqueContractProcessIds = Object.values(records)
32
- .filter((record) => record.processId !== undefined)
33
- .map((record) => record.processId);
34
- // check the contract owner and controllers
35
- const ownedOrControlledByWallet = await Promise.all(uniqueContractProcessIds.map(async (processId) => throttle(async () => {
36
- const ant = ANT.init({
37
- processId,
38
- });
39
- const { Owner, Controllers } = await ant.getState();
40
- if (Owner === address || Controllers.includes(address)) {
41
- return processId;
42
- }
43
- return;
44
- })));
45
- if (ownedOrControlledByWallet.length === 0) {
46
- return [];
47
- }
48
- // TODO: insert gql query to find ANT processes owned by wallet given wallet not currently in the registry
49
- return [...new Set(ownedOrControlledByWallet)];
24
+ /**
25
+ * @beta This API is in beta and may change in the future.
26
+ */
27
+ export const getANTProcessesOwnedByWallet = async ({ address, registry = ANTRegistry.init(), }) => {
28
+ const res = await registry.accessControlList({ address });
29
+ return [...new Set([...res.Owned, ...res.Controlled])];
50
30
  };
51
31
  function timeout(ms, promise) {
52
32
  return new Promise((resolve, reject) => {
@@ -78,9 +58,11 @@ export class ArNSEventEmitter extends EventEmitter {
78
58
  this.throttle = pLimit(concurrency);
79
59
  this.logger = logger;
80
60
  }
81
- async fetchProcessesOwnedByWallet({ address }) {
61
+ async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ANTRegistry.init(), }) {
82
62
  const uniqueContractProcessIds = {};
83
- await timeout(this.timeoutMs, fetchAllArNSRecords({ contract: this.contract, emitter: this }))
63
+ const antIdRes = await antRegistry.accessControlList({ address });
64
+ const antIds = new Set([...antIdRes.Owned, ...antIdRes.Controlled]);
65
+ await timeout(this.timeoutMs, fetchAllArNSRecords({ contract: this.contract, emitter: this, pageSize }))
84
66
  .catch((e) => {
85
67
  this.emit('error', `Error getting ArNS records: ${e}`);
86
68
  this.logger.error(`Error getting ArNS records`, {
@@ -90,19 +72,17 @@ export class ArNSEventEmitter extends EventEmitter {
90
72
  return {};
91
73
  })
92
74
  .then((records) => {
93
- if (!records)
94
- return;
95
- Object.entries(records).forEach(([name, record]) => {
96
- if (record.processId === undefined) {
97
- return;
98
- }
99
- if (uniqueContractProcessIds[record.processId] === undefined) {
100
- uniqueContractProcessIds[record.processId] = {
101
- state: undefined,
102
- names: {},
103
- };
75
+ Object.entries(records).forEach(([name, arnsRecord]) => {
76
+ if (antIds.has(arnsRecord.processId)) {
77
+ if (uniqueContractProcessIds[arnsRecord.processId] == undefined) {
78
+ uniqueContractProcessIds[arnsRecord.processId] = {
79
+ state: undefined,
80
+ names: {},
81
+ };
82
+ }
83
+ uniqueContractProcessIds[arnsRecord.processId].names[name] =
84
+ arnsRecord;
104
85
  }
105
- uniqueContractProcessIds[record.processId].names[name] = record;
106
86
  });
107
87
  });
108
88
  const idCount = Object.keys(uniqueContractProcessIds).length;
@@ -132,13 +112,14 @@ export class ArNSEventEmitter extends EventEmitter {
132
112
  }
133
113
  export const fetchAllArNSRecords = async ({ contract = IO.init({
134
114
  processId: IO_TESTNET_PROCESS_ID,
135
- }), emitter, logger = Logger.default, }) => {
115
+ }), emitter, logger = Logger.default, pageSize = 50_000, }) => {
136
116
  let cursor;
137
117
  const startTimestamp = Date.now();
138
118
  const records = {};
139
119
  do {
140
120
  const pageResult = await contract
141
- .getArNSRecords({ cursor })
121
+ .getArNSRecords({ cursor, limit: pageSize })
122
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
123
  .catch((e) => {
143
124
  logger?.error(`Error getting ArNS records`, {
144
125
  message: e?.message,
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '2.1.0-alpha.1';
18
+ export const version = '2.1.0-alpha.11';
@@ -0,0 +1,26 @@
1
+ import { AoANTRegistryRead, AoANTRegistryWrite, AoMessageResult, ProcessConfiguration, WithSigner } from '../types.js';
2
+ import { AOProcess } from './index.js';
3
+ export declare class ANTRegistry {
4
+ static init(): AoANTRegistryRead;
5
+ static init(config: Required<ProcessConfiguration> & {
6
+ signer?: undefined;
7
+ }): AoANTRegistryRead;
8
+ static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>): AoANTRegistryRead;
9
+ }
10
+ export declare class AoANTRegistryReadable implements AoANTRegistryRead {
11
+ protected process: AOProcess;
12
+ constructor(config?: ProcessConfiguration);
13
+ accessControlList({ address, }: {
14
+ address: string;
15
+ }): Promise<{
16
+ Owned: string[];
17
+ Controlled: string[];
18
+ }>;
19
+ }
20
+ export declare class AoANTRegistryWriteable extends AoANTRegistryReadable implements AoANTRegistryWrite {
21
+ private signer;
22
+ constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
23
+ register({ processId, }: {
24
+ processId: string;
25
+ }): Promise<AoMessageResult>;
26
+ }
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- import { ANTRecord, AoANTRead, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
17
+ import { AoANTRead, AoANTRecord, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
18
18
  import { AOProcess } from './index.js';
19
19
  export declare class ANT {
20
20
  static init(config: Required<ProcessConfiguration> & {
@@ -44,16 +44,16 @@ export declare class AoANTReadable implements AoANTRead {
44
44
  */
45
45
  getRecord({ undername }: {
46
46
  undername: string;
47
- }): Promise<ANTRecord>;
47
+ }): Promise<AoANTRecord>;
48
48
  /**
49
- * @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
49
+ * @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
50
50
  * @example
51
51
  * Get the current records
52
52
  * ```ts
53
53
  * ant.getRecords();
54
54
  * ````
55
55
  */
56
- getRecords(): Promise<Record<string, ANTRecord>>;
56
+ getRecords(): Promise<Record<string, AoANTRecord>>;
57
57
  /**
58
58
  * @returns {Promise<string>} The owner of the ANT.
59
59
  * @example
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import { AOContract, AoClient, ContractSigner } from '../../types.js';
1
+ import { AOContract, AoClient, AoSigner } from '../../types.js';
3
2
  import { ILogger } from '../logger.js';
4
3
  export declare class AOProcess implements AOContract {
5
4
  private logger;
@@ -10,18 +9,6 @@ export declare class AOProcess implements AOContract {
10
9
  ao?: AoClient;
11
10
  logger?: ILogger;
12
11
  });
13
- static createAoSigner(signer: ContractSigner): Promise<(args: {
14
- data: string | Buffer;
15
- tags?: {
16
- name: string;
17
- value: string;
18
- }[];
19
- target?: string;
20
- anchor?: string;
21
- }) => Promise<{
22
- id: string;
23
- raw: ArrayBuffer;
24
- }>>;
25
12
  read<K>({ tags, retries, }: {
26
13
  tags?: Array<{
27
14
  name: string;
@@ -29,13 +16,13 @@ export declare class AOProcess implements AOContract {
29
16
  }>;
30
17
  retries?: number;
31
18
  }): Promise<K>;
32
- send<I, K>({ tags, data, signer, retries, }: {
19
+ send<K>({ tags, data, signer, retries, }: {
33
20
  tags: Array<{
34
21
  name: string;
35
22
  value: string;
36
23
  }>;
37
- data?: I;
38
- signer: ContractSigner;
24
+ data?: string | undefined;
25
+ signer: AoSigner;
39
26
  retries?: number;
40
27
  }): Promise<{
41
28
  id: string;
@@ -17,5 +17,6 @@
17
17
  export * from './error.js';
18
18
  export * from './logger.js';
19
19
  export * from './ant.js';
20
+ export * from './ant-registry.js';
20
21
  export * from './io.js';
21
22
  export * from './contracts/ao-process.js';
@@ -15,10 +15,9 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import Arweave from 'arweave';
18
- import { ArNSReservedNameData, EpochDistributionData, EpochObservations, WeightedObserver } from '../contract-state.js';
19
18
  import { AoArNSNameData, AoEpochData, AoEpochSettings, AoGateway, AoIORead, AoIOWrite, EpochInput } from '../io.js';
20
19
  import { mIOToken } from '../token.js';
21
- import { AoArNSNameDataWithName, AoBalanceWithAddress, AoGatewayWithAddress, AoMessageResult, ContractSigner, JoinNetworkParams, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WithSigner, WriteOptions } from '../types.js';
20
+ import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types.js';
22
21
  import { AOProcess } from './contracts/ao-process.js';
23
22
  export declare class IO {
24
23
  static init(): AoIORead;
@@ -49,16 +48,17 @@ export declare class IOReadable implements AoIORead {
49
48
  Logo: string;
50
49
  Denomination: number;
51
50
  }>;
51
+ getTokenSupply(): Promise<number>;
52
52
  getEpochSettings(params?: EpochInput): Promise<AoEpochSettings>;
53
53
  getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
54
54
  getArNSRecord({ name, }: {
55
55
  name: string;
56
56
  }): Promise<AoArNSNameData | undefined>;
57
57
  getArNSRecords(pageParams?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
58
- getArNSReservedNames(): Promise<Record<string, ArNSReservedNameData> | Record<string, never>>;
58
+ getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
59
59
  getArNSReservedName({ name, }: {
60
60
  name: string;
61
- }): Promise<ArNSReservedNameData | undefined>;
61
+ }): Promise<AoArNSReservedNameData | undefined>;
62
62
  getBalance({ address }: {
63
63
  address: WalletAddress;
64
64
  }): Promise<number>;
@@ -68,10 +68,10 @@ export declare class IOReadable implements AoIORead {
68
68
  }): Promise<AoGateway | undefined>;
69
69
  getGateways(pageParams?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
70
70
  getCurrentEpoch(): Promise<AoEpochData>;
71
- getPrescribedObservers(epoch?: EpochInput): Promise<WeightedObserver[]>;
71
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
72
72
  getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
73
- getObservations(epoch?: EpochInput): Promise<EpochObservations>;
74
- getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
73
+ getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
74
+ getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
75
75
  getTokenCost(params: {
76
76
  intent: 'Buy-Record';
77
77
  purchaseType: 'permabuy' | 'lease';
@@ -101,12 +101,9 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
101
101
  target: string;
102
102
  qty: number | mIOToken;
103
103
  }, options?: WriteOptions): Promise<AoMessageResult>;
104
- joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<JoinNetworkParams, 'observerWallet' | 'qty'> & {
105
- observerAddress: string;
106
- operatorStake: number | mIOToken;
107
- }, options?: WriteOptions): Promise<AoMessageResult>;
104
+ joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
108
105
  leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
109
- updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
106
+ updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
110
107
  delegateStake(params: {
111
108
  target: string;
112
109
  stakeQty: number | mIOToken;