@ar.io/sdk 3.6.0-alpha.2 → 3.6.0-alpha.4

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.
@@ -24,7 +24,7 @@ async function buyRecordCLICommand(o) {
24
24
  ario,
25
25
  address: signerAddress,
26
26
  costDetailsParams: {
27
- intent: 'Buy-Record',
27
+ intent: 'Buy-Name',
28
28
  type,
29
29
  name,
30
30
  years,
@@ -29,8 +29,18 @@ exports.optionMap = {
29
29
  alias: '--private-key <key>',
30
30
  description: 'Stringified private key to use with the action',
31
31
  },
32
- dev: {
33
- alias: '--dev',
32
+ mainnet: {
33
+ alias: '--mainnet',
34
+ description: 'Run against the AR.IO mainnet process',
35
+ type: 'boolean',
36
+ },
37
+ testnet: {
38
+ alias: '--testnet',
39
+ description: 'Run against the AR.IO testnet process',
40
+ type: 'boolean',
41
+ },
42
+ devnet: {
43
+ alias: '--dev, --devnet',
34
44
  description: 'Run against the AR.IO devnet process',
35
45
  type: 'boolean',
36
46
  },
@@ -266,7 +276,9 @@ exports.walletOptions = [
266
276
  ];
267
277
  exports.globalOptions = [
268
278
  ...exports.walletOptions,
269
- exports.optionMap.dev,
279
+ exports.optionMap.devnet,
280
+ exports.optionMap.testnet,
281
+ exports.optionMap.mainnet,
270
282
  exports.optionMap.debug,
271
283
  exports.optionMap.arioProcessId,
272
284
  exports.optionMap.cuUrl,
@@ -75,12 +75,20 @@ function makeCommand({ description, name, options = [], action, }) {
75
75
  return appliedCommand;
76
76
  }
77
77
  exports.makeCommand = makeCommand;
78
- function arioProcessIdFromOptions({ arioProcessId, dev, }) {
79
- return arioProcessId !== undefined
80
- ? arioProcessId
81
- : dev
82
- ? index_js_1.ARIO_DEVNET_PROCESS_ID
83
- : index_js_1.ARIO_TESTNET_PROCESS_ID;
78
+ function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, mainnet, }) {
79
+ if (arioProcessId !== undefined) {
80
+ return arioProcessId;
81
+ }
82
+ if (devnet) {
83
+ return index_js_1.ARIO_DEVNET_PROCESS_ID;
84
+ }
85
+ if (testnet) {
86
+ return index_js_1.ARIO_TESTNET_PROCESS_ID;
87
+ }
88
+ if (mainnet) {
89
+ return index_js_1.ARIO_MAINNET_PROCESS_ID;
90
+ }
91
+ return index_js_1.ARIO_TESTNET_PROCESS_ID; // TODO(4.0): move to mainnet
84
92
  }
85
93
  exports.arioProcessIdFromOptions = arioProcessIdFromOptions;
86
94
  function jwkFromOptions({ privateKey, walletFile, }) {
@@ -436,7 +444,7 @@ function getANTStateFromOptions(options) {
436
444
  }
437
445
  exports.getANTStateFromOptions = getANTStateFromOptions;
438
446
  function getTokenCostParamsFromOptions(o) {
439
- o.intent ??= 'Buy-Record';
447
+ o.intent ??= 'Buy-Name';
440
448
  o.type ??= 'lease';
441
449
  o.years ??= '1';
442
450
  if (!(0, index_js_1.isValidIntent)(o.intent)) {
@@ -299,11 +299,12 @@ class ARIOReadable {
299
299
  });
300
300
  }
301
301
  async getTokenCost({ intent, type, years, name, quantity, fromAddress, }) {
302
+ const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
302
303
  const allTags = [
303
304
  { name: 'Action', value: 'Token-Cost' },
304
305
  {
305
306
  name: 'Intent',
306
- value: intent,
307
+ value: replacedBuyRecordWithBuyName,
307
308
  },
308
309
  {
309
310
  name: 'Name',
@@ -329,11 +330,12 @@ class ARIOReadable {
329
330
  }
330
331
  // TODO: Can overload this function to refine different types of cost details params
331
332
  async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
333
+ const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
332
334
  const allTags = [
333
335
  { name: 'Action', value: 'Cost-Details' },
334
336
  {
335
337
  name: 'Intent',
336
- value: intent,
338
+ value: replacedBuyRecordWithBuyName,
337
339
  },
338
340
  {
339
341
  name: 'Name',
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_SCHEDULER_ID = exports.AO_AUTHORITY = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MARIO_PER_ARIO = exports.ANT_REGISTRY_ID = exports.ARIO_TESTNET_PROCESS_ID = exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID = exports.ARNS_DEVNET_REGISTRY_TX = exports.ARNS_TESTNET_REGISTRY_TX = exports.SORT_KEY_REGEX = exports.FQDN_REGEX = exports.ARWEAVE_TX_REGEX = void 0;
3
+ exports.DEFAULT_SCHEDULER_ID = exports.AO_AUTHORITY = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MARIO_PER_ARIO = exports.ANT_REGISTRY_ID = exports.ARIO_MAINNET_PROCESS_ID = exports.ARIO_TESTNET_PROCESS_ID = exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID = exports.ARNS_DEVNET_REGISTRY_TX = exports.ARNS_TESTNET_REGISTRY_TX = exports.SORT_KEY_REGEX = exports.FQDN_REGEX = exports.ARWEAVE_TX_REGEX = void 0;
4
4
  /**
5
5
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
6
  *
@@ -27,6 +27,7 @@ exports.ARIO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
27
27
  // backwards compatibility - TODO: remove in v2.0.0
28
28
  exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID;
29
29
  exports.ARIO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
30
+ exports.ARIO_MAINNET_PROCESS_ID = 'placeholder'; // TODO: add id
30
31
  exports.ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
31
32
  exports.MARIO_PER_ARIO = 1_000_000;
32
33
  exports.AOS_MODULE_ID = 'pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8';
@@ -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.6.0-alpha.2';
20
+ exports.version = '3.6.0-alpha.4';
@@ -21,7 +21,7 @@ export async function buyRecordCLICommand(o) {
21
21
  ario,
22
22
  address: signerAddress,
23
23
  costDetailsParams: {
24
- intent: 'Buy-Record',
24
+ intent: 'Buy-Name',
25
25
  type,
26
26
  name,
27
27
  years,
@@ -26,8 +26,18 @@ export const optionMap = {
26
26
  alias: '--private-key <key>',
27
27
  description: 'Stringified private key to use with the action',
28
28
  },
29
- dev: {
30
- alias: '--dev',
29
+ mainnet: {
30
+ alias: '--mainnet',
31
+ description: 'Run against the AR.IO mainnet process',
32
+ type: 'boolean',
33
+ },
34
+ testnet: {
35
+ alias: '--testnet',
36
+ description: 'Run against the AR.IO testnet process',
37
+ type: 'boolean',
38
+ },
39
+ devnet: {
40
+ alias: '--dev, --devnet',
31
41
  description: 'Run against the AR.IO devnet process',
32
42
  type: 'boolean',
33
43
  },
@@ -263,7 +273,9 @@ export const walletOptions = [
263
273
  ];
264
274
  export const globalOptions = [
265
275
  ...walletOptions,
266
- optionMap.dev,
276
+ optionMap.devnet,
277
+ optionMap.testnet,
278
+ optionMap.mainnet,
267
279
  optionMap.debug,
268
280
  optionMap.arioProcessId,
269
281
  optionMap.cuUrl,
@@ -17,7 +17,7 @@ import { connect } from '@permaweb/aoconnect';
17
17
  import { program } from 'commander';
18
18
  import { readFileSync } from 'fs';
19
19
  import prompts from 'prompts';
20
- import { ANT, AOProcess, ARIO, ARIOToken, ARIO_DEVNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, ArweaveSigner, Logger, createAoSigner, fromB64Url, fundFromOptions, initANTStateForAddress, isValidFundFrom, isValidIntent, mARIOToken, sha256B64Url, validIntents, } from '../node/index.js';
20
+ import { ANT, AOProcess, ARIO, ARIOToken, ARIO_DEVNET_PROCESS_ID, ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, ArweaveSigner, Logger, createAoSigner, fromB64Url, fundFromOptions, initANTStateForAddress, isValidFundFrom, isValidIntent, mARIOToken, sha256B64Url, validIntents, } from '../node/index.js';
21
21
  import { globalOptions } from './options.js';
22
22
  export const defaultTtlSecondsCLI = 3600;
23
23
  export function stringifyJsonForCLIDisplay(json) {
@@ -65,12 +65,20 @@ export function makeCommand({ description, name, options = [], action, }) {
65
65
  }
66
66
  return appliedCommand;
67
67
  }
68
- export function arioProcessIdFromOptions({ arioProcessId, dev, }) {
69
- return arioProcessId !== undefined
70
- ? arioProcessId
71
- : dev
72
- ? ARIO_DEVNET_PROCESS_ID
73
- : ARIO_TESTNET_PROCESS_ID;
68
+ export function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, mainnet, }) {
69
+ if (arioProcessId !== undefined) {
70
+ return arioProcessId;
71
+ }
72
+ if (devnet) {
73
+ return ARIO_DEVNET_PROCESS_ID;
74
+ }
75
+ if (testnet) {
76
+ return ARIO_TESTNET_PROCESS_ID;
77
+ }
78
+ if (mainnet) {
79
+ return ARIO_MAINNET_PROCESS_ID;
80
+ }
81
+ return ARIO_TESTNET_PROCESS_ID; // TODO(4.0): move to mainnet
74
82
  }
75
83
  function jwkFromOptions({ privateKey, walletFile, }) {
76
84
  if (privateKey !== undefined) {
@@ -392,7 +400,7 @@ export function getANTStateFromOptions(options) {
392
400
  });
393
401
  }
394
402
  export function getTokenCostParamsFromOptions(o) {
395
- o.intent ??= 'Buy-Record';
403
+ o.intent ??= 'Buy-Name';
396
404
  o.type ??= 'lease';
397
405
  o.years ??= '1';
398
406
  if (!isValidIntent(o.intent)) {
@@ -295,11 +295,12 @@ export class ARIOReadable {
295
295
  });
296
296
  }
297
297
  async getTokenCost({ intent, type, years, name, quantity, fromAddress, }) {
298
+ const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
298
299
  const allTags = [
299
300
  { name: 'Action', value: 'Token-Cost' },
300
301
  {
301
302
  name: 'Intent',
302
- value: intent,
303
+ value: replacedBuyRecordWithBuyName,
303
304
  },
304
305
  {
305
306
  name: 'Name',
@@ -325,11 +326,12 @@ export class ARIOReadable {
325
326
  }
326
327
  // TODO: Can overload this function to refine different types of cost details params
327
328
  async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
329
+ const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
328
330
  const allTags = [
329
331
  { name: 'Action', value: 'Cost-Details' },
330
332
  {
331
333
  name: 'Intent',
332
- value: intent,
334
+ value: replacedBuyRecordWithBuyName,
333
335
  },
334
336
  {
335
337
  name: 'Name',
@@ -24,6 +24,7 @@ export const ARIO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGr
24
24
  // backwards compatibility - TODO: remove in v2.0.0
25
25
  export const arioDevnetProcessId = ARIO_DEVNET_PROCESS_ID;
26
26
  export const ARIO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
27
+ export const ARIO_MAINNET_PROCESS_ID = 'placeholder'; // TODO: add id
27
28
  export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
28
29
  export const MARIO_PER_ARIO = 1_000_000;
29
30
  export const AOS_MODULE_ID = 'pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8';
@@ -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.6.0-alpha.2';
17
+ export const version = '3.6.0-alpha.4';
@@ -22,7 +22,17 @@ export declare const optionMap: {
22
22
  alias: string;
23
23
  description: string;
24
24
  };
25
- dev: {
25
+ mainnet: {
26
+ alias: string;
27
+ description: string;
28
+ type: string;
29
+ };
30
+ testnet: {
31
+ alias: string;
32
+ description: string;
33
+ type: string;
34
+ };
35
+ devnet: {
26
36
  alias: string;
27
37
  description: string;
28
38
  type: string;
@@ -19,7 +19,9 @@ export type WalletCLIOptions = {
19
19
  privateKey?: string;
20
20
  };
21
21
  export type GlobalCLIOptions = WalletCLIOptions & {
22
- dev: boolean;
22
+ devnet: boolean;
23
+ testnet: boolean;
24
+ mainnet: boolean;
23
25
  debug: boolean;
24
26
  arioProcessId?: string;
25
27
  cuUrl?: string;
@@ -17,7 +17,7 @@ export declare function makeCommand<O extends OptionValues = GlobalCLIOptions>({
17
17
  action?: (options: O) => Promise<JsonSerializable>;
18
18
  options?: CommanderOption[];
19
19
  }): Command;
20
- export declare function arioProcessIdFromOptions({ arioProcessId, dev, }: GlobalCLIOptions): string;
20
+ export declare function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, mainnet, }: GlobalCLIOptions): string;
21
21
  export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKInterface;
22
22
  export declare function jwkToAddress(jwk: JWKInterface): string;
23
23
  export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
@@ -77,7 +77,7 @@ export declare class ARIOReadable implements AoARIORead {
77
77
  getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
78
78
  getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
79
79
  getTokenCost(params: {
80
- intent: 'Buy-Record';
80
+ intent: 'Buy-Record' | 'Buy-Name';
81
81
  type: 'permabuy' | 'lease';
82
82
  years: number;
83
83
  name: string;
@@ -22,6 +22,7 @@ export declare const ARNS_DEVNET_REGISTRY_TX = "_NctcA2sRy1-J4OmIQZbYFPM17piNcbd
22
22
  export declare const ARIO_DEVNET_PROCESS_ID = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
23
23
  export declare const arioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
24
24
  export declare const ARIO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
25
+ export declare const ARIO_MAINNET_PROCESS_ID = "placeholder";
25
26
  export declare const ANT_REGISTRY_ID = "i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc";
26
27
  export declare const MARIO_PER_ARIO = 1000000;
27
28
  export declare const AOS_MODULE_ID = "pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8";
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.6.0-alpha.1";
16
+ export declare const version = "3.6.0-alpha.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.6.0-alpha.2",
3
+ "version": "3.6.0-alpha.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"