@ar.io/sdk 3.11.0-beta.1 → 3.11.1-alpha.1

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 (81) hide show
  1. package/README.md +2 -0
  2. package/bundles/web.bundle.min.js +258 -170
  3. package/lib/cjs/cli/utils.js +2 -0
  4. package/lib/cjs/common/ant-versions.js +3 -2
  5. package/lib/cjs/common/contracts/ao-process.js +3 -1
  6. package/lib/cjs/common/index.js +0 -2
  7. package/lib/cjs/common/io.js +17 -9
  8. package/lib/cjs/common/turbo.js +1 -1
  9. package/lib/cjs/types/index.js +0 -1
  10. package/lib/cjs/utils/ao.js +8 -3
  11. package/lib/cjs/utils/processes.js +3 -1
  12. package/lib/cjs/version.js +1 -1
  13. package/lib/esm/cli/utils.js +2 -0
  14. package/lib/esm/common/ant-versions.js +3 -2
  15. package/lib/esm/common/contracts/ao-process.js +3 -1
  16. package/lib/esm/common/index.js +0 -2
  17. package/lib/esm/common/io.js +17 -9
  18. package/lib/esm/common/turbo.js +1 -1
  19. package/lib/esm/types/index.js +0 -1
  20. package/lib/esm/utils/ao.js +8 -3
  21. package/lib/esm/utils/processes.js +3 -1
  22. package/lib/esm/version.js +1 -1
  23. package/lib/types/common/ant-versions.d.ts +3 -5
  24. package/lib/types/common/index.d.ts +0 -1
  25. package/lib/types/types/index.d.ts +0 -1
  26. package/lib/types/version.d.ts +1 -1
  27. package/package.json +2 -2
  28. package/lib/cjs/common/wayfinder/gateways/network.js +0 -48
  29. package/lib/cjs/common/wayfinder/gateways/simple-cache.js +0 -35
  30. package/lib/cjs/common/wayfinder/gateways/static.js +0 -13
  31. package/lib/cjs/common/wayfinder/index.js +0 -47
  32. package/lib/cjs/common/wayfinder/routing/strategies/ping.js +0 -72
  33. package/lib/cjs/common/wayfinder/routing/strategies/ping.test.js +0 -156
  34. package/lib/cjs/common/wayfinder/routing/strategies/random.js +0 -13
  35. package/lib/cjs/common/wayfinder/routing/strategies/random.test.js +0 -68
  36. package/lib/cjs/common/wayfinder/routing/strategies/round-robin.js +0 -42
  37. package/lib/cjs/common/wayfinder/routing/strategies/round-robin.test.js +0 -78
  38. package/lib/cjs/common/wayfinder/routing/strategies/static.js +0 -29
  39. package/lib/cjs/common/wayfinder/routing/strategies/static.test.js +0 -40
  40. package/lib/cjs/common/wayfinder/verification/strategies/data-root-verifier.js +0 -139
  41. package/lib/cjs/common/wayfinder/verification/strategies/hash-verifier.js +0 -50
  42. package/lib/cjs/common/wayfinder/verification/trusted.js +0 -106
  43. package/lib/cjs/common/wayfinder/wayfinder.js +0 -736
  44. package/lib/cjs/common/wayfinder/wayfinder.test.js +0 -519
  45. package/lib/cjs/types/wayfinder.js +0 -3
  46. package/lib/esm/common/wayfinder/gateways/network.js +0 -44
  47. package/lib/esm/common/wayfinder/gateways/simple-cache.js +0 -31
  48. package/lib/esm/common/wayfinder/gateways/static.js +0 -9
  49. package/lib/esm/common/wayfinder/index.js +0 -31
  50. package/lib/esm/common/wayfinder/routing/strategies/ping.js +0 -68
  51. package/lib/esm/common/wayfinder/routing/strategies/ping.test.js +0 -151
  52. package/lib/esm/common/wayfinder/routing/strategies/random.js +0 -9
  53. package/lib/esm/common/wayfinder/routing/strategies/random.test.js +0 -63
  54. package/lib/esm/common/wayfinder/routing/strategies/round-robin.js +0 -38
  55. package/lib/esm/common/wayfinder/routing/strategies/round-robin.test.js +0 -73
  56. package/lib/esm/common/wayfinder/routing/strategies/static.js +0 -25
  57. package/lib/esm/common/wayfinder/routing/strategies/static.test.js +0 -35
  58. package/lib/esm/common/wayfinder/verification/strategies/data-root-verifier.js +0 -130
  59. package/lib/esm/common/wayfinder/verification/strategies/hash-verifier.js +0 -46
  60. package/lib/esm/common/wayfinder/verification/trusted.js +0 -102
  61. package/lib/esm/common/wayfinder/wayfinder.js +0 -724
  62. package/lib/esm/common/wayfinder/wayfinder.test.js +0 -514
  63. package/lib/esm/types/wayfinder.js +0 -2
  64. package/lib/types/common/wayfinder/gateways/network.d.ts +0 -33
  65. package/lib/types/common/wayfinder/gateways/simple-cache.d.ts +0 -31
  66. package/lib/types/common/wayfinder/gateways/static.d.ts +0 -23
  67. package/lib/types/common/wayfinder/index.d.ts +0 -26
  68. package/lib/types/common/wayfinder/routing/strategies/ping.d.ts +0 -27
  69. package/lib/types/common/wayfinder/routing/strategies/ping.test.d.ts +0 -1
  70. package/lib/types/common/wayfinder/routing/strategies/random.d.ts +0 -21
  71. package/lib/types/common/wayfinder/routing/strategies/random.test.d.ts +0 -1
  72. package/lib/types/common/wayfinder/routing/strategies/round-robin.d.ts +0 -29
  73. package/lib/types/common/wayfinder/routing/strategies/round-robin.test.d.ts +0 -1
  74. package/lib/types/common/wayfinder/routing/strategies/static.d.ts +0 -29
  75. package/lib/types/common/wayfinder/routing/strategies/static.test.d.ts +0 -1
  76. package/lib/types/common/wayfinder/verification/strategies/data-root-verifier.d.ts +0 -31
  77. package/lib/types/common/wayfinder/verification/strategies/hash-verifier.d.ts +0 -27
  78. package/lib/types/common/wayfinder/verification/trusted.d.ts +0 -51
  79. package/lib/types/common/wayfinder/wayfinder.d.ts +0 -299
  80. package/lib/types/common/wayfinder/wayfinder.test.d.ts +0 -1
  81. package/lib/types/types/wayfinder.d.ts +0 -66
