@ar.io/sdk 3.10.0-alpha.6 → 3.10.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 (104) hide show
  1. package/README.md +66 -125
  2. package/bundles/web.bundle.min.js +147 -126
  3. package/lib/cjs/cli/commands/antCommands.js +3 -4
  4. package/lib/cjs/cli/commands/arnsPurchaseCommands.js +5 -6
  5. package/lib/cjs/cli/commands/gatewayWriteCommands.js +11 -12
  6. package/lib/cjs/cli/commands/readCommands.js +21 -22
  7. package/lib/cjs/cli/commands/transfer.js +6 -7
  8. package/lib/cjs/cli/options.js +0 -12
  9. package/lib/cjs/cli/utils.js +52 -74
  10. package/lib/cjs/common/ant-versions.js +5 -5
  11. package/lib/cjs/common/faucet.js +2 -2
  12. package/lib/cjs/common/index.js +0 -2
  13. package/lib/cjs/common/io.js +5 -64
  14. package/lib/cjs/types/ant.js +2 -13
  15. package/lib/cjs/types/index.js +0 -1
  16. package/lib/cjs/types/io.js +5 -5
  17. package/lib/cjs/utils/ao.js +9 -14
  18. package/lib/cjs/utils/arweave.js +4 -4
  19. package/lib/cjs/utils/base64.js +4 -5
  20. package/lib/cjs/utils/json.js +1 -2
  21. package/lib/cjs/utils/schema.js +1 -2
  22. package/lib/cjs/version.js +1 -1
  23. package/lib/cjs/web/index.js +1 -3
  24. package/lib/esm/cli/options.js +0 -12
  25. package/lib/esm/cli/utils.js +10 -31
  26. package/lib/esm/common/ant-versions.js +5 -5
  27. package/lib/esm/common/index.js +0 -2
  28. package/lib/esm/common/io.js +5 -64
  29. package/lib/esm/types/ant.js +0 -11
  30. package/lib/esm/types/index.js +0 -1
  31. package/lib/esm/types/io.js +1 -1
  32. package/lib/esm/utils/ao.js +0 -5
  33. package/lib/esm/version.js +1 -1
  34. package/lib/esm/web/index.js +1 -1
  35. package/lib/types/cli/commands/antCommands.d.ts +3 -3
  36. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +1 -1
  37. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +9 -9
  38. package/lib/types/cli/commands/readCommands.d.ts +3 -4
  39. package/lib/types/cli/commands/transfer.d.ts +3 -3
  40. package/lib/types/cli/options.d.ts +0 -9
  41. package/lib/types/cli/types.d.ts +0 -3
  42. package/lib/types/cli/utils.d.ts +0 -4
  43. package/lib/types/common/ant-versions.d.ts +6 -3
  44. package/lib/types/common/http.d.ts +0 -1
  45. package/lib/types/common/index.d.ts +0 -1
  46. package/lib/types/common/io.d.ts +9 -15
  47. package/lib/types/types/ant.d.ts +1 -53
  48. package/lib/types/types/common.d.ts +2 -8
  49. package/lib/types/types/index.d.ts +0 -1
  50. package/lib/types/types/io.d.ts +7 -9
  51. package/lib/types/types/token.d.ts +0 -2
  52. package/lib/types/utils/ao.d.ts +12 -1
  53. package/lib/types/utils/base64.d.ts +0 -2
  54. package/lib/types/version.d.ts +1 -1
  55. package/lib/types/web/index.d.ts +1 -1
  56. package/package.json +3 -5
  57. package/lib/cjs/common/turbo.js +0 -208
  58. package/lib/cjs/common/wayfinder/gateways.js +0 -75
  59. package/lib/cjs/common/wayfinder/index.js +0 -36
  60. package/lib/cjs/common/wayfinder/routers/fixed.js +0 -14
  61. package/lib/cjs/common/wayfinder/routers/fixed.test.js +0 -14
  62. package/lib/cjs/common/wayfinder/routers/priority.js +0 -38
  63. package/lib/cjs/common/wayfinder/routers/priority.test.js +0 -155
  64. package/lib/cjs/common/wayfinder/routers/random.js +0 -23
  65. package/lib/cjs/common/wayfinder/routers/random.test.js +0 -104
  66. package/lib/cjs/common/wayfinder/routers/simple-cache.js +0 -25
  67. package/lib/cjs/common/wayfinder/routers/simple-cache.test.js +0 -41
  68. package/lib/cjs/common/wayfinder/wayfinder.js +0 -194
  69. package/lib/cjs/common/wayfinder/wayfinder.test.js +0 -254
  70. package/lib/cjs/types/wayfinder.js +0 -2
  71. package/lib/cjs/utils/url.js +0 -28
  72. package/lib/cjs/utils/url.test.js +0 -24
  73. package/lib/esm/common/turbo.js +0 -200
  74. package/lib/esm/common/wayfinder/gateways.js +0 -69
  75. package/lib/esm/common/wayfinder/index.js +0 -20
  76. package/lib/esm/common/wayfinder/routers/fixed.js +0 -10
  77. package/lib/esm/common/wayfinder/routers/fixed.test.js +0 -12
  78. package/lib/esm/common/wayfinder/routers/priority.js +0 -34
  79. package/lib/esm/common/wayfinder/routers/priority.test.js +0 -153
  80. package/lib/esm/common/wayfinder/routers/random.js +0 -19
  81. package/lib/esm/common/wayfinder/routers/random.test.js +0 -102
  82. package/lib/esm/common/wayfinder/routers/simple-cache.js +0 -21
  83. package/lib/esm/common/wayfinder/routers/simple-cache.test.js +0 -39
  84. package/lib/esm/common/wayfinder/wayfinder.js +0 -187
  85. package/lib/esm/common/wayfinder/wayfinder.test.js +0 -249
  86. package/lib/esm/types/wayfinder.js +0 -1
  87. package/lib/esm/utils/url.js +0 -24
  88. package/lib/esm/utils/url.test.js +0 -19
  89. package/lib/types/common/turbo.d.ts +0 -62
  90. package/lib/types/common/wayfinder/gateways.d.ts +0 -44
  91. package/lib/types/common/wayfinder/index.d.ts +0 -19
  92. package/lib/types/common/wayfinder/routers/fixed.d.ts +0 -25
  93. package/lib/types/common/wayfinder/routers/fixed.test.d.ts +0 -1
  94. package/lib/types/common/wayfinder/routers/priority.d.ts +0 -34
  95. package/lib/types/common/wayfinder/routers/priority.test.d.ts +0 -1
  96. package/lib/types/common/wayfinder/routers/random.d.ts +0 -28
  97. package/lib/types/common/wayfinder/routers/random.test.d.ts +0 -1
  98. package/lib/types/common/wayfinder/routers/simple-cache.d.ts +0 -29
  99. package/lib/types/common/wayfinder/routers/simple-cache.test.d.ts +0 -1
  100. package/lib/types/common/wayfinder/wayfinder.d.ts +0 -106
  101. package/lib/types/common/wayfinder/wayfinder.test.d.ts +0 -1
  102. package/lib/types/types/wayfinder.d.ts +0 -20
  103. package/lib/types/utils/url.d.ts +0 -19
  104. package/lib/types/utils/url.test.d.ts +0 -1
