@ar.io/sdk 2.7.0-alpha.7 → 3.0.0

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 (38) hide show
  1. package/README.md +186 -186
  2. package/bundles/web.bundle.min.js +2 -2
  3. package/lib/cjs/cli/cli.js +26 -26
  4. package/lib/cjs/cli/commands/gatewayWriteCommands.js +39 -39
  5. package/lib/cjs/cli/commands/readCommands.js +19 -19
  6. package/lib/cjs/cli/commands/transfer.js +7 -7
  7. package/lib/cjs/cli/options.js +4 -4
  8. package/lib/cjs/cli/utils.js +25 -25
  9. package/lib/cjs/common/ant.js +18 -14
  10. package/lib/cjs/common/io.js +11 -11
  11. package/lib/cjs/constants.js +5 -5
  12. package/lib/cjs/types/token.js +14 -14
  13. package/lib/cjs/utils/processes.js +4 -4
  14. package/lib/cjs/version.js +1 -1
  15. package/lib/esm/cli/cli.js +28 -28
  16. package/lib/esm/cli/commands/gatewayWriteCommands.js +41 -41
  17. package/lib/esm/cli/commands/readCommands.js +21 -21
  18. package/lib/esm/cli/commands/transfer.js +8 -8
  19. package/lib/esm/cli/options.js +4 -4
  20. package/lib/esm/cli/utils.js +21 -21
  21. package/lib/esm/common/ant.js +18 -14
  22. package/lib/esm/common/io.js +8 -8
  23. package/lib/esm/constants.js +4 -4
  24. package/lib/esm/types/token.js +12 -12
  25. package/lib/esm/utils/processes.js +6 -6
  26. package/lib/esm/version.js +1 -1
  27. package/lib/types/cli/options.d.ts +1 -1
  28. package/lib/types/cli/types.d.ts +1 -1
  29. package/lib/types/cli/utils.d.ts +10 -10
  30. package/lib/types/common/ant.d.ts +14 -14
  31. package/lib/types/common/io.d.ts +16 -16
  32. package/lib/types/constants.d.ts +4 -4
  33. package/lib/types/types/ant.d.ts +8 -8
  34. package/lib/types/types/io.d.ts +9 -9
  35. package/lib/types/types/token.d.ts +8 -8
  36. package/lib/types/utils/processes.d.ts +4 -4
  37. package/lib/types/version.d.ts +1 -1
  38. package/package.json +1 -1
@@ -34,22 +34,22 @@ const utils_js_1 = require("./utils.js");
34
34
  (0, utils_js_1.makeCommand)({
35
35
  name: 'info',
36
36
  description: 'Get network info',
37
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getInfo(),
37
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getInfo(),
38
38
  });
39
39
  (0, utils_js_1.makeCommand)({
40
40
  name: 'token-supply',
41
41
  description: 'Get the total token supply',
42
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getTokenSupply(),
42
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getTokenSupply(),
43
43
  });
44
44
  (0, utils_js_1.makeCommand)({
45
45
  name: 'get-registration-fees',
46
46
  description: 'Get registration fees',
47
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getRegistrationFees(),
47
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getRegistrationFees(),
48
48
  });
49
49
  (0, utils_js_1.makeCommand)({
50
50
  name: 'get-demand-factor',
51
51
  description: 'Get demand factor',
52
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getDemandFactor(),
52
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getDemandFactor(),
53
53
  });
54
54
  (0, utils_js_1.makeCommand)({
55
55
  name: 'get-gateway',
@@ -126,7 +126,7 @@ const utils_js_1 = require("./utils.js");
126
126
  (0, utils_js_1.makeCommand)({
127
127
  name: 'get-current-epoch',
128
128
  description: 'Get current epoch data',
129
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getCurrentEpoch(),
129
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getCurrentEpoch(),
130
130
  });
131
131
  (0, utils_js_1.makeCommand)({
132
132
  name: 'get-prescribed-observers',
@@ -144,13 +144,13 @@ const utils_js_1 = require("./utils.js");
144
144
  name: 'get-observations',
145
145
  description: 'Get observations for an epoch',
146
146
  options: options_js_1.epochOptions,
147
- action: (o) => (0, utils_js_1.readIOFromOptions)(o).getObservations((0, utils_js_1.epochInputFromOptions)(o)),
147
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o).getObservations((0, utils_js_1.epochInputFromOptions)(o)),
148
148
  });
149
149
  (0, utils_js_1.makeCommand)({
150
150
  name: 'get-distributions',
151
151
  description: 'Get distributions for an epoch',
152
152
  options: options_js_1.epochOptions,
153
- action: (o) => (0, utils_js_1.readIOFromOptions)(o).getDistributions((0, utils_js_1.epochInputFromOptions)(o)),
153
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o).getDistributions((0, utils_js_1.epochInputFromOptions)(o)),
154
154
  });
155
155
  (0, utils_js_1.makeCommand)({
156
156
  name: 'get-token-cost',
@@ -162,7 +162,7 @@ const utils_js_1 = require("./utils.js");
162
162
  name: 'list-vaults',
163
163
  description: 'Get all wallet vaults',
164
164
  options: options_js_1.paginationOptions,
165
- action: (o) => (0, utils_js_1.readIOFromOptions)(o)
165
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o)
166
166
  .getVaults((0, utils_js_1.paginationParamsFromOptions)(o))
167
167
  .then((result) => result.items.length ? result : { message: 'No vaults found' }),
168
168
  });
@@ -171,7 +171,7 @@ const utils_js_1 = require("./utils.js");
171
171
  name: 'get-primary-name-request',
