@ar.io/sdk 3.6.0-alpha.1 → 3.6.0-alpha.3
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.
- package/README.md +4 -4
- package/bundles/web.bundle.min.js +23 -23
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +1 -1
- package/lib/cjs/cli/options.js +15 -3
- package/lib/cjs/cli/utils.js +15 -7
- package/lib/cjs/common/io.js +4 -2
- package/lib/cjs/constants.js +4 -3
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +1 -1
- package/lib/esm/cli/options.js +15 -3
- package/lib/esm/cli/utils.js +16 -8
- package/lib/esm/common/io.js +4 -2
- package/lib/esm/constants.js +3 -2
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/options.d.ts +11 -1
- package/lib/types/cli/types.d.ts +3 -1
- package/lib/types/cli/utils.d.ts +1 -1
- package/lib/types/common/io.d.ts +1 -1
- package/lib/types/constants.d.ts +3 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/cli/options.js
CHANGED
|
@@ -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
|
-
|
|
33
|
-
alias: '--
|
|
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.
|
|
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,
|
package/lib/cjs/cli/utils.js
CHANGED
|
@@ -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,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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-
|
|
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)) {
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -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:
|
|
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:
|
|
338
|
+
value: replacedBuyRecordWithBuyName,
|
|
337
339
|
},
|
|
338
340
|
{
|
|
339
341
|
name: 'Name',
|
package/lib/cjs/constants.js
CHANGED
|
@@ -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,9 +27,10 @@ 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
|
-
exports.AOS_MODULE_ID = '
|
|
33
|
-
exports.ANT_LUA_ID = '
|
|
33
|
+
exports.AOS_MODULE_ID = 'pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8';
|
|
34
|
+
exports.ANT_LUA_ID = 'OO2ewZKq4AHoqGQmYUIl-NhJ-llQyFJ3ha4Uf4-w5RI';
|
|
34
35
|
exports.AO_AUTHORITY = 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY';
|
|
35
36
|
exports.DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/options.js
CHANGED
|
@@ -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
|
-
|
|
30
|
-
alias: '--
|
|
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.
|
|
276
|
+
optionMap.devnet,
|
|
277
|
+
optionMap.testnet,
|
|
278
|
+
optionMap.mainnet,
|
|
267
279
|
optionMap.debug,
|
|
268
280
|
optionMap.arioProcessId,
|
|
269
281
|
optionMap.cuUrl,
|
package/lib/esm/cli/utils.js
CHANGED
|
@@ -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,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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-
|
|
403
|
+
o.intent ??= 'Buy-Name';
|
|
396
404
|
o.type ??= 'lease';
|
|
397
405
|
o.years ??= '1';
|
|
398
406
|
if (!isValidIntent(o.intent)) {
|
package/lib/esm/common/io.js
CHANGED
|
@@ -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:
|
|
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:
|
|
334
|
+
value: replacedBuyRecordWithBuyName,
|
|
333
335
|
},
|
|
334
336
|
{
|
|
335
337
|
name: 'Name',
|
package/lib/esm/constants.js
CHANGED
|
@@ -24,9 +24,10 @@ 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
|
-
export const AOS_MODULE_ID = '
|
|
30
|
-
export const ANT_LUA_ID = '
|
|
30
|
+
export const AOS_MODULE_ID = 'pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8';
|
|
31
|
+
export const ANT_LUA_ID = 'OO2ewZKq4AHoqGQmYUIl-NhJ-llQyFJ3ha4Uf4-w5RI';
|
|
31
32
|
export const AO_AUTHORITY = 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY';
|
|
32
33
|
export const DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/esm/version.js
CHANGED
|
@@ -22,7 +22,17 @@ export declare const optionMap: {
|
|
|
22
22
|
alias: string;
|
|
23
23
|
description: string;
|
|
24
24
|
};
|
|
25
|
-
|
|
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;
|
package/lib/types/cli/types.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export type WalletCLIOptions = {
|
|
|
19
19
|
privateKey?: string;
|
|
20
20
|
};
|
|
21
21
|
export type GlobalCLIOptions = WalletCLIOptions & {
|
|
22
|
-
|
|
22
|
+
devnet: boolean;
|
|
23
|
+
testnet: boolean;
|
|
24
|
+
mainnet: boolean;
|
|
23
25
|
debug: boolean;
|
|
24
26
|
arioProcessId?: string;
|
|
25
27
|
cuUrl?: string;
|
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -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,
|
|
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;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -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;
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -22,9 +22,10 @@ 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
|
-
export declare const AOS_MODULE_ID = "
|
|
28
|
-
export declare const ANT_LUA_ID = "
|
|
28
|
+
export declare const AOS_MODULE_ID = "pb4fCvdJqwT-_bn38ERMdqnOF4weRMjoJ6bY6yfl4a8";
|
|
29
|
+
export declare const ANT_LUA_ID = "OO2ewZKq4AHoqGQmYUIl-NhJ-llQyFJ3ha4Uf4-w5RI";
|
|
29
30
|
export declare const AO_AUTHORITY = "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY";
|
|
30
31
|
export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
|
package/lib/types/version.d.ts
CHANGED