@@ -3,7 +3,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertLockLengthInRange = exports.fundFromFromOptions = exports.getTokenCostParamsFromOptions = exports.getANTStateFromOptions = exports.requiredPositiveIntegerFromOptions = exports.positiveIntegerFromOptions = exports.requiredStringArrayFromOptions = exports.requiredStringFromOptions = exports.booleanFromOptions = exports.writeANTFromOptions = exports.readANTFromOptions = exports.requiredProcessIdFromOptions = exports.assertConfirmationPrompt = exports.confirmationPrompt = exports.assertEnoughMARIOBalance = exports.assertEnoughBalanceForArNSPurchase = exports.requiredMARIOFromOptions = exports.recordTypeFromOptions = exports.redelegateParamsFromOptions = exports.requiredTargetAndQuantityFromOptions = exports.gatewaySettingsFromOptions = exports.customTagsFromOptions = exports.requiredInitiatorFromOptions = exports.epochInputFromOptions = exports.paginationParamsFromOptions = exports.requiredAddressFromOptions = exports.addressFromOptions = exports.formatMARIOToARIOWithCommas = exports.formatARIOWithCommas = exports.writeARIOFromOptions = exports.requiredAoSignerFromOptions = exports.requiredContractSignerFromOptions = exports.contractSignerFromOptions = exports.readARIOFromOptions = exports.getLoggerFromOptions = exports.jwkToAddress = exports.requiredJwkFromOptions = exports.arioProcessIdFromOptions = exports.makeCommand = exports.applyOptions = exports.runCommand = exports.stringifyJsonForCLIDisplay = exports.defaultTtlSecondsCLI = void 0;
6
+ exports.defaultTtlSecondsCLI = void 0;
7
+ exports.stringifyJsonForCLIDisplay = stringifyJsonForCLIDisplay;
8
+ exports.runCommand = runCommand;
9
+ exports.applyOptions = applyOptions;
10
+ exports.makeCommand = makeCommand;
11
+ exports.arioProcessIdFromOptions = arioProcessIdFromOptions;
12
+ exports.requiredJwkFromOptions = requiredJwkFromOptions;
13
+ exports.jwkToAddress = jwkToAddress;
14
+ exports.getLoggerFromOptions = getLoggerFromOptions;
15
+ exports.readARIOFromOptions = readARIOFromOptions;
16
+ exports.requiredContractSignerFromOptions = requiredContractSignerFromOptions;
17
+ exports.requiredAoSignerFromOptions = requiredAoSignerFromOptions;
18
+ exports.writeARIOFromOptions = writeARIOFromOptions;
19
+ exports.formatARIOWithCommas = formatARIOWithCommas;
20
+ exports.formatMARIOToARIOWithCommas = formatMARIOToARIOWithCommas;
21
+ exports.addressFromOptions = addressFromOptions;
22
+ exports.requiredAddressFromOptions = requiredAddressFromOptions;
23
+ exports.paginationParamsFromOptions = paginationParamsFromOptions;
24
+ exports.epochInputFromOptions = epochInputFromOptions;
25
+ exports.requiredInitiatorFromOptions = requiredInitiatorFromOptions;
26
+ exports.customTagsFromOptions = customTagsFromOptions;
27
+ exports.gatewaySettingsFromOptions = gatewaySettingsFromOptions;
28
+ exports.requiredTargetAndQuantityFromOptions = requiredTargetAndQuantityFromOptions;
29
+ exports.redelegateParamsFromOptions = redelegateParamsFromOptions;
30
+ exports.recordTypeFromOptions = recordTypeFromOptions;
31
+ exports.requiredMARIOFromOptions = requiredMARIOFromOptions;
32
+ exports.assertEnoughBalanceForArNSPurchase = assertEnoughBalanceForArNSPurchase;
33
+ exports.assertEnoughMARIOBalance = assertEnoughMARIOBalance;
34
+ exports.confirmationPrompt = confirmationPrompt;
35
+ exports.assertConfirmationPrompt = assertConfirmationPrompt;
36
+ exports.requiredProcessIdFromOptions = requiredProcessIdFromOptions;
37
+ exports.readANTFromOptions = readANTFromOptions;
38
+ exports.writeANTFromOptions = writeANTFromOptions;
39
+ exports.booleanFromOptions = booleanFromOptions;
40
+ exports.requiredStringFromOptions = requiredStringFromOptions;
41
+ exports.requiredStringArrayFromOptions = requiredStringArrayFromOptions;
42
+ exports.positiveIntegerFromOptions = positiveIntegerFromOptions;
43
+ exports.requiredPositiveIntegerFromOptions = requiredPositiveIntegerFromOptions;
44
+ exports.getANTStateFromOptions = getANTStateFromOptions;
45
+ exports.getTokenCostParamsFromOptions = getTokenCostParamsFromOptions;
46
+ exports.fundFromFromOptions = fundFromFromOptions;
47
+ exports.assertLockLengthInRange = assertLockLengthInRange;
7
48
  /**
8
49
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
9
50
  *
@@ -19,7 +60,6 @@ exports.assertLockLengthInRange = exports.fundFromFromOptions = exports.getToken
19
60
  * See the License for the specific language governing permissions and
20
61
  * limitations under the License.
21
62
  */