172
172
  description: 'Get primary name request',
173
173
  options: options_js_1.initiatorOptions,
174
- action: (o) => (0, utils_js_1.readIOFromOptions)(o)
174
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o)
175
175
  .getPrimaryNameRequest({
176
176
  initiator: (0, utils_js_1.requiredStringFromOptions)(o, 'initiator'),
177
177
  })
@@ -183,7 +183,7 @@ const utils_js_1 = require("./utils.js");
183
183
  name: 'list-primary-name-requests',
184
184
  description: 'Get primary name requests',
185
185
  options: options_js_1.paginationOptions,
186
- action: (o) => (0, utils_js_1.readIOFromOptions)(o)
186
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o)
187
187
  .getPrimaryNameRequests((0, utils_js_1.paginationParamsFromOptions)(o))
188
188
  .then((result) => result.items.length ? result : { message: 'No requests found' }),
189
189
  });
@@ -197,7 +197,7 @@ const utils_js_1 = require("./utils.js");
197
197
  name: 'list-primary-names',
198
198
  description: 'Get primary names',
199
199
  options: options_js_1.paginationOptions,
200
- action: (o) => (0, utils_js_1.readIOFromOptions)(o)
200
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o)
201
201
  .getPrimaryNames((0, utils_js_1.paginationParamsFromOptions)(o))
202
202
  .then((result) => result.items.length ? result : { message: 'No names found' }),
203
203
  });
@@ -205,19 +205,19 @@ const utils_js_1 = require("./utils.js");
205
205
  name: 'balance',
206
206
  description: 'Get the balance of an address',
207
207
  options: options_js_1.addressOptions,
208
- action: (options) => (0, utils_js_1.readIOFromOptions)(options)
208
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options)
209
209
  .getBalance({ address: (0, utils_js_1.requiredAddressFromOptions)(options) })
210
210
  .then((result) => ({
211
211
  address: (0, utils_js_1.requiredAddressFromOptions)(options),
212
212
  mIOBalance: result,
213
- message: `Provided address current has a balance of ${(0, utils_js_1.formatIOWithCommas)(new token_js_1.mIOToken(result).toIO())} IO`,
213
+ message: `Provided address current has a balance of ${(0, utils_js_1.formatARIOWithCommas)(new token_js_1.mARIOToken(result).toARIO())} ARIO`,
214
214
  })),
215
215
  });
216
216
  (0, utils_js_1.makeCommand)({
217
217
  name: 'list-balances',
218
218
  description: 'List all balances',
219
219
  options: options_js_1.paginationOptions,
220
- action: (o) => (0, utils_js_1.readIOFromOptions)(o)
220
+ action: (o) => (0, utils_js_1.readARIOFromOptions)(o)
221
221
  .getBalances((0, utils_js_1.paginationParamsFromOptions)(o))
222
222
  .then((result) => result.items.length ? result : { message: 'No balances found' }),
223
223
  });
@@ -225,7 +225,7 @@ const utils_js_1 = require("./utils.js");
225
225
  name: 'get-redelegation-fee',
226
226
  description: 'Get redelegation fee',
227
227
  options: options_js_1.addressOptions,
228
- action: (options) => (0, utils_js_1.readIOFromOptions)(options).getRedelegationFee({
228
+ action: (options) => (0, utils_js_1.readARIOFromOptions)(options).getRedelegationFee({
229
229
  address: (0, utils_js_1.requiredAddressFromOptions)(options),
230
230
  }),
231
231
  });
@@ -243,7 +243,7 @@ const utils_js_1 = require("./utils.js");
243
243
  });
244
244
  (0, utils_js_1.makeCommand)({
245
245
  name: 'transfer',
246
- description: 'Transfer IO to another address',
246
+ description: 'Transfer ARIO to another address',
247
247
  options: options_js_1.transferOptions,
248
248
  action: transfer_js_1.transfer,
249
249
  });
@@ -321,7 +321,7 @@ const utils_js_1 = require("./utils.js");
321
321
  description: 'Buy a record',
322
322
  options: options_js_1.buyRecordOptions,
323
323
  action: async (options) => {
324
- const io = (0, utils_js_1.writeIOFromOptions)(options).io;
324
+ const ario = (0, utils_js_1.writeARIOFromOptions)(options).ario;
325
325
  const name = (0, utils_js_1.requiredStringFromOptions)(options, 'name');
326
326
  const type = (0, utils_js_1.recordTypeFromOptions)(options);
327
327
  const years = (0, utils_js_1.positiveIntegerFromOptions)(options, 'years');
@@ -333,7 +333,7 @@ const utils_js_1 = require("./utils.js");
333
333
  throw new Error('Process ID must be provided for buy-record');
334
334
  }
