@ar.io/sdk 3.11.0-alpha.1 → 3.11.0-alpha.2
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/bundles/web.bundle.min.js +64 -64
- package/lib/cjs/cli/wayfinder.js +34 -0
- package/lib/cjs/common/wayfinder/index.js +2 -0
- package/lib/cjs/common/wayfinder/wayfinder.js +13 -6
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/wayfinder.js +32 -0
- package/lib/esm/common/wayfinder/index.js +2 -0
- package/lib/esm/common/wayfinder/wayfinder.js +13 -6
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/wayfinder.d.ts +1 -0
- package/lib/types/common/wayfinder/index.d.ts +1 -0
- package/lib/types/common/wayfinder/wayfinder.d.ts +17 -10
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const commander_1 = require("commander");
|
|
19
|
+
const version_js_1 = require("../version.js");
|
|
20
|
+
const options_js_1 = require("./options.js");
|
|
21
|
+
const utils_js_1 = require("./utils.js");
|
|
22
|
+
(0, utils_js_1.applyOptions)(commander_1.program
|
|
23
|
+
.name('ar.io')
|
|
24
|
+
.version(version_js_1.version)
|
|
25
|
+
.description('AR.IO Network CLI')
|
|
26
|
+
.helpCommand(true), options_js_1.globalOptions);
|
|
27
|
+
(0, utils_js_1.makeCommand)({
|
|
28
|
+
name: '',
|
|
29
|
+
description: 'Get network info',
|
|
30
|
+
action: () => {
|
|
31
|
+
console.log('wayfinder');
|
|
32
|
+
return Promise.resolve({});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -34,3 +34,5 @@ __exportStar(require("./wayfinder.js"), exports);
|
|
|
34
34
|
__exportStar(require("./routers/random.js"), exports);
|
|
35
35
|
__exportStar(require("./routers/priority.js"), exports);
|
|
36
36
|
__exportStar(require("./routers/fixed.js"), exports);
|
|
37
|
+
// gateways providers
|
|
38
|
+
__exportStar(require("./gateways.js"), exports);
|
|
@@ -92,7 +92,9 @@ class Wayfinder {
|
|
|
92
92
|
*
|
|
93
93
|
* @example
|
|
94
94
|
* const wayfinder = new Wayfinder({
|
|
95
|
-
* router: new RandomGatewayRouter({
|
|
95
|
+
* router: new RandomGatewayRouter({
|
|
96
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
97
|
+
* }),
|
|
96
98
|
* });
|
|
97
99
|
*/
|
|
98
100
|
router;
|
|
@@ -101,7 +103,9 @@ class Wayfinder {
|
|
|
101
103
|
*
|
|
102
104
|
* @example
|
|
103
105
|
* const wayfinder = new Wayfinder({
|
|
104
|
-
* router: new RandomGatewayRouter({
|
|
106
|
+
* router: new RandomGatewayRouter({
|
|
107
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
108
|
+
* }),
|
|
105
109
|
* httpClient: axios,
|
|
106
110
|
* });
|
|
107
111
|
*/
|
|
@@ -111,7 +115,9 @@ class Wayfinder {
|
|
|
111
115
|
*
|
|
112
116
|
* @example
|
|
113
117
|
* const wayfinder = new Wayfinder({
|
|
114
|
-
* router: new RandomGatewayRouter({
|
|
118
|
+
* router: new RandomGatewayRouter({
|
|
119
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
120
|
+
* }),
|
|
115
121
|
* httpClient: axios,
|
|
116
122
|
* });
|
|
117
123
|
*
|
|
@@ -123,12 +129,13 @@ class Wayfinder {
|
|
|
123
129
|
*
|
|
124
130
|
* @example
|
|
125
131
|
* const { request: wayfind } = new Wayfinder({
|
|
126
|
-
* router: new RandomGatewayRouter({
|
|
132
|
+
* router: new RandomGatewayRouter({
|
|
133
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
134
|
+
* }),
|
|
127
135
|
* httpClient: axios,
|
|
128
136
|
* });;
|
|
129
137
|
*
|
|
130
|
-
*
|
|
131
|
-
* const response = await wayfind('ar://', {
|
|
138
|
+
* const response = await wayfind('ar://example', {
|
|
132
139
|
* method: 'POST',
|
|
133
140
|
* data: {
|
|
134
141
|
* name: 'John Doe',
|
package/lib/cjs/version.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
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 { program } from 'commander';
|
|
17
|
+
import { version } from '../version.js';
|
|
18
|
+
import { globalOptions } from './options.js';
|
|
19
|
+
import { applyOptions, makeCommand } from './utils.js';
|
|
20
|
+
applyOptions(program
|
|
21
|
+
.name('ar.io')
|
|
22
|
+
.version(version)
|
|
23
|
+
.description('AR.IO Network CLI')
|
|
24
|
+
.helpCommand(true), globalOptions);
|
|
25
|
+
makeCommand({
|
|
26
|
+
name: '',
|
|
27
|
+
description: 'Get network info',
|
|
28
|
+
action: () => {
|
|
29
|
+
console.log('wayfinder');
|
|
30
|
+
return Promise.resolve({});
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -87,7 +87,9 @@ export class Wayfinder {
|
|
|
87
87
|
*
|
|
88
88
|
* @example
|
|
89
89
|
* const wayfinder = new Wayfinder({
|
|
90
|
-
* router: new RandomGatewayRouter({
|
|
90
|
+
* router: new RandomGatewayRouter({
|
|
91
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
92
|
+
* }),
|
|
91
93
|
* });
|
|
92
94
|
*/
|
|
93
95
|
router;
|
|
@@ -96,7 +98,9 @@ export class Wayfinder {
|
|
|
96
98
|
*
|
|
97
99
|
* @example
|
|
98
100
|
* const wayfinder = new Wayfinder({
|
|
99
|
-
* router: new RandomGatewayRouter({
|
|
101
|
+
* router: new RandomGatewayRouter({
|
|
102
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
103
|
+
* }),
|
|
100
104
|
* httpClient: axios,
|
|
101
105
|
* });
|
|
102
106
|
*/
|
|
@@ -106,7 +110,9 @@ export class Wayfinder {
|
|
|
106
110
|
*
|
|
107
111
|
* @example
|
|
108
112
|
* const wayfinder = new Wayfinder({
|
|
109
|
-
* router: new RandomGatewayRouter({
|
|
113
|
+
* router: new RandomGatewayRouter({
|
|
114
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
115
|
+
* }),
|
|
110
116
|
* httpClient: axios,
|
|
111
117
|
* });
|
|
112
118
|
*
|
|
@@ -118,12 +124,13 @@ export class Wayfinder {
|
|
|
118
124
|
*
|
|
119
125
|
* @example
|
|
120
126
|
* const { request: wayfind } = new Wayfinder({
|
|
121
|
-
* router: new RandomGatewayRouter({
|
|
127
|
+
* router: new RandomGatewayRouter({
|
|
128
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
129
|
+
* }),
|
|
122
130
|
* httpClient: axios,
|
|
123
131
|
* });;
|
|
124
132
|
*
|
|
125
|
-
*
|
|
126
|
-
* const response = await wayfind('ar://', {
|
|
133
|
+
* const response = await wayfind('ar://example', {
|
|
127
134
|
* method: 'POST',
|
|
128
135
|
* data: {
|
|
129
136
|
* name: 'John Doe',
|
package/lib/esm/version.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { WayfinderRouter } from '../../types/wayfinder.js';
|
|
17
|
-
type
|
|
18
|
-
type WayfinderHttpClient<T extends
|
|
17
|
+
type HttpClientFunction = (...args: [string, ...unknown[]]) => unknown;
|
|
18
|
+
type WayfinderHttpClient<T extends HttpClientFunction> = T;
|
|
19
19
|
export declare const arnsRegex: RegExp;
|
|
20
20
|
export declare const txIdRegex: RegExp;
|
|
21
21
|
/**
|
|
@@ -41,7 +41,7 @@ export declare const resolveWayfinderUrl: ({ originalUrl, targetGateway, }: {
|
|
|
41
41
|
* @param resolveUrl - the function to construct the redirect url for ar:// requests
|
|
42
42
|
* @returns a wrapped http client that supports ar:// protocol
|
|
43
43
|
*/
|
|
44
|
-
export declare const createWayfinderClient: <T extends
|
|
44
|
+
export declare const createWayfinderClient: <T extends HttpClientFunction>({ httpClient, resolveUrl, }: {
|
|
45
45
|
httpClient: T;
|
|
46
46
|
resolveUrl: (params: {
|
|
47
47
|
originalUrl: string | URL;
|
|
@@ -53,13 +53,15 @@ export declare const createWayfinderClient: <T extends AnyFunction>({ httpClient
|
|
|
53
53
|
* @param httpClient - the http client to use for requests
|
|
54
54
|
* @param blocklist - the blocklist of gateways to avoid
|
|
55
55
|
*/
|
|
56
|
-
export declare class Wayfinder<T extends
|
|
56
|
+
export declare class Wayfinder<T extends HttpClientFunction> {
|
|
57
57
|
/**
|
|
58
58
|
* The router to use for requests
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* const wayfinder = new Wayfinder({
|
|
62
|
-
* router: new RandomGatewayRouter({
|
|
62
|
+
* router: new RandomGatewayRouter({
|
|
63
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
64
|
+
* }),
|
|
63
65
|
* });
|
|
64
66
|
*/
|
|
65
67
|
readonly router: WayfinderRouter;
|
|
@@ -68,7 +70,9 @@ export declare class Wayfinder<T extends AnyFunction> {
|
|
|
68
70
|
*
|
|
69
71
|
* @example
|
|
70
72
|
* const wayfinder = new Wayfinder({
|
|
71
|
-
* router: new RandomGatewayRouter({
|
|
73
|
+
* router: new RandomGatewayRouter({
|
|
74
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
75
|
+
* }),
|
|
72
76
|
* httpClient: axios,
|
|
73
77
|
* });
|
|
74
78
|
*/
|
|
@@ -78,7 +82,9 @@ export declare class Wayfinder<T extends AnyFunction> {
|
|
|
78
82
|
*
|
|
79
83
|
* @example
|
|
80
84
|
* const wayfinder = new Wayfinder({
|
|
81
|
-
* router: new RandomGatewayRouter({
|
|
85
|
+
* router: new RandomGatewayRouter({
|
|
86
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
87
|
+
* }),
|
|
82
88
|
* httpClient: axios,
|
|
83
89
|
* });
|
|
84
90
|
*
|
|
@@ -92,12 +98,13 @@ export declare class Wayfinder<T extends AnyFunction> {
|
|
|
92
98
|
*
|
|
93
99
|
* @example
|
|
94
100
|
* const { request: wayfind } = new Wayfinder({
|
|
95
|
-
* router: new RandomGatewayRouter({
|
|
101
|
+
* router: new RandomGatewayRouter({
|
|
102
|
+
* gatewaysProvider: new ARIOGatewaysProvider({ ario: ARIO.mainnet() })
|
|
103
|
+
* }),
|
|
96
104
|
* httpClient: axios,
|
|
97
105
|
* });;
|
|
98
106
|
*
|
|
99
|
-
*
|
|
100
|
-
* const response = await wayfind('ar://', {
|
|
107
|
+
* const response = await wayfind('ar://example', {
|
|
101
108
|
* method: 'POST',
|
|
102
109
|
* data: {
|
|
103
110
|
* name: 'John Doe',
|
package/lib/types/version.d.ts
CHANGED