@ar.io/sdk 2.6.0-alpha.4 → 2.7.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/bundles/web.bundle.min.js +65 -65
  2. package/lib/cjs/cli/cli.js +713 -0
  3. package/lib/cjs/cli/commands/gatewayWriteCommands.js +211 -0
  4. package/lib/cjs/cli/commands/readCommands.js +219 -0
  5. package/lib/cjs/cli/commands/transfer.js +26 -0
  6. package/lib/cjs/cli/options.js +336 -0
  7. package/lib/cjs/cli/types.js +2 -0
  8. package/lib/cjs/cli/utils.js +406 -0
  9. package/lib/cjs/common/io.js +2 -7
  10. package/lib/cjs/types/io.js +13 -1
  11. package/lib/cjs/utils/ao.js +32 -13
  12. package/lib/cjs/utils/base64.js +1 -1
  13. package/lib/cjs/version.js +1 -1
  14. package/lib/esm/cli/cli.js +711 -0
  15. package/lib/esm/cli/commands/gatewayWriteCommands.js +194 -0
  16. package/lib/esm/cli/commands/readCommands.js +197 -0
  17. package/lib/esm/cli/commands/transfer.js +22 -0
  18. package/lib/esm/cli/options.js +333 -0
  19. package/lib/esm/cli/types.js +1 -0
  20. package/lib/esm/cli/utils.js +366 -0
  21. package/lib/esm/common/io.js +2 -7
  22. package/lib/esm/types/io.js +11 -0
  23. package/lib/esm/utils/ao.js +30 -12
  24. package/lib/esm/utils/base64.js +1 -1
  25. package/lib/esm/version.js +1 -1
  26. package/lib/types/cli/cli.d.ts +2 -0
  27. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +38 -0
  28. package/lib/types/cli/commands/readCommands.d.ts +57 -0
  29. package/lib/types/cli/commands/transfer.d.ts +23 -0
  30. package/lib/types/cli/options.d.ts +326 -0
  31. package/lib/types/cli/types.d.ts +106 -0
  32. package/lib/types/cli/utils.d.ts +66 -0
  33. package/lib/types/common/io.d.ts +4 -7
  34. package/lib/types/types/io.d.ts +81 -60
  35. package/lib/types/utils/ao.d.ts +20 -10
  36. package/lib/types/version.d.ts +1 -1
  37. package/package.json +7 -1
@@ -380,13 +380,7 @@ export class IOReadable {
380
380
  });
381
381
  }
382
382
  async getAllowedDelegates(params) {
383
- return this.process.read({
384
- tags: [
385
- { name: 'Action', value: 'Paginated-Allowed-Delegates' },
386
- { name: 'Address', value: params.address },
387
- ...paginationParamsToTags(params),
388
- ],
389
- });
383
+ return this.getGatewayDelegateAllowList(params);
390
384
  }
