@ar.io/sdk 3.0.1-alpha.1 → 3.1.0-alpha.10

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 +38 -0
  2. package/bundles/web.bundle.min.js +79 -79
  3. package/lib/cjs/cli/cli.js +27 -71
  4. package/lib/cjs/cli/commands/arnsPurchaseCommands.js +167 -0
  5. package/lib/cjs/cli/commands/gatewayWriteCommands.js +8 -4
  6. package/lib/cjs/cli/commands/readCommands.js +17 -38
  7. package/lib/cjs/cli/commands/transfer.js +5 -1
  8. package/lib/cjs/cli/options.js +14 -7
  9. package/lib/cjs/cli/utils.js +59 -7
  10. package/lib/cjs/common/contracts/ao-process.js +41 -19
  11. package/lib/cjs/common/io.js +107 -101
  12. package/lib/cjs/types/io.js +6 -1
  13. package/lib/cjs/utils/arweave.js +22 -13
  14. package/lib/cjs/version.js +1 -1
  15. package/lib/esm/cli/cli.js +30 -74
  16. package/lib/esm/cli/commands/arnsPurchaseCommands.js +159 -0
  17. package/lib/esm/cli/commands/gatewayWriteCommands.js +6 -2
  18. package/lib/esm/cli/commands/readCommands.js +16 -38
  19. package/lib/esm/cli/commands/transfer.js +6 -2
  20. package/lib/esm/cli/options.js +13 -6
  21. package/lib/esm/cli/utils.js +53 -5
  22. package/lib/esm/common/contracts/ao-process.js +41 -19
  23. package/lib/esm/common/io.js +108 -102
  24. package/lib/esm/types/io.js +4 -0
  25. package/lib/esm/utils/arweave.js +21 -11
  26. package/lib/esm/version.js +1 -1
  27. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +22 -0
  28. package/lib/types/cli/commands/readCommands.d.ts +24 -2
  29. package/lib/types/cli/options.d.ts +5 -9
  30. package/lib/types/cli/types.d.ts +3 -5
  31. package/lib/types/cli/utils.d.ts +25 -4
  32. package/lib/types/common/contracts/ao-process.d.ts +3 -1
  33. package/lib/types/common/io.d.ts +15 -43
  34. package/lib/types/types/common.d.ts +1 -0
  35. package/lib/types/types/io.d.ts +46 -12
  36. package/lib/types/utils/arweave.d.ts +6 -18
  37. package/lib/types/version.d.ts +1 -1
  38. package/package.json +2 -2
@@ -28,7 +28,13 @@ export class AOProcess {
28
28
  this.logger = logger;
29
29
  this.ao = ao;
30
30
  }