22
- const arbundles_1 = require("@dha-team/arbundles");
23
63
  const aoconnect_1 = require("@permaweb/aoconnect");
24
64
  const commander_1 = require("commander");
25
65
  const fs_1 = require("fs");
@@ -30,7 +70,6 @@ exports.defaultTtlSecondsCLI = 3600;
30
70
  function stringifyJsonForCLIDisplay(json) {
31
71
  return JSON.stringify(json, null, 2);
32
72
  }
33
- exports.stringifyJsonForCLIDisplay = stringifyJsonForCLIDisplay;
34
73
  function logCommandOutput(output) {
35
74
  console.log(stringifyJsonForCLIDisplay(output));
36
75
  }
@@ -59,14 +98,12 @@ async function runCommand(command, action) {
59
98
  exitWithErrorLog(error, options.debug);
60
99
  }
61
100
  }
62
- exports.runCommand = runCommand;
63
101
  function applyOptions(command, options) {
64
102
  [...options].forEach((option) => {
65
103
  command.option(option.alias, option.description, option.default);
66
104
  });
67
105
  return command;
68
106
  }
69
- exports.applyOptions = applyOptions;
70
107
  function makeCommand({ description, name, options = [], action, }) {
71
108
  const command = commander_1.program.command(name).description(description);
72
109
  const appliedCommand = applyOptions(command, [...options, ...options_js_1.globalOptions]);
@@ -75,7 +112,6 @@ function makeCommand({ description, name, options = [], action, }) {
75
112
  }
76
113
  return appliedCommand;
77
114
  }
78
- exports.makeCommand = makeCommand;
79
115
  function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, }) {
80
116
  if (arioProcessId !== undefined) {
81
117
  return arioProcessId;
@@ -88,8 +124,7 @@ function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, }) {
88
124
  }
89
125
  return index_js_1.ARIO_MAINNET_PROCESS_ID;
90
126
  }
