@ar.io/sdk 3.10.0-alpha.6 → 3.11.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.
- package/README.md +66 -125
- package/bundles/web.bundle.min.js +148 -122
- 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/utils.js +43 -43
- package/lib/cjs/common/faucet.js +2 -2
- package/lib/cjs/common/turbo.js +3 -3
- package/lib/cjs/common/wayfinder/routers/priority.js +2 -2
- package/lib/cjs/common/wayfinder/routers/random.js +2 -2
- package/lib/cjs/common/wayfinder/wayfinder.js +1 -28
- package/lib/cjs/common/wayfinder/wayfinder.test.js +23 -24
- package/lib/cjs/types/ant.js +2 -2
- package/lib/cjs/types/io.js +4 -4
- package/lib/cjs/utils/ao.js +9 -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/random.js +30 -0
- package/lib/cjs/utils/schema.js +1 -2
- package/lib/cjs/utils/utils.test.js +8 -8
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/wayfinder/routers/priority.js +1 -1
- package/lib/esm/common/wayfinder/routers/random.js +1 -1
- package/lib/esm/common/wayfinder/wayfinder.js +0 -26
- package/lib/esm/common/wayfinder/wayfinder.test.js +23 -24
- package/lib/esm/utils/random.js +26 -0
- package/lib/esm/utils/utils.test.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/readCommands.d.ts +4 -4
- package/lib/types/common/http.d.ts +0 -1
- package/lib/types/common/wayfinder/routers/fixed.d.ts +0 -1
- package/lib/types/common/wayfinder/routers/priority.d.ts +0 -1
- package/lib/types/common/wayfinder/routers/random.d.ts +0 -1
- package/lib/types/common/wayfinder/routers/simple-cache.d.ts +0 -1
- package/lib/types/common/wayfinder/wayfinder.d.ts +15 -8
- package/lib/types/types/common.d.ts +0 -1
- package/lib/types/types/io.d.ts +2 -2
- package/lib/types/types/token.d.ts +0 -2
- package/lib/types/types/wayfinder.d.ts +0 -1
- package/lib/types/utils/base64.d.ts +0 -2
- package/lib/types/utils/random.d.ts +7 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +3 -3
package/lib/cjs/utils/arweave.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.epochDistributionNoticeGqlQueryFallback = exports.epochDistributionNoticeGqlQuery = exports.getEpochDataFromGqlFallback = exports.getEpochDataFromGqlWithCUFallback = exports.getEpochDataFromGql = exports.paginationParamsToTags = exports.pruneTags = exports.validateArweaveId = void 0;
|
|
4
|
+
exports.isBlockHeight = isBlockHeight;
|
|
5
|
+
exports.sortAndPaginateEpochDataIntoEligibleDistributions = sortAndPaginateEpochDataIntoEligibleDistributions;
|
|
6
|
+
exports.removeEligibleRewardsFromEpochData = removeEligibleRewardsFromEpochData;
|
|
4
7
|
const constants_js_1 = require("../constants.js");
|
|
5
8
|
const io_js_1 = require("../types/io.js");
|
|
6
9
|
const ao_js_1 = require("./ao.js");
|
|
@@ -11,7 +14,6 @@ exports.validateArweaveId = validateArweaveId;
|
|
|
11
14
|
function isBlockHeight(height) {
|
|
12
15
|
return height !== undefined && !isNaN(parseInt(height.toString()));
|
|
13
16
|
}
|
|
14
|
-
exports.isBlockHeight = isBlockHeight;
|
|
15
17
|
/**
|
|
16
18
|
* Prune tags that are undefined or empty.
|
|
17
19
|
* @param tags - The tags to prune.
|
|
@@ -251,7 +253,6 @@ function sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params) {
|
|
|
251
253
|
sortBy,
|
|
252
254
|
};
|
|
253
255
|
}
|
|
254
|
-
exports.sortAndPaginateEpochDataIntoEligibleDistributions = sortAndPaginateEpochDataIntoEligibleDistributions;
|
|
255
256
|
function removeEligibleRewardsFromEpochData(epochData) {
|
|
256
257
|
if (!(0, io_js_1.isDistributedEpoch)(epochData)) {
|
|
257
258
|
return epochData;
|
|
@@ -268,4 +269,3 @@ function removeEligibleRewardsFromEpochData(epochData) {
|
|
|
268
269
|
},
|
|
269
270
|
};
|
|
270
271
|
}
|
|
271
|
-
exports.removeEligibleRewardsFromEpochData = removeEligibleRewardsFromEpochData;
|
package/lib/cjs/utils/base64.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fromB64Url = fromB64Url;
|
|
4
|
+
exports.toB64Url = toB64Url;
|
|
5
|
+
exports.sha256B64Url = sha256B64Url;
|
|
6
|
+
exports.getRandomText = getRandomText;
|
|
4
7
|
/**
|
|
5
8
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
9
|
*
|
|
@@ -42,16 +45,13 @@ function fromB64Url(str) {
|
|
|
42
45
|
const b64Str = base64urlToBase64(str);
|
|
43
46
|
return Buffer.from(b64Str, 'base64');
|
|
44
47
|
}
|
|
45
|
-
exports.fromB64Url = fromB64Url;
|
|
46
48
|
function toB64Url(buffer) {
|
|
47
49
|
const b64Str = buffer.toString('base64');
|
|
48
50
|
return base64urlFromBase64(b64Str);
|
|
49
51
|
}
|
|
50
|
-
exports.toB64Url = toB64Url;
|
|
51
52
|
function sha256B64Url(input) {
|
|
52
53
|
return toB64Url((0, crypto_1.createHash)('sha256').update(Uint8Array.from(input)).digest());
|
|
53
54
|
}
|
|
54
|
-
exports.sha256B64Url = sha256B64Url;
|
|
55
55
|
function getRandomText(length = 32) {
|
|
56
56
|
// Generate a buffer of random bytes
|
|
57
57
|
const buffer = (0, crypto_1.randomBytes)(length);
|
|
@@ -60,4 +60,3 @@ function getRandomText(length = 32) {
|
|
|
60
60
|
.join('')
|
|
61
61
|
.slice(0, length);
|
|
62
62
|
}
|
|
63
|
-
exports.getRandomText = getRandomText;
|
package/lib/cjs/utils/json.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.safeDecode =
|
|
18
|
+
exports.safeDecode = safeDecode;
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
20
|
function safeDecode(data) {
|
|
21
21
|
try {
|
|
@@ -25,4 +25,3 @@ function safeDecode(data) {
|
|
|
25
25
|
return data;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
exports.safeDecode = safeDecode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomInt = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const crypto_1 = require("crypto");
|
|
20
|
+
/**
|
|
21
|
+
* Cryptographically secure helper for randomness, does not support seeding
|
|
22
|
+
* @param min - the minimum value
|
|
23
|
+
* @param max - the maximum value
|
|
24
|
+
* @returns a random integer between min and max
|
|
25
|
+
*/
|
|
26
|
+
const randomInt = (min, max) => {
|
|
27
|
+
const [rand] = crypto_1.webcrypto.getRandomValues(new Uint32Array(1));
|
|
28
|
+
return min + (rand % (max - min));
|
|
29
|
+
};
|
|
30
|
+
exports.randomInt = randomInt;
|
package/lib/cjs/utils/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSchemaResult =
|
|
3
|
+
exports.parseSchemaResult = parseSchemaResult;
|
|
4
4
|
/**
|
|
5
5
|
* @param schema - zod schema
|
|
6
6
|
* @param v - value to parse
|
|
@@ -13,4 +13,3 @@ function parseSchemaResult(schema, v) {
|
|
|
13
13
|
}
|
|
14
14
|
return schemaResult;
|
|
15
15
|
}
|
|
16
|
-
exports.parseSchemaResult = parseSchemaResult;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_assert_1 = require("node:assert");
|
|
4
4
|
const node_test_1 = require("node:test");
|
|
5
|
+
const ao_js_1 = require("./ao.js");
|
|
5
6
|
const arweave_js_1 = require("./arweave.js");
|
|
6
|
-
const index_js_1 = require("./index.js");
|
|
7
7
|
(0, node_test_1.describe)('pruneTags', () => {
|
|
8
8
|
(0, node_test_1.it)('should remove tags with undefined values', () => {
|
|
9
9
|
const tags = [
|
|
@@ -45,7 +45,7 @@ const index_js_1 = require("./index.js");
|
|
|
45
45
|
const output = {
|
|
46
46
|
Error: 'Error message',
|
|
47
47
|
};
|
|
48
|
-
const errorMessage = (0,
|
|
48
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
49
49
|
node_assert_1.strict.equal(errorMessage, 'Error message');
|
|
50
50
|
});
|
|
51
51
|
(0, node_test_1.it)('should return error message from Error tag', () => {
|
|
@@ -56,7 +56,7 @@ const index_js_1 = require("./index.js");
|
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
58
|
};
|
|
59
|
-
const errorMessage = (0,
|
|
59
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
60
60
|
node_assert_1.strict.equal(errorMessage, 'Error message');
|
|
61
61
|
});
|
|
62
62
|
(0, node_test_1.it)('should return error message from Error tag if Error field is undefined', () => {
|
|
@@ -67,7 +67,7 @@ const index_js_1 = require("./index.js");
|
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
69
|
};
|
|
70
|
-
const errorMessage = (0,
|
|
70
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
71
71
|
node_assert_1.strict.equal(errorMessage, 'Error message');
|
|
72
72
|
});
|
|
73
73
|
(0, node_test_1.it)('should return undefined if no error message is present', () => {
|
|
@@ -78,21 +78,21 @@ const index_js_1 = require("./index.js");
|
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
80
|
};
|
|
81
|
-
const errorMessage = (0,
|
|
81
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
82
82
|
node_assert_1.strict.equal(errorMessage, undefined);
|
|
83
83
|
});
|
|
84
84
|
(0, node_test_1.it)('should return error message with line number', () => {
|
|
85
85
|
const output = {
|
|
86
86
|
Error: '[string "aos"]:123: Error message',
|
|
87
87
|
};
|
|
88
|
-
const errorMessage = (0,
|
|
88
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
89
89
|
node_assert_1.strict.equal(errorMessage, 'Error message (line 123)');
|
|
90
90
|
});
|
|
91
91
|
(0, node_test_1.it)('should return error message with line number and remove unicode', () => {
|
|
92
92
|
const output = {
|
|
93
93
|
Error: '[string "aos"]:123: Error message\u001b[0m',
|
|
94
94
|
};
|
|
95
|
-
const errorMessage = (0,
|
|
95
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
96
96
|
node_assert_1.strict.equal(errorMessage, 'Error message (line 123)');
|
|
97
97
|
});
|
|
98
98
|
const knownErrorMessages = '\u001b[31mError\u001b[90m handling message with Action = Register\u001b[0m\n\u001b[32m[string ".handlers"]:723: [string "aos"]:128: Already registered\u001b[0m\n\n\u001b[90mstack traceback:\n\t[string ".process"]:871: in function \'.process.handle\'\u001b[0m\n\n\u001b[31merror:\n\u001b[0m[string ".handlers"]:723: [string "aos"]:128: Already registered';
|
|
@@ -100,7 +100,7 @@ const index_js_1 = require("./index.js");
|
|
|
100
100
|
const output = {
|
|
101
101
|
Error: knownErrorMessages,
|
|
102
102
|
};
|
|
103
|
-
const errorMessage = (0,
|
|
103
|
+
const errorMessage = (0, ao_js_1.errorMessageFromOutput)(output);
|
|
104
104
|
node_assert_1.strict.equal(errorMessage, 'Already registered (line 128)');
|
|
105
105
|
});
|
|
106
106
|
});
|
package/lib/cjs/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { randomInt } from '
|
|
1
|
+
import { randomInt } from '../../../utils/random.js';
|
|
2
2
|
// TODO: one of N where N are in the last time window have met certain performance thresholds
|
|
3
3
|
// TODO: look at bitorrent routing protocols for inspiration
|
|
4
4
|
// TODO: router that looks at local stats/metrics and adjusts based on those
|
|
@@ -1,35 +1,9 @@
|
|
|
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 { webcrypto } from 'crypto';
|
|
17
1
|
import { ARIO } from '../io.js';
|
|
18
2
|
import { ARIOGatewaysProvider } from './gateways.js';
|
|
19
3
|
import { RandomGatewayRouter } from './routers/random.js';
|
|
20
4
|
// known regexes for wayfinder urls
|
|
21
5
|
export const arnsRegex = /^[a-z0-9_-]{1,51}$/;
|
|
22
6
|
export const txIdRegex = /^[a-z0-9]{43}$/;
|
|
23
|
-
/**
|
|
24
|
-
* Cryptographically secure helper for randomness, does not support seeding
|
|
25
|
-
* @param min - the minimum value
|
|
26
|
-
* @param max - the maximum value
|
|
27
|
-
* @returns a random integer between min and max
|
|
28
|
-
*/
|
|
29
|
-
export const randomInt = (min, max) => {
|
|
30
|
-
const [rand] = webcrypto.getRandomValues(new Uint32Array(1));
|
|
31
|
-
return min + (rand % (max - min));
|
|
32
|
-
};
|
|
33
7
|
/**
|
|
34
8
|
* Core function to resolve a wayfinder url against a target gateway
|
|
35
9
|
* @param originalUrl - the wayfinder url to resolve
|
|
@@ -219,31 +219,30 @@ describe('Wayfinder', () => {
|
|
|
219
219
|
assert.strictEqual(response.data, nativeAxios.data);
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
})
|
|
222
|
+
describe('got', () => {
|
|
223
|
+
let wayfinder;
|
|
224
|
+
before(() => {
|
|
225
|
+
wayfinder = new Wayfinder({
|
|
226
|
+
httpClient: got,
|
|
227
|
+
router: new RandomGatewayRouter({
|
|
228
|
+
gatewaysProvider: stubbedGatewaysProvider,
|
|
229
|
+
}),
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
it('should fetch the data using the got default function against the target gateway', async () => {
|
|
233
|
+
const [nativeGot, response] = await Promise.all([
|
|
234
|
+
got('https://ao.arweave.net'),
|
|
235
|
+
wayfinder.request('ar://ao'),
|
|
236
|
+
]);
|
|
237
|
+
assert.strictEqual(response.statusCode, 200);
|
|
238
|
+
assert.strictEqual(response.statusCode, nativeGot.statusCode);
|
|
239
|
+
assert.deepStrictEqual(response.body, nativeGot.body);
|
|
240
|
+
});
|
|
241
|
+
it('should stream the data using got.stream against the selected target gateway', async () => {
|
|
242
|
+
const nativeBuffer = await buffer(await got.stream('https://ao.arweave.net', { decompress: false }));
|
|
243
|
+
const wayfinderBuffer = await buffer(await wayfinder.request.stream('ar://ao', { decompress: false }));
|
|
244
|
+
assert.deepStrictEqual(wayfinderBuffer, nativeBuffer);
|
|
231
245
|
});
|
|
232
|
-
});
|
|
233
|
-
it('should fetch the data using the got default function against the target gateway', async () => {
|
|
234
|
-
const [nativeGot, response] = await Promise.all([
|
|
235
|
-
got('https://ao.arweave.net'),
|
|
236
|
-
wayfinder.request('ar://ao'),
|
|
237
|
-
]);
|
|
238
|
-
assert.strictEqual(response.statusCode, 200);
|
|
239
|
-
assert.strictEqual(response.statusCode, nativeGot.statusCode);
|
|
240
|
-
assert.deepStrictEqual(response.body, nativeGot.body);
|
|
241
|
-
});
|
|
242
|
-
it('should stream the data using got.stream against the selected target gateway', async () => {
|
|
243
|
-
const nativeBuffer = await buffer(await got.stream('https://ao.arweave.net', { decompress: false }));
|
|
244
|
-
const wayfinderBuffer = await buffer(await wayfinder.request.stream('ar://ao', { decompress: false }));
|
|
245
|
-
assert.deepStrictEqual(wayfinderBuffer, nativeBuffer);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
-
// TODO: streaming support using got.stream and got()
|
|
249
248
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { webcrypto } from 'crypto';
|
|
17
|
+
/**
|
|
18
|
+
* Cryptographically secure helper for randomness, does not support seeding
|
|
19
|
+
* @param min - the minimum value
|
|
20
|
+
* @param max - the maximum value
|
|
21
|
+
* @returns a random integer between min and max
|
|
22
|
+
*/
|
|
23
|
+
export const randomInt = (min, max) => {
|
|
24
|
+
const [rand] = webcrypto.getRandomValues(new Uint32Array(1));
|
|
25
|
+
return min + (rand % (max - min));
|
|
26
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { strict as assert } from 'node:assert';
|
|
2
2
|
import { describe, it } from 'node:test';
|
|
3
|
+
import { errorMessageFromOutput } from './ao.js';
|
|
3
4
|
import { pruneTags, sortAndPaginateEpochDataIntoEligibleDistributions, } from './arweave.js';
|
|
4
|
-
import { errorMessageFromOutput } from './index.js';
|
|
5
5
|
describe('pruneTags', () => {
|
|
6
6
|
it('should remove tags with undefined values', () => {
|
|
7
7
|
const tags = [
|
package/lib/esm/version.js
CHANGED
|
@@ -54,11 +54,11 @@ 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
|
|
59
|
+
};
|
|
60
|
+
fundingPlan?: import("../../types/io.js").AoFundingPlan;
|
|
61
|
+
wincQty?: string;
|
|
62
62
|
}>;
|
|
63
63
|
export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName>;
|
|
64
64
|
export declare function getGatewayVaults(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<AoGatewayVault> | {
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
16
|
import { WayfinderRouter } from '../../types/wayfinder.js';
|
|
3
17
|
type AnyFunction = (...args: [string, ...unknown[]]) => unknown;
|
|
4
18
|
type WayfinderHttpClient<T extends AnyFunction> = T;
|
|
5
19
|
export declare const arnsRegex: RegExp;
|
|
6
20
|
export declare const txIdRegex: RegExp;
|
|
7
|
-
/**
|
|
8
|
-
* Cryptographically secure helper for randomness, does not support seeding
|
|
9
|
-
* @param min - the minimum value
|
|
10
|
-
* @param max - the maximum value
|
|
11
|
-
* @returns a random integer between min and max
|
|
12
|
-
*/
|
|
13
|
-
export declare const randomInt: (min: number, max: number) => number;
|
|
14
21
|
/**
|
|
15
22
|
* Core function to resolve a wayfinder url against a target gateway
|
|
16
23
|
* @param originalUrl - the wayfinder url to resolve
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ export type AoRedelegateStakeParams = {
|
|
|
301
301
|
export declare const validIntents: readonly ["Buy-Name", "Buy-Record", "Extend-Lease", "Increase-Undername-Limit", "Upgrade-Name", "Primary-Name-Request"];
|
|
302
302
|
export declare const intentsUsingYears: readonly ["Buy-Record", "Buy-Name", "Extend-Lease"];
|
|
303
303
|
export type Intent = (typeof validIntents)[number];
|
|
304
|
-
export declare const isValidIntent: (intent: string) => intent is
|
|
304
|
+
export declare const isValidIntent: (intent: string) => intent is Intent;
|
|
305
305
|
export type AoTokenCostParams = {
|
|
306
306
|
intent: Intent;
|
|
307
307
|
type?: 'permabuy' | 'lease';
|
|
@@ -312,7 +312,7 @@ export type AoTokenCostParams = {
|
|
|
312
312
|
};
|
|
313
313
|
export declare const fundFromOptions: readonly ["balance", "stakes", "any", "turbo"];
|
|
314
314
|
export type FundFrom = (typeof fundFromOptions)[number];
|
|
315
|
-
export declare const isValidFundFrom: (fundFrom: string) => fundFrom is
|
|
315
|
+
export declare const isValidFundFrom: (fundFrom: string) => fundFrom is FundFrom;
|
|
316
316
|
export type AoGetCostDetailsParams = AoTokenCostParams & {
|
|
317
317
|
fundFrom?: FundFrom;
|
|
318
318
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographically secure helper for randomness, does not support seeding
|
|
3
|
+
* @param min - the minimum value
|
|
4
|
+
* @param max - the maximum value
|
|
5
|
+
* @returns a random integer between min and max
|
|
6
|
+
*/
|
|
7
|
+
export declare const randomInt: (min: number, max: number) => number;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0-alpha.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"test:cjs": "yarn build:cjs && yarn link && cd ./tests/e2e/cjs && yarn && yarn test",
|
|
73
73
|
"test:esm": "yarn build:esm && yarn link && cd ./tests/e2e/esm && yarn && yarn test",
|
|
74
74
|
"test:web": "yarn build:esm && yarn link && cd ./tests/e2e/web && yarn && yarn test",
|
|
75
|
-
"test:unit": "node --import=./register.mjs --test --test-reporter=spec 'src/**/*.test.ts'",
|
|
75
|
+
"test:unit": "node --import=./register.mjs --test --test-reporter=spec --enable-source-maps --trace-warnings 'src/**/*.test.ts'",
|
|
76
76
|
"test:link": "yarn build && yarn link",
|
|
77
77
|
"test:e2e": "yarn test:cjs && yarn test:esm && yarn test:web",
|
|
78
78
|
"test:integration": "yarn build:esm && yarn link && cd ./tests/integration && yarn && yarn test",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"@semantic-release/exec": "^6.0.3",
|
|
92
92
|
"@semantic-release/git": "^10.0.1",
|
|
93
93
|
"@semantic-release/npm": "^11.0.3",
|
|
94
|
+
"@swc/core": "^1.11.22",
|
|
94
95
|
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
|
95
96
|
"@types/node": "^22.14.1",
|
|
96
97
|
"@types/prompts": "^2.4.9",
|
|
@@ -134,7 +135,6 @@
|
|
|
134
135
|
"eventemitter3": "^5.0.1",
|
|
135
136
|
"plimit-lit": "^3.0.1",
|
|
136
137
|
"prompts": "^2.4.2",
|
|
137
|
-
"uuid": "^11.1.0",
|
|
138
138
|
"winston": "^3.13.0",
|
|
139
139
|
"zod": "^3.23.8"
|
|
140
140
|
},
|