@ar.io/sdk 3.10.0-alpha.1 → 3.10.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 (63) hide show
  1. package/README.md +124 -140
  2. package/bundles/web.bundle.min.js +150 -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 +150 -0
  12. package/lib/cjs/common/index.js +1 -0
  13. package/lib/cjs/common/io.js +71 -55
  14. package/lib/cjs/types/ant.js +2 -2
  15. package/lib/cjs/types/faucet.js +2 -0
  16. package/lib/cjs/types/index.js +1 -0
  17. package/lib/cjs/types/io.js +8 -7
  18. package/lib/cjs/utils/ao.js +11 -9
  19. package/lib/cjs/utils/arweave.js +4 -4
  20. package/lib/cjs/utils/base64.js +4 -5
  21. package/lib/cjs/utils/json.js +1 -2
  22. package/lib/cjs/utils/schema.js +1 -2
  23. package/lib/cjs/version.js +1 -1
  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/faucet.js +145 -0
  28. package/lib/esm/common/index.js +1 -0
  29. package/lib/esm/common/io.js +70 -54
  30. package/lib/esm/types/index.js +1 -0
  31. package/lib/esm/types/io.js +4 -3
  32. package/lib/esm/utils/ao.js +2 -0
  33. package/lib/esm/version.js +1 -1
  34. package/lib/types/cli/commands/antCommands.d.ts +3 -3
  35. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +1 -1
  36. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +9 -9
  37. package/lib/types/cli/commands/readCommands.d.ts +3 -4
  38. package/lib/types/cli/commands/transfer.d.ts +3 -3
  39. package/lib/types/cli/options.d.ts +0 -9
  40. package/lib/types/cli/types.d.ts +0 -3
  41. package/lib/types/cli/utils.d.ts +1 -5
  42. package/lib/types/common/ant-versions.d.ts +6 -3
  43. package/lib/types/common/faucet.d.ts +96 -0
  44. package/lib/types/common/http.d.ts +0 -1
  45. package/lib/types/common/index.d.ts +1 -0
  46. package/lib/types/common/io.d.ts +22 -13
  47. package/lib/types/types/common.d.ts +1 -7
  48. package/lib/types/types/faucet.d.ts +82 -0
  49. package/lib/types/types/index.d.ts +1 -0
  50. package/lib/types/types/io.d.ts +9 -10
  51. package/lib/types/types/token.d.ts +0 -1
  52. package/lib/types/utils/base64.d.ts +0 -1
  53. package/lib/types/version.d.ts +1 -1
  54. package/package.json +5 -7
  55. package/lib/cjs/common/turbo.js +0 -134
  56. package/lib/cjs/utils/url.js +0 -28
  57. package/lib/cjs/utils/url.test.js +0 -24
  58. package/lib/esm/common/turbo.js +0 -129
  59. package/lib/esm/utils/url.js +0 -24
  60. package/lib/esm/utils/url.test.js +0 -19
  61. package/lib/types/common/turbo.d.ts +0 -47
  62. package/lib/types/utils/url.d.ts +0 -19
  63. /package/lib/{types/utils/url.test.d.ts → esm/types/faucet.js} +0 -0