335
335
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to ${type} the record ${name}?`, options);
336
- return io.buyRecord({
336
+ return ario.buyRecord({
337
337
  name: (0, utils_js_1.requiredStringFromOptions)(options, 'name'),
338
338
  processId,
339
339
  type,
@@ -349,7 +349,7 @@ const utils_js_1 = require("./utils.js");
349
349
  action: async (options) => {
350
350
  const name = (0, utils_js_1.requiredStringFromOptions)(options, 'name');
351
351
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to upgrade the lease of ${name} to a permabuy?`, options);
352
- return (0, utils_js_1.writeIOFromOptions)(options).io.upgradeRecord({
352
+ return (0, utils_js_1.writeARIOFromOptions)(options).ario.upgradeRecord({
353
353
  name,
354
354
  });
355
355
  },
@@ -362,7 +362,7 @@ const utils_js_1 = require("./utils.js");
362
362
  const name = (0, utils_js_1.requiredStringFromOptions)(options, 'name');
363
363
  const years = (0, utils_js_1.requiredPositiveIntegerFromOptions)(options, 'years');
364
364
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to extend the lease of ${name} by ${years}?`, options);
365
- return (0, utils_js_1.writeIOFromOptions)(options).io.extendLease({
365
+ return (0, utils_js_1.writeARIOFromOptions)(options).ario.extendLease({
366
366
  name,
367
367
  years,
368
368
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
@@ -376,7 +376,7 @@ const utils_js_1 = require("./utils.js");
376
376
  const name = (0, utils_js_1.requiredStringFromOptions)(options, 'name');
377
377
  const increaseCount = (0, utils_js_1.requiredPositiveIntegerFromOptions)(options, 'increaseCount');
378
378
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to increase the undername limit of ${name} by ${increaseCount}?`, options);
379
- return (0, utils_js_1.writeIOFromOptions)(options).io.increaseUndernameLimit({
379
+ return (0, utils_js_1.writeARIOFromOptions)(options).ario.increaseUndernameLimit({
380
380
  name,
381
381
  increaseCount,
382
382
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
@@ -392,7 +392,7 @@ const utils_js_1 = require("./utils.js");
392
392
  // TODO: More assertions?
393
393
  const name = (0, utils_js_1.requiredStringFromOptions)(options, 'name');
394
394
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to request the primary name ${name}?`, options);
395
- return (0, utils_js_1.writeIOFromOptions)(options).io.requestPrimaryName({
395
+ return (0, utils_js_1.writeARIOFromOptions)(options).ario.requestPrimaryName({
396
396
  name,
397
397
  });
398
398
  },
@@ -641,7 +641,7 @@ const utils_js_1 = require("./utils.js");
641
641
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to release the name ${name} back to the protocol?`, options);
642
642
  return (0, utils_js_1.writeANTFromOptions)(options).releaseName({
643
643
  name,
644
- ioProcessId: (0, utils_js_1.ioProcessIdFromOptions)(options),
644
+ arioProcessId: (0, utils_js_1.arioProcessIdFromOptions)(options),
645
645
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
646
646
  },
647
647
  });
@@ -660,7 +660,7 @@ const utils_js_1 = require("./utils.js");
660
660
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to reassign the name ${name} to ANT process ${targetProcess}?`, options);
661
661
  return (0, utils_js_1.writeANTFromOptions)(options).reassignName({
662
662
  name,
663
- ioProcessId: (0, utils_js_1.ioProcessIdFromOptions)(options),
663
+ arioProcessId: (0, utils_js_1.arioProcessIdFromOptions)(options),
664
664
  antProcessId: targetProcess,
665
665
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
666
666
  },
@@ -681,7 +681,7 @@ const utils_js_1 = require("./utils.js");
681
681
  return (0, utils_js_1.writeANTFromOptions)(options).approvePrimaryNameRequest({
682
682
  name,
683
683
  address,
684
- ioProcessId: (0, utils_js_1.ioProcessIdFromOptions)(options),
684
+ arioProcessId: (0, utils_js_1.arioProcessIdFromOptions)(options),
685
685
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
686
686
  },
687
687
  });
@@ -694,7 +694,7 @@ const utils_js_1 = require("./utils.js");
694
694
  await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you want to remove the primary names ${names}?`, options);
695
695
  return (0, utils_js_1.writeANTFromOptions)(options).removePrimaryNames({
696
696
  names,
697
- ioProcessId: (0, utils_js_1.ioProcessIdFromOptions)(options),
697
+ arioProcessId: (0, utils_js_1.arioProcessIdFromOptions)(options),
698
698
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
699
699
  },
700
700
  });
@@ -23,7 +23,7 @@ const prompts_1 = __importDefault(require("prompts"));
23
23
  const index_js_1 = require("../../node/index.js");
24
24
  const utils_js_1 = require("../utils.js");