31
- async read({ tags, retries = 3, }) {
31
+ isMessageDataEmpty(messageData) {
32
+ return (messageData === undefined ||
33
+ messageData === 'null' || // This is what the CU returns for 'nil' values that are json.encoded
34
+ messageData === '' ||
35
+ messageData === null);
36
+ }
37
+ async read({ tags, retries = 3, fromAddress, }) {
32
38
  let attempts = 0;
33
39
  let lastError;
34
40
  while (attempts < retries) {
@@ -37,27 +43,29 @@ export class AOProcess {
37
43
  tags,
38
44
  });
39
45
  // map tags to inputs
40
- const result = await this.ao.dryrun({
46
+ const dryRunInput = {
41
47
  process: this.processId,
42
48
  tags,
43
- });
49
+ };
50
+ if (fromAddress !== undefined) {
51
+ dryRunInput['Owner'] = fromAddress;
52
+ }
53
+ const result = await this.ao.dryrun(dryRunInput);
44
54
  this.logger.debug(`Read interaction result`, {
45
55
  result,
46
56
  });
57
+ const error = errorMessageFromOutput(result);
58
+ if (error !== undefined) {
59
+ throw new Error(error);
60
+ }
47
61
  if (result.Messages === undefined || result.Messages.length === 0) {
48
62
  this.logger.debug(`Process ${this.processId} does not support provided action.`, result, tags);
49
63
  throw new Error(`Process ${this.processId} does not support provided action.`);
50
64
  }
51
- const tagsOutput = result.Messages?.[0]?.Tags;
52
65
  const messageData = result.Messages?.[0]?.Data;
53
- const errorData = result.Error;
54
- const error = errorData || tagsOutput?.find((tag) => tag.name === 'Error')?.value;
55
- if (error) {
56
- throw new Error(`${error}${messageData ? `: ${messageData}` : ''}`);
57
- }
58
- // return empty object if no data is returned
59
- if (messageData === undefined) {
60
- return {};
66
+ // return undefined if no data is returned
67
+ if (this.isMessageDataEmpty(messageData)) {
68
+ return undefined;
61
69
  }
62
70
  const response = safeDecode(result.Messages[0].Data);
63
71
  return response;
@@ -65,7 +73,7 @@ export class AOProcess {
65
73
  catch (e) {
66
74
  attempts++;
67
75
  this.logger.debug(`Read attempt ${attempts} failed`, {
68
- error: e,
76
+ error: e instanceof Error ? e.message : e,
69
77
  tags,
70
78
  });
71
79
  lastError = e;
@@ -112,11 +120,8 @@ export class AOProcess {
112
120
  messageId,
113
121
  processId: this.processId,
114
122
  });
115
- const errorData = output.Error;
116
- const error = errorData ||
117
- output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')
118
- ?.value;
119
- if (error) {
123
+ const error = errorMessageFromOutput(output);
124
+ if (error !== undefined) {
120
125
  throw new WriteInteractionError(error);
121
126
  }
122
127
  // check if there are any Messages in the output
@@ -126,7 +131,7 @@ export class AOProcess {
126
131
  if (output.Messages.length === 0) {
127
132
  throw new Error(`Process ${this.processId} does not support provided action.`);
128
133
  }
129
- if (output.Messages[0].Data === undefined) {
134
+ if (this.isMessageDataEmpty(output.Messages[0].Data)) {
130
135
  return { id: messageId };
131
136
  }
132
137
  const resultData = safeDecode(output.Messages[0].Data);
@@ -163,3 +168,20 @@ export class AOProcess {
163
168
  throw lastError;
164
169
  }
165
170
  }
171
+ function errorMessageFromOutput(output) {
172
+ const errorData = output.Error;
173
+ if (errorData !== undefined) {
174
+ // TODO: Could clean this one up too, current error is verbose, but not always deterministic for parsing
175
+ // Throw the whole raw error if AO process level error
176
+ return errorData;
177
+ }
178
+ const error = output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
179
+ if (error !== undefined) {
180
+ // from [string "aos"]:6846: Name is already registered
181
+ const lineNumber = error.match(/\d+/)?.[0];
182
+ const message = error.replace(/\[string "aos"\]:\d+:/, '');
183
+ // to more user friendly: Name is already registered (line 6846)
184
+ return `${message} (line ${lineNumber})`.trim();
185
+ }
186
+ return undefined;
187
+ }
@@ -1,8 +1,22 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
  import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
2
17
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/io.js';
3
18
  import { createAoSigner } from '../utils/ao.js';
4
- import { getCurrentBlockUnixTimestampMs, paginationParamsToTags, pruneTags, } from '../utils/arweave.js';
5
- import { defaultArweave } from './arweave.js';
19
+ import { paginationParamsToTags, pruneTags } from '../utils/arweave.js';
6
20
  import { AOProcess } from './contracts/ao-process.js';
7
21
  import { InvalidContractConfigurationError } from './error.js';
8
22
  export class ARIO {
@@ -19,8 +33,8 @@ export class ARIO {
19
33
  }
20
34
  export class ARIOReadable {
21
35
  process;
22
- arweave;
23
- constructor(config, arweave = defaultArweave) {
36
+ epochSettings;
37
+ constructor(config) {
24
38
  if (!config) {
25
39
  this.process = new AOProcess({
26
40
  processId: ARIO_TESTNET_PROCESS_ID,
@@ -37,7 +51,6 @@ export class ARIOReadable {
37
51
  else {
38
52
  throw new InvalidContractConfigurationError();
39
53
  }
40
- this.arweave = arweave;
41
54
  }
42
55
  async getInfo() {
43
56
  return this.process.read({
@@ -49,35 +62,32 @@ export class ARIOReadable {
49
62
  tags: [{ name: 'Action', value: 'Total-Token-Supply' }],
50
63
  });
51
64
  }
52
- async getEpochSettings(params) {
53
- const allTags = [
54
- { name: 'Action', value: 'Epoch-Settings' },
55
- {
56
- name: 'Timestamp',
57
- value: params?.timestamp?.toString() ??
58
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
59
- },
60
- {
61
- name: 'Epoch-Index',
62
- value: params?.epochIndex?.toString(),
63
- },
64
- ];
65
- return this.process.read({
66
- tags: pruneTags(allTags),
67
- });
65
+ async computeEpochIndexForTimestamp(timestamp) {
66
+ const epochSettings = await this.getEpochSettings();
67
+ const epochZeroStartTimestamp = epochSettings.epochZeroStartTimestamp;
68
+ const epochLengthMs = epochSettings.durationMs;
69
+ return Math.floor((timestamp - epochZeroStartTimestamp) / epochLengthMs);
70
+ }
71
+ async computeEpochIndex(params) {
72
+ const epochIndex = params?.epochIndex;
73
+ if (epochIndex !== undefined) {
74
+ return epochIndex.toString();
75
+ }
76
+ const timestamp = params?.timestamp;
77
+ if (timestamp !== undefined) {
78
+ return (await this.computeEpochIndexForTimestamp(timestamp)).toString();
79
+ }
80
+ return undefined;
81
+ }
82
+ async getEpochSettings() {
83
+ return (this.epochSettings ??= await this.process.read({
84
+ tags: [{ name: 'Action', value: 'Epoch-Settings' }],
85
+ }));
68
86
  }
69
87
  async getEpoch(epoch) {
70
88
  const allTags = [
71
89
  { name: 'Action', value: 'Epoch' },
72
- {
73
- name: 'Timestamp',
74
- value: epoch?.timestamp?.toString() ??
75
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
76
- },
77
- {
78
- name: 'Epoch-Index',
79
- value: epoch?.epochIndex?.toString(),
80
- },
90
+ { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
81
91
  ];
82
92
  return this.process.read({
83
93
  tags: pruneTags(allTags),
@@ -184,27 +194,13 @@ export class ARIOReadable {
184
194
  }
185
195
  async getCurrentEpoch() {
186
196
  return this.process.read({
187
- tags: [
188
- { name: 'Action', value: 'Epoch' },
189
- {
190
- name: 'Timestamp',
191
- value: (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
192
- },
193
- ],
197
+ tags: [{ name: 'Action', value: 'Epoch' }],
194
198
  });
195
199
  }
196
200
  async getPrescribedObservers(epoch) {
197
201
  const allTags = [
198
202
  { name: 'Action', value: 'Epoch-Prescribed-Observers' },
199
- {
200
- name: 'Timestamp',
201
- value: epoch?.timestamp?.toString() ??
202
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
203
- },
204
- {
205
- name: 'Epoch-Index',
206
- value: epoch?.epochIndex?.toString(),
207
- },
203
+ { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
208
204
  ];
209
205
  return this.process.read({
210
206
  tags: pruneTags(allTags),
@@ -213,15 +209,7 @@ export class ARIOReadable {
213
209
  async getPrescribedNames(epoch) {
214
210
  const allTags = [
215
211
  { name: 'Action', value: 'Epoch-Prescribed-Names' },
216
- {
217
- name: 'Timestamp',
218
- value: epoch?.timestamp?.toString() ??
219
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
220
- },
221
- {
222
- name: 'Epoch-Index',
223
- value: epoch?.epochIndex?.toString(),
224
- },
212
+ { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
225
213
  ];
226
214
  return this.process.read({
227
215
  tags: pruneTags(allTags),
@@ -230,15 +218,7 @@ export class ARIOReadable {
230
218
  async getObservations(epoch) {
231
219
  const allTags = [
232
220
  { name: 'Action', value: 'Epoch-Observations' },
233
- {
234
- name: 'Timestamp',
235
- value: epoch?.timestamp?.toString() ??
236
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
237
- },
238
- {
239
- name: 'Epoch-Index',
240
- value: epoch?.epochIndex?.toString(),
241
- },
221
+ { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
242
222
  ];
243
223
  return this.process.read({
244
224
  tags: pruneTags(allTags),
@@ -247,23 +227,45 @@ export class ARIOReadable {
247
227
  async getDistributions(epoch) {
248
228
  const allTags = [
249
229
  { name: 'Action', value: 'Epoch-Distributions' },
230
+ { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
231
+ ];
232
+ return this.process.read({
233
+ tags: pruneTags(allTags),
234
+ });
235
+ }
236
+ async getTokenCost({ intent, type, years, name, quantity, fromAddress, }) {
237
+ const allTags = [
238
+ { name: 'Action', value: 'Token-Cost' },
250
239
  {
251
- name: 'Timestamp',
252
- value: epoch?.timestamp?.toString() ??
253
- (await getCurrentBlockUnixTimestampMs(this.arweave)).toString(),
240
+ name: 'Intent',
241
+ value: intent,
254
242
  },
255
243
  {
256
- name: 'Epoch-Index',
257
- value: epoch?.epochIndex?.toString(),
244
+ name: 'Name',
245
+ value: name,
246
+ },
247
+ {
248
+ name: 'Years',
249
+ value: years?.toString(),
250
+ },
251
+ {
252
+ name: 'Quantity',
253
+ value: quantity?.toString(),
254
+ },
255
+ {
256
+ name: 'Purchase-Type',
257
+ value: type,
258
258
  },
259
259
  ];
260
260
  return this.process.read({
261
261
  tags: pruneTags(allTags),
262
+ fromAddress,
262
263
  });
263
264
  }
264
- async getTokenCost({ intent, type, years, name, quantity, }) {
265
+ // TODO: Can overload this function to refine different types of cost details params
266
+ async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
265
267
  const allTags = [
266
- { name: 'Action', value: 'Token-Cost' },
268
+ { name: 'Action', value: 'Get-Cost-Details-For-Action' },
267
269
  {
268
270
  name: 'Intent',
269
271
  value: intent,
@@ -285,19 +287,13 @@ export class ARIOReadable {
285
287
  value: type,
286
288
  },
287
289
  {
288
- name: 'Timestamp',
289
- value: (await this.arweave.blocks
290
- .getCurrent()
291
- .then((block) => {
292
- return { timestamp: block.timestamp * 1000 };
293
- })
294
- .catch(() => {
295
- return { timestamp: Date.now() }; // fallback to current time
296
- })).timestamp.toString(),
290
+ name: 'Fund-From',
291
+ value: fundFrom,
297
292
  },
298
293
  ];
299
294
  return this.process.read({
300
295
  tags: pruneTags(allTags),
296
+ fromAddress,
301
297
  });
302
298
  }
303
299
  async getRegistrationFees() {
@@ -662,6 +658,7 @@ export class ARIOWriteable extends ARIOReadable {
662
658
  { name: 'Years', value: params.years?.toString() ?? '1' },
663
659
  { name: 'Process-Id', value: params.processId },
664
660
  { name: 'Purchase-Type', value: params.type || 'lease' },
661
+ { name: 'Fund-From', value: params.fundFrom },
665
662
  ];
666
663
  return this.process.send({
667
664
  signer: this.signer,
@@ -678,13 +675,15 @@ export class ARIOWriteable extends ARIOReadable {
678
675
  */
679
676
  async upgradeRecord(params, options) {
680
677
  const { tags = [] } = options || {};
678
+ const allTags = [
679
+ ...tags,
680
+ { name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
681
+ { name: 'Name', value: params.name },
682
+ { name: 'Fund-From', value: params.fundFrom },
683
+ ];
681
684
  return this.process.send({
682
685
  signer: this.signer,
683
- tags: [
684
- ...tags,
685
- { name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
686
- { name: 'Name', value: params.name },
687
- ],
686
+ tags: pruneTags(allTags),
688
687
  });
689
688
  }
690
689
  /**
@@ -698,26 +697,30 @@ export class ARIOWriteable extends ARIOReadable {
698
697
  */
699
698
  async extendLease(params, options) {
700
699
  const { tags = [] } = options || {};
700
+ const allTags = [
701
+ ...tags,
702
+ { name: 'Action', value: 'Extend-Lease' },
703
+ { name: 'Name', value: params.name },
704
+ { name: 'Years', value: params.years.toString() },
705
+ { name: 'Fund-From', value: params.fundFrom },
706
+ ];
701
707
  return this.process.send({
702
708
  signer: this.signer,
703
- tags: [
704
- ...tags,
705
- { name: 'Action', value: 'Extend-Lease' },
706
- { name: 'Name', value: params.name },
707
- { name: 'Years', value: params.years.toString() },
708
- ],
709
+ tags: pruneTags(allTags),
709
710
  });
710
711
  }
711
712
  async increaseUndernameLimit(params, options) {
712
713
  const { tags = [] } = options || {};
714
+ const allTags = [
715
+ ...tags,
716
+ { name: 'Action', value: 'Increase-Undername-Limit' },
717
+ { name: 'Name', value: params.name },
718
+ { name: 'Quantity', value: params.increaseCount.toString() },
719
+ { name: 'Fund-From', value: params.fundFrom },
720
+ ];
713
721
  return this.process.send({
714
722
  signer: this.signer,
715
- tags: [
716
- ...tags,
717
- { name: 'Action', value: 'Increase-Undername-Limit' },
718
- { name: 'Name', value: params.name },
719
- { name: 'Quantity', value: params.increaseCount.toString() },
720
- ],
723
+ tags: pruneTags(allTags),
721
724
  });
722
725
  }
723
726
  /**
@@ -742,13 +745,16 @@ export class ARIOWriteable extends ARIOReadable {
742
745
  tags: pruneTags(allTags),
743
746
  });
744
747
  }
745
- async requestPrimaryName(params) {
748
+ async requestPrimaryName(params, options) {
749
+ const { tags = [] } = options || {};
750
+ const allTags = [
751
+ ...tags,
752
+ { name: 'Action', value: 'Request-Primary-Name' },
753
+ { name: 'Name', value: params.name },
754
+ ];
746
755
  return this.process.send({
747
756
  signer: this.signer,
748
- tags: [
749
- { name: 'Action', value: 'Request-Primary-Name' },
750
- { name: 'Name', value: params.name },
751
- ],
757
+ tags: pruneTags(allTags),
752
758
  });
753
759
  }
754
760
  /**
@@ -10,6 +10,10 @@ export const intentsUsingYears = ['Buy-Record', 'Extend-Lease'];
10
10
  export const isValidIntent = (intent) => {
11
11
  return validIntents.indexOf(intent) !== -1;
12
12
  };
13
+ export const fundFromOptions = ['balance', 'stakes', 'any'];
14
+ export const isValidFundFrom = (fundFrom) => {
15
+ return fundFromOptions.indexOf(fundFrom) !== -1;
16
+ };
13
17
  // Typeguard functions
14
18
  export function isProcessConfiguration(config) {
15
19
  return 'process' in config;
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
  import { ARWEAVE_TX_REGEX } from '../constants.js';
2
17
  export const validateArweaveId = (id) => {
3
18
  return ARWEAVE_TX_REGEX.test(id);
@@ -5,18 +20,13 @@ export const validateArweaveId = (id) => {
5
20
  export function isBlockHeight(height) {
6
21
  return height !== undefined && !isNaN(parseInt(height.toString()));
7
22
  }
23
+ /**
24
+ * Prune tags that are undefined or empty.
25
+ * @param tags - The tags to prune.
26
+ * @returns The pruned tags.
27
+ */
8
28
  export const pruneTags = (tags) => {
9
- return tags.filter((tag) => tag.value !== undefined);
10
- };
11
- export const getCurrentBlockUnixTimestampMs = async (arweave) => {
12
- return await arweave.blocks
13
- .getCurrent()
14
- .then((block) => {
15
- return block.timestamp * 1000;
16
- })
17
- .catch(() => {
18
- return Date.now(); // fallback to current time
19
- });
29
+ return tags.filter((tag) => tag.value !== undefined && tag.value !== '');
20
30
  };
21
31
  export const paginationParamsToTags = (params) => {
22
32
  const tags = [
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.0.1-alpha.1';
17
+ export const version = '3.1.0-alpha.10';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AoArNSPurchaseParams, AoBuyRecordParams, AoExtendLeaseParams, AoIncreaseUndernameLimitParams } from '../../types/io.js';
17
+ import { CLIWriteOptionsFromAoParams } from '../types.js';
18
+ export declare function buyRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoBuyRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
19
+ export declare function upgradeRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
20
+ export declare function extendLeaseCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendLeaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
21
+ export declare function increaseUndernameLimitCLICommand(o: CLIWriteOptionsFromAoParams<AoIncreaseUndernameLimitParams>): Promise<import("../../types/common.js").AoMessageResult>;
22
+ export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
@@ -1,4 +1,20 @@
1
- import { AddressAndNameCLIOptions, AddressAndVaultIdCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, NameCLIOptions, PaginationAddressCLIOptions, PaginationCLIOptions } from '../types.js';
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AoGetCostDetailsParams } from '../../types/io.js';
17
+ import { AddressAndNameCLIOptions, AddressAndVaultIdCLIOptions, AddressCLIOptions, CLIOptionsFromAoParams, EpochCLIOptions, GetTokenCostCLIOptions, GlobalCLIOptions, NameCLIOptions, PaginationAddressCLIOptions, PaginationCLIOptions } from '../types.js';
2
18
  export declare function getGateway(o: AddressCLIOptions): Promise<import("../../types/io.js").AoGateway | {
3
19
  message: string;
4
20
  }>;
@@ -42,9 +58,15 @@ export declare function getPrescribedNames(o: EpochCLIOptions): Promise<string[]
42
58
  message: string;
43
59
  }>;
44
60
  export declare function getTokenCost(o: GetTokenCostCLIOptions): Promise<{
45
- mIOTokenCost: number;
61
+ mARIOTokenCost: number;
46
62
  message: string;
47
63
  }>;
64
+ export declare function getCostDetails(o: GlobalCLIOptions & CLIOptionsFromAoParams<AoGetCostDetailsParams>): Promise<{
65
+ message: string;
66
+ tokenCost: number;
67
+ discounts: import("../../types/io.js").CostDiscount[];
68
+ fundingPlan?: import("../../types/io.js").AoFundingPlan | undefined;
69
+ }>;
48
70
  export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName | {
49
71
  message: string;
50
72
  }>;
@@ -230,6 +230,10 @@ export declare const optionMap: {
230
230
  description: string;
231
231
  type: string;
232
232
  };
233
+ fundFrom: {
234
+ alias: string;
235
+ description: string;
236
+ };
233
237
  };
234
238
  export declare const walletOptions: {
235
239
  alias: string;
@@ -244,15 +248,7 @@ export declare const writeActionOptions: {
244
248
  description: string;
245
249
  type: string;
246
250
  }[];
247
- export declare const addressOptions: {
248
- alias: string;
249
- description: string;
250
- }[];
251
- export declare const nameOptions: {
252
- alias: string;
253
- description: string;
254
- }[];
255
- export declare const initiatorOptions: {
251
+ export declare const arnsPurchaseOptions: {
256
252
  alias: string;
257
253
  description: string;
258
254
  }[];
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { AoAddressParams, AoArNSNameParams, AoBuyRecordParams, AoExtendLeaseParams, AoGetVaultParams, AoIncreaseUndernameLimitParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
16
+ import { AoAddressParams, AoArNSNameParams, AoGetVaultParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
17
17
  export type WalletCLIOptions = {
18
18
  walletFile?: string;
19
19
  privateKey?: string;
@@ -47,6 +47,8 @@ export type ProcessIdWriteActionCLIOptions = WriteActionCLIOptions & {
47
47
  export type CLIOptionsFromAoParams<T> = {
48
48
  [K in keyof T]?: T[K] extends number | undefined ? string | undefined : T[K] extends string | boolean | symbol ? string : T[K] extends ReadonlyArray<infer U> ? ReadonlyArray<U> : T[K] extends object ? CLIOptionsFromAoParams<T[K]> : T[K];
49
49
  };
50
+ export type CLIReadOptionsFromAoParams<T> = CLIOptionsFromAoParams<T> & GlobalCLIOptions;
51
+ export type CLIWriteOptionsFromAoParams<T> = WriteActionCLIOptions & CLIOptionsFromAoParams<T>;
50
52
  export type PaginationCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<PaginationParams>;
51
53
  export type AddressCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoAddressParams>;
52
54
  export type ProcessIdCLIOptions = GlobalCLIOptions & {
@@ -86,10 +88,6 @@ export type OperatorStakeCLIOptions = WriteActionCLIOptions & {
86
88
  export type DecreaseDelegateStakeCLIOptions = DelegateStakeCLIOptions & {
87
89
  instant: boolean;
88
90
  };
89
- export type BuyRecordCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoBuyRecordParams>;
90
- export type UpgradeRecordCLIOptions = NameWriteCLIOptions;
91
- export type ExtendLeaseCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoExtendLeaseParams>;
92
- export type IncreaseUndernameLimitCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoIncreaseUndernameLimitParams>;
93
91
  export type ANTStateCLIOptions = WriteActionCLIOptions & {
94
92
  target?: string;
95
93
  keywords?: string[];