@@ -1,14 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ARIOWriteable = exports.ARIOReadable = exports.ARIO = void 0;
4
+ /**
5
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const aoconnect_1 = require("@permaweb/aoconnect");
4
20
  const constants_js_1 = require("../constants.js");
5
- const io_js_1 = require("../types/io.js");
21
+ const index_js_1 = require("../types/index.js");
6
22
  const ao_js_1 = require("../utils/ao.js");
7
23
  const arweave_js_1 = require("../utils/arweave.js");
8
24
  const arweave_js_2 = require("./arweave.js");
9
25
  const ao_process_js_1 = require("./contracts/ao-process.js");
10
26
  const error_js_1 = require("./error.js");
11
- const turbo_js_1 = require("./turbo.js");
27
+ const faucet_js_1 = require("./faucet.js");
12
28
  class ARIO {
13
29
  // Implementation
14
30
  static init(config) {
@@ -17,13 +33,62 @@ class ARIO {
17
33
  }
18
34
  return new ARIOReadable(config);
19
35
  }
36
+ static mainnet(config) {
37
+ if (config !== undefined && 'signer' in config) {
38
+ return new ARIOWriteable({
39
+ ...config,
40
+ process: new ao_process_js_1.AOProcess({
41
+ processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
42
+ ao: (0, aoconnect_1.connect)({
43
+ CU_URL: 'https://cu.ardrive.io',
44
+ ...config?.process?.ao,
45
+ }),
46
+ }),
47
+ });
48
+ }
49
+ return new ARIOReadable({
50
+ ...config,
51
+ process: new ao_process_js_1.AOProcess({
52
+ processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
53
+ }),
54
+ });
55
+ }
56
+ static testnet(config) {
57
+ if (config !== undefined && 'signer' in config) {
58
+ return (0, faucet_js_1.createFaucet)({
59
+ arioInstance: new ARIOWriteable({
60
+ ...config,
61
+ process: new ao_process_js_1.AOProcess({
62
+ processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
63
+ ao: (0, aoconnect_1.connect)({
64
+ CU_URL: 'https://cu.ardrive.io',
65
+ ...config?.process?.ao,
66
+ }),
67
+ }),
68
+ }),
69
+ faucetApiUrl: config?.faucetUrl,
70
+ });
71
+ }
72
+ return (0, faucet_js_1.createFaucet)({
73
+ arioInstance: new ARIOReadable({
74
+ ...config,
75
+ process: new ao_process_js_1.AOProcess({
76
+ processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
77
+ ao: (0, aoconnect_1.connect)({
78
+ CU_URL: 'https://cu.ardrive.io',
79
+ ...config?.process?.ao,
80
+ }),
81
+ }),
82
+ }),
83
+ faucetApiUrl: config?.faucetUrl,
84
+ });
85
+ }
20
86
  }
21
87
  exports.ARIO = ARIO;
22
88
  class ARIOReadable {
23
89
  process;
24
90
  epochSettings;
25
91
  arweave;
26
- paymentProvider; // TODO: this could be an array/map of payment providers
27
92
  constructor(config) {
28
93
  this.arweave = config?.arweave ?? arweave_js_2.defaultArweave;
29
94
  if (config === undefined || Object.keys(config).length === 0) {
@@ -31,10 +96,10 @@ class ARIOReadable {
31
96
  processId: constants_js_1.ARIO_MAINNET_PROCESS_ID,
32
97
  });
33
98
  }
34
- else if ((0, io_js_1.isProcessConfiguration)(config)) {
99
+ else if ((0, index_js_1.isProcessConfiguration)(config)) {
35
100
  this.process = config.process;
36
101
  }
37
- else if ((0, io_js_1.isProcessIdConfiguration)(config)) {
102
+ else if ((0, index_js_1.isProcessIdConfiguration)(config)) {
38
103
  this.process = new ao_process_js_1.AOProcess({
39
104
  processId: config.processId,
40
105
  });
@@ -42,9 +107,6 @@ class ARIOReadable {
42
107
  else {
43
108
  throw new error_js_1.InvalidContractConfigurationError();
44
109
  }
45
- this.paymentProvider = new turbo_js_1.TurboArNSPaymentProvider({
46
- paymentUrl: config?.paymentUrl,
47
- });
48
110
  }
49
111
  async getInfo() {
50
112
  return this.process.read({
@@ -376,20 +438,6 @@ class ARIOReadable {
376
438
  // TODO: Can overload this function to refine different types of cost details params
377
439
  async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
378
440
  const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
379
- if (fundFrom === 'turbo') {
380
- const { mARIO, winc } = await this.paymentProvider.getArNSPriceDetails({
381
- intent: replacedBuyRecordWithBuyName,
382
- name,
383
- quantity,
384
- type,
385
- years,
386
- });
387
- return {
388
- tokenCost: +mARIO,
389
- wincQty: winc,
390
- discounts: [],
391
- };
392
- }
393
441
  const allTags = [
394
442
  { name: 'Action', value: 'Cost-Details' },
395
443
  {
@@ -557,8 +605,7 @@ class ARIOReadable {
557
605
  exports.ARIOReadable = ARIOReadable;
558
606
  class ARIOWriteable extends ARIOReadable {
559
607
  signer;
560
- paymentProvider;
561
- constructor({ signer, paymentUrl, ...config }) {
608
+ constructor({ signer, ...config }) {
562
609
  if (config === undefined) {
563
610
  super({
564
611
  process: new ao_process_js_1.AOProcess({
@@ -570,10 +617,6 @@ class ARIOWriteable extends ARIOReadable {
570
617
  super(config);
571
618
  }
572
619
  this.signer = (0, ao_js_1.createAoSigner)(signer);
573
- this.paymentProvider = new turbo_js_1.TurboArNSPaymentProvider({
574
- signer: signer,
575
- paymentUrl,
576
- });
577
620
  }
578
621
  async transfer({ target, qty, }, options) {
579
622
  const { tags = [] } = options || {};
@@ -848,12 +891,6 @@ class ARIOWriteable extends ARIOReadable {
848
891
  });
849
892
  }
850
893
  async buyRecord(params, options) {
851
- if (params.fundFrom === 'turbo') {
852
- return this.paymentProvider.initiateArNSPurchase({
853
- intent: 'Buy-Name',
854
- ...params,
855
- });
856
- }
857
894
  const { tags = [] } = options || {};
858
895
  const allTags = [
859
896
  ...tags,
@@ -878,12 +915,6 @@ class ARIOWriteable extends ARIOReadable {
878
915
  * @returns {Promise<AoMessageResult>} The result of the upgrade
879
916
  */