25
25
  async function joinNetwork(options) {
26
- const { io, signerAddress } = (0, utils_js_1.writeIOFromOptions)(options);
26
+ const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(options);
27
27
  const mARIOQuantity = (0, utils_js_1.requiredMIOFromOptions)(options, 'operatorStake');
28
28
  const settings = {
29
29
  ...(0, utils_js_1.gatewaySettingsFromOptions)(options),
@@ -36,14 +36,14 @@ async function joinNetwork(options) {
36
36
  throw new Error('FQDN is required. Please provide a --fqdn for your node.');
37
37
  }
38
38
  if (!options.skipConfirmation) {
39
- const settings = await io.getGatewayRegistrySettings();
39
+ const settings = await ario.getGatewayRegistrySettings();
40
40
  if (settings.operators.minStake > mARIOQuantity.valueOf()) {
41
- throw new Error(`The minimum operator stake is ${(0, utils_js_1.formatIOWithCommas)(new index_js_1.mIOToken(settings.operators.minStake).toIO())} IO. Please provide a higher stake.`);
41
+ throw new Error(`The minimum operator stake is ${(0, utils_js_1.formatARIOWithCommas)(new index_js_1.mARIOToken(settings.operators.minStake).toARIO())} ARIO. Please provide a higher stake.`);
42
42
  }
43
- await (0, utils_js_1.assertEnoughBalance)(io, signerAddress, mARIOQuantity.toIO());
44
- await (0, utils_js_1.assertConfirmationPrompt)(`Gateway Settings:\n\n${JSON.stringify(settings, null, 2)}\n\nYou are about to stake ${(0, utils_js_1.formatIOWithCommas)(mARIOQuantity.toIO())} IO to join the AR.IO network\nAre you sure?\n`, options);
43
+ await (0, utils_js_1.assertEnoughBalance)(ario, signerAddress, mARIOQuantity.toARIO());
44
+ await (0, utils_js_1.assertConfirmationPrompt)(`Gateway Settings:\n\n${JSON.stringify(settings, null, 2)}\n\nYou are about to stake ${(0, utils_js_1.formatARIOWithCommas)(mARIOQuantity.toARIO())} ARIO to join the AR.IO network\nAre you sure?\n`, options);
45
45
  }
46
- const result = await io.joinNetwork(settings, (0, utils_js_1.writeActionTagsFromOptions)(options));
46
+ const result = await ario.joinNetwork(settings, (0, utils_js_1.writeActionTagsFromOptions)(options));
47
47
  const output = {
48
48
  joinNetworkResult: result,
49
49
  joinedAddress: signerAddress,
@@ -53,14 +53,14 @@ async function joinNetwork(options) {
53
53
  }
54
54
  exports.joinNetwork = joinNetwork;
55
55
  async function updateGatewaySettings(options) {
56
- const { io, signerAddress } = (0, utils_js_1.writeIOFromOptions)(options);
56
+ const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(options);
57
57
  const gatewaySettings = (0, utils_js_1.gatewaySettingsFromOptions)(options);
58
58
  if (Object.keys(gatewaySettings).length === 0) {
59
59
  // TODO: The contract accepts empty Update-Gateway-Settings actions, but we'll throw in the CLI for now
60
60
  throw new Error('No gateway settings provided');
61
61
  }
62
62
  await (0, utils_js_1.assertConfirmationPrompt)(`Gateway Settings:\n\n${(0, utils_js_1.stringifyJsonForCLIDisplay)(gatewaySettings)}\n\nYou are about to update your gateway settings to the above\nAre you sure?\n`, options);
63
- const result = await io.updateGatewaySettings(gatewaySettings, (0, utils_js_1.writeActionTagsFromOptions)(options));
63
+ const result = await ario.updateGatewaySettings(gatewaySettings, (0, utils_js_1.writeActionTagsFromOptions)(options));
64
64
  const output = {
65
65
  updateGatewaySettingsResult: result,
66
66
  updatedGatewayAddress: signerAddress,
@@ -70,9 +70,9 @@ async function updateGatewaySettings(options) {
70
70
  }
71
71
  exports.updateGatewaySettings = updateGatewaySettings;
72
72
  async function leaveNetwork(options) {
73
- const { io, signerAddress } = (0, utils_js_1.writeIOFromOptions)(options);
73
+ const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(options);
74
74
  if (!options.skipConfirmation) {
75
- const gateway = await io.getGateway({ address: signerAddress });
75
+ const gateway = await ario.getGateway({ address: signerAddress });
76
76
  if (!gateway) {
77
77
  throw new Error(`Gateway not found for address: ${signerAddress}`);
78
78
  }
@@ -81,14 +81,14 @@ async function leaveNetwork(options) {
81
81
  '\n\n' +
82
82
  'Are you sure you want to leave the AR.IO network?', options);
83
83
  }
84
- return (0, utils_js_1.writeIOFromOptions)(options).io.leaveNetwork((0, utils_js_1.writeActionTagsFromOptions)(options));
84
+ return (0, utils_js_1.writeARIOFromOptions)(options).ario.leaveNetwork((0, utils_js_1.writeActionTagsFromOptions)(options));
85
85
  }
86
86
  exports.leaveNetwork = leaveNetwork;
87
87
  async function saveObservations(o) {
88
88
  const failedGateways = (0, utils_js_1.requiredStringArrayFromOptions)(o, 'failedGateways');
89
89
  const reportTxId = (0, utils_js_1.requiredStringFromOptions)(o, 'transactionId');
90
90
  await (0, utils_js_1.assertConfirmationPrompt)(`You are about to save the following failed gateways to the AR.IO network:\n\n${failedGateways.join('\n')}\n\nTransaction ID: ${reportTxId}\n\nAre you sure?`, o);
91
- return (0, utils_js_1.writeIOFromOptions)(o).io.saveObservations({
91
+ return (0, utils_js_1.writeARIOFromOptions)(o).ario.saveObservations({
92
92
  failedGateways: (0, utils_js_1.requiredStringArrayFromOptions)(o, 'failedGateways'),
93
93
  reportTxId: (0, utils_js_1.requiredStringFromOptions)(o, 'transactionId'),
94
94
  }, (0, utils_js_1.writeActionTagsFromOptions)(o));
@@ -96,8 +96,8 @@ async function saveObservations(o) {
96
96
  exports.saveObservations = saveObservations;
97
97
  async function increaseOperatorStake(o) {
98
98
  const increaseQty = (0, utils_js_1.requiredMIOFromOptions)(o, 'operatorStake');
99
- await (0, utils_js_1.assertConfirmationPrompt)(`You are about to increase your operator stake by ${(0, utils_js_1.formatIOWithCommas)(increaseQty.toIO())} IO\nAre you sure?`, o);
100
- return ((0, utils_js_1.writeIOFromOptions)(o).io.increaseOperatorStake({
99
+ await (0, utils_js_1.assertConfirmationPrompt)(`You are about to increase your operator stake by ${(0, utils_js_1.formatARIOWithCommas)(increaseQty.toARIO())} ARIO\nAre you sure?`, o);
100
+ return ((0, utils_js_1.writeARIOFromOptions)(o).ario.increaseOperatorStake({
101
101
  increaseQty,
102
102
  }),
103
103
  (0, utils_js_1.writeActionTagsFromOptions)(o));
@@ -106,8 +106,8 @@ exports.increaseOperatorStake = increaseOperatorStake;
106
106
  async function decreaseOperatorStake(o) {
107
107
  const decreaseQty = (0, utils_js_1.requiredMIOFromOptions)(o, 'operatorStake');
108
108
  // TODO: Can assert stake is sufficient for action, and new target stake meets contract minimum
109
- await (0, utils_js_1.assertConfirmationPrompt)(`You are about to decrease your operator stake by ${(0, utils_js_1.formatIOWithCommas)(decreaseQty.toIO())} IO\nAre you sure?`, o);
110
- return (0, utils_js_1.writeIOFromOptions)(o).io.decreaseOperatorStake({
109
+ await (0, utils_js_1.assertConfirmationPrompt)(`You are about to decrease your operator stake by ${(0, utils_js_1.formatARIOWithCommas)(decreaseQty.toARIO())} ARIO\nAre you sure?`, o);
110
+ return (0, utils_js_1.writeARIOFromOptions)(o).ario.decreaseOperatorStake({
111
111
  decreaseQty,
112
112
  }, (0, utils_js_1.writeActionTagsFromOptions)(o));
113
113
  }
@@ -116,7 +116,7 @@ async function instantWithdrawal(o) {
116
116
  const vaultId = (0, utils_js_1.requiredStringFromOptions)(o, 'vaultId');
117
117
  const gatewayAddress = (0, utils_js_1.requiredAddressFromOptions)(o);
118
118
  await (0, utils_js_1.assertConfirmationPrompt)(`You are about to instantly withdraw from vault ${vaultId} for with gateway address ${gatewayAddress}\nAre you sure?`, o);
119
- return (0, utils_js_1.writeIOFromOptions)(o).io.instantWithdrawal({
119
+ return (0, utils_js_1.writeARIOFromOptions)(o).ario.instantWithdrawal({
120
120
  vaultId,
121
121
  gatewayAddress,
122
122
  }, (0, utils_js_1.writeActionTagsFromOptions)(o));
@@ -126,22 +126,22 @@ async function cancelWithdrawal(o) {
126
126
  const vaultId = (0, utils_js_1.requiredStringFromOptions)(o, 'vaultId');
127
127
  const gatewayAddress = (0, utils_js_1.requiredAddressFromOptions)(o);
128
128
  await (0, utils_js_1.assertConfirmationPrompt)(`You are about to cancel the pending withdrawal from vault ${vaultId} for with gateway address ${gatewayAddress}\nAre you sure?`, o);
129
- return (0, utils_js_1.writeIOFromOptions)(o).io.cancelWithdrawal({
129
+ return (0, utils_js_1.writeARIOFromOptions)(o).ario.cancelWithdrawal({
130
130
  vaultId,
131
131
  gatewayAddress,
132
132
  }, (0, utils_js_1.writeActionTagsFromOptions)(o));
133
133
  }
134
134
  exports.cancelWithdrawal = cancelWithdrawal;
135
135
  async function delegateStake(options) {
136
- const { io, signerAddress } = (0, utils_js_1.writeIOFromOptions)(options);
137
- const { target, ioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
138
- const mIOQuantity = ioQuantity.toMIO();
136
+ const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(options);
137
+ const { target, arioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
138
+ const mARIOQuantity = arioQuantity.toMARIO();
139
139
  if (!options.skipConfirmation) {
140
- const balance = await io.getBalance({ address: signerAddress });
141
- if (balance < mIOQuantity.valueOf()) {
142
- throw new Error(`Insufficient IO balance for delegating stake. Balance available: ${new index_js_1.mIOToken(balance).toIO()} IO`);
140
+ const balance = await ario.getBalance({ address: signerAddress });
141
+ if (balance < mARIOQuantity.valueOf()) {
142
+ throw new Error(`Insufficient ARIO balance for delegating stake. Balance available: ${new index_js_1.mARIOToken(balance).toARIO()} ARIO`);
143
143
  }
144
- const targetGateway = await io.getGateway({ address: target });
144
+ const targetGateway = await ario.getGateway({ address: target });
145
145
  if (targetGateway === undefined) {
146
146
  throw new Error(`Gateway not found for address: ${target}`);
147
147
  }
@@ -153,58 +153,58 @@ async function delegateStake(options) {
153
153
  const { confirm } = await (0, prompts_1.default)({
154
154
  type: 'confirm',
155
155
  name: 'confirm',
156
- message: `Target Gateway:\n${JSON.stringify(targetGateway, null, 2)}\n\nAre you sure you want to delegate ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO to ${target}?`,
156
+ message: `Target Gateway:\n${JSON.stringify(targetGateway, null, 2)}\n\nAre you sure you want to delegate ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO to ${target}?`,
157
157
  });
158
158
  if (!confirm) {
159
159
  return { message: 'Delegate stake aborted by user' };
160
160
  }
161
161
  }
162
- const result = await io.delegateStake({
162
+ const result = await ario.delegateStake({
163
163
  target,
164
- stakeQty: ioQuantity.toMIO(),
164
+ stakeQty: arioQuantity.toMARIO(),
165
165
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
166
166
  const output = {
167
167
  senderAddress: signerAddress,
168
168
  transferResult: result,
169
- message: `Successfully delegated ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO to ${target}`,
169
+ message: `Successfully delegated ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO to ${target}`,
170
170
  };
171
171
  return output;
172
172
  }
173
173
  exports.delegateStake = delegateStake;
174
174
  async function decreaseDelegateStake(options) {
175
- const io = (0, utils_js_1.writeIOFromOptions)(options).io;
176
- const { target, ioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
175
+ const ario = (0, utils_js_1.writeARIOFromOptions)(options).ario;
176
+ const { target, arioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
177
177
  const instant = options.instant ?? false;
178
178
  // TODO: Could assert sender is a delegate with enough stake to decrease
179
179
  // TODO: Could assert new target stake meets contract and target gateway minimums
180
180
  // TODO: Could present confirmation prompt with any fee for instant withdrawal (50% of the stake is put back into protocol??)
181
- await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you'd like to decrease delegated stake of ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO on gateway ${target}?`, options);
182
- const result = await io.decreaseDelegateStake({
181
+ await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you'd like to decrease delegated stake of ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO on gateway ${target}?`, options);
182
+ const result = await ario.decreaseDelegateStake({
183
183
  target,
184
- decreaseQty: ioQuantity.toMIO(),
184
+ decreaseQty: arioQuantity.toMARIO(),
185
185
  instant,
186
186
  });
187
187
  const output = {
188
188
  targetGateway: target,
189
189
  decreaseDelegateStakeResult: result,
190
- message: `Successfully decreased delegated stake of ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO to ${target}`,
190
+ message: `Successfully decreased delegated stake of ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO to ${target}`,
191
191
  };
192
192
  return output;
193
193
  }
194
194
  exports.decreaseDelegateStake = decreaseDelegateStake;
195
195
  async function redelegateStake(options) {
196
- const io = (0, utils_js_1.writeIOFromOptions)(options).io;
196
+ const ario = (0, utils_js_1.writeARIOFromOptions)(options).ario;
197
197
  const params = (0, utils_js_1.redelegateParamsFromOptions)(options);
198
198
  // TODO: Could assert target gateway exists
199
199
  // TODO: Could do assertion on source has enough stake to redelegate
200
200
  // TODO: Could do assertions on source/target min delegate stakes are met
201
- await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you'd like to redelegate stake of ${(0, utils_js_1.formatIOWithCommas)(params.stakeQty.toIO())} IO from ${params.source} to ${params.target}?`, options);
202
- const result = await io.redelegateStake(params);
201
+ await (0, utils_js_1.assertConfirmationPrompt)(`Are you sure you'd like to redelegate stake of ${(0, utils_js_1.formatARIOWithCommas)(params.stakeQty.toARIO())} ARIO from ${params.source} to ${params.target}?`, options);
202
+ const result = await ario.redelegateStake(params);
203
203
  const output = {
204
204
  sourceGateway: params.source,
205
205
  targetGateway: params.target,
206
206
  redelegateStakeResult: result,
207
- message: `Successfully re-delegated stake of ${(0, utils_js_1.formatIOWithCommas)(params.stakeQty.toIO())} IO from ${params.source} to ${params.target}`,
207
+ message: `Successfully re-delegated stake of ${(0, utils_js_1.formatARIOWithCommas)(params.stakeQty.toARIO())} ARIO from ${params.source} to ${params.target}`,
208
208
  };
209
209
  return output;
210
210
  }
@@ -21,20 +21,20 @@ const token_js_1 = require("../../types/token.js");
21
21
  const utils_js_1 = require("../utils.js");
22
22
  async function getGateway(o) {
23
23
  const address = (0, utils_js_1.requiredAddressFromOptions)(o);
24
- const gateway = await (0, utils_js_1.readIOFromOptions)(o).getGateway({
24
+ const gateway = await (0, utils_js_1.readARIOFromOptions)(o).getGateway({
25
25
  address,
26
26
  });
27
27
  return gateway ?? { message: `No gateway found for address ${address}` };
28
28
  }
29
29
  exports.getGateway = getGateway;
30
30
  async function listGateways(o) {
31
- const gateways = await (0, utils_js_1.readIOFromOptions)(o).getGateways((0, utils_js_1.paginationParamsFromOptions)(o));
31
+ const gateways = await (0, utils_js_1.readARIOFromOptions)(o).getGateways((0, utils_js_1.paginationParamsFromOptions)(o));
32
32
  return gateways.items.length ? gateways : { message: 'No gateways found' };
33
33
  }
34
34
  exports.listGateways = listGateways;
35
35
  async function getGatewayDelegates(o) {
36
36
  const address = (0, utils_js_1.requiredAddressFromOptions)(o);
37
- const result = await (0, utils_js_1.readIOFromOptions)(o).getGatewayDelegates({
37
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getGatewayDelegates({
38
38
  address,
39
39
  ...(0, utils_js_1.paginationParamsFromOptions)(o),
40
40
  });
@@ -47,7 +47,7 @@ async function getGatewayDelegates(o) {
47
47
  exports.getGatewayDelegates = getGatewayDelegates;
48
48
  async function getDelegations(o) {
49
49
  const address = (0, utils_js_1.requiredAddressFromOptions)(o);
50
- const result = await (0, utils_js_1.readIOFromOptions)(o).getDelegations({
50
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getDelegations({
51
51
  address,
52
52
  ...(0, utils_js_1.paginationParamsFromOptions)(o),
53
53
  });
@@ -60,7 +60,7 @@ async function getDelegations(o) {
60
60
  exports.getDelegations = getDelegations;
61
61
  async function getAllowedDelegates(o) {
62
62
  const address = (0, utils_js_1.requiredAddressFromOptions)(o);
63
- const result = await (0, utils_js_1.readIOFromOptions)(o).getAllowedDelegates({
63
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getAllowedDelegates({
64
64
  address,
65
65
  ...(0, utils_js_1.paginationParamsFromOptions)(o),
66
66
  });
@@ -73,25 +73,25 @@ async function getAllowedDelegates(o) {
73
73
  exports.getAllowedDelegates = getAllowedDelegates;
74
74
  async function getArNSRecord(o) {
75
75
  const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
76
- return ((await (0, utils_js_1.readIOFromOptions)(o).getArNSRecord({
76
+ return ((await (0, utils_js_1.readARIOFromOptions)(o).getArNSRecord({
77
77
  name,
78
78
  })) ?? { message: `No record found for name ${name}` });
79
79
  }
80
80
  exports.getArNSRecord = getArNSRecord;
81
81
  async function listArNSRecords(o) {
82
- const records = await (0, utils_js_1.readIOFromOptions)(o).getArNSRecords((0, utils_js_1.paginationParamsFromOptions)(o));
82
+ const records = await (0, utils_js_1.readARIOFromOptions)(o).getArNSRecords((0, utils_js_1.paginationParamsFromOptions)(o));
83
83
  return records.items.length ? records : { message: 'No records found' };
84
84
  }
85
85
  exports.listArNSRecords = listArNSRecords;
86
86
  async function getArNSReservedName(o) {
87
87
  const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
88
- return ((await (0, utils_js_1.readIOFromOptions)(o).getArNSReservedName({
88
+ return ((await (0, utils_js_1.readARIOFromOptions)(o).getArNSReservedName({
89
89
  name,
90
90
  })) ?? { message: `No reserved name found for name ${name}` });
91
91
  }
92
92
  exports.getArNSReservedName = getArNSReservedName;
93
93
  async function listArNSReservedNames(o) {
94
- const reservedNames = await (0, utils_js_1.readIOFromOptions)(o).getArNSReservedNames((0, utils_js_1.paginationParamsFromOptions)(o));
94
+ const reservedNames = await (0, utils_js_1.readARIOFromOptions)(o).getArNSReservedNames((0, utils_js_1.paginationParamsFromOptions)(o));
95
95
  return reservedNames.items.length
96
96
  ? reservedNames
97
97
  : { message: 'No reserved names found' };
@@ -99,25 +99,25 @@ async function listArNSReservedNames(o) {
99
99
  exports.listArNSReservedNames = listArNSReservedNames;
100
100
  async function getArNSReturnedName(o) {
101
101
  const name = (0, utils_js_1.requiredStringFromOptions)(o, 'name');
102
- const result = await (0, utils_js_1.readIOFromOptions)(o).getArNSReturnedName({ name });
102
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getArNSReturnedName({ name });
103
103
  return result ?? { message: `No returned name found for name ${name}` };
104
104
  }
105
105
  exports.getArNSReturnedName = getArNSReturnedName;
106
106
  async function listArNSReturnedNames(o) {
107
- const returnedNames = await (0, utils_js_1.readIOFromOptions)(o).getArNSReturnedNames((0, utils_js_1.paginationParamsFromOptions)(o));
107
+ const returnedNames = await (0, utils_js_1.readARIOFromOptions)(o).getArNSReturnedNames((0, utils_js_1.paginationParamsFromOptions)(o));
108
108
  return returnedNames.items.length
109
109
  ? returnedNames
110
110
  : { message: 'No returned names found' };
111
111
  }
112
112
  exports.listArNSReturnedNames = listArNSReturnedNames;
113
113
  async function getEpoch(o) {
114
- const epoch = await (0, utils_js_1.readIOFromOptions)(o).getEpoch((0, utils_js_1.epochInputFromOptions)(o));
114
+ const epoch = await (0, utils_js_1.readARIOFromOptions)(o).getEpoch((0, utils_js_1.epochInputFromOptions)(o));
115
115
  return epoch ?? { message: `No epoch found for provided input` };
116
116
  }
117
117
  exports.getEpoch = getEpoch;
118
118
  async function getPrescribedObservers(o) {
119
119
  const epoch = (0, utils_js_1.epochInputFromOptions)(o);
120
- const result = await (0, utils_js_1.readIOFromOptions)(o).getPrescribedObservers(epoch);
120
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getPrescribedObservers(epoch);
121
121
  return result?.length
122
122
  ? result
123
123
  : { message: `No prescribed observers found for epoch ${epoch}` };
@@ -125,7 +125,7 @@ async function getPrescribedObservers(o) {
125
125
  exports.getPrescribedObservers = getPrescribedObservers;
126
126
  async function getPrescribedNames(o) {
127
127
  const epoch = (0, utils_js_1.epochInputFromOptions)(o);
128
- const result = await (0, utils_js_1.readIOFromOptions)(o).getPrescribedNames((0, utils_js_1.epochInputFromOptions)(o));
128
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getPrescribedNames((0, utils_js_1.epochInputFromOptions)(o));
129
129
  return result?.length
130
130
  ? result
131
131
  : { message: `No prescribed names found for epoch ${epoch}` };
@@ -145,7 +145,7 @@ async function getTokenCost(o) {
145
145
  o.years === undefined) {
146
146
  throw new Error('Years is required for lease type');
147
147
  }
148
- const tokenCost = await (0, utils_js_1.readIOFromOptions)(o).getTokenCost({
148
+ const tokenCost = await (0, utils_js_1.readARIOFromOptions)(o).getTokenCost({
149
149
  type: o.type,
150
150
  quantity: o.quantity !== undefined ? +o.quantity : undefined,
151
151
  years: o.years !== undefined ? +o.years : undefined,
@@ -154,7 +154,7 @@ async function getTokenCost(o) {
154
154
  });
155
155
  const output = {
156
156
  mIOTokenCost: tokenCost,
157
- message: `The cost of the provided action is ${(0, utils_js_1.formatIOWithCommas)(new token_js_1.mIOToken(tokenCost).toIO())} IO`,
157
+ message: `The cost of the provided action is ${(0, utils_js_1.formatARIOWithCommas)(new token_js_1.mARIOToken(tokenCost).toARIO())} ARIO`,
158
158
  };
159
159
  return output;
160
160
  }
@@ -170,7 +170,7 @@ async function getPrimaryName(o) {
170
170
  if (params === undefined) {
171
171
  throw new Error('Either --address or --name is required');
172
172
  }
173
- const result = await (0, utils_js_1.readIOFromOptions)(o).getPrimaryName(params);
173
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getPrimaryName(params);
174
174
  return (result ?? {
175
175
  message: `No primary name found`,
176
176
  });
@@ -178,7 +178,7 @@ async function getPrimaryName(o) {
178
178
  exports.getPrimaryName = getPrimaryName;
179
179
  async function getGatewayVaults(o) {
180
180
  const address = (0, utils_js_1.requiredAddressFromOptions)(o);
181
- const result = await (0, utils_js_1.readIOFromOptions)(o).getGatewayVaults({
181
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getGatewayVaults({
182
182
  address,
183
183
  ...(0, utils_js_1.paginationParamsFromOptions)(o),
184
184
  });
@@ -190,7 +190,7 @@ async function getGatewayVaults(o) {
190
190
  }
191
191
  exports.getGatewayVaults = getGatewayVaults;
192
192
  async function getVault(o) {
193
- return (0, utils_js_1.readIOFromOptions)(o)
193
+ return (0, utils_js_1.readARIOFromOptions)(o)
194
194
  .getVault({
195
195
  address: (0, utils_js_1.requiredAddressFromOptions)(o),
196
196
  vaultId: (0, utils_js_1.requiredStringFromOptions)(o, 'vaultId'),
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transfer = void 0;
4
4
  const utils_js_1 = require("../utils.js");
5
5
  async function transfer(options) {
6
- const { target, ioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
7
- const { io, signerAddress } = (0, utils_js_1.writeIOFromOptions)(options);
6
+ const { target, arioQuantity } = (0, utils_js_1.requiredTargetAndQuantityFromOptions)(options);
7
+ const { ario, signerAddress } = (0, utils_js_1.writeARIOFromOptions)(options);
8
8
  if (!options.skipConfirmation) {
9
- await (0, utils_js_1.assertEnoughBalance)(io, signerAddress, ioQuantity);
10
- const confirm = await (0, utils_js_1.confirmationPrompt)(`Are you sure you want to transfer ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO to ${target}?`);
9
+ await (0, utils_js_1.assertEnoughBalance)(ario, signerAddress, arioQuantity);
10
+ const confirm = await (0, utils_js_1.confirmationPrompt)(`Are you sure you want to transfer ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO to ${target}?`);
11
11
  if (!confirm) {
12
12
  return { message: 'Transfer aborted by user' };
13
13
  }
14
14
  }
15
- const result = await io.transfer({
15
+ const result = await ario.transfer({
16
16
  target,
17
- qty: ioQuantity.toMIO().valueOf(),
17
+ qty: arioQuantity.toMARIO().valueOf(),
18
18
  }, (0, utils_js_1.writeActionTagsFromOptions)(options));
19
19
  const output = {
20
20
  senderAddress: signerAddress,
21
21
  transferResult: result,
22
- message: `Successfully transferred ${(0, utils_js_1.formatIOWithCommas)(ioQuantity)} IO to ${target}`,
22
+ message: `Successfully transferred ${(0, utils_js_1.formatARIOWithCommas)(arioQuantity)} ARIO to ${target}`,
23
23
  };
24
24
  return output;
25
25
  }
@@ -34,8 +34,8 @@ exports.optionMap = {
34
34
  description: 'Run against the AR.IO devnet process',
35
35
  type: 'boolean',
36
36
  },
37
- ioProcessId: {
38
- alias: '--io-process-id',
37
+ arioProcessId: {
38
+ alias: '--ario-process-id <arioProcessId>',
39
39
  description: 'Run against a custom AR.IO process id',
40
40
  },
41
41
  cuUrl: {
@@ -65,7 +65,7 @@ exports.optionMap = {
65
65
  },
66
66
  quantity: {
67
67
  alias: '-q, --quantity <quantity>',
68
- description: 'The quantity of IO to interact with',
68
+ description: 'The quantity of ARIO to interact with',
69
69
  },
70
70
  autoStake: {
71
71
  alias: '--auto-stake',
@@ -247,7 +247,7 @@ exports.globalOptions = [
247
247
  ...exports.walletOptions,
248
248
  exports.optionMap.dev,
249
249
  exports.optionMap.debug,
250
- exports.optionMap.ioProcessId,
250
+ exports.optionMap.arioProcessId,
251
251
  exports.optionMap.cuUrl,
252
252
  ];
253
253
  exports.writeActionOptions = [exports.optionMap.skipConfirmation, exports.optionMap.tags];