@@ -158,6 +158,7 @@ function aoProcessFromOptions(options) {
158
158
  return new index_js_1.AOProcess({
159
159
  processId: arioProcessIdFromOptions(options),
160
160
  ao: (0, aoconnect_1.connect)({
161
+ MODE: 'legacy',
161
162
  CU_URL: options.cuUrl,
162
163
  }),
163
164
  });
@@ -400,6 +401,7 @@ function ANTProcessFromOptions(options) {
400
401
  return new index_js_1.AOProcess({
401
402
  processId: requiredProcessIdFromOptions(options),
402
403
  ao: (0, aoconnect_1.connect)({
404
+ MODE: 'legacy',
403
405
  CU_URL: options.cuUrl,
404
406
  }),
405
407
  });
@@ -75,7 +75,8 @@ class ANTVersionsWritable extends ANTVersionsReadable {
75
75
  super(config);
76
76
  this.signer = (0, ao_js_1.createAoSigner)(signer);
77
77
  }
78
- async addVersion({ version, moduleId, luaSourceId, notes, }, { tags }) {
78
+ async addVersion(params, options) {
79
+ const { version, moduleId, luaSourceId, notes } = params;
79
80
  return this.process.send({
80
81
  tags: (0, arweave_js_1.pruneTags)([
81
82
  { name: 'Action', value: 'Add-Version' },
@@ -83,7 +84,7 @@ class ANTVersionsWritable extends ANTVersionsReadable {
83
84
  { name: 'Module-Id', value: moduleId },
84
85
  { name: 'Lua-Source-Id', value: luaSourceId },
85
86
  { name: 'Notes', value: notes },
86
- ...(tags ?? []),
87
+ ...(options?.tags ?? []),
87
88
  ]),
88
89
  signer: this.signer,
89
90
  });
@@ -27,7 +27,9 @@ class AOProcess {
27
27
  logger;
28
28
  ao;
29
29
  processId;
30
- constructor({ processId, ao = (0, aoconnect_1.connect)(), logger = logger_js_1.Logger.default, }) {
30
+ constructor({ processId, ao = (0, aoconnect_1.connect)({
31
+ MODE: 'legacy',
32
+ }), logger = logger_js_1.Logger.default, }) {
31
33
  this.processId = processId;
32
34
  this.logger = logger;
33
35
  this.ao = ao;
@@ -38,5 +38,3 @@ __exportStar(require("./faucet.js"), exports);
38
38
  // ao
39
39
  __exportStar(require("./io.js"), exports);
40
40
  __exportStar(require("./contracts/ao-process.js"), exports);
41
- // wayfinder
42
- __exportStar(require("./wayfinder/index.js"), exports);
@@ -42,6 +42,7 @@ class ARIO {
42
42
  process: new ao_process_js_1.AOProcess({
43
43
  processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
44
44
  ao: (0, aoconnect_1.connect)({
45
+ MODE: 'legacy',
45
46
  CU_URL: 'https://cu.ardrive.io',
46
47
  ...config?.process?.ao,
47
48
  }),
@@ -54,6 +55,7 @@ class ARIO {
54
55
  processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
55
56
  ao: (0, aoconnect_1.connect)({
56
57
  CU_URL: 'https://cu.ardrive.io',
58
+ MODE: 'legacy',
57
59
  ...config?.process?.ao,
58
60
  }),
59
61
  }),
@@ -67,6 +69,7 @@ class ARIO {
67
69
  process: new ao_process_js_1.AOProcess({
68
70
  processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
69
71
  ao: (0, aoconnect_1.connect)({
72
+ MODE: 'legacy',
70
73
  CU_URL: 'https://cu.ardrive.io',
71
74
  ...config?.process?.ao,
72
75
  }),
@@ -81,6 +84,7 @@ class ARIO {
81
84
  process: new ao_process_js_1.AOProcess({
82
85
  processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
83
86
  ao: (0, aoconnect_1.connect)({
87
+ MODE: 'legacy',
84
88
  CU_URL: 'https://cu.ardrive.io',
85
89
  ...config?.process?.ao,
86
90
  }),
@@ -457,7 +461,7 @@ class ARIOReadable {
457
461
  years,
458
462
  });
459
463
  return {
460
- tokenCost: +mARIO,
464
+ tokenCost: mARIO.valueOf(),
461
465
  wincQty: winc,
462
466
  discounts: [],
463
467
  };
@@ -626,12 +630,15 @@ class ARIOReadable {
626
630
  });
627
631
  }
628
632
  async resolveArNSName({ name, }) {
629
- const baseName = name.split('_').pop();
630
- if (baseName === undefined) {
631
- throw new Error('Invalid name');
632
- }
633
- const undername = name === baseName ? '@' : name.replace(`_${baseName}`, '');
633
+ // derive baseName & undername using last underscore
634
+ const lastUnderscore = name.lastIndexOf('_');
635
+ const baseName = lastUnderscore === -1 ? name : name.slice(lastUnderscore + 1);
636
+ const undername = lastUnderscore === -1 ? '@' : name.slice(0, lastUnderscore);
637
+ // guard against missing or unregistered ARNS record
634
638
  const nameData = await this.getArNSRecord({ name: baseName });
639
+ if (nameData === undefined || nameData.processId === undefined) {
640
+ throw new Error(`Base ArNS name ${baseName} not found on ARIO contract (${this.process.processId}).`);
641
+ }
635
642
  const ant = ant_js_1.ANT.init({
636
643
  process: new ao_process_js_1.AOProcess({
637
644
  ao: this.process.ao,
@@ -650,12 +657,13 @@ class ARIOReadable {
650
657
  throw new Error(`Invalid record on ANT. Must have ttlSeconds and transactionId. Record: ${JSON.stringify(antRecord)}`);
651
658
  }
652
659
  return {
653
- name: name,
654
- owner: owner,
660
+ name,
661
+ owner,
655
662
  txId: antRecord.transactionId,
656
663
  ttlSeconds: antRecord.ttlSeconds,
657
664
  priority: antRecord.priority,
658
- // NOTE: we may want return the actual index of the record based on sorting in case ANT tries to set duplicate priority values to get around undername limits
665
+ // NOTE: we may want return the actual index of the record based on sorting
666
+ // in case ANT tries to set duplicate priority values to get around undername limits
659
667
  processId: nameData.processId,
660
668
  undernameLimit: nameData.undernameLimit,
661
669
  type: nameData.type,
@@ -77,7 +77,7 @@ async function signedRequestHeadersFromSigner({ signer, nonce = (0, uuid_1.v4)()
77
77
  'x-public-key': publicKey,
78
78
  'x-nonce': nonce,
79
79
  'x-signature': signature,
80
- 'x-signature-type': signatureType,
80
+ 'x-signature-type': signatureType.toString(),
81
81
  };
82
82
  }
83
83
  class TurboArNSPaymentFactory {
@@ -35,4 +35,3 @@ __exportStar(require("./common.js"), exports);
35
35
  __exportStar(require("./faucet.js"), exports);
36
36
  __exportStar(require("./io.js"), exports);
37
37
  __exportStar(require("./token.js"), exports);
38
- __exportStar(require("./wayfinder.js"), exports);
@@ -32,7 +32,9 @@ const index_js_1 = require("../common/index.js");
32
32
  const constants_js_1 = require("../constants.js");
33
33
  const ant_js_1 = require("../types/ant.js");
34
34
  const schema_js_1 = require("./schema.js");
35
- async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)(), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, antRegistryId = constants_js_1.ANT_REGISTRY_ID, logger = index_js_1.Logger.default, authority = constants_js_1.AO_AUTHORITY, }) {
35
+ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)({
36
+ MODE: 'legacy',
37
+ }), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, antRegistryId = constants_js_1.ANT_REGISTRY_ID, logger = index_js_1.Logger.default, authority = constants_js_1.AO_AUTHORITY, }) {
36
38
  // TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
37
39
  if (state) {
38
40
  (0, schema_js_1.parseSchemaResult)(ant_js_1.SpawnANTStateSchema, state);
@@ -77,8 +79,9 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0
77
79
  }
78
80
  }
79
81
  if (bootRes === undefined ||
80
- bootRes.Messages.find((m) => m.Tags.find((t) => t.value === 'Invalid-Boot-Notice'))) {
82
+ bootRes.Messages?.some((m) => m?.Tags?.some((t) => t.value === 'Invalid-Boot-Notice'))) {
81
83
  if (bootRes === undefined) {
84
+ // …
82
85
  throw new Error('Failed to get boot result');
83
86
  }
84
87
  const bootError = errorMessageFromOutput(bootRes);
@@ -98,7 +101,9 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0
98
101
  });
99
102
  return processId;
100
103
  }
101
- async function evolveANT({ signer, processId, luaCodeTxId = constants_js_1.ANT_LUA_ID, ao = (0, aoconnect_1.connect)(), logger = index_js_1.Logger.default, arweave = arweave_js_1.defaultArweave, }) {
104
+ async function evolveANT({ signer, processId, luaCodeTxId = constants_js_1.ANT_LUA_ID, ao = (0, aoconnect_1.connect)({
105
+ MODE: 'legacy',
106
+ }), logger = index_js_1.Logger.default, arweave = arweave_js_1.defaultArweave, }) {
102
107
  const aosClient = new index_js_1.AOProcess({
103
108
  processId,
104
109
  ao,
@@ -58,7 +58,9 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
58
58
  antAoClient;
59
59
  constructor({ contract = io_js_1.ARIO.init({
60
60
  processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
61
- }), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)(), } = {}) {
61
+ }), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)({
62
+ MODE: 'legacy',
63
+ }), } = {}) {
62
64
  super();
63
65
  this.contract = contract;
64
66
  this.timeoutMs = timeoutMs;
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.11.0-beta.1';
20
+ exports.version = '3.11.1-alpha.1';
@@ -110,6 +110,7 @@ function aoProcessFromOptions(options) {
110
110
  return new AOProcess({
111
111
  processId: arioProcessIdFromOptions(options),
112
112
  ao: connect({
113
+ MODE: 'legacy',
113
114
  CU_URL: options.cuUrl,
114
115
  }),
115
116
  });
@@ -352,6 +353,7 @@ function ANTProcessFromOptions(options) {
352
353
  return new AOProcess({
353
354
  processId: requiredProcessIdFromOptions(options),
354
355
  ao: connect({
356
+ MODE: 'legacy',
355
357
  CU_URL: options.cuUrl,
356
358
  }),
357
359
  });
@@ -70,7 +70,8 @@ export class ANTVersionsWritable extends ANTVersionsReadable {
70
70
  super(config);
71
71
  this.signer = createAoSigner(signer);
72
72
  }
73
- async addVersion({ version, moduleId, luaSourceId, notes, }, { tags }) {
73
+ async addVersion(params, options) {
74
+ const { version, moduleId, luaSourceId, notes } = params;
74
75
  return this.process.send({
75
76
  tags: pruneTags([
76
77
  { name: 'Action', value: 'Add-Version' },
@@ -78,7 +79,7 @@ export class ANTVersionsWritable extends ANTVersionsReadable {
78
79
  { name: 'Module-Id', value: moduleId },
79
80
  { name: 'Lua-Source-Id', value: luaSourceId },
80
81
  { name: 'Notes', value: notes },
81
- ...(tags ?? []),
82
+ ...(options?.tags ?? []),
82
83
  ]),
83
84
  signer: this.signer,
84
85
  });
@@ -24,7 +24,9 @@ export class AOProcess {
24
24
  logger;
25
25
  ao;
26
26
  processId;
27
- constructor({ processId, ao = connect(), logger = Logger.default, }) {
27
+ constructor({ processId, ao = connect({
28
+ MODE: 'legacy',
29
+ }), logger = Logger.default, }) {
28
30
  this.processId = processId;
29
31
  this.logger = logger;
30
32
  this.ao = ao;
@@ -22,5 +22,3 @@ export * from './faucet.js';
22
22
  // ao
23
23
  export * from './io.js';
24
24
  export * from './contracts/ao-process.js';
25
- // wayfinder
26
- export * from './wayfinder/index.js';
@@ -39,6 +39,7 @@ export class ARIO {
39
39
  process: new AOProcess({
40
40
  processId: ARIO_MAINNET_PROCESS_ID,
41
41
  ao: connect({
42
+ MODE: 'legacy',
42
43
  CU_URL: 'https://cu.ardrive.io',
43
44
  ...config?.process?.ao,
44
45
  }),
@@ -51,6 +52,7 @@ export class ARIO {
51
52
  processId: ARIO_MAINNET_PROCESS_ID,
52
53
  ao: connect({
53
54
  CU_URL: 'https://cu.ardrive.io',
55
+ MODE: 'legacy',
54
56
  ...config?.process?.ao,
55
57
  }),
56
58
  }),
@@ -64,6 +66,7 @@ export class ARIO {
64
66
  process: new AOProcess({
65
67
  processId: ARIO_TESTNET_PROCESS_ID,
66
68
  ao: connect({
69
+ MODE: 'legacy',
67
70
  CU_URL: 'https://cu.ardrive.io',
68
71
  ...config?.process?.ao,
69
72
  }),
@@ -78,6 +81,7 @@ export class ARIO {
78
81
  process: new AOProcess({
79
82
  processId: ARIO_TESTNET_PROCESS_ID,
80
83
  ao: connect({
84
+ MODE: 'legacy',
81
85
  CU_URL: 'https://cu.ardrive.io',
82
86
  ...config?.process?.ao,
83
87
  }),
@@ -453,7 +457,7 @@ export class ARIOReadable {
453
457
  years,
454
458
  });
455
459
  return {
456
- tokenCost: +mARIO,
460
+ tokenCost: mARIO.valueOf(),
457
461
  wincQty: winc,
458
462
  discounts: [],
459
463
  };
@@ -622,12 +626,15 @@ export class ARIOReadable {
622
626
  });
623
627
  }
624
628
  async resolveArNSName({ name, }) {
625
- const baseName = name.split('_').pop();
626
- if (baseName === undefined) {
627
- throw new Error('Invalid name');
628
- }
629
- const undername = name === baseName ? '@' : name.replace(`_${baseName}`, '');
629
+ // derive baseName & undername using last underscore
630
+ const lastUnderscore = name.lastIndexOf('_');
631
+ const baseName = lastUnderscore === -1 ? name : name.slice(lastUnderscore + 1);
632
+ const undername = lastUnderscore === -1 ? '@' : name.slice(0, lastUnderscore);
633
+ // guard against missing or unregistered ARNS record
630
634
  const nameData = await this.getArNSRecord({ name: baseName });
635
+ if (nameData === undefined || nameData.processId === undefined) {
636
+ throw new Error(`Base ArNS name ${baseName} not found on ARIO contract (${this.process.processId}).`);
637
+ }
631
638
  const ant = ANT.init({
632
639
  process: new AOProcess({
633
640
  ao: this.process.ao,
@@ -646,12 +653,13 @@ export class ARIOReadable {
646
653
  throw new Error(`Invalid record on ANT. Must have ttlSeconds and transactionId. Record: ${JSON.stringify(antRecord)}`);
647
654
  }
648
655
  return {
649
- name: name,
650
- owner: owner,
656
+ name,
657
+ owner,
651
658
  txId: antRecord.transactionId,
652
659
  ttlSeconds: antRecord.ttlSeconds,
653
660
  priority: antRecord.priority,
654
- // NOTE: we may want return the actual index of the record based on sorting in case ANT tries to set duplicate priority values to get around undername limits
661
+ // NOTE: we may want return the actual index of the record based on sorting
662
+ // in case ANT tries to set duplicate priority values to get around undername limits
655
663
  processId: nameData.processId,
656
664
  undernameLimit: nameData.undernameLimit,
657
665
  type: nameData.type,
@@ -72,7 +72,7 @@ export async function signedRequestHeadersFromSigner({ signer, nonce = uuidv4(),
72
72
  'x-public-key': publicKey,
73
73
  'x-nonce': nonce,
74
74
  'x-signature': signature,
75
- 'x-signature-type': signatureType,
75
+ 'x-signature-type': signatureType.toString(),
76
76
  };
77
77
  }
78
78
  export class TurboArNSPaymentFactory {
@@ -19,4 +19,3 @@ export * from './common.js';
19
19
  export * from './faucet.js';
20
20
  export * from './io.js';
21
21
  export * from './token.js';
22
- export * from './wayfinder.js';
@@ -21,7 +21,9 @@ import { AOProcess, Logger } from '../common/index.js';
21
21
  import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, AO_AUTHORITY, DEFAULT_SCHEDULER_ID, } from '../constants.js';
22
22
  import { SpawnANTStateSchema } from '../types/ant.js';
23
23
  import { parseSchemaResult } from './schema.js';
24
- export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, }) {
24
+ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect({
25
+ MODE: 'legacy',
26
+ }), scheduler = DEFAULT_SCHEDULER_ID, state, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, }) {
25
27
  // TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
26
28
  if (state) {
27
29
  parseSchemaResult(SpawnANTStateSchema, state);
@@ -66,8 +68,9 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(),
66
68
  }
67
69
  }
68
70
  if (bootRes === undefined ||
69
- bootRes.Messages.find((m) => m.Tags.find((t) => t.value === 'Invalid-Boot-Notice'))) {
71
+ bootRes.Messages?.some((m) => m?.Tags?.some((t) => t.value === 'Invalid-Boot-Notice'))) {
70
72
  if (bootRes === undefined) {
73
+ // …
71
74
  throw new Error('Failed to get boot result');
72
75
  }
73
76
  const bootError = errorMessageFromOutput(bootRes);
@@ -87,7 +90,9 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(),
87
90
  });
88
91
  return processId;
89
92
  }
90
- export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect(), logger = Logger.default, arweave = defaultArweave, }) {
93
+ export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect({
94
+ MODE: 'legacy',
95
+ }), logger = Logger.default, arweave = defaultArweave, }) {
91
96
  const aosClient = new AOProcess({
92
97
  processId,
93
98
  ao,
@@ -54,7 +54,9 @@ export class ArNSEventEmitter extends EventEmitter {
54
54
  antAoClient;
55
55
  constructor({ contract = ARIO.init({
56
56
  processId: ARIO_MAINNET_PROCESS_ID,
57
- }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect(), } = {}) {
57
+ }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect({
58
+ MODE: 'legacy',
59
+ }), } = {}) {
58
60
  super();
59
61
  this.contract = contract;
60
62
  this.timeoutMs = timeoutMs;
@@ -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.11.0-beta.1';
17
+ export const version = '3.11.1-alpha.1';
@@ -1,5 +1,5 @@
1
1
  import { AoANTVersionsRead, AoANTVersionsWrite } from '../types/ant.js';
2
- import { AoMessageResult, WithSigner } from '../types/common.js';
2
+ import { AoMessageResult, WithSigner, WriteOptions } from '../types/common.js';
3
3
  import { ProcessConfiguration } from '../types/io.js';
4
4
  import { AOProcess } from './contracts/ao-process.js';
5
5
  type ANTVersionsNoSigner = ProcessConfiguration;
@@ -27,13 +27,11 @@ export declare class ANTVersionsReadable implements AoANTVersionsRead {
27
27
  export declare class ANTVersionsWritable extends ANTVersionsReadable implements AoANTVersionsWrite {
28
28
  private signer;
29
29
  constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
30
- addVersion({ version, moduleId, luaSourceId, notes, }: {
30
+ addVersion(params: {
31
31
  version: string;
32
32
  moduleId: string;
33
33
  luaSourceId?: string;
34
34
  notes?: string;
35
- }, { tags }: {
36
- tags: any;
37
- }): Promise<AoMessageResult>;
35
+ }, options?: WriteOptions): Promise<AoMessageResult>;
38
36
  }
39
37
  export {};
@@ -21,4 +21,3 @@ export * from './ant-versions.js';
21
21
  export * from './faucet.js';
22
22
  export * from './io.js';
23
23
  export * from './contracts/ao-process.js';
24
- export * from './wayfinder/index.js';
@@ -19,4 +19,3 @@ export * from './common.js';
19
19
  export * from './faucet.js';
20
20
  export * from './io.js';
21
21
  export * from './token.js';
22
- export * from './wayfinder.js';
@@ -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.11.0-alpha.12";
16
+ export declare const version = "3.11.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.11.0-beta.1",
3
+ "version": "3.11.1-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -127,7 +127,7 @@
127
127
  },
128
128
  "dependencies": {
129
129
  "@dha-team/arbundles": "^1.0.1",
130
- "@permaweb/aoconnect": "^0.0.57",
130
+ "@permaweb/aoconnect": "^0.0.85",
131
131
  "arweave": "1.15.5",
132
132
  "axios": "1.8.4",
133
133
  "axios-retry": "^4.3.0",
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkGatewaysProvider = void 0;
4
- const io_js_1 = require("../../io.js");
5
- class NetworkGatewaysProvider {
6
- ario;
7
- sortBy;
8
- sortOrder;
9
- limit;
10
- filter;
11
- constructor({ ario = io_js_1.ARIO.mainnet(), sortBy = 'operatorStake', sortOrder = 'desc', limit = 1000, filter = (g) => g.status === 'joined', }) {
12
- this.ario = ario;
13
- this.sortBy = sortBy;
14
- this.sortOrder = sortOrder;
15
- this.limit = limit;
16
- this.filter = filter;
17
- }
18
- async getGateways() {
19
- let cursor;
20
- let attempts = 0;
21
- const gateways = [];
22
- do {
23
- try {
24
- const { items: newGateways = [], nextCursor } = await this.ario.getGateways({
25
- limit: 1000,
26
- cursor,
27
- sortBy: this.sortBy,
28
- sortOrder: this.sortOrder,
29
- });
30
- gateways.push(...newGateways);
31
- cursor = nextCursor;
32
- attempts = 0; // reset attempts if we get a new cursor
33
- }
34
- catch (error) {
35
- console.error('Error fetching gateways', {
36
- cursor,
37
- attempts,
38
- error,
39
- });
40
- attempts++;
41
- }
42
- } while (cursor !== undefined && attempts < 3);
43
- // filter out any gateways that are not joined
44
- const filteredGateways = gateways.filter(this.filter).slice(0, this.limit);
45
- return filteredGateways.map((g) => new URL(`${g.settings.protocol}://${g.settings.fqdn}:${g.settings.port}`));
46
- }
47
- }
48
- exports.NetworkGatewaysProvider = NetworkGatewaysProvider;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimpleCacheGatewaysProvider = void 0;
4
- const index_js_1 = require("../../../web/index.js");
5
- class SimpleCacheGatewaysProvider {
6
- gatewaysProvider;
7
- ttlSeconds;
8
- lastUpdated;
9
- gatewaysCache;
10
- logger;
11
- constructor({ gatewaysProvider, ttlSeconds = 60 * 60, // 1 hour
12
- logger = index_js_1.Logger.default, }) {
13
- this.gatewaysCache = [];
14
- this.gatewaysProvider = gatewaysProvider;
15
- this.ttlSeconds = ttlSeconds;
16
- this.logger = logger;
17
- }
18
- async getGateways() {
19
- const now = Date.now();
20
- if (this.gatewaysCache.length === 0 ||
21
- now - this.lastUpdated > this.ttlSeconds * 1000) {
22
- try {
23
- // preserve the cache if the fetch fails
24
- const allGateways = await this.gatewaysProvider.getGateways();
25
- this.gatewaysCache = allGateways;
26
- this.lastUpdated = now;
27
- }
28
- catch (error) {
29
- this.logger.error('Error fetching gateways', error);
30
- }
31
- }
32
- return this.gatewaysCache;
33
- }
34
- }
35
- exports.SimpleCacheGatewaysProvider = SimpleCacheGatewaysProvider;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StaticGatewaysProvider = void 0;
4
- class StaticGatewaysProvider {
5
- gateways;
6
- constructor({ gateways }) {
7
- this.gateways = gateways.map((g) => new URL(g));
8
- }
9
- async getGateways() {
10
- return this.gateways;
11
- }
12
- }
13
- exports.StaticGatewaysProvider = StaticGatewaysProvider;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
19
- *
20
- * Licensed under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License.
22
- * You may obtain a copy of the License at
23
- *
24
- * http://www.apache.org/licenses/LICENSE-2.0
25
- *
26
- * Unless required by applicable law or agreed to in writing, software
27
- * distributed under the License is distributed on an "AS IS" BASIS,
28
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
- * See the License for the specific language governing permissions and
30
- * limitations under the License.
31
- */
32
- __exportStar(require("./wayfinder.js"), exports);
33
- // routing strategies
34
- __exportStar(require("./routing/strategies/random.js"), exports);
35
- __exportStar(require("./routing/strategies/static.js"), exports);
36
- __exportStar(require("./routing/strategies/ping.js"), exports);
37
- __exportStar(require("./routing/strategies/round-robin.js"), exports);
38
- // gateways providers
39
- __exportStar(require("./gateways/network.js"), exports);
40
- __exportStar(require("./gateways/simple-cache.js"), exports);
41
- __exportStar(require("./gateways/static.js"), exports);
42
- // trusted gateways
43
- __exportStar(require("./verification/trusted.js"), exports);
44
- // hash providers
45
- __exportStar(require("./verification/strategies/data-root-verifier.js"), exports);
46
- __exportStar(require("./verification/strategies/hash-verifier.js"), exports);
47
- // TODO: signature verification