880
917
  async upgradeRecord(params, options) {
881
- if (params.fundFrom === 'turbo') {
882
- return this.paymentProvider.initiateArNSPurchase({
883
- intent: 'Upgrade-Name',
884
- name: params.name,
885
- });
886
- }
887
918
  const { tags = [] } = options || {};
888
919
  const allTags = [
889
920
  ...tags,
@@ -906,12 +937,6 @@ class ARIOWriteable extends ARIOReadable {
906
937
  * @returns {Promise<AoMessageResult>} The result of the extension
907
938
  */
908
939
  async extendLease(params, options) {
909
- if (params.fundFrom === 'turbo') {
910
- return this.paymentProvider.initiateArNSPurchase({
911
- intent: 'Extend-Lease',
912
- ...params,
913
- });
914
- }
915
940
  const { tags = [] } = options || {};
916
941
  const allTags = [
917
942
  ...tags,
@@ -926,12 +951,6 @@ class ARIOWriteable extends ARIOReadable {
926
951
  });
927
952
  }
928
953
  async increaseUndernameLimit(params, options) {
929
- if (params.fundFrom === 'turbo') {
930
- return this.paymentProvider.initiateArNSPurchase({
931
- intent: 'Increase-Undername-Limit',
932
- ...params,
933
- });
934
- }
935
954
  const { tags = [] } = options || {};
936
955
  const allTags = [
937
956
  ...tags,
@@ -968,9 +987,6 @@ class ARIOWriteable extends ARIOReadable {
968
987
  });
969
988
  }
970
989
  async requestPrimaryName(params, options) {
971
- if (params.fundFrom === 'turbo') {
972
- throw new Error('Turbo funding is not yet supported for primary name requests');
973
- }
974
990
  const { tags = [] } = options || {};
975
991
  const allTags = [
976
992
  ...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.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
  *
@@ -136,4 +137,3 @@ exports.AntInfoSchema = zod_1.z.object({
136
137
  function isAoANTState(state) {
137
138
  return exports.AntStateSchema.safeParse(state).success;
138
139
  }
139
- exports.isAoANTState = isAoANTState;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -32,5 +32,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
32
32
  __exportStar(require("./ant-registry.js"), exports);
33
33
  __exportStar(require("./ant.js"), exports);
34
34
  __exportStar(require("./common.js"), exports);
35
+ __exportStar(require("./faucet.js"), exports);
35
36
  __exportStar(require("./io.js"), exports);
36
37
  __exportStar(require("./token.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,23 +31,21 @@ 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
  };
35
38
  exports.isValidFundFrom = isValidFundFrom;
36
39
  // Type-guard functions
37
40
  function isProcessConfiguration(config) {
38
- return 'process' in config;
41
+ return config !== undefined && 'process' in config;
39
42
  }
40
- exports.isProcessConfiguration = isProcessConfiguration;
41
43
  function isProcessIdConfiguration(config) {
42
- return ('processId' in config &&
44
+ return (config !== undefined &&
45
+ 'processId' in config &&
43
46
  typeof config.processId === 'string' &&
44
47
  (0, arweave_js_1.validateArweaveId)(config.processId) === true);
45
48
  }
46
- exports.isProcessIdConfiguration = isProcessIdConfiguration;
47
49
  function isLeasedArNSRecord(record) {
48
50
  return record.type === 'lease';
49
51
  }
50
- exports.isLeasedArNSRecord = isLeasedArNSRecord;
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeUnicodeFromError = exports.errorMessageFromOutput = exports.parseAoEpochData = exports.initANTStateForAddress = exports.defaultANTLogoId = exports.defaultTargetManifestId = exports.createAoSigner = exports.isAoSigner = exports.evolveANT = exports.spawnANT = void 0;
3
+ exports.defaultANTLogoId = exports.defaultTargetManifestId = void 0;
4
+ exports.spawnANT = spawnANT;
5
+ exports.evolveANT = evolveANT;
6
+ exports.isAoSigner = isAoSigner;
7
+ exports.createAoSigner = createAoSigner;
8
+ exports.initANTStateForAddress = initANTStateForAddress;
9
+ exports.parseAoEpochData = parseAoEpochData;
10
+ exports.errorMessageFromOutput = errorMessageFromOutput;
11
+ exports.removeUnicodeFromError = removeUnicodeFromError;
4
12
  /**
5
13
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
14
  *
@@ -48,7 +56,6 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0
48
56
  });
49
57
  return processId;
50
58
  }
51
- exports.spawnANT = spawnANT;
52
59
  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, }) {
53
60
  const aosClient = new index_js_1.AOProcess({
54
61
  processId,
@@ -75,7 +82,6 @@ async function evolveANT({ signer, processId, luaCodeTxId = constants_js_1.ANT_L
75
82
  });
76
83
  return evolveMsgId;
77
84
  }
78
- exports.evolveANT = evolveANT;
79
85
  function isAoSigner(value) {
80
86
  const TagSchema = zod_1.z.object({
81
87
  name: zod_1.z.string(),
@@ -101,7 +107,6 @@ function isAoSigner(value) {
101
107
  return false;
102
108
  }
103
109
  }
104
- exports.isAoSigner = isAoSigner;
105
110
  function createAoSigner(signer) {
106
111
  if (isAoSigner(signer)) {
107
112
  return signer;
@@ -137,9 +142,10 @@ function createAoSigner(signer) {
137
142
  }));
138
143
  return signedData;
139
144
  };
145
+ // eslint-disable-next-line
146
+ // @ts-ignore Buffer vs ArrayBuffer type mismatch
140
147
  return aoSigner;
141
148
  }
142
- exports.createAoSigner = createAoSigner;
143
149
  exports.defaultTargetManifestId = '-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI';
144
150
  exports.defaultANTLogoId = 'Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A';
145
151
  function initANTStateForAddress({ owner, targetId, ttlSeconds = 3600, keywords = [], controllers = [], description = '', ticker = 'aos', name = 'ANT', logo = exports.defaultANTLogoId, }) {
@@ -160,7 +166,6 @@ function initANTStateForAddress({ owner, targetId, ttlSeconds = 3600, keywords =
160
166
  logo,
161
167
  };
162
168
  }
163
- exports.initANTStateForAddress = initANTStateForAddress;
164
169
  /**
165
170
  * Uses zod schema to parse the epoch data
166
171
  */
@@ -177,7 +182,6 @@ function parseAoEpochData(value) {
177
182
  });
178
183
  return epochDataSchema.parse(value);
179
184
  }
180
- exports.parseAoEpochData = parseAoEpochData;
181
185
  function errorMessageFromOutput(output) {
182
186
  const errorData = output.Error;
183
187
  // Attempt to extract error details from Messages.Tags if Error is undefined
@@ -196,7 +200,6 @@ function errorMessageFromOutput(output) {
196
200
  }
197
201
  return undefined;
198
202
  }
199
- exports.errorMessageFromOutput = errorMessageFromOutput;
200
203
  function removeUnicodeFromError(error) {
201
204
  //The regular expression /[\u001b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g is designed to match ANSI escape codes used for terminal formatting. These are sequences that begin with \u001b (ESC character) and are often followed by [ and control codes.
202
205
  const ESC = String.fromCharCode(27); // Represents '\u001b' or '\x1b'
@@ -204,4 +207,3 @@ function removeUnicodeFromError(error) {
204
207
  .replace(new RegExp(`${ESC}[\\[\\]()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`, 'g'), '')
205
208
  .trim();
206
209
  }
207
- exports.removeUnicodeFromError = removeUnicodeFromError;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeEligibleRewardsFromEpochData = exports.sortAndPaginateEpochDataIntoEligibleDistributions = exports.epochDistributionNoticeGqlQueryFallback = exports.epochDistributionNoticeGqlQuery = exports.getEpochDataFromGqlFallback = exports.getEpochDataFromGqlWithCUFallback = exports.getEpochDataFromGql = exports.paginationParamsToTags = exports.pruneTags = exports.isBlockHeight = exports.validateArweaveId = void 0;
3
+ exports.epochDistributionNoticeGqlQueryFallback = exports.epochDistributionNoticeGqlQuery = exports.getEpochDataFromGqlFallback = exports.getEpochDataFromGqlWithCUFallback = exports.getEpochDataFromGql = exports.paginationParamsToTags = exports.pruneTags = exports.validateArweaveId = void 0;
4
+ exports.isBlockHeight = isBlockHeight;
5
+ exports.sortAndPaginateEpochDataIntoEligibleDistributions = sortAndPaginateEpochDataIntoEligibleDistributions;
6
+ exports.removeEligibleRewardsFromEpochData = removeEligibleRewardsFromEpochData;
4
7
  const constants_js_1 = require("../constants.js");
5
8
  const io_js_1 = require("../types/io.js");
6
9
  const ao_js_1 = require("./ao.js");
@@ -11,7 +14,6 @@ exports.validateArweaveId = validateArweaveId;
11
14
  function isBlockHeight(height) {
12
15
  return height !== undefined && !isNaN(parseInt(height.toString()));
13
16
  }
14
- exports.isBlockHeight = isBlockHeight;
15
17
  /**
16
18
  * Prune tags that are undefined or empty.
17
19
  * @param tags - The tags to prune.
@@ -251,7 +253,6 @@ function sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params) {
251
253
  sortBy,
252
254
  };
253
255
  }
254
- exports.sortAndPaginateEpochDataIntoEligibleDistributions = sortAndPaginateEpochDataIntoEligibleDistributions;
255
256
  function removeEligibleRewardsFromEpochData(epochData) {
256
257
  if (!(0, io_js_1.isDistributedEpoch)(epochData)) {
257
258
  return epochData;
@@ -268,4 +269,3 @@ function removeEligibleRewardsFromEpochData(epochData) {
268
269
  },
269
270
  };
270
271
  }
271
- exports.removeEligibleRewardsFromEpochData = removeEligibleRewardsFromEpochData;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRandomText = exports.sha256B64Url = exports.toB64Url = exports.fromB64Url = void 0;
3
+ exports.fromB64Url = fromB64Url;
4
+ exports.toB64Url = toB64Url;
5
+ exports.sha256B64Url = sha256B64Url;
6
+ exports.getRandomText = getRandomText;
4
7
  /**
5
8
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
9
  *
@@ -42,16 +45,13 @@ function fromB64Url(str) {
42
45
  const b64Str = base64urlToBase64(str);
43
46
  return Buffer.from(b64Str, 'base64');
44
47
  }
45
- exports.fromB64Url = fromB64Url;
46
48
  function toB64Url(buffer) {
47
49
  const b64Str = buffer.toString('base64');
48
50
  return base64urlFromBase64(b64Str);
49
51
  }
50
- exports.toB64Url = toB64Url;
51
52
  function sha256B64Url(input) {
52
53
  return toB64Url((0, crypto_1.createHash)('sha256').update(Uint8Array.from(input)).digest());
53
54
  }
54
- exports.sha256B64Url = sha256B64Url;
55
55
  function getRandomText(length = 32) {
56
56
  // Generate a buffer of random bytes
57
57
  const buffer = (0, crypto_1.randomBytes)(length);
@@ -60,4 +60,3 @@ function getRandomText(length = 32) {
60
60
  .join('')
61
61
  .slice(0, length);
62
62
  }
63
- exports.getRandomText = getRandomText;
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.safeDecode = void 0;
18
+ exports.safeDecode = safeDecode;
19
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
20
  function safeDecode(data) {
21
21
  try {
@@ -25,4 +25,3 @@ function safeDecode(data) {
25
25
  return data;
26
26
  }
27
27
  }
28
- exports.safeDecode = safeDecode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseSchemaResult = void 0;
3
+ exports.parseSchemaResult = parseSchemaResult;
4
4
  /**
5
5
  * @param schema - zod schema
6
6
  * @param v - value to parse
@@ -13,4 +13,3 @@ function parseSchemaResult(schema, v) {
13
13
  }
14
14
  return schemaResult;
15
15
  }
16
- exports.parseSchemaResult = parseSchemaResult;
@@ -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.10.0-alpha.1';
20
+ exports.version = '3.10.0';
@@ -49,10 +49,6 @@ export const optionMap = {
49
49
  alias: '--cu-url <cuUrl>',
50
50
  description: 'The URL for a custom compute unit',
51
51
  },
52
- paymentUrl: {
53
- alias: '--payment-url <paymentUrl>',
54
- description: 'The URL for a custom turbo payment service',
55
- },
56
52
  processId: {
57
53
  alias: '--process-id <processId>',
58
54
  description: 'The process ID to interact with',
@@ -273,15 +269,9 @@ export const optionMap = {
273
269
  alias: '--logo <logo>',
274
270
  description: 'The ANT logo',
275
271
  },
276
- token: {
277
- alias: '-t, --token <type>',
278
- description: 'Crypto token type for wallet or action',
279
- default: 'arweave',
280
- },
281
272
  };
282
273
  export const walletOptions = [
283
274
  optionMap.walletFile,
284
- optionMap.token,
285
275
  // optionMap.mnemonic,
286
276
  optionMap.privateKey,
287
277
  ];
@@ -299,7 +289,6 @@ export const arnsPurchaseOptions = [
299
289
  ...writeActionOptions,
300
290
  optionMap.name,
301
291
  optionMap.fundFrom,
302
- optionMap.paymentUrl,
303
292
  ];
304
293
  export const epochOptions = [optionMap.epochIndex, optionMap.timestamp];
305
294
  export const addressAndVaultIdOptions = [optionMap.address, optionMap.vaultId];
@@ -323,7 +312,6 @@ export const tokenCostOptions = [
323
312
  optionMap.quantity,
324
313
  optionMap.address,
325
314
  optionMap.fundFrom,
326
- optionMap.paymentUrl,
327
315
  ];
328
316
  export const transferOptions = [
329
317
  ...writeActionOptions,
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { EthereumSigner } from '@dha-team/arbundles';
17
16
  import { connect } from '@permaweb/aoconnect';
18
17
  import { program } from 'commander';
19
18
  import { readFileSync } from 'fs';
@@ -78,7 +77,7 @@ export function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, }) {
78
77
  }
79
78
  return ARIO_MAINNET_PROCESS_ID;
80
79
  }
81
- function walletFromOptions({ privateKey, walletFile, }) {
80
+ function jwkFromOptions({ privateKey, walletFile, }) {
82
81
  if (privateKey !== undefined) {
83
82
  return JSON.parse(privateKey);
84
83
  }
@@ -88,7 +87,7 @@ function walletFromOptions({ privateKey, walletFile, }) {
88
87
  return undefined;
89
88
  }
90
89
  export function requiredJwkFromOptions(options) {
91
- const jwk = walletFromOptions(options);
90
+ const jwk = jwkFromOptions(options);
92
91
  if (jwk === undefined) {
93
92
  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`');
94
93
  }
@@ -118,30 +117,13 @@ export function readARIOFromOptions(options) {
118
117
  setLoggerIfDebug(options);
119
118
  return ARIO.init({
120
119
  process: aoProcessFromOptions(options),
121
- paymentUrl: options.paymentUrl,
122
120
  });
123
121
  }
124
- export function contractSignerFromOptions(options) {
125
- const wallet = walletFromOptions(options);
126
- if (wallet === undefined) {
127
- return undefined;
128
- }
129
- const token = options.token ?? 'arweave';
130
- if (token === 'ethereum') {
131
- const signer = new EthereumSigner(wallet);
132
- // For EthereumSigner, we need to convert the JWK to a string
133
- return { signer, signerAddress: signer.publicKey.toString('hex') };
134
- }
135
- // TODO: Support other wallet types
136
- const signer = new ArweaveSigner(wallet);
137
- return { signer, signerAddress: jwkToAddress(wallet) };
138
- }
139
122
  export function requiredContractSignerFromOptions(options) {
140
- const contractSigner = contractSignerFromOptions(options);
141
- if (contractSigner === undefined) {
142
- 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`');
143
- }
144
- return contractSigner;
123
+ // TODO: Support other wallet types
124
+ const jwk = requiredJwkFromOptions(options);
125
+ const signer = new ArweaveSigner(jwk);
126
+ return { signer, signerAddress: jwkToAddress(jwk) };
145
127
  }
146
128
  export function requiredAoSignerFromOptions(options) {
147
129
  return createAoSigner(requiredContractSignerFromOptions(options).signer);
@@ -153,7 +135,6 @@ export function writeARIOFromOptions(options) {
153
135
  ario: ARIO.init({
154
136
  process: aoProcessFromOptions(options),
155
137
  signer,
156
- paymentUrl: options.paymentUrl,
157
138
  }),
158
139
  signerAddress,
159
140
  };
@@ -174,9 +155,10 @@ export function addressFromOptions(options) {
174
155
  if (options.address !== undefined) {
175
156
  return options.address;
176
157
  }
177
- const signer = contractSignerFromOptions(options);
178
- if (signer !== undefined) {
179
- return signer.signerAddress;
158
+ // TODO: Support other wallet types
159
+ const jwk = jwkFromOptions(options);
160
+ if (jwk !== undefined) {
161
+ return jwkToAddress(jwk);
180
162
  }
181
163
  return undefined;
182
164
  }
@@ -299,9 +281,6 @@ export function requiredMARIOFromOptions(options, key) {
299
281
  return new ARIOToken(+options[key]).toMARIO();
300
282
  }
301
283
  export async function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsParams, }) {
302
- if (costDetailsParams.fundFrom === 'turbo') {
303
- return;
304
- }
305
284
  const costDetails = await ario.getCostDetails(costDetailsParams);
306
285
  if (costDetails.fundingPlan) {
307
286
  if (costDetails.fundingPlan.shortfall > 0) {
@@ -70,14 +70,14 @@ 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, { tags }) {
74
74
  return this.process.send({
75
75
  tags: pruneTags([
76
76
  { name: 'Action', value: 'Add-Version' },
77
- { name: 'Version', value: version },
78
- { name: 'Module-Id', value: moduleId },
79
- { name: 'Lua-Source-Id', value: luaSourceId },
80
- { name: 'Notes', value: notes },
77
+ { name: 'Version', value: params.version },
78
+ { name: 'Module-Id', value: params.moduleId },
79
+ { name: 'Lua-Source-Id', value: params.luaSourceId },
80
+ { name: 'Notes', value: params.notes },
81
81
  ...(tags ?? []),
82
82
  ]),
83
83
  signer: this.signer,