@ar.io/wayfinder-core 1.4.3-alpha.0 → 1.5.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 +58 -25
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/wayfinder.d.ts.map +1 -1
- package/dist/wayfinder.js +4 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add @ar.io/wayfinder-core
|
|
|
19
19
|
```javascript
|
|
20
20
|
import { createWayfinderClient } from '@ar.io/wayfinder-core';
|
|
21
21
|
|
|
22
|
-
// Uses
|
|
22
|
+
// Uses trusted peers gateway provider by default
|
|
23
23
|
const wayfinder = createWayfinderClient();
|
|
24
24
|
|
|
25
25
|
// Use Wayfinder to fetch and verify data using ar:// protocol
|
|
@@ -39,14 +39,14 @@ const wayfinder = createWayfinderClient({
|
|
|
39
39
|
});
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
###
|
|
42
|
+
### Custom Trusted Gateway
|
|
43
43
|
|
|
44
44
|
```javascript
|
|
45
45
|
import { createWayfinderClient } from '@ar.io/wayfinder-core';
|
|
46
46
|
|
|
47
|
-
// Use
|
|
47
|
+
// Use a specific trusted gateway for fetching peers
|
|
48
48
|
const wayfinder = createWayfinderClient({
|
|
49
|
-
trustedGateways: ['https://permagate.io',
|
|
49
|
+
trustedGateways: ['https://permagate.io'], // First gateway is used for TrustedPeersGatewaysProvider
|
|
50
50
|
routing: 'fastest',
|
|
51
51
|
verification: 'hash',
|
|
52
52
|
});
|
|
@@ -112,11 +112,11 @@ ar://NAME // ArNS name (paths supported)
|
|
|
112
112
|
ar:///info // Gateway endpoint (/info)
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
## Dynamic
|
|
115
|
+
## Dynamic Routing
|
|
116
116
|
|
|
117
117
|
Wayfinder supports a `resolveUrl` method which generates dynamic redirect URLs to a target gateway based on the provided routing strategy. This function can be used to directly replace any hard-coded gateway URLs, and instead use Wayfinder's routing logic to select a gateway for the request.
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
#### ArNS names
|
|
120
120
|
|
|
121
121
|
Given an ArNS name, the redirect URL will be the same as the original URL, but with the gateway selected by Wayfinder's routing strategy.
|
|
122
122
|
|
|
@@ -127,7 +127,7 @@ const redirectUrl = await wayfinder.resolveUrl({
|
|
|
127
127
|
// results in https://ardrive.<selected-gateway>
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
#### Transaction Ids
|
|
131
131
|
|
|
132
132
|
Given a txId, the redirect URL will be the same as the original URL, but with the gateway selected by Wayfinder's routing strategy.
|
|
133
133
|
|
|
@@ -138,7 +138,7 @@ const redirectUrl = await wayfinder.resolveUrl({
|
|
|
138
138
|
// results in https://<selected-gateway>/example-tx-id
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
#### Legacy arweave.net or arweave.dev URLs
|
|
142
142
|
|
|
143
143
|
Given a legacy arweave.net or arweave.dev URL, the redirect URL will be the same as the original URL, but with the gateway selected by Wayfinder's routing strategy.
|
|
144
144
|
|
|
@@ -149,7 +149,7 @@ const redirectUrl = await wayfinder.resolveUrl({
|
|
|
149
149
|
// results in https://<selected-gateway>/example-tx-id
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
#### ar:// URLs
|
|
153
153
|
|
|
154
154
|
Given an ar:// URL, the redirect URL will be the same as the original URL, but with the gateway selected by Wayfinder's routing strategy.
|
|
155
155
|
|
|
@@ -162,7 +162,15 @@ const redirectUrl = await wayfinder.resolveUrl({
|
|
|
162
162
|
|
|
163
163
|
## Gateway Providers
|
|
164
164
|
|
|
165
|
-
Gateway providers are responsible for providing a list of gateways to Wayfinder to choose from when routing requests. By default, Wayfinder will use the `
|
|
165
|
+
Gateway providers are responsible for providing a list of gateways to Wayfinder to choose from when routing requests. By default, Wayfinder will use the `TrustedPeersGatewaysProvider` to fetch available gateways from a trusted gateway's peer list.
|
|
166
|
+
|
|
167
|
+
| Provider | Description | Use Case |
|
|
168
|
+
| ------------------------------ | ---------------------------------------------- | --------------------------------------- |
|
|
169
|
+
| `NetworkGatewaysProvider` | Returns gateways from AR.IO Network based on on-chain metrics | Leverage AR.IO Network with quality filtering |
|
|
170
|
+
| `TrustedPeersGatewaysProvider` | Fetches gateway list from a trusted gateway's `/ar-io/peers` endpoint | Dynamic gateway discovery from network peers |
|
|
171
|
+
| `StaticGatewaysProvider` | Returns a static list of gateways you provide | Testing or when specific gateways are required |
|
|
172
|
+
| `SimpleCacheGatewaysProvider` | Wraps another provider with in-memory caching | Reduce API calls and improve performance |
|
|
173
|
+
| `LocalStorageGatewaysProvider` | Wraps another provider with browser localStorage caching | Persistent caching across page reloads |
|
|
166
174
|
|
|
167
175
|
### NetworkGatewaysProvider
|
|
168
176
|
|
|
@@ -182,11 +190,28 @@ const gatewayProvider = new NetworkGatewaysProvider({
|
|
|
182
190
|
});
|
|
183
191
|
```
|
|
184
192
|
|
|
193
|
+
### TrustedPeersGatewaysProvider
|
|
194
|
+
|
|
195
|
+
Fetches a dynamic list of trusted peer gateways from an AR.IO gateway's `/ar-io/peers` endpoint. This provider is useful for discovering available gateways from a trusted source.
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
import { TrustedPeersGatewaysProvider } from '@ar.io/wayfinder-core';
|
|
199
|
+
|
|
200
|
+
const gatewayProvider = new TrustedPeersGatewaysProvider({
|
|
201
|
+
trustedGateway: 'https://arweave.net', // Gateway to fetch peers from
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// The provider will fetch the peer list from https://arweave.net/ar-io/peers
|
|
205
|
+
// and return an array of gateway URLs from the response
|
|
206
|
+
```
|
|
207
|
+
|
|
185
208
|
### StaticGatewaysProvider
|
|
186
209
|
|
|
187
210
|
The static gateway provider returns a list of gateways that you provide. This is useful for testing or for users who want to use a specific gateway for all requests.
|
|
188
211
|
|
|
189
212
|
```javascript
|
|
213
|
+
import { StaticGatewaysProvider } from '@ar.io/wayfinder-core';
|
|
214
|
+
|
|
190
215
|
const gatewayProvider = new StaticGatewaysProvider({
|
|
191
216
|
gateways: ['https://arweave.net'],
|
|
192
217
|
});
|
|
@@ -237,7 +262,7 @@ const gateway3 = await routingStrategy2.selectGateway({
|
|
|
237
262
|
### StaticRoutingStrategy
|
|
238
263
|
|
|
239
264
|
```javascript
|
|
240
|
-
import {
|
|
265
|
+
import { StaticRoutingStrategy } from '@ar.io/wayfinder-core';
|
|
241
266
|
|
|
242
267
|
const routingStrategy = new StaticRoutingStrategy({
|
|
243
268
|
gateway: 'https://arweave.net',
|
|
@@ -311,7 +336,7 @@ const gateway3 = await routingStrategy2.selectGateway({
|
|
|
311
336
|
Uses a preferred gateway, with a fallback strategy if the preferred gateway is not available. This is useful for builders who run their own gateways and want to use their own gateway as the preferred gateway, but also want to have a fallback strategy in case their gateway is not available.
|
|
312
337
|
|
|
313
338
|
```javascript
|
|
314
|
-
import {
|
|
339
|
+
import { PreferredWithFallbackRoutingStrategy, FastestPingRoutingStrategy } from '@ar.io/wayfinder-core';
|
|
315
340
|
|
|
316
341
|
const routingStrategy = new PreferredWithFallbackRoutingStrategy({
|
|
317
342
|
preferredGateway: 'https://permagate.io',
|
|
@@ -432,6 +457,14 @@ Because `SimpleCacheRoutingStrategy` accepts any `RoutingStrategy`, you can
|
|
|
432
457
|
cache more complex compositions too.
|
|
433
458
|
|
|
434
459
|
```ts
|
|
460
|
+
import {
|
|
461
|
+
RandomRoutingStrategy,
|
|
462
|
+
PingRoutingStrategy,
|
|
463
|
+
SimpleCacheRoutingStrategy,
|
|
464
|
+
NetworkGatewaysProvider,
|
|
465
|
+
} from "@ar.io/wayfinder-core";
|
|
466
|
+
import { ARIO } from '@ar.io/sdk';
|
|
467
|
+
|
|
435
468
|
// use a dynamic list of gateways from the ARIO Network
|
|
436
469
|
const randomStrategy = new RandomRoutingStrategy({
|
|
437
470
|
gatewaysProvider: new NetworkGatewaysProvider({
|
|
@@ -536,7 +569,7 @@ const wayfinder = new Wayfinder({
|
|
|
536
569
|
Verifies signatures of Arweave transactions and data items. Headers are retrieved from trusted gateways for use during verification. For a transaction, its data root is computed while streaming its data and then utilized alongside its headers for verification. For data items, the ANS-104 deep hash method of signature verification is used.
|
|
537
570
|
|
|
538
571
|
```javascript
|
|
539
|
-
import { Wayfinder, SignatureVerificationStrategy } from '@ar
|
|
572
|
+
import { Wayfinder, SignatureVerificationStrategy } from '@ar.io/wayfinder-core';
|
|
540
573
|
|
|
541
574
|
const wayfinder = new Wayfinder({
|
|
542
575
|
verificationSettings: {
|
|
@@ -550,10 +583,10 @@ const wayfinder = new Wayfinder({
|
|
|
550
583
|
|
|
551
584
|
## Monitoring and Events
|
|
552
585
|
|
|
553
|
-
Wayfinder emits events during the routing and verification process for all requests, allowing you to monitor its operation. All events are emitted on the `wayfinder.emitter` event emitter, and are updated for each request.
|
|
554
|
-
|
|
555
586
|
### Global request events
|
|
556
587
|
|
|
588
|
+
Wayfinder emits events during the routing and verification process for all requests, allowing you to monitor its operation. All events are emitted on the `wayfinder.emitter` event emitter, and are updated for each request.
|
|
589
|
+
|
|
557
590
|
```javascript
|
|
558
591
|
// Provide events to the Wayfinder constructor for tracking all requests
|
|
559
592
|
const wayfinder = new Wayfinder({
|
|
@@ -617,7 +650,8 @@ wayfinder.emitter.on('verification-failed', (event) => {
|
|
|
617
650
|
|
|
618
651
|
You can also provide events to the `request` function to track a single request. These events are called for each request and are not updated for subsequent requests.
|
|
619
652
|
|
|
620
|
-
>
|
|
653
|
+
> [!INFO]
|
|
654
|
+
> Events are still emitted to the global event emitter for all requests. It is recommended to use the global event emitter for tracking all requests, and the request-specific events for tracking a single request.
|
|
621
655
|
|
|
622
656
|
```javascript
|
|
623
657
|
// create a wayfinder instance with verification enabled
|
|
@@ -683,7 +717,7 @@ Wayfinder supports intelligent caching:
|
|
|
683
717
|
|
|
684
718
|
## Advanced Usage
|
|
685
719
|
|
|
686
|
-
###
|
|
720
|
+
### Custom Providers and Strategies
|
|
687
721
|
|
|
688
722
|
For advanced use cases, you can provide custom providers and strategies to `createWayfinderClient`:
|
|
689
723
|
|
|
@@ -778,19 +812,18 @@ const wayfinder = new Wayfinder({
|
|
|
778
812
|
});
|
|
779
813
|
```
|
|
780
814
|
|
|
781
|
-
|
|
815
|
+
## Telemetry
|
|
782
816
|
|
|
783
817
|
Wayfinder can optionally emit OpenTelemetry spans for every request. **By default, telemetry is disabled**. You can control this behavior with the `telemetrySettings` option.
|
|
784
818
|
|
|
785
819
|
```javascript
|
|
786
820
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}),
|
|
821
|
+
import { createWayfinderClient } from '@ar.io/wayfinder-core';
|
|
822
|
+
import { ARIO } from '@ar.io/sdk';
|
|
823
|
+
|
|
824
|
+
const wayfinder = createWayfinderClient({
|
|
825
|
+
ario: ARIO.mainnet(),
|
|
826
|
+
// other settings...
|
|
794
827
|
telemetrySettings: {
|
|
795
828
|
enabled: true, // disabled by default (must be explicitly enabled)
|
|
796
829
|
sampleRate: 0.1, // 10% sample rate by default
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU7C,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,eAAe,EAGf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsB3C,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;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17,7 @@
|
|
|
17
17
|
import { LocalStorageGatewaysProvider } from './gateways/local-storage-cache.js';
|
|
18
18
|
import { NetworkGatewaysProvider } from './gateways/network.js';
|
|
19
19
|
import { SimpleCacheGatewaysProvider } from './gateways/simple-cache.js';
|
|
20
|
-
import {
|
|
20
|
+
import { TrustedPeersGatewaysProvider } from './gateways/trusted-peers.js';
|
|
21
21
|
import { FastestPingRoutingStrategy } from './routing/ping.js';
|
|
22
22
|
import { PreferredWithFallbackRoutingStrategy } from './routing/preferred-with-fallback.js';
|
|
23
23
|
import { RandomRoutingStrategy } from './routing/random.js';
|
|
@@ -98,15 +98,10 @@ export function createWayfinderClient(options = {}) {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
// Fall back to
|
|
102
|
-
gatewaysProvider = new
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: [
|
|
106
|
-
'https://permagate.io',
|
|
107
|
-
'https://arweave.net',
|
|
108
|
-
'https://ardrive.net',
|
|
109
|
-
],
|
|
101
|
+
// Fall back to trusted peers gateway provider when no ARIO instance is provided
|
|
102
|
+
gatewaysProvider = new TrustedPeersGatewaysProvider({
|
|
103
|
+
trustedGateway: trustedGateways[0] || 'https://arweave.net',
|
|
104
|
+
logger,
|
|
110
105
|
});
|
|
111
106
|
}
|
|
112
107
|
// Wrap with cache if enabled
|
package/dist/version.d.ts
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export declare const WAYFINDER_CORE_VERSION = "v1.
|
|
17
|
+
export declare const WAYFINDER_CORE_VERSION = "v1.5.0";
|
|
18
18
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,WAAW,CAAC"}
|
package/dist/version.js
CHANGED
package/dist/wayfinder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wayfinder.d.ts","sourceRoot":"","sources":["../src/wayfinder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAQ,KAAK,MAAM,EAAkB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO,KAAK,EACV,gBAAgB,EAChB,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAKpB,eAAO,MAAM,uBAAuB,GAAI,cAErC;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;CAMA,CAAC;AAGF,eAAO,MAAM,SAAS,QAAuB,CAAC;AAC9C,eAAO,MAAM,SAAS,QAAwB,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,kBAAkB,KACzB,YAoCF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,KACZ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAqCnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,uCAIjC;IACD,eAAe,EAAE,GAAG,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;I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qB;IAwFxB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,QAAQ,EAAE,eAAe;IAI5C;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB;IAItD;;;;;;;;;;;;;;;OAeG;IACH,mBAAmB;IAInB;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,CAAC,EACjB,MAAc,EACd,QAAQ,GACT,GAAE;QACD,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;KAC5B;IAYN;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,KAAK,EAAE,GAAG,GAAG,WAAW,EACxB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,oBAAoB,CAAC,EAAE,WAAW,CAChC,gBAAgB,CAAC,sBAAsB,CAAC,CACzC,CAAC;QACF,eAAe,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACpE,GACA,OAAO,CAAC,QAAQ,CAAC;IAWpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;CAiD3D"}
|
package/dist/wayfinder.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { defaultLogger } from './logger.js';
|
|
18
18
|
import { context, trace } from '@opentelemetry/api';
|
|
19
19
|
import { WayfinderEmitter } from './emitter.js';
|
|
20
|
-
import {
|
|
20
|
+
import { TrustedPeersGatewaysProvider } from './gateways/trusted-peers.js';
|
|
21
21
|
import { PingRoutingStrategy } from './routing/ping.js';
|
|
22
22
|
import { RandomRoutingStrategy } from './routing/random.js';
|
|
23
23
|
import { initTelemetry, startRequestSpans } from './telemetry.js';
|
|
@@ -524,12 +524,9 @@ export class Wayfinder {
|
|
|
524
524
|
// default gateways provider to use if no provider is provided
|
|
525
525
|
this.gatewaysProvider =
|
|
526
526
|
gatewaysProvider ??
|
|
527
|
-
new
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
'https://arweave.net',
|
|
531
|
-
'https://ardrive.net',
|
|
532
|
-
],
|
|
527
|
+
new TrustedPeersGatewaysProvider({
|
|
528
|
+
trustedGateway: 'https://arweave.net',
|
|
529
|
+
logger: this.logger,
|
|
533
530
|
});
|
|
534
531
|
// default verification settings
|
|
535
532
|
this.verificationSettings = {
|
package/package.json
CHANGED