@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.
- package/README.md +124 -140
- package/bundles/web.bundle.min.js +150 -126
- package/lib/cjs/cli/commands/antCommands.js +3 -4
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +5 -6
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +11 -12
- package/lib/cjs/cli/commands/readCommands.js +21 -22
- package/lib/cjs/cli/commands/transfer.js +6 -7
- package/lib/cjs/cli/options.js +0 -12
- package/lib/cjs/cli/utils.js +52 -74
- package/lib/cjs/common/ant-versions.js +5 -5
- package/lib/cjs/common/faucet.js +150 -0
- package/lib/cjs/common/index.js +1 -0
- package/lib/cjs/common/io.js +71 -55
- package/lib/cjs/types/ant.js +2 -2
- package/lib/cjs/types/faucet.js +2 -0
- package/lib/cjs/types/index.js +1 -0
- package/lib/cjs/types/io.js +8 -7
- package/lib/cjs/utils/ao.js +11 -9
- package/lib/cjs/utils/arweave.js +4 -4
- package/lib/cjs/utils/base64.js +4 -5
- package/lib/cjs/utils/json.js +1 -2
- package/lib/cjs/utils/schema.js +1 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/options.js +0 -12
- package/lib/esm/cli/utils.js +10 -31
- package/lib/esm/common/ant-versions.js +5 -5
- package/lib/esm/common/faucet.js +145 -0
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/io.js +70 -54
- package/lib/esm/types/index.js +1 -0
- package/lib/esm/types/io.js +4 -3
- package/lib/esm/utils/ao.js +2 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +3 -3
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +1 -1
- package/lib/types/cli/commands/gatewayWriteCommands.d.ts +9 -9
- package/lib/types/cli/commands/readCommands.d.ts +3 -4
- package/lib/types/cli/commands/transfer.d.ts +3 -3
- package/lib/types/cli/options.d.ts +0 -9
- package/lib/types/cli/types.d.ts +0 -3
- package/lib/types/cli/utils.d.ts +1 -5
- package/lib/types/common/ant-versions.d.ts +6 -3
- package/lib/types/common/faucet.d.ts +96 -0
- package/lib/types/common/http.d.ts +0 -1
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/common/io.d.ts +22 -13
- package/lib/types/types/common.d.ts +1 -7
- package/lib/types/types/faucet.d.ts +82 -0
- package/lib/types/types/index.d.ts +1 -0
- package/lib/types/types/io.d.ts +9 -10
- package/lib/types/types/token.d.ts +0 -1
- package/lib/types/utils/base64.d.ts +0 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +5 -7
- package/lib/cjs/common/turbo.js +0 -134
- package/lib/cjs/utils/url.js +0 -28
- package/lib/cjs/utils/url.test.js +0 -24
- package/lib/esm/common/turbo.js +0 -129
- package/lib/esm/utils/url.js +0 -24
- package/lib/esm/utils/url.test.js +0 -19
- package/lib/types/common/turbo.d.ts +0 -47
- package/lib/types/utils/url.d.ts +0 -19
- /package/lib/{types/utils/url.test.d.ts → esm/types/faucet.js} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const DEFAULT_FAUCET_API_URL = 'https://faucet.ario.permaweb.services';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a proxy object that implements the TokenFaucet interface. It wraps the ARIOReadable instance and adds methods for claiming tokens from the faucet API.
|
|
4
|
+
* @param arioInstance - The ARIOReadable instance
|
|
5
|
+
* @param faucetApiUrl - The URL of the faucet API
|
|
6
|
+
* @returns A proxy object that implements the TokenFaucet interface
|
|
7
|
+
*/
|
|
8
|
+
export function createFaucet({ arioInstance, faucetApiUrl = DEFAULT_FAUCET_API_URL, }) {
|
|
9
|
+
const faucet = new ARIOTokenFaucet({
|
|
10
|
+
faucetUrl: faucetApiUrl,
|
|
11
|
+
processId: arioInstance.process.processId,
|
|
12
|
+
});
|
|
13
|
+
const proxy = new Proxy(arioInstance, {
|
|
14
|
+
get(target, prop) {
|
|
15
|
+
if (prop === 'faucet') {
|
|
16
|
+
return faucet;
|
|
17
|
+
}
|
|
18
|
+
if (prop in target) {
|
|
19
|
+
const result = target[prop];
|
|
20
|
+
if (typeof result === 'function') {
|
|
21
|
+
return result.bind(target);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return proxy;
|
|
29
|
+
}
|
|
30
|
+
export class ARIOTokenFaucet {
|
|
31
|
+
faucetUrl;
|
|
32
|
+
processId;
|
|
33
|
+
constructor({ faucetUrl, processId, }) {
|
|
34
|
+
this.faucetUrl = faucetUrl;
|
|
35
|
+
this.processId = processId;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the captcha URL for a process. The captcha is used to verify a human is solving the captcha. Once you have a captcha response, you can use it to request an authorization token via the requestAuthToken method.
|
|
39
|
+
* @returns The captcha URL for a process
|
|
40
|
+
*/
|
|
41
|
+
async captchaUrl() {
|
|
42
|
+
const res = await fetch(`${this.faucetUrl}/api/captcha/url?process-id=${this.processId}`, {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
});
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
47
|
+
throw new Error(body.error);
|
|
48
|
+
}
|
|
49
|
+
const data = (await res.json());
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Claim tokens for a process using a captcha response. This method is used to synchronously claim tokens for a process using a captcha response.
|
|
54
|
+
* @param captchaResponse - The captcha response
|
|
55
|
+
* @param recipient - The recipient address
|
|
56
|
+
* @param quantity - The quantity of tokens to claim
|
|
57
|
+
* @returns The claim id and success status
|
|
58
|
+
*/
|
|
59
|
+
async claimWithCaptchaResponse({ captchaResponse, recipient, quantity, }) {
|
|
60
|
+
const res = await fetch(`${this.faucetUrl}/api/claim/sync`, {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: { 'Content-Type': 'application/json' },
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
processId: this.processId,
|
|
65
|
+
recipient,
|
|
66
|
+
quantity,
|
|
67
|
+
captchaResponse,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
72
|
+
throw new Error(body.error);
|
|
73
|
+
}
|
|
74
|
+
const data = (await res.json());
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Requests an authorization token for a process. The captcha response is used to verify a human is solving the captcha. Once you have an authorization token, you can use it to claim tokens from the faucet via the claimWithAuthToken method.
|
|
79
|
+
* @param captchaResponse - The captcha response
|
|
80
|
+
* @returns The status of the request, the authorization token, and the expiration time
|
|
81
|
+
*/
|
|
82
|
+
async requestAuthToken({ captchaResponse, }) {
|
|
83
|
+
const res = await fetch(`${this.faucetUrl}/api/captcha/verify`, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: { 'Content-Type': 'application/json' },
|
|
86
|
+
body: JSON.stringify({
|
|
87
|
+
processId: this.processId,
|
|
88
|
+
captchaResponse,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
if (!res.ok) {
|
|
92
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
93
|
+
throw new Error(body.error);
|
|
94
|
+
}
|
|
95
|
+
const data = (await res.json());
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Transfers tokens from the faucet wallet to a recipient address using an authorization token. To request an authorization token, solve the captcha from the captchaUrl method.
|
|
100
|
+
* @param authToken - The authorization token
|
|
101
|
+
* @param recipient - The recipient address
|
|
102
|
+
* @param quantity - The quantity of tokens to claim
|
|
103
|
+
* @returns The message id of the transfer and success status
|
|
104
|
+
*/
|
|
105
|
+
async claimWithAuthToken({ authToken, recipient, quantity, }) {
|
|
106
|
+
const res = await fetch(`${this.faucetUrl}/api/claim/async`, {
|
|
107
|
+
method: 'POST',
|
|
108
|
+
headers: {
|
|
109
|
+
'Content-Type': 'application/json',
|
|
110
|
+
Authorization: `Bearer ${authToken}`,
|
|
111
|
+
},
|
|
112
|
+
body: JSON.stringify({
|
|
113
|
+
recipient,
|
|
114
|
+
qty: quantity,
|
|
115
|
+
processId: this.processId,
|
|
116
|
+
}),
|
|
117
|
+
});
|
|
118
|
+
if (!res.ok) {
|
|
119
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
120
|
+
throw new Error(body.error);
|
|
121
|
+
}
|
|
122
|
+
const data = (await res.json());
|
|
123
|
+
return data;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Verifies an authorization token is valid.
|
|
127
|
+
* @param authToken - The authorization token
|
|
128
|
+
* @returns The validity of the authorization token and the expiration time
|
|
129
|
+
*/
|
|
130
|
+
async verifyAuthToken({ authToken }) {
|
|
131
|
+
const res = await fetch(`${this.faucetUrl}/api/token/verify?process-id=${this.processId}`, {
|
|
132
|
+
method: 'GET',
|
|
133
|
+
headers: {
|
|
134
|
+
'Content-Type': 'application/json',
|
|
135
|
+
Authorization: `Bearer ${authToken}`,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
if (!res.ok) {
|
|
139
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
140
|
+
throw new Error(body.error);
|
|
141
|
+
}
|
|
142
|
+
const data = (await res.json());
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
}
|
package/lib/esm/common/index.js
CHANGED
package/lib/esm/common/io.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { connect } from '@permaweb/aoconnect';
|
|
17
|
+
import { ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, } from '../constants.js';
|
|
18
|
+
import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/index.js';
|
|
3
19
|
import { createAoSigner } from '../utils/ao.js';
|
|
4
20
|
import { getEpochDataFromGqlWithCUFallback, paginationParamsToTags, pruneTags, removeEligibleRewardsFromEpochData, sortAndPaginateEpochDataIntoEligibleDistributions, } from '../utils/arweave.js';
|
|
5
21
|
import { defaultArweave } from './arweave.js';
|
|
6
22
|
import { AOProcess } from './contracts/ao-process.js';
|
|
7
23
|
import { InvalidContractConfigurationError } from './error.js';
|
|
8
|
-
import {
|
|
24
|
+
import { createFaucet } from './faucet.js';
|
|
9
25
|
export class ARIO {
|
|
10
26
|
// Implementation
|
|
11
27
|
static init(config) {
|
|
@@ -14,12 +30,61 @@ export class ARIO {
|
|
|
14
30
|
}
|
|
15
31
|
return new ARIOReadable(config);
|
|
16
32
|
}
|
|
33
|
+
static mainnet(config) {
|
|
34
|
+
if (config !== undefined && 'signer' in config) {
|
|
35
|
+
return new ARIOWriteable({
|
|
36
|
+
...config,
|
|
37
|
+
process: new AOProcess({
|
|
38
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
39
|
+
ao: connect({
|
|
40
|
+
CU_URL: 'https://cu.ardrive.io',
|
|
41
|
+
...config?.process?.ao,
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return new ARIOReadable({
|
|
47
|
+
...config,
|
|
48
|
+
process: new AOProcess({
|
|
49
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static testnet(config) {
|
|
54
|
+
if (config !== undefined && 'signer' in config) {
|
|
55
|
+
return createFaucet({
|
|
56
|
+
arioInstance: new ARIOWriteable({
|
|
57
|
+
...config,
|
|
58
|
+
process: new AOProcess({
|
|
59
|
+
processId: ARIO_TESTNET_PROCESS_ID,
|
|
60
|
+
ao: connect({
|
|
61
|
+
CU_URL: 'https://cu.ardrive.io',
|
|
62
|
+
...config?.process?.ao,
|
|
63
|
+
}),
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
faucetApiUrl: config?.faucetUrl,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return createFaucet({
|
|
70
|
+
arioInstance: new ARIOReadable({
|
|
71
|
+
...config,
|
|
72
|
+
process: new AOProcess({
|
|
73
|
+
processId: ARIO_TESTNET_PROCESS_ID,
|
|
74
|
+
ao: connect({
|
|
75
|
+
CU_URL: 'https://cu.ardrive.io',
|
|
76
|
+
...config?.process?.ao,
|
|
77
|
+
}),
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
80
|
+
faucetApiUrl: config?.faucetUrl,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
17
83
|
}
|
|
18
84
|
export class ARIOReadable {
|
|
19
85
|
process;
|
|
20
86
|
epochSettings;
|
|
21
87
|
arweave;
|
|
22
|
-
paymentProvider; // TODO: this could be an array/map of payment providers
|
|
23
88
|
constructor(config) {
|
|
24
89
|
this.arweave = config?.arweave ?? defaultArweave;
|
|
25
90
|
if (config === undefined || Object.keys(config).length === 0) {
|
|
@@ -38,9 +103,6 @@ export class ARIOReadable {
|
|
|
38
103
|
else {
|
|
39
104
|
throw new InvalidContractConfigurationError();
|
|
40
105
|
}
|
|
41
|
-
this.paymentProvider = new TurboArNSPaymentProvider({
|
|
42
|
-
paymentUrl: config?.paymentUrl,
|
|
43
|
-
});
|
|
44
106
|
}
|
|
45
107
|
async getInfo() {
|
|
46
108
|
return this.process.read({
|
|
@@ -372,20 +434,6 @@ export class ARIOReadable {
|
|
|
372
434
|
// TODO: Can overload this function to refine different types of cost details params
|
|
373
435
|
async getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }) {
|
|
374
436
|
const replacedBuyRecordWithBuyName = intent === 'Buy-Record' ? 'Buy-Name' : intent;
|
|
375
|
-
if (fundFrom === 'turbo') {
|
|
376
|
-
const { mARIO, winc } = await this.paymentProvider.getArNSPriceDetails({
|
|
377
|
-
intent: replacedBuyRecordWithBuyName,
|
|
378
|
-
name,
|
|
379
|
-
quantity,
|
|
380
|
-
type,
|
|
381
|
-
years,
|
|
382
|
-
});
|
|
383
|
-
return {
|
|
384
|
-
tokenCost: +mARIO,
|
|
385
|
-
wincQty: winc,
|
|
386
|
-
discounts: [],
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
437
|
const allTags = [
|
|
390
438
|
{ name: 'Action', value: 'Cost-Details' },
|
|
391
439
|
{
|
|
@@ -552,8 +600,7 @@ export class ARIOReadable {
|
|
|
552
600
|
}
|
|
553
601
|
export class ARIOWriteable extends ARIOReadable {
|
|
554
602
|
signer;
|
|
555
|
-
|
|
556
|
-
constructor({ signer, paymentUrl, ...config }) {
|
|
603
|
+
constructor({ signer, ...config }) {
|
|
557
604
|
if (config === undefined) {
|
|
558
605
|
super({
|
|
559
606
|
process: new AOProcess({
|
|
@@ -565,10 +612,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
565
612
|
super(config);
|
|
566
613
|
}
|
|
567
614
|
this.signer = createAoSigner(signer);
|
|
568
|
-
this.paymentProvider = new TurboArNSPaymentProvider({
|
|
569
|
-
signer: signer,
|
|
570
|
-
paymentUrl,
|
|
571
|
-
});
|
|
572
615
|
}
|
|
573
616
|
async transfer({ target, qty, }, options) {
|
|
574
617
|
const { tags = [] } = options || {};
|
|
@@ -843,12 +886,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
843
886
|
});
|
|
844
887
|
}
|
|
845
888
|
async buyRecord(params, options) {
|
|
846
|
-
if (params.fundFrom === 'turbo') {
|
|
847
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
848
|
-
intent: 'Buy-Name',
|
|
849
|
-
...params,
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
889
|
const { tags = [] } = options || {};
|
|
853
890
|
const allTags = [
|
|
854
891
|
...tags,
|
|
@@ -873,12 +910,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
873
910
|
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
874
911
|
*/
|
|
875
912
|
async upgradeRecord(params, options) {
|
|
876
|
-
if (params.fundFrom === 'turbo') {
|
|
877
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
878
|
-
intent: 'Upgrade-Name',
|
|
879
|
-
name: params.name,
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
913
|
const { tags = [] } = options || {};
|
|
883
914
|
const allTags = [
|
|
884
915
|
...tags,
|
|
@@ -901,12 +932,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
901
932
|
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
902
933
|
*/
|
|
903
934
|
async extendLease(params, options) {
|
|
904
|
-
if (params.fundFrom === 'turbo') {
|
|
905
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
906
|
-
intent: 'Extend-Lease',
|
|
907
|
-
...params,
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
935
|
const { tags = [] } = options || {};
|
|
911
936
|
const allTags = [
|
|
912
937
|
...tags,
|
|
@@ -921,12 +946,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
921
946
|
});
|
|
922
947
|
}
|
|
923
948
|
async increaseUndernameLimit(params, options) {
|
|
924
|
-
if (params.fundFrom === 'turbo') {
|
|
925
|
-
return this.paymentProvider.initiateArNSPurchase({
|
|
926
|
-
intent: 'Increase-Undername-Limit',
|
|
927
|
-
...params,
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
949
|
const { tags = [] } = options || {};
|
|
931
950
|
const allTags = [
|
|
932
951
|
...tags,
|
|
@@ -963,9 +982,6 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
963
982
|
});
|
|
964
983
|
}
|
|
965
984
|
async requestPrimaryName(params, options) {
|
|
966
|
-
if (params.fundFrom === 'turbo') {
|
|
967
|
-
throw new Error('Turbo funding is not yet supported for primary name requests');
|
|
968
|
-
}
|
|
969
985
|
const { tags = [] } = options || {};
|
|
970
986
|
const allTags = [
|
|
971
987
|
...tags,
|
package/lib/esm/types/index.js
CHANGED
package/lib/esm/types/io.js
CHANGED
|
@@ -22,16 +22,17 @@ export const intentsUsingYears = [
|
|
|
22
22
|
export const isValidIntent = (intent) => {
|
|
23
23
|
return validIntents.indexOf(intent) !== -1;
|
|
24
24
|
};
|
|
25
|
-
export const fundFromOptions = ['balance', 'stakes', 'any'
|
|
25
|
+
export const fundFromOptions = ['balance', 'stakes', 'any'];
|
|
26
26
|
export const isValidFundFrom = (fundFrom) => {
|
|
27
27
|
return fundFromOptions.indexOf(fundFrom) !== -1;
|
|
28
28
|
};
|
|
29
29
|
// Type-guard functions
|
|
30
30
|
export function isProcessConfiguration(config) {
|
|
31
|
-
return 'process' in config;
|
|
31
|
+
return config !== undefined && 'process' in config;
|
|
32
32
|
}
|
|
33
33
|
export function isProcessIdConfiguration(config) {
|
|
34
|
-
return (
|
|
34
|
+
return (config !== undefined &&
|
|
35
|
+
'processId' in config &&
|
|
35
36
|
typeof config.processId === 'string' &&
|
|
36
37
|
validateArweaveId(config.processId) === true);
|
|
37
38
|
}
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -131,6 +131,8 @@ export function createAoSigner(signer) {
|
|
|
131
131
|
}));
|
|
132
132
|
return signedData;
|
|
133
133
|
};
|
|
134
|
+
// eslint-disable-next-line
|
|
135
|
+
// @ts-ignore Buffer vs ArrayBuffer type mismatch
|
|
134
136
|
return aoSigner;
|
|
135
137
|
}
|
|
136
138
|
export const defaultTargetManifestId = '-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI';
|
package/lib/esm/version.js
CHANGED
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
import { AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams } from '../../types/ant.js';
|
|
17
17
|
import { CLIWriteOptionsFromAoAntParams } from '../types.js';
|
|
18
18
|
/** @deprecated -- use set-ant-base-name and set-ant-undername */
|
|
19
|
-
export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult
|
|
20
|
-
export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult
|
|
21
|
-
export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult
|
|
19
|
+
export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
20
|
+
export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
21
|
+
export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
@@ -19,4 +19,4 @@ export declare function buyRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoBuy
|
|
|
19
19
|
export declare function upgradeRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
20
20
|
export declare function extendLeaseCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendLeaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
21
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
|
|
22
|
+
export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AddressAndVaultIdCLIWriteOptions, DecreaseDelegateStakeCLIOptions, JoinNetworkCLIOptions, OperatorStakeCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WriteActionCLIOptions } from '../types.js';
|
|
2
2
|
export declare function joinNetwork(options: JoinNetworkCLIOptions): Promise<{
|
|
3
|
-
joinNetworkResult: import("../../types/common.js").AoMessageResult
|
|
3
|
+
joinNetworkResult: import("../../types/common.js").AoMessageResult;
|
|
4
4
|
joinedAddress: string;
|
|
5
5
|
message: string;
|
|
6
6
|
}>;
|
|
7
7
|
export declare function updateGatewaySettings(options: UpdateGatewaySettingsCLIOptions): Promise<{
|
|
8
|
-
updateGatewaySettingsResult: import("../../types/common.js").AoMessageResult
|
|
8
|
+
updateGatewaySettingsResult: import("../../types/common.js").AoMessageResult;
|
|
9
9
|
updatedGatewayAddress: string;
|
|
10
10
|
message: string;
|
|
11
11
|
}>;
|
|
@@ -13,26 +13,26 @@ export declare function leaveNetwork(options: WriteActionCLIOptions): Promise<im
|
|
|
13
13
|
export declare function saveObservations(o: WriteActionCLIOptions & {
|
|
14
14
|
failedGateways?: string[];
|
|
15
15
|
transactionId?: string;
|
|
16
|
-
}): Promise<import("../../types/common.js").AoMessageResult
|
|
16
|
+
}): Promise<import("../../types/common.js").AoMessageResult>;
|
|
17
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
|
|
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
21
|
export declare function delegateStake(options: TransferCLIOptions): Promise<{
|
|
22
22
|
senderAddress: string;
|
|
23
|
-
transferResult: import("../../types/common.js").AoMessageResult
|
|
23
|
+
transferResult: import("../../types/common.js").AoMessageResult;
|
|
24
24
|
message: string;
|
|
25
25
|
} | {
|
|
26
26
|
message: string;
|
|
27
27
|
}>;
|
|
28
28
|
export declare function decreaseDelegateStake(options: DecreaseDelegateStakeCLIOptions): Promise<{
|
|
29
29
|
targetGateway: string;
|
|
30
|
-
decreaseDelegateStakeResult: import("../../types/common.js").AoMessageResult
|
|
30
|
+
decreaseDelegateStakeResult: import("../../types/common.js").AoMessageResult;
|
|
31
31
|
message: string;
|
|
32
32
|
}>;
|
|
33
33
|
export declare function redelegateStake(options: RedelegateStakeCLIOptions): Promise<{
|
|
34
34
|
sourceGateway: string;
|
|
35
35
|
targetGateway: string;
|
|
36
|
-
redelegateStakeResult: import("../../types/common.js").AoMessageResult
|
|
36
|
+
redelegateStakeResult: import("../../types/common.js").AoMessageResult;
|
|
37
37
|
message: string;
|
|
38
38
|
}>;
|
|
@@ -54,11 +54,10 @@ export declare function getCostDetails(o: GlobalCLIOptions & CLIOptionsFromAoPar
|
|
|
54
54
|
message: string;
|
|
55
55
|
tokenCost: number;
|
|
56
56
|
discounts: import("../../types/io.js").CostDiscount[];
|
|
57
|
-
returnedNameDetails?:
|
|
57
|
+
returnedNameDetails?: import("../../types/io.js").AoReturnedName & {
|
|
58
58
|
basePrice: number;
|
|
59
|
-
}
|
|
60
|
-
fundingPlan?: import("../../types/io.js").AoFundingPlan
|
|
61
|
-
wincQty?: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
fundingPlan?: import("../../types/io.js").AoFundingPlan;
|
|
62
61
|
}>;
|
|
63
62
|
export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName>;
|
|
64
63
|
export declare function getGatewayVaults(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<AoGatewayVault> | {
|
|
@@ -17,7 +17,7 @@ import { AoCreateVaultParams, AoExtendVaultParams, AoIncreaseVaultParams, AoRevo
|
|
|
17
17
|
import { CLIWriteOptionsFromAoParams, JsonSerializable, TransferCLIOptions } from '../types.js';
|
|
18
18
|
export declare function transferCLICommand(options: TransferCLIOptions): Promise<{
|
|
19
19
|
senderAddress: string;
|
|
20
|
-
transferResult: import("../../types/common.js").AoMessageResult
|
|
20
|
+
transferResult: import("../../types/common.js").AoMessageResult;
|
|
21
21
|
message: string;
|
|
22
22
|
} | {
|
|
23
23
|
message: string;
|
|
@@ -27,14 +27,14 @@ export declare function revokeVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoR
|
|
|
27
27
|
export declare function createVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoCreateVaultParams>): Promise<JsonSerializable>;
|
|
28
28
|
export declare function extendVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendVaultParams>): Promise<{
|
|
29
29
|
senderAddress: string;
|
|
30
|
-
transferResult: import("../../types/common.js").AoMessageResult
|
|
30
|
+
transferResult: import("../../types/common.js").AoMessageResult;
|
|
31
31
|
message: string;
|
|
32
32
|
} | {
|
|
33
33
|
message: string;
|
|
34
34
|
}>;
|
|
35
35
|
export declare function increaseVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoIncreaseVaultParams>): Promise<{
|
|
36
36
|
senderAddress: string;
|
|
37
|
-
transferResult: import("../../types/common.js").AoMessageResult
|
|
37
|
+
transferResult: import("../../types/common.js").AoMessageResult;
|
|
38
38
|
message: string;
|
|
39
39
|
} | {
|
|
40
40
|
message: string;
|
|
@@ -45,10 +45,6 @@ export declare const optionMap: {
|
|
|
45
45
|
alias: string;
|
|
46
46
|
description: string;
|
|
47
47
|
};
|
|
48
|
-
paymentUrl: {
|
|
49
|
-
alias: string;
|
|
50
|
-
description: string;
|
|
51
|
-
};
|
|
52
48
|
processId: {
|
|
53
49
|
alias: string;
|
|
54
50
|
description: string;
|
|
@@ -269,11 +265,6 @@ export declare const optionMap: {
|
|
|
269
265
|
alias: string;
|
|
270
266
|
description: string;
|
|
271
267
|
};
|
|
272
|
-
token: {
|
|
273
|
-
alias: string;
|
|
274
|
-
description: string;
|
|
275
|
-
default: string;
|
|
276
|
-
};
|
|
277
268
|
};
|
|
278
269
|
export declare const walletOptions: {
|
|
279
270
|
alias: string;
|
package/lib/types/cli/types.d.ts
CHANGED
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { AoAddressParams, AoArNSNameParams, AoGetVaultParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
|
|
17
|
-
export type SupportedCLITokenType = 'ethereum' | 'arweave';
|
|
18
17
|
export type WalletCLIOptions = {
|
|
19
18
|
walletFile?: string;
|
|
20
|
-
token?: SupportedCLITokenType;
|
|
21
19
|
privateKey?: string;
|
|
22
20
|
};
|
|
23
21
|
export type GlobalCLIOptions = WalletCLIOptions & {
|
|
@@ -27,7 +25,6 @@ export type GlobalCLIOptions = WalletCLIOptions & {
|
|
|
27
25
|
debug: boolean;
|
|
28
26
|
arioProcessId?: string;
|
|
29
27
|
cuUrl?: string;
|
|
30
|
-
paymentUrl?: string;
|
|
31
28
|
};
|
|
32
29
|
export type WriteActionCLIOptions = GlobalCLIOptions & {
|
|
33
30
|
tags?: string[];
|
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -22,10 +22,6 @@ export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKIn
|
|
|
22
22
|
export declare function jwkToAddress(jwk: JWKInterface): string;
|
|
23
23
|
export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
|
|
24
24
|
export declare function readARIOFromOptions(options: GlobalCLIOptions): AoARIORead;
|
|
25
|
-
export declare function contractSignerFromOptions(options: WalletCLIOptions): {
|
|
26
|
-
signer: ContractSigner;
|
|
27
|
-
signerAddress: string;
|
|
28
|
-
} | undefined;
|
|
29
25
|
export declare function requiredContractSignerFromOptions(options: WalletCLIOptions): {
|
|
30
26
|
signer: ContractSigner;
|
|
31
27
|
signerAddress: string;
|
|
@@ -80,7 +76,7 @@ export declare function positiveIntegerFromOptions<O extends GlobalCLIOptions>(o
|
|
|
80
76
|
export declare function requiredPositiveIntegerFromOptions<O extends GlobalCLIOptions>(options: O, key: string): number;
|
|
81
77
|
export declare function getANTStateFromOptions(options: ANTStateCLIOptions): SpawnANTState;
|
|
82
78
|
export declare function getTokenCostParamsFromOptions(o: GetTokenCostCLIOptions): {
|
|
83
|
-
type: "
|
|
79
|
+
type: "lease" | "permabuy";
|
|
84
80
|
quantity: number | undefined;
|
|
85
81
|
years: number;
|
|
86
82
|
intent: "Buy-Name" | "Buy-Record" | "Extend-Lease" | "Increase-Undername-Limit" | "Upgrade-Name" | "Primary-Name-Request";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AoANTVersionsRead, AoANTVersionsWrite } from '../types/ant.js';
|
|
2
|
-
import {
|
|
2
|
+
import { WithSigner } from '../types/common.js';
|
|
3
3
|
import { ProcessConfiguration } from '../types/io.js';
|
|
4
4
|
import { AOProcess } from './contracts/ao-process.js';
|
|
5
5
|
type ANTVersionsNoSigner = ProcessConfiguration;
|
|
@@ -27,13 +27,16 @@ export declare class ANTVersionsReadable implements AoANTVersionsRead {
|
|
|
27
27
|
export declare class ANTVersionsWritable extends ANTVersionsReadable implements AoANTVersionsWrite {
|
|
28
28
|
private signer;
|
|
29
29
|
constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
|
|
30
|
-
addVersion(
|
|
30
|
+
addVersion(params: {
|
|
31
31
|
version: string;
|
|
32
32
|
moduleId: string;
|
|
33
33
|
luaSourceId?: string;
|
|
34
34
|
notes?: string;
|
|
35
35
|
}, { tags }: {
|
|
36
36
|
tags: any;
|
|
37
|
-
}): Promise<
|
|
37
|
+
}): Promise<{
|
|
38
|
+
id: string;
|
|
39
|
+
result?: unknown;
|
|
40
|
+
}>;
|
|
38
41
|
}
|
|
39
42
|
export {};
|