391
385
  async getGatewayVaults(params) {
392
386
  return this.process.read({
@@ -674,6 +668,7 @@ export class IOWriteable extends IOReadable {
674
668
  ...tags,
675
669
  { name: 'Action', value: 'Decrease-Operator-Stake' },
676
670
  { name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
671
+ { name: 'Instant', value: `${params.instant || false}` },
677
672
  ],
678
673
  });
679
674
  }
@@ -1,4 +1,15 @@
1
1
  import { validateArweaveId } from '../utils/arweave.js';
2
+ export const validIntents = [
3
+ 'Buy-Record',
4
+ 'Extend-Lease',
5
+ 'Increase-Undername-Limit',
6
+ 'Upgrade-Name',
7
+ 'Primary-Name-Request',
8
+ ];
9
+ export const intentsUsingYears = ['Buy-Record', 'Extend-Lease'];
10
+ export const isValidIntent = (intent) => {
11
+ return validIntents.indexOf(intent) !== -1;
12
+ };
2
13
  // Typeguard functions
3
14
  export function isProcessConfiguration(config) {
4
15
  return 'process' in config;
@@ -20,14 +20,6 @@ import { defaultArweave } from '../common/arweave.js';
20
20
  import { ANTRegistry, AOProcess, Logger } from '../common/index.js';
21
21
  import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, DEFAULT_SCHEDULER_ID, } from '../constants.js';
22
22
  export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = ANT_LUA_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, stateContractTxId, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, arweave = defaultArweave, }) {
23
- const registryClient = ANTRegistry.init({
24
- process: new AOProcess({
25
- processId: antRegistryId,
26
- ao,
27
- logger,
28
- }),
29
- signer: signer,
30
- });
31
23
  //TODO: cache locally and only fetch if not cached
32
24
  const luaString = (await arweave.transactions.getData(luaCodeTxId, {
33
25
  decode: true,
@@ -62,7 +54,7 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
62
54
  data: luaString,
63
55
  signer,
64
56
  });
65
- logger.info(`Spawned ANT`, {
57
+ logger.debug(`Spawned ANT`, {
66
58
  processId,
67
59
  module,
68
60
  scheduler,
@@ -80,17 +72,25 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
80
72
  data: JSON.stringify(state),
81
73
  signer,
82
74
  });
83
- logger.info(`Initialized ANT`, {
75
+ logger.debug(`Initialized ANT`, {
84
76
  processId,
85
77
  module,
86
78
  scheduler,
87
79
  initializeMsgId,
88
80
  });
89
81
  }
82
+ const registryClient = ANTRegistry.init({
83
+ process: new AOProcess({
84
+ processId: antRegistryId,
85
+ ao,
86
+ logger,
87
+ }),
88
+ signer: signer,
89
+ });
90
90
  const { id: antRegistrationMsgId } = await registryClient.register({
91
91
  processId,
92
92
  });
93
- logger.info(`Registered ANT to ANT Registry`, {
93
+ logger.debug(`Registered ANT to ANT Registry`, {
94
94
  processId,
95
95
  module,
96
96
  scheduler,
@@ -119,7 +119,7 @@ export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, a
119
119
  data: luaString,
120
120
  signer,
121
121
  });
122
- logger.info(`Evolved ANT`, {
122
+ logger.debug(`Evolved ANT`, {
123
123
  processId,
124
124
  luaCodeTxId,
125
125
  evalMsgId: evolveMsgId,
@@ -174,3 +174,21 @@ export function createAoSigner(signer) {
174
174
  };
175
175
  return aoSigner;
176
176
  }
177
+ export const defaultTargetManifestId = '-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI';
178
+ export function initANTStateForAddress({ owner, targetId, ttlSeconds = 3600, keywords = [], controllers = [], description = '', ticker = 'aos', name = 'ANT', }) {
179
+ return {
180
+ ticker,
181
+ name,
182
+ description,
183
+ keywords,
184
+ owner,
185
+ controllers: [owner, ...controllers],
186
+ balances: { [owner]: 1 },
187
+ records: {
188
+ ['@']: {
189
+ transactionId: targetId ?? defaultTargetManifestId.toString(),
190
+ ttlSeconds,
191
+ },
192
+ },
193
+ };
194
+ }
@@ -44,5 +44,5 @@ export function toB64Url(buffer) {
44
44
  return base64urlFromBase64(b64Str);
45
45
  }
46
46
  export function sha256B64Url(input) {
47
- return toB64Url(createHash('sha256').update(input).digest());
47
+ return toB64Url(createHash('sha256').update(Uint8Array.from(input)).digest());
48
48
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '2.6.0-alpha.4';
17
+ export const version = '2.7.0-alpha.1';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './commands/updateGatewaySettings.js';
@@ -0,0 +1,38 @@
1
+ import { AddressAndVaultIdCLIWriteOptions, DecreaseDelegateStakeCLIOptions, JoinNetworkCLIOptions, OperatorStakeCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WriteActionCLIOptions } from '../types.js';
2
+ export declare function joinNetwork(options: JoinNetworkCLIOptions): Promise<{
3
+ joinNetworkResult: import("../../types/common.js").AoMessageResult;
4
+ joinedAddress: string;
5
+ message: string;
6
+ }>;
7
+ export declare function updateGatewaySettings(options: UpdateGatewaySettingsCLIOptions): Promise<{
8
+ updateGatewaySettingsResult: import("../../types/common.js").AoMessageResult;
9
+ updatedGatewayAddress: string;
10
+ message: string;
11
+ }>;
12
+ export declare function leaveNetwork(options: WriteActionCLIOptions): Promise<import("../../types/common.js").AoMessageResult>;
13
+ export declare function saveObservations(o: WriteActionCLIOptions & {
14
+ failedGateways?: string[];
15
+ transactionId?: string;
16
+ }): Promise<import("../../types/common.js").AoMessageResult>;
17
+ export declare function increaseOperatorStake(o: OperatorStakeCLIOptions): Promise<import("../../types/common.js").WriteOptions>;
18
+ export declare function decreaseOperatorStake(o: OperatorStakeCLIOptions): Promise<import("../../types/common.js").AoMessageResult>;
19
+ export declare function instantWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult>;
20
+ export declare function cancelWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult>;
21
+ export declare function delegateStake(options: TransferCLIOptions): Promise<{
22
+ senderAddress: string;
23
+ transferResult: import("../../types/common.js").AoMessageResult;
24
+ message: string;
25
+ } | {
26
+ message: string;
27
+ }>;
28
+ export declare function decreaseDelegateStake(options: DecreaseDelegateStakeCLIOptions): Promise<{
29
+ targetGateway: string;
30
+ decreaseDelegateStakeResult: import("../../types/common.js").AoMessageResult;
31
+ message: string;
32
+ }>;
33
+ export declare function redelegateStake(options: RedelegateStakeCLIOptions): Promise<{
34
+ sourceGateway: string;
35
+ targetGateway: string;
36
+ redelegateStakeResult: import("../../types/common.js").AoMessageResult;
37
+ message: string;
38
+ }>;
@@ -0,0 +1,57 @@
1
+ import { AddressAndNameCLIOptions, AddressAndVaultIdCLIOptions, AddressCLIOptions, AuctionPricesCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, NameCLIOptions, PaginationAddressCLIOptions, PaginationCLIOptions } from '../types.js';
2
+ export declare function getGateway(o: AddressCLIOptions): Promise<import("../../types/io.js").AoGateway | {
3
+ message: string;
4
+ }>;
5
+ export declare function listGateways(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoGatewayWithAddress> | {
6
+ message: string;
7
+ }>;
8
+ export declare function getGatewayDelegates(o: AddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoGatewayDelegateWithAddress> | {
9
+ message: string;
10
+ }>;
11
+ export declare function getDelegations(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoDelegation> | {
12
+ message: string;
13
+ }>;
14
+ export declare function getAllowedDelegates(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<string> | {
15
+ message: string;
16
+ }>;
17
+ export declare function getArNSRecord(o: NameCLIOptions): Promise<import("../../types/io.js").AoArNSPermabuyData | import("../../types/io.js").AoArNSLeaseData | {
18
+ message: string;
19
+ }>;
20
+ export declare function listArNSRecords(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoArNSNameDataWithName> | {
21
+ message: string;
22
+ }>;
23
+ export declare function getArNSReservedName(o: NameCLIOptions): Promise<import("../../types/io.js").AoArNSReservedNameData | {
24
+ message: string;
25
+ }>;
26
+ export declare function listArNSReservedNames(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoArNSReservedNameDataWithName> | {
27
+ message: string;
28
+ }>;
29
+ export declare function getArNSAuction(o: NameCLIOptions): Promise<import("../../types/io.js").AoAuction | {
30
+ message: string;
31
+ }>;
32
+ export declare function listArNSAuctions(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoAuction> | {
33
+ message: string;
34
+ }>;
35
+ export declare function getArNSAuctionPrices(o: AuctionPricesCLIOptions): Promise<import("../../types/io.js").AoAuctionPriceData>;
36
+ export declare function getEpoch(o: EpochCLIOptions): Promise<import("../../types/io.js").AoEpochData | {
37
+ message: string;
38
+ }>;
39
+ export declare function getPrescribedObservers(o: EpochCLIOptions): Promise<import("../../types/io.js").AoWeightedObserver[] | {
40
+ message: string;
41
+ }>;
42
+ export declare function getPrescribedNames(o: EpochCLIOptions): Promise<string[] | {
43
+ message: string;
44
+ }>;
45
+ export declare function getTokenCost(o: GetTokenCostCLIOptions): Promise<{
46
+ mIOTokenCost: number;
47
+ message: string;
48
+ }>;
49
+ export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName | {
50
+ message: string;
51
+ }>;
52
+ export declare function getGatewayVaults(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoGatewayVault> | {
53
+ message: string;
54
+ }>;
55
+ export declare function getVault(o: AddressAndVaultIdCLIOptions): Promise<import("../../types/io.js").AoVaultData | {
56
+ message: string;
57
+ }>;
@@ -0,0 +1,23 @@
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 { TransferCLIOptions } from '../types.js';
17
+ export declare function transfer(options: TransferCLIOptions): Promise<{
18
+ senderAddress: string;
19
+ transferResult: import("../../types/common.js").AoMessageResult;
20
+ message: string;
21
+ } | {
22
+ message: string;
23
+ }>;
@@ -0,0 +1,326 @@
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
+ export declare const optionMap: {
17
+ walletFile: {
18
+ alias: string;
19
+ description: string;
20
+ };
21
+ privateKey: {
22
+ alias: string;
23
+ description: string;
24
+ };
25
+ dev: {
26
+ alias: string;
27
+ description: string;
28
+ type: string;
29
+ };
30
+ ioProcessId: {
31
+ alias: string;
32
+ description: string;
33
+ };
34
+ cuUrl: {
35
+ alias: string;
36
+ description: string;
37
+ };
38
+ processId: {
39
+ alias: string;
40
+ description: string;
41
+ };
42
+ debug: {
43
+ alias: string;
44
+ description: string;
45
+ type: string;
46
+ };
47
+ address: {
48
+ alias: string;
49
+ description: string;
50
+ };
51
+ target: {
52
+ alias: string;
53
+ description: string;
54
+ };
55
+ source: {
56
+ alias: string;
57
+ description: string;
58
+ };
59
+ quantity: {
60
+ alias: string;
61
+ description: string;
62
+ };
63
+ autoStake: {
64
+ alias: string;
65
+ description: string;
66
+ type: string;
67
+ };
68
+ allowDelegatedStaking: {
69
+ alias: string;
70
+ description: string;
71
+ type: string;
72
+ };
73
+ minDelegatedStake: {
74
+ alias: string;
75
+ description: string;
76
+ };
77
+ delegateRewardShareRatio: {
78
+ alias: string;
79
+ description: string;
80
+ };
81
+ label: {
82
+ alias: string;
83
+ description: string;
84
+ };
85
+ note: {
86
+ alias: string;
87
+ description: string;
88
+ };
89
+ properties: {
90
+ alias: string;
91
+ description: string;
92
+ };
93
+ observerAddress: {
94
+ alias: string;
95
+ description: string;
96
+ };
97
+ fqdn: {
98
+ alias: string;
99
+ description: string;
100
+ };
101
+ port: {
102
+ alias: string;
103
+ description: string;
104
+ };
105
+ protocol: {
106
+ alias: string;
107
+ description: string;
108
+ };
109
+ allowedDelegates: {
110
+ alias: string;
111
+ description: string;
112
+ type: string;
113
+ };
114
+ skipConfirmation: {
115
+ alias: string;
116
+ description: string;
117
+ type: string;
118
+ };
119
+ vaultId: {
120
+ alias: string;
121
+ description: string;
122
+ };
123
+ operatorStake: {
124
+ alias: string;
125
+ description: string;
126
+ };
127
+ name: {
128
+ alias: string;
129
+ description: string;
130
+ };
131
+ epochIndex: {
132
+ alias: string;
133
+ description: string;
134
+ };
135
+ timestamp: {
136
+ alias: string;
137
+ description: string;
138
+ };
139
+ initiator: {
140
+ alias: string;
141
+ description: string;
142
+ };
143
+ intent: {
144
+ alias: string;
145
+ description: string;
146
+ };
147
+ type: {
148
+ alias: string;
149
+ description: string;
150
+ };
151
+ years: {
152
+ alias: string;
153
+ description: string;
154
+ };
155
+ intervalMs: {
156
+ alias: string;
157
+ description: string;
158
+ };
159
+ cursor: {
160
+ alias: string;
161
+ description: string;
162
+ };
163
+ limit: {
164
+ alias: string;
165
+ description: string;
166
+ };
167
+ sortBy: {
168
+ alias: string;
169
+ description: string;
170
+ };
171
+ sortOrder: {
172
+ alias: string;
173
+ description: string;
174
+ };
175
+ tags: {
176
+ description: string;
177
+ alias: string;
178
+ type: string;
179
+ };
180
+ instant: {
181
+ alias: string;
182
+ description: string;
183
+ type: string;
184
+ };
185
+ increaseCount: {
186
+ alias: string;
187
+ description: string;
188
+ };
189
+ undername: {
190
+ alias: string;
191
+ description: string;
192
+ };
193
+ controller: {
194
+ alias: string;
195
+ description: string;
196
+ };
197
+ controllers: {
198
+ alias: string;
199
+ description: string;
200
+ type: string;
201
+ };
202
+ transactionId: {
203
+ alias: string;
204
+ description: string;
205
+ };
206
+ ttlSeconds: {
207
+ alias: string;
208
+ description: string;
209
+ };
210
+ ticker: {
211
+ alias: string;
212
+ description: string;
213
+ };
214
+ description: {
215
+ alias: string;
216
+ description: string;
217
+ };
218
+ keywords: {
219
+ alias: string;
220
+ description: string;
221
+ type: string;
222
+ };
223
+ names: {
224
+ alias: string;
225
+ description: string;
226
+ type: string;
227
+ };
228
+ failedGateways: {
229
+ alias: string;
230
+ description: string;
231
+ type: string;
232
+ };
233
+ };
234
+ export declare const walletOptions: {
235
+ alias: string;
236
+ description: string;
237
+ }[];
238
+ export declare const globalOptions: {
239
+ alias: string;
240
+ description: string;
241
+ }[];
242
+ export declare const writeActionOptions: {
243
+ alias: string;
244
+ description: string;
245
+ type: string;
246
+ }[];
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: {
256
+ alias: string;
257
+ description: string;
258
+ }[];
259
+ export declare const epochOptions: {
260
+ alias: string;
261
+ description: string;
262
+ }[];
263
+ export declare const addressAndVaultIdOptions: {
264
+ alias: string;
265
+ description: string;
266
+ }[];
267
+ export declare const nameWriteOptions: {
268
+ alias: string;
269
+ description: string;
270
+ }[];
271
+ export declare const paginationOptions: {
272
+ alias: string;
273
+ description: string;
274
+ }[];
275
+ export declare const paginationAddressOptions: {
276
+ alias: string;
277
+ description: string;
278
+ }[];
279
+ export declare const getVaultOptions: {
280
+ alias: string;
281
+ description: string;
282
+ }[];
283
+ export declare const tokenCostOptions: {
284
+ alias: string;
285
+ description: string;
286
+ }[];
287
+ export declare const arNSAuctionPricesOptions: {
288
+ alias: string;
289
+ description: string;
290
+ }[];
291
+ export declare const transferOptions: {
292
+ alias: string;
293
+ description: string;
294
+ }[];
295
+ export declare const operatorStakeOptions: {
296
+ alias: string;
297
+ description: string;
298
+ }[];
299
+ export declare const redelegateStakeOptions: {
300
+ alias: string;
301
+ description: string;
302
+ }[];
303
+ export declare const delegateStakeOptions: {
304
+ alias: string;
305
+ description: string;
306
+ }[];
307
+ export declare const decreaseDelegateStakeOptions: {
308
+ alias: string;
309
+ description: string;
310
+ }[];
311
+ export declare const updateGatewaySettingsOptions: {
312
+ alias: string;
313
+ description: string;
314
+ }[];
315
+ export declare const joinNetworkOptions: {
316
+ alias: string;
317
+ description: string;
318
+ }[];
319
+ export declare const buyRecordOptions: {
320
+ alias: string;
321
+ description: string;
322
+ }[];
323
+ export declare const antStateOptions: {
324
+ alias: string;
325
+ description: string;
326
+ }[];
@@ -0,0 +1,106 @@
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 { AoAddressParams, AoArNSAuctionPricesParams, AoArNSNameParams, AoBuyRecordParams, AoExtendLeaseParams, AoGetVaultParams, AoIncreaseUndernameLimitParams, AoJoinNetworkParams, AoSubmitAuctionBidParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
17
+ export type WalletCLIOptions = {
18
+ walletFile?: string;
19
+ privateKey?: string;
20
+ };
21
+ export type GlobalCLIOptions = WalletCLIOptions & {
22
+ dev: boolean;
23
+ debug: boolean;
24
+ ioProcessId?: string;
25
+ cuUrl?: string;
26
+ };
27
+ export type WriteActionCLIOptions = GlobalCLIOptions & {
28
+ tags?: string[];
29
+ skipConfirmation?: boolean;
30
+ };
31
+ export type ProcessIdWriteActionCLIOptions = WriteActionCLIOptions & {
32
+ processId?: string;
33
+ };
34
+ /**
35
+ * A utility type to transform `number` properties in a type `T` to `string`
36
+ * properties, while preserving arrays, objects, and other types.
37
+ * Additionally, all properties are made optional.
38
+ *
39
+ * This type is intended to represent how `commander` parses CLI options,
40
+ * where all values are strings, and nested objects are recursively processed.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * export type MyNewCommandOptions = CLIOptionsFromAoParams<MyNewAoMethodParams> & GlobalOptions;
45
+ * ```
46
+ */
47
+ export type CLIOptionsFromAoParams<T> = {
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
+ };
50
+ export type PaginationCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<PaginationParams>;
51
+ export type AddressCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoAddressParams>;
52
+ export type ProcessIdCLIOptions = GlobalCLIOptions & {
53
+ processId?: string;
54
+ };
55
+ export type InitiatorCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<{
56
+ initiator: string;
57
+ }>;
58
+ export type AddressAndNameCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<{
59
+ address: string;
60
+ name: string;
61
+ }>;
62
+ export type EpochCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<{
63
+ epochIndex: number;
64
+ timestamp: number;
65
+ }>;
66
+ export type GetTokenCostCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoTokenCostParams>;
67
+ export type AuctionPricesCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoArNSAuctionPricesParams>;
68
+ export type PaginationAddressCLIOptions = AddressCLIOptions & PaginationCLIOptions;
69
+ export type NameCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoArNSNameParams>;
70
+ export type NameWriteCLIOptions = WriteActionCLIOptions & NameCLIOptions;
71
+ export type AddressAndVaultIdCLIOptions = CLIOptionsFromAoParams<AoGetVaultParams> & GlobalCLIOptions;
72
+ export type AddressAndVaultIdCLIWriteOptions = WriteActionCLIOptions & AddressAndVaultIdCLIOptions;
73
+ export type TransferCLIOptions = WriteActionCLIOptions & {
74
+ quantity?: string;
75
+ target?: string;
76
+ };
77
+ export type JoinNetworkCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoJoinNetworkParams>;
78
+ export type UpdateGatewaySettingsCLIOptions = Omit<JoinNetworkCLIOptions, 'operatorStake'>;
79
+ export type DelegateStakeCLIOptions = TransferCLIOptions;
80
+ export type RedelegateStakeCLIOptions = TransferCLIOptions & {
81
+ source?: string;
82
+ vaultId?: string;
83
+ };
84
+ export type OperatorStakeCLIOptions = WriteActionCLIOptions & {
85
+ operatorStake?: string;
86
+ };
87
+ export type DecreaseDelegateStakeCLIOptions = DelegateStakeCLIOptions & {
88
+ instant: boolean;
89
+ };
90
+ export type BuyRecordCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoBuyRecordParams>;
91
+ export type UpgradeRecordCLIOptions = NameWriteCLIOptions;
92
+ export type ExtendLeaseCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoExtendLeaseParams>;
93
+ export type IncreaseUndernameLimitCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoIncreaseUndernameLimitParams>;
94
+ export type SubmitAuctionBidCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoSubmitAuctionBidParams>;
95
+ export type ANTStateCLIOptions = WriteActionCLIOptions & {
96
+ target?: string;
97
+ keywords?: string[];
98
+ ticker?: string;
99
+ name?: string;
100
+ description?: string;
101
+ controllers?: string[];
102
+ ttlSeconds?: string;
103
+ };
104
+ export type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
105
+ [key: string]: JsonSerializable;
106
+ };