91
- exports.arioProcessIdFromOptions = arioProcessIdFromOptions;
92
- function walletFromOptions({ privateKey, walletFile, }) {
127
+ function jwkFromOptions({ privateKey, walletFile, }) {
93
128
  if (privateKey !== undefined) {
94
129
  return JSON.parse(privateKey);
95
130
  }
@@ -99,17 +134,15 @@ function walletFromOptions({ privateKey, walletFile, }) {
99
134
  return undefined;
100
135
  }
101
136
  function requiredJwkFromOptions(options) {
102
- const jwk = walletFromOptions(options);
137
+ const jwk = jwkFromOptions(options);
103
138
  if (jwk === undefined) {
104
139
  throw new Error('No JWK provided for signing!\nPlease provide a stringified JWK with `--private-key` or the file path of a jwk.json file with `--wallet-file`');
105
140
  }
106
141
  return jwk;
107
142
  }
108
- exports.requiredJwkFromOptions = requiredJwkFromOptions;
109
143
  function jwkToAddress(jwk) {
110
144
  return (0, index_js_1.sha256B64Url)((0, index_js_1.fromB64Url)(jwk.n));
111
145
  }
112
- exports.jwkToAddress = jwkToAddress;
113
146
  function setLoggerIfDebug(options) {
114
147
  if (options.debug) {
115
148
  index_js_1.Logger.default.setLogLevel('debug');
@@ -119,7 +152,6 @@ function getLoggerFromOptions(options) {
119
152
  setLoggerIfDebug(options);
120
153
  return index_js_1.Logger.default;
121
154
  }
122
- exports.getLoggerFromOptions = getLoggerFromOptions;
123
155
  function aoProcessFromOptions(options) {
124
156
  return new index_js_1.AOProcess({
125
157
  processId: arioProcessIdFromOptions(options),
@@ -132,38 +164,17 @@ function readARIOFromOptions(options) {
132
164
  setLoggerIfDebug(options);
133
165
  return index_js_1.ARIO.init({
134
166
  process: aoProcessFromOptions(options),
135
- paymentUrl: options.paymentUrl,
136
167
  });
137
168
  }
138
- exports.readARIOFromOptions = readARIOFromOptions;
139
- function contractSignerFromOptions(options) {
140
- const wallet = walletFromOptions(options);
141
- if (wallet === undefined) {
142
- return undefined;
143
- }
144
- const token = options.token ?? 'arweave';
145
- if (token === 'ethereum') {
146
- const signer = new arbundles_1.EthereumSigner(wallet);
147
- // For EthereumSigner, we need to convert the JWK to a string
148
- return { signer, signerAddress: signer.publicKey.toString('hex') };
149
- }
150
- // TODO: Support other wallet types
151
- const signer = new index_js_1.ArweaveSigner(wallet);
152
- return { signer, signerAddress: jwkToAddress(wallet) };
153
- }
154
- exports.contractSignerFromOptions = contractSignerFromOptions;
155
169
  function requiredContractSignerFromOptions(options) {
156
- const contractSigner = contractSignerFromOptions(options);
157
- if (contractSigner === undefined) {
158
- throw new Error('No signer provided for signing!\nPlease provide a stringified JWK or Ethereum private key with `--private-key` or the file path of an arweave.jwk.json or eth.private.key.txt file with `--wallet-file`');
159
- }
160
- return contractSigner;
170
+ // TODO: Support other wallet types
171
+ const jwk = requiredJwkFromOptions(options);
172
+ const signer = new index_js_1.ArweaveSigner(jwk);
173
+ return { signer, signerAddress: jwkToAddress(jwk) };
161
174
  }
162
- exports.requiredContractSignerFromOptions = requiredContractSignerFromOptions;
163
175
  function requiredAoSignerFromOptions(options) {
164
176
  return (0, index_js_1.createAoSigner)(requiredContractSignerFromOptions(options).signer);
165
177
  }
166
- exports.requiredAoSignerFromOptions = requiredAoSignerFromOptions;
167
178
  function writeARIOFromOptions(options) {
168
179
  const { signer, signerAddress } = requiredContractSignerFromOptions(options);
169
180
  setLoggerIfDebug(options);
@@ -171,12 +182,10 @@ function writeARIOFromOptions(options) {
171
182
  ario: index_js_1.ARIO.init({
172
183
  process: aoProcessFromOptions(options),
173
184
  signer,
174
- paymentUrl: options.paymentUrl,
175
185
  }),
176
186
  signerAddress,
177
187
  };
178
188
  }
179
- exports.writeARIOFromOptions = writeARIOFromOptions;
180
189
  function formatARIOWithCommas(value) {
181
190
  const [integerPart, decimalPart] = value.toString().split('.');
182
191
  const integerWithCommas = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
@@ -185,23 +194,21 @@ function formatARIOWithCommas(value) {
185
194
  }
186
195
  return integerWithCommas + '.' + decimalPart;
187
196
  }
188
- exports.formatARIOWithCommas = formatARIOWithCommas;
189
197
  function formatMARIOToARIOWithCommas(value) {
190
198
  return formatARIOWithCommas(value.toARIO());
191
199
  }
192
- exports.formatMARIOToARIOWithCommas = formatMARIOToARIOWithCommas;
193
200
  /** helper to get address from --address option first, then check wallet options */
194
201
  function addressFromOptions(options) {
195
202
  if (options.address !== undefined) {
196
203
  return options.address;
197
204
  }
198
- const signer = contractSignerFromOptions(options);
199
- if (signer !== undefined) {
200
- return signer.signerAddress;
205
+ // TODO: Support other wallet types
206
+ const jwk = jwkFromOptions(options);
207
+ if (jwk !== undefined) {
208
+ return jwkToAddress(jwk);
201
209
  }
202
210
  return undefined;
203
211
  }
204
- exports.addressFromOptions = addressFromOptions;
205
212
  function requiredAddressFromOptions(options) {
206
213
  const address = addressFromOptions(options);
207
214
  if (address !== undefined) {
@@ -209,7 +216,6 @@ function requiredAddressFromOptions(options) {
209
216
  }
210
217
  throw new Error('No address provided. Use --address or --wallet-file');
211
218
  }
212
- exports.requiredAddressFromOptions = requiredAddressFromOptions;
213
219
  const defaultCliPaginationLimit = 10; // more friendly UX than 100
214
220
  function paginationParamsFromOptions(options) {
215
221
  const { cursor, limit, sortBy, sortOrder } = options;
@@ -227,7 +233,6 @@ function paginationParamsFromOptions(options) {
227
233
  sortOrder,
228
234
  };
229
235
  }
230
- exports.paginationParamsFromOptions = paginationParamsFromOptions;
231
236
  function epochInputFromOptions(options) {
232
237
  if (options.epochIndex !== undefined) {
233
238
  return { epochIndex: +options.epochIndex };
@@ -237,14 +242,12 @@ function epochInputFromOptions(options) {
237
242
  }
238
243
  return undefined;
239
244
  }
240
- exports.epochInputFromOptions = epochInputFromOptions;
241
245
  function requiredInitiatorFromOptions(options) {
242
246
  if (options.initiator !== undefined) {
243
247
  return options.initiator;
244
248
  }
245
249
  return requiredAddressFromOptions(options);
246
250
  }
247
- exports.requiredInitiatorFromOptions = requiredInitiatorFromOptions;
248
251
  function customTagsFromOptions(options) {
249
252
  if (options.tags === undefined) {
250
253
  return {};
@@ -269,7 +272,6 @@ function customTagsFromOptions(options) {
269
272
  tags,
270
273
  };
271
274
  }
272
- exports.customTagsFromOptions = customTagsFromOptions;
273
275
  function gatewaySettingsFromOptions({ allowDelegatedStaking, autoStake, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, observerAddress, port, properties, allowedDelegates, }) {
274
276
  return {
275
277
  observerAddress,
@@ -287,7 +289,6 @@ function gatewaySettingsFromOptions({ allowDelegatedStaking, autoStake, delegate
287
289
  properties,
288
290
  };
289
291
  }
290
- exports.gatewaySettingsFromOptions = gatewaySettingsFromOptions;
291
292
  function requiredTargetAndQuantityFromOptions(options) {
292
293
  if (options.target === undefined) {
293
294
  throw new Error('No target provided. Use --target');
@@ -300,7 +301,6 @@ function requiredTargetAndQuantityFromOptions(options) {
300
301
  arioQuantity: new index_js_1.ARIOToken(+options.quantity),
301
302
  };
302
303
  }
303
- exports.requiredTargetAndQuantityFromOptions = requiredTargetAndQuantityFromOptions;
304
304
  function redelegateParamsFromOptions(options) {
305
305
  const { target, arioQuantity: aRIOQuantity } = requiredTargetAndQuantityFromOptions(options);
306
306
  const source = options.source;
@@ -314,7 +314,6 @@ function redelegateParamsFromOptions(options) {
314
314
  stakeQty: aRIOQuantity.toMARIO(),
315
315
  };
316
316
  }
317
- exports.redelegateParamsFromOptions = redelegateParamsFromOptions;
318
317
  function recordTypeFromOptions(options) {
319
318
  options.type ??= 'lease';
320
319
  if (options.type !== 'lease' && options.type !== 'permabuy') {
@@ -322,18 +321,13 @@ function recordTypeFromOptions(options) {
322
321
  }
323
322
  return options.type;
324
323
  }
325
- exports.recordTypeFromOptions = recordTypeFromOptions;
326
324
  function requiredMARIOFromOptions(options, key) {
327
325
  if (options[key] === undefined) {
328
326
  throw new Error(`No ${key} provided. Use --${key} denominated in ARIO`);
329
327
  }
330
328
  return new index_js_1.ARIOToken(+options[key]).toMARIO();
331
329
  }
332
- exports.requiredMARIOFromOptions = requiredMARIOFromOptions;
333
330
  async function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsParams, }) {
334
- if (costDetailsParams.fundFrom === 'turbo') {
335
- return;
336
- }
337
331
  const costDetails = await ario.getCostDetails(costDetailsParams);
338
332
  if (costDetails.fundingPlan) {
339
333
  if (costDetails.fundingPlan.shortfall > 0) {
@@ -348,7 +342,6 @@ async function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsPa
348
342
  });
349
343
  }
350
344
  }
351
- exports.assertEnoughBalanceForArNSPurchase = assertEnoughBalanceForArNSPurchase;
352
345
  async function assertEnoughMARIOBalance({ address, ario, mARIOQuantity, }) {
353
346
  if (typeof mARIOQuantity === 'number') {
354
347
  mARIOQuantity = new index_js_1.mARIOToken(mARIOQuantity);
@@ -358,7 +351,6 @@ async function assertEnoughMARIOBalance({ address, ario, mARIOQuantity, }) {
358
351
  throw new Error(`Insufficient ARIO balance for action. Balance available: ${formatMARIOToARIOWithCommas(new index_js_1.mARIOToken(balance))} ARIO`);
359
352
  }
360
353
  }
361
- exports.assertEnoughMARIOBalance = assertEnoughMARIOBalance;
362
354
  async function confirmationPrompt(message) {
363
355
  const { confirm } = await (0, prompts_1.default)({
364
356
  type: 'confirm',
@@ -367,21 +359,18 @@ async function confirmationPrompt(message) {
367
359
  });
368
360
  return confirm;
369
361
  }
370
- exports.confirmationPrompt = confirmationPrompt;
371
362
  async function assertConfirmationPrompt(message, options) {
372
363
  if (options.skipConfirmation) {
373
364
  return true;
374
365
  }
375
366
  return confirmationPrompt(message);
376
367
  }
377
- exports.assertConfirmationPrompt = assertConfirmationPrompt;
378
368
  function requiredProcessIdFromOptions(o) {
379
369
  if (o.processId === undefined) {
380
370
  throw new Error('--process-id is required');
381
371
  }
382
372
  return o.processId;
383
373
  }
384
- exports.requiredProcessIdFromOptions = requiredProcessIdFromOptions;
385
374
  function ANTProcessFromOptions(options) {
386
375
  return new index_js_1.AOProcess({
387
376
  processId: requiredProcessIdFromOptions(options),
@@ -395,7 +384,6 @@ function readANTFromOptions(options) {
395
384
  process: ANTProcessFromOptions(options),
396
385
  });
397
386
  }
398
- exports.readANTFromOptions = readANTFromOptions;
399
387
  function writeANTFromOptions(options, signer) {
400
388
  signer ??= requiredContractSignerFromOptions(options).signer;
401
389
  return index_js_1.ANT.init({
@@ -403,11 +391,9 @@ function writeANTFromOptions(options, signer) {
403
391
  signer,
404
392
  });
405
393
  }
406
- exports.writeANTFromOptions = writeANTFromOptions;
407
394
  function booleanFromOptions(options, key) {
408
395
  return !!options[key];
409
396
  }
410
- exports.booleanFromOptions = booleanFromOptions;
411
397
  function requiredStringFromOptions(options, key) {
412
398
  const value = options[key];
413
399
  if (value === undefined) {
@@ -415,7 +401,6 @@ function requiredStringFromOptions(options, key) {
415
401
  }
416
402
  return value;
417
403
  }
418
- exports.requiredStringFromOptions = requiredStringFromOptions;
419
404
  function requiredStringArrayFromOptions(options, key) {
420
405
  const value = options[key];
421
406
  if (value === undefined) {
@@ -426,7 +411,6 @@ function requiredStringArrayFromOptions(options, key) {
426
411
  }
427
412
  return value;
428
413
  }
429
- exports.requiredStringArrayFromOptions = requiredStringArrayFromOptions;
430
414
  function positiveIntegerFromOptions(options, key) {
431
415
  const value = options[key];
432
416
  if (value === undefined) {
@@ -438,7 +422,6 @@ function positiveIntegerFromOptions(options, key) {
438
422
  }
439
423
  return numberValue;
440
424
  }
441
- exports.positiveIntegerFromOptions = positiveIntegerFromOptions;
442
425
  function requiredPositiveIntegerFromOptions(options, key) {
443
426
  const value = positiveIntegerFromOptions(options, key);
444
427
  if (value === undefined) {
@@ -446,7 +429,6 @@ function requiredPositiveIntegerFromOptions(options, key) {
446
429
  }
447
430
  return value;
448
431
  }
449
- exports.requiredPositiveIntegerFromOptions = requiredPositiveIntegerFromOptions;
450
432
  function getANTStateFromOptions(options) {
451
433
  return (0, index_js_1.initANTStateForAddress)({
452
434
  owner: requiredAddressFromOptions(options),
@@ -462,7 +444,6 @@ function getANTStateFromOptions(options) {
462
444
  : exports.defaultTtlSecondsCLI,
463
445
  });
464
446
  }
465
- exports.getANTStateFromOptions = getANTStateFromOptions;
466
447
  function getTokenCostParamsFromOptions(o) {
467
448
  o.intent ??= 'Buy-Name';
468
449
  o.type ??= 'lease';
@@ -482,7 +463,6 @@ function getTokenCostParamsFromOptions(o) {
482
463
  fromAddress: addressFromOptions(o),
483
464
  };
484
465
  }
485
- exports.getTokenCostParamsFromOptions = getTokenCostParamsFromOptions;
486
466
  function fundFromFromOptions(o) {
487
467
  if (o.fundFrom !== undefined) {
488
468
  if (!(0, index_js_1.isValidFundFrom)(o.fundFrom)) {
@@ -491,7 +471,6 @@ function fundFromFromOptions(o) {
491
471
  }
492
472
  return o.fundFrom ?? 'balance';
493
473
  }
494
- exports.fundFromFromOptions = fundFromFromOptions;
495
474
  function assertLockLengthInRange(lockLengthMs, assertMin = true) {
496
475
  const minLockLengthMs = 1209600000; // 14 days
497
476
  const maxLockLengthMs = 378432000000; // ~12 years
@@ -505,4 +484,3 @@ function assertLockLengthInRange(lockLengthMs, assertMin = true) {
505
484
  throw new Error(`Lock length must be at least 14 days (1209600000 ms). Provided lock length: ${lockLengthMs} ms`);
506
485
  }
507
486
  }
508
- exports.assertLockLengthInRange = assertLockLengthInRange;
@@ -75,14 +75,14 @@ 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, { tags }) {
79
79
  return this.process.send({
80
80
  tags: (0, arweave_js_1.pruneTags)([
81
81
  { name: 'Action', value: 'Add-Version' },
82
- { name: 'Version', value: version },
83
- { name: 'Module-Id', value: moduleId },
84
- { name: 'Lua-Source-Id', value: luaSourceId },
85
- { name: 'Notes', value: notes },
82
+ { name: 'Version', value: params.version },
83
+ { name: 'Module-Id', value: params.moduleId },
84
+ { name: 'Lua-Source-Id', value: params.luaSourceId },
85
+ { name: 'Notes', value: params.notes },
86
86
  ...(tags ?? []),
87
87
  ]),
88
88
  signer: this.signer,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ARIOTokenFaucet = exports.createFaucet = void 0;
3
+ exports.ARIOTokenFaucet = void 0;
4
+ exports.createFaucet = createFaucet;
4
5
  const DEFAULT_FAUCET_API_URL = 'https://faucet.ario.permaweb.services';
5
6
  /**
6
7
  * Creates a proxy object that implements the TokenFaucet interface. It wraps the ARIOReadable instance and adds methods for claiming tokens from the faucet API.
@@ -30,7 +31,6 @@ function createFaucet({ arioInstance, faucetApiUrl = DEFAULT_FAUCET_API_URL, })
30
31
  });
31
32
  return proxy;
32
33
  }
33
- exports.createFaucet = createFaucet;
34
34
  class ARIOTokenFaucet {
35
35
  faucetUrl;
36
36
  processId;
@@ -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);
@@ -25,7 +25,6 @@ const arweave_js_2 = require("./arweave.js");
25
25
  const ao_process_js_1 = require("./contracts/ao-process.js");
26
26
  const error_js_1 = require("./error.js");
27
27
  const faucet_js_1 = require("./faucet.js");
28
- const turbo_js_1 = require("./turbo.js");
29
28
  class ARIO {
30
29
  // Implementation
31
30
  static init(config) {
@@ -51,6 +50,10 @@ class ARIO {
51
50
  ...config,
52
51
  process: new ao_process_js_1.AOProcess({
53
52
  processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
53
+ ao: (0, aoconnect_1.connect)({
54
+ CU_URL: 'https://cu.ardrive.io',
55
+ ...config?.process?.ao,
56
+ }),
54
57
  }),
55
58
  });
56
59
  }
@@ -90,7 +93,6 @@ class ARIOReadable {
90
93
  process;
91
94
  epochSettings;
92
95
  arweave;
93
- paymentProvider; // TODO: this could be an array/map of payment providers
94
96
  constructor(config) {
95
97
  this.arweave = config?.arweave ?? arweave_js_2.defaultArweave;
96
98
  if (config === undefined || Object.keys(config).length === 0) {
@@ -109,9 +111,6 @@ class ARIOReadable {
109
111
  else {
110
112
  throw new error_js_1.InvalidContractConfigurationError();
111
113
  }
112
- this.paymentProvider = turbo_js_1.TurboArNSPaymentFactory.init({
113
- paymentUrl: config?.paymentUrl,
114
- });
115
114
  }
116
115
  async getInfo() {
117
116
  return this.process.read({
@@ -443,20 +442,6 @@ class ARIOReadable {
443
442
  // TODO: Can overload this function to refine different types of cost details params
444
443
  async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
445
444
  const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
446
- if (fundFrom === 'turbo') {
447
- const { mARIO, winc } = await this.paymentProvider.getArNSPriceDetails({
448
- intent: replacedBuyRecordWithBuyName,
449
- name,
450
- quantity,
451
- type,
452
- years,
453
- });
454
- return {
455
- tokenCost: +mARIO,
456
- wincQty: winc,
457
- discounts: [],
458
- };
459
- }
460
445
  const allTags = [
461
446
  { name: 'Action', value: 'Cost-Details' },
462
447
  {
@@ -624,8 +609,7 @@ class ARIOReadable {
624
609
  exports.ARIOReadable = ARIOReadable;
625
610
  class ARIOWriteable extends ARIOReadable {
626
611
  signer;
627
- paymentProvider;
628
- constructor({ signer, paymentUrl, ...config }) {
612
+ constructor({ signer, ...config }) {
629
613
  if (config === undefined) {
630
614
  super({
631
615
  process: new ao_process_js_1.AOProcess({
@@ -637,10 +621,6 @@ class ARIOWriteable extends ARIOReadable {
637
621
  super(config);
638
622
  }
639
623
  this.signer = (0, ao_js_1.createAoSigner)(signer);
640
- this.paymentProvider = turbo_js_1.TurboArNSPaymentFactory.init({
641
- signer: (0, turbo_js_1.isTurboArNSSigner)(signer) ? signer : undefined,
642
- paymentUrl,
643
- });
644
624
  }
645
625
  async transfer({ target, qty, }, options) {
646
626
  const { tags = [] } = options || {};
@@ -915,15 +895,6 @@ class ARIOWriteable extends ARIOReadable {
915
895
  });
916
896
  }
917
897
  async buyRecord(params, options) {
918
- if (params.fundFrom === 'turbo') {
919
- if (!(this.paymentProvider instanceof turbo_js_1.TurboArNSPaymentProviderAuthenticated)) {
920
- throw new Error('Turbo funding is not supported for this payment provider');
921
- }
922
- return this.paymentProvider.initiateArNSPurchase({
923
- intent: 'Buy-Name',
924
- ...params,
925
- });
926
- }
927
898
  const { tags = [] } = options || {};
928
899
  const allTags = [
929
900
  ...tags,
@@ -948,15 +919,6 @@ class ARIOWriteable extends ARIOReadable {
948
919
  * @returns {Promise<AoMessageResult>} The result of the upgrade
949
920
  */
950
921
  async upgradeRecord(params, options) {
951
- if (params.fundFrom === 'turbo') {
952
- if (!(this.paymentProvider instanceof turbo_js_1.TurboArNSPaymentProviderAuthenticated)) {
953
- throw new Error('Turbo funding is not supported for this payment provider');
954
- }
955
- return this.paymentProvider.initiateArNSPurchase({
956
- intent: 'Upgrade-Name',
957
- name: params.name,
958
- });
959
- }
960
922
  const { tags = [] } = options || {};
961
923
  const allTags = [
962
924
  ...tags,
@@ -979,15 +941,6 @@ class ARIOWriteable extends ARIOReadable {
979
941
  * @returns {Promise<AoMessageResult>} The result of the extension
980
942
  */
981
943
  async extendLease(params, options) {
982
- if (params.fundFrom === 'turbo') {
983
- if (!(this.paymentProvider instanceof turbo_js_1.TurboArNSPaymentProviderAuthenticated)) {
984
- throw new Error('Turbo funding is not supported for this payment provider');
985
- }
986
- return this.paymentProvider.initiateArNSPurchase({
987
- intent: 'Extend-Lease',
988
- ...params,
989
- });
990
- }
991
944
  const { tags = [] } = options || {};
992
945
  const allTags = [
993
946
  ...tags,
@@ -1002,15 +955,6 @@ class ARIOWriteable extends ARIOReadable {
1002
955
  });
1003
956
  }
1004
957
  async increaseUndernameLimit(params, options) {
1005
- if (params.fundFrom === 'turbo') {
1006
- if (!(this.paymentProvider instanceof turbo_js_1.TurboArNSPaymentProviderAuthenticated)) {
1007
- throw new Error('Turbo funding is not supported for this payment provider');
1008
- }
1009
- return this.paymentProvider.initiateArNSPurchase({
1010
- intent: 'Increase-Undername-Limit',
1011
- ...params,
1012
- });
1013
- }
1014
958
  const { tags = [] } = options || {};
1015
959
  const allTags = [
1016
960
  ...tags,
@@ -1047,9 +991,6 @@ class ARIOWriteable extends ARIOReadable {
1047
991
  });
1048
992
  }
1049
993
  async requestPrimaryName(params, options) {
1050
- if (params.fundFrom === 'turbo') {
1051
- throw new Error('Turbo funding is not yet supported for primary name requests');
1052
- }
1053
994
  const { tags = [] } = options || {};
1054
995
  const allTags = [
1055
996
  ...tags,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.SpawnANTStateSchema = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.AOAddressSchema = exports.ArweaveTxIdSchema = void 0;
3
+ exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.AOAddressSchema = exports.ArweaveTxIdSchema = void 0;
4
+ exports.isAoANTState = isAoANTState;
4
5
  /**
5
6
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
7
  *
@@ -80,17 +81,6 @@ exports.AntStateSchema = zod_1.z.object({
80
81
  .boolean()
81
82
  .describe('Flag indicating whether the ANT has been initialized.'),
82
83
  });
83
- exports.SpawnANTStateSchema = zod_1.z.object({
84
- name: zod_1.z.string().describe('The name of the ANT.'),
85
- ticker: zod_1.z.string().describe('The ticker symbol for the ANT.'),
86
- description: zod_1.z.string().describe('The description for the ANT.'),
87
- keywords: exports.AntKeywordsSchema.describe('The keywords for the ANT.'),
88
- owner: exports.AOAddressSchema.describe('The Owners address.'),
89
- controllers: exports.AntControllersSchema.describe('Controllers of the ANT who have administrative privileges.'),
90
- records: exports.AntRecordsSchema.describe('Records associated with the ANT.'),
91
- balances: exports.AntBalancesSchema.describe('Balance details for each address holding the ANT.'),
92
- logo: exports.ArweaveTxIdSchema.describe('Transaction ID of the ANT logo.'),
93
- });
94
84
  exports.AntReadHandlers = [
95
85
  'balance',
96
86
  'balances',
@@ -147,4 +137,3 @@ exports.AntInfoSchema = zod_1.z.object({
147
137
  function isAoANTState(state) {
148
138
  return exports.AntStateSchema.safeParse(state).success;
149
139
  }
150
- exports.isAoANTState = isAoANTState;
@@ -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);
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLeasedArNSRecord = exports.isProcessIdConfiguration = exports.isProcessConfiguration = exports.isValidFundFrom = exports.fundFromOptions = exports.isValidIntent = exports.intentsUsingYears = exports.validIntents = exports.isDistributedEpoch = exports.isDistributedEpochData = void 0;
3
+ exports.isValidFundFrom = exports.fundFromOptions = exports.isValidIntent = exports.intentsUsingYears = exports.validIntents = exports.isDistributedEpoch = exports.isDistributedEpochData = void 0;
4
+ exports.isProcessConfiguration = isProcessConfiguration;
5
+ exports.isProcessIdConfiguration = isProcessIdConfiguration;
6
+ exports.isLeasedArNSRecord = isLeasedArNSRecord;
4
7
  const arweave_js_1 = require("../utils/arweave.js");
5
8
  const isDistributedEpochData = (data) => {
6
9
  return data.distributedTimestamp !== undefined;
@@ -28,7 +31,7 @@ const isValidIntent = (intent) => {
28
31
  return exports.validIntents.indexOf(intent) !== -1;
29
32
  };
30
33
  exports.isValidIntent = isValidIntent;
31
- exports.fundFromOptions = ['balance', 'stakes', 'any', 'turbo'];
34
+ exports.fundFromOptions = ['balance', 'stakes', 'any'];
32
35
  const isValidFundFrom = (fundFrom) => {
33
36
  return exports.fundFromOptions.indexOf(fundFrom) !== -1;
34
37
  };
@@ -37,15 +40,12 @@ exports.isValidFundFrom = isValidFundFrom;
37
40
  function isProcessConfiguration(config) {
38
41
  return config !== undefined && 'process' in config;
39
42
  }
40
- exports.isProcessConfiguration = isProcessConfiguration;
41
43
  function isProcessIdConfiguration(config) {
42
44
  return (config !== undefined &&
43
45
  'processId' in config &&
44
46
  typeof config.processId === 'string' &&
45
47
  (0, arweave_js_1.validateArweaveId)(config.processId) === true);
46
48
  }
47
- exports.isProcessIdConfiguration = isProcessIdConfiguration;
48
49
  function isLeasedArNSRecord(record) {
49
50
  return record.type === 'lease';
50
51
  }
51
- exports.isLeasedArNSRecord = isLeasedArNSRecord;