@toon-protocol/client 5.1.1 → 5.2.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.
@@ -1,24 +1,32 @@
1
+ import {
2
+ ClientChannelFacade,
3
+ ClientWalletFacade,
4
+ DEFAULT_DEPOSIT,
5
+ DEFAULT_TIMEOUT_MS,
6
+ ToonClient,
7
+ addressFor,
8
+ resolveConfig,
9
+ send,
10
+ toEnvelopeRequest
11
+ } from "./chunk-IN75RK7V.js";
12
+ import "./chunk-6O5OXJVR.js";
1
13
  import {
2
14
  BeforePayRefusedError,
3
15
  ChainUnavailableError,
4
16
  ChannelFundingError,
5
17
  ChannelNotOpenError,
6
18
  ChannelResumeError,
7
- ClientChannelFacade,
8
- ClientWalletFacade,
9
19
  ConfigError,
10
20
  ConnectorError,
11
- DEFAULT_DEPOSIT,
12
- DEFAULT_TIMEOUT_MS,
13
21
  FacilitatorError,
14
22
  InsufficientBalanceError,
15
23
  InvalidAddressError,
16
24
  NetworkError,
17
25
  PaymentRequiredError,
26
+ ProxyBypassError,
18
27
  RouteNotPricedError,
19
28
  SponsorRefusedError,
20
29
  StaleRpcReadError,
21
- ToonClient,
22
30
  ToonClientError,
23
31
  TransactionOutcomeError,
24
32
  TransferNotDeliveredError,
@@ -26,15 +34,10 @@ import {
26
34
  TransportRequiredError,
27
35
  UnknownChainError,
28
36
  ValidationError,
29
- addressFor,
30
37
  chainUnavailableMessage,
31
38
  describeEndpoint,
32
- isInsufficientGasError,
33
- resolveConfig,
34
- send,
35
- toEnvelopeRequest
36
- } from "./chunk-GNPJRJ6U.js";
37
- import "./chunk-6O5OXJVR.js";
39
+ isInsufficientGasError
40
+ } from "./chunk-ABOW5ZCE.js";
38
41
  import "./chunk-32MD3CXE.js";
39
42
  export {
40
43
  BeforePayRefusedError,
@@ -53,6 +56,7 @@ export {
53
56
  InvalidAddressError,
54
57
  NetworkError,
55
58
  PaymentRequiredError,
59
+ ProxyBypassError,
56
60
  RouteNotPricedError,
57
61
  SponsorRefusedError,
58
62
  StaleRpcReadError,
@@ -72,4 +76,4 @@ export {
72
76
  send,
73
77
  toEnvelopeRequest
74
78
  };
75
- //# sourceMappingURL=client-RO3VITXU.js.map
79
+ //# sourceMappingURL=client-LXLZVJV4.js.map
@@ -33,9 +33,9 @@ declare function validateSocks5hUrl(socksProxy: string): {
33
33
  * Node is undici and takes a **dispatcher**. It does not take an `http.Agent`,
34
34
  * which is why the `socks-proxy-agent` this package used to depend on cannot
35
35
  * serve this path at all.
36
- * - **Chain RPC** goes through viem, which calls the *global* `fetch` and accepts
37
- * no injected one. Its only opening is `http(url, { fetchOptions })`, so it
38
- * needs the same dispatcher handed to it as a fetch option (ADR 0002).
36
+ * - **Chain RPC** goes through viem, which takes an injected `fetchFn`
37
+ * (`http(url, { fetchFn })`), so it is handed this transport's proxied `fetch`
38
+ * (ADR 0002, ADR 0005).
39
39
  * - **The BTP carriage** goes through `ws`, which is `node:http` underneath and
40
40
  * therefore takes an `http.Agent` and nothing else.
41
41
  *
@@ -145,10 +145,15 @@ interface HiddenServiceTransport {
145
145
  createWebSocket: (url: string) => unknown;
146
146
  /**
147
147
  * The undici dispatcher behind `fetch`, for handing to something that insists
148
- * on calling the global `fetch` itself — viem's HTTP transport, in practice
149
- * (`http(url, { fetchOptions: { dispatcher } })`).
148
+ * on calling the global `fetch` itself. The client's own paths, viem's
149
+ * included (`http(url, { fetchFn })`), use `fetch` instead.
150
150
  */
151
151
  dispatcher: unknown;
152
+ /**
153
+ * How many canary dials this transport's proxy hooks (the dispatcher's
154
+ * `connect`, the websocket agents' `createConnection`) have seen and refused.
155
+ */
156
+ canaryHits(): number;
152
157
  /** Close the dispatcher's pool and the websocket agents' sockets. */
153
158
  close(): Promise<void>;
154
159
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Hex, LocalAccount, TransactionReceipt, http } from 'viem';
2
- import { C as ChainKind } from './hidden-service-BtIv3u0L.js';
3
- export { H as HiddenServiceTransport, a as HiddenServiceTransportOptions, v as validateSocks5hUrl } from './hidden-service-BtIv3u0L.js';
1
+ import { Hex, http, LocalAccount, TransactionReceipt } from 'viem';
2
+ import { C as ChainKind } from './hidden-service-D58bCgdN.js';
3
+ export { H as HiddenServiceTransport, a as HiddenServiceTransportOptions, v as validateSocks5hUrl } from './hidden-service-D58bCgdN.js';
4
4
  import { PrivateKeyAccount } from 'viem/accounts';
5
5
 
6
6
  /**
@@ -316,8 +316,14 @@ declare class NetworkError extends ToonClientError {
316
316
  constructor(message: string, cause?: Error, endpoint?: string);
317
317
  }
318
318
  /** Where a packet-path URL came from: the caller's config, or the node's self-description. */
319
- type EndpointSource = 'configured' | 'published';
320
- /** `url`, plus a note when the node (not the caller) chose it. */
319
+ type EndpointSource = 'configured' | 'published'
320
+ /** The caller's `carriageEndpoints` replaced what the connector published (`published`, when it did). */
321
+ | {
322
+ override: {
323
+ published?: string;
324
+ };
325
+ };
326
+ /** `url`, plus a note when the node (not the caller) chose it, or when the caller replaced the node's. */
321
327
  declare function describeEndpoint(url: string, source?: EndpointSource): string;
322
328
  /**
323
329
  * Connector error for a transport-level failure at the client edge: a `4xx`
@@ -464,6 +470,20 @@ declare class TransportRequiredError extends ToonClientError {
464
470
  cause?: Error;
465
471
  });
466
472
  }
473
+ /** The four paths a hidden payer hands its proxy to. */
474
+ type ProxiedPath = 'client-edge' | 'evm-rpc' | 'solana-rpc' | 'btp';
475
+ /**
476
+ * Thrown by `ToonClient.create` when a hidden payer's canary shows that one path
477
+ * ignores its proxy hook, so that path would dial clearnet and name the payer
478
+ * (ADR 0005). Nothing has been sent: the canary targets a closed loopback port.
479
+ * {@link path} says which path, and the message says how to fix it.
480
+ */
481
+ declare class ProxyBypassError extends ToonClientError {
482
+ /** The path whose proxy hook was never reached. */
483
+ readonly path: ProxiedPath;
484
+ constructor(path: ProxiedPath);
485
+ private static messageFor;
486
+ }
467
487
  /**
468
488
  * Thrown when the one-time on-chain payment-channel OPEN reverts because the
469
489
  * local settlement wallet has no native gas to pay for its own
@@ -617,6 +637,80 @@ declare class TransactionOutcomeError extends ToonClientError {
617
637
  constructor(message: string, chain: ChainKind, txHash: string, outcome: 'failed' | 'expired' | 'unknown', cause?: Error);
618
638
  }
619
639
 
640
+ /**
641
+ * The one place viem is told to send chain RPC through the hidden-service proxy.
642
+ *
643
+ * viem's HTTP transport takes an injected `fetchFn` (viem `^2.37.2`). Handing it
644
+ * the proxied fetch means chain traffic joins the packet traffic inside the
645
+ * overlay (ADR 0002) through the same fetch the canary tests (ADR 0005).
646
+ *
647
+ * Browser-safe: this module imports nothing but viem. The proxied fetch itself is
648
+ * built in `./socks.js`, which is Node-only and dynamically imported.
649
+ */
650
+
651
+ /** Options a caller already wanted, independent of any proxy. */
652
+ interface RpcTransportOptions {
653
+ timeout?: number;
654
+ retryCount?: number;
655
+ retryDelay?: number;
656
+ }
657
+ /**
658
+ * What a proxied RPC request gets when its caller names nothing else, sized
659
+ * from connector ADR 0073's measurements through `anon` (decisions 4 and 5).
660
+ *
661
+ * - `timeout` 30s, not viem's 10s. The worst call measured that needed a new
662
+ * circuit took 13s. Under 10s that one would have been reported as a failure,
663
+ * and retried on another new circuit.
664
+ * - `retryDelay` 500ms, not viem's 150ms. viem already retries 403, 408, 429,
665
+ * 5xx and dropped connections. Exit IPs are shared, so a 429 is the error to
666
+ * expect, and retrying it at 150ms mostly earns another one.
667
+ * - `retryCount` 3, viem's own.
668
+ */
669
+ declare const PROXIED_RPC_DEFAULTS: {
670
+ readonly timeout: 30000;
671
+ readonly retryCount: 3;
672
+ readonly retryDelay: 500;
673
+ };
674
+ /**
675
+ * Where one chain's JSON-RPC goes and what it goes through: the URL, and the
676
+ * `fetch` that dials it. Both are required. A chain RPC call site cannot compile
677
+ * without the fetch it should use, so a hidden payer cannot reach clearnet by
678
+ * leaving one out (ADR 0005).
679
+ *
680
+ * The client decides it once, in its chain-access layer, and every internal
681
+ * layer below takes it whole. The only defaults to the global `fetch` left are
682
+ * at public helpers, for a direct caller on clearnet; the client always passes
683
+ * its own route to them.
684
+ */
685
+ interface ChainRpcRoute {
686
+ url: string;
687
+ fetch: typeof fetch;
688
+ /**
689
+ * The `fetch` rides the hidden-service proxy, so a request gets
690
+ * {@link PROXIED_RPC_DEFAULTS} under anything the caller set explicitly.
691
+ */
692
+ proxied?: boolean;
693
+ }
694
+ /**
695
+ * The global `fetch`, looked up per call. This is the deliberately direct
696
+ * route: a clearnet client's, a public helper's default, and a hidden payer's
697
+ * with `proxyRpc: false` (ADR 0002). Choose it by name, at the one place that
698
+ * decides.
699
+ */
700
+ declare const directFetch: typeof fetch;
701
+ /**
702
+ * A viem HTTP transport over `route`.
703
+ *
704
+ * A proxied route also brings {@link PROXIED_RPC_DEFAULTS}, under anything the
705
+ * caller set explicitly.
706
+ */
707
+ declare function rpcTransport(route: ChainRpcRoute, options?: RpcTransportOptions): ReturnType<typeof http>;
708
+ /**
709
+ * `fetch` bound to `dispatcher`, for a JSON-RPC path that calls `fetch` itself
710
+ * rather than going through viem — Solana's, in practice.
711
+ */
712
+ declare function rpcFetch(dispatcher: unknown | undefined, fetchImpl?: typeof fetch): typeof fetch;
713
+
620
714
  /**
621
715
  * Solana over raw JSON-RPC: the program-derived-address search, associated
622
716
  * token accounts, a legacy transaction compiler and sender, and the reads a
@@ -665,17 +759,13 @@ interface Signer {
665
759
  /**
666
760
  * Where Solana JSON-RPC goes, and how it gets there.
667
761
  *
668
- * A bare URL is the ordinary case and dials the global `fetch`. The object form
669
- * carries a `fetch` to use instead — on a hidden-service client that is the
670
- * proxied one, so chain reads ride the overlay with the packets rather than
671
- * announcing this wallet on clearnet (ADR 0002). Every function in this module
672
- * that takes an RPC target passes it straight through to {@link solanaRpc}; only
673
- * that function ever looks inside.
762
+ * A {@link ChainRpcRoute}: it carries the `fetch` to dial with, and there is no
763
+ * default. On a hidden-service client that is the proxied one, so chain reads
764
+ * ride the overlay with the packets rather than announcing this wallet on
765
+ * clearnet (ADR 0002). Every function in this module that takes a route passes
766
+ * it straight through to {@link solanaRpc}; only that function ever looks inside.
674
767
  */
675
- type SolanaRpcTarget = string | {
676
- url: string;
677
- fetchImpl?: typeof fetch;
678
- };
768
+ type SolanaRpcTarget = ChainRpcRoute;
679
769
  /**
680
770
  * A Solana JSON-RPC call that got no answer from the node: every try was lost in
681
771
  * transit, timed out, or was turned away at the HTTP layer.
@@ -1219,12 +1309,12 @@ interface ChannelStoreEntry {
1219
1309
  */
1220
1310
  provenFloor?: bigint;
1221
1311
  /**
1222
- * Set when a signed claim's fate is unknown (a transport error or a timeout,
1223
- * where the packet may have been delivered and banked anyway) or when the
1224
- * connector refused one. It means "our watermark and the connector's may
1225
- * disagree", and the next claim on this channel reconciles against
1226
- * `POST /ilp/claim-state` before it is signed. Persisted because a timeout in
1227
- * one `toon-client` invocation desyncs the next one.
1312
+ * Set when the connector refused a claim as not advancing its watermark
1313
+ * without saying where that watermark is. It means "our watermark and the
1314
+ * connector's disagree", and the next claim on this channel reconciles
1315
+ * against `POST /ilp/claim-state` before it is signed; adopting the
1316
+ * connector's figure clears it. Persisted because each `toon-client`
1317
+ * invocation is a new process, and the next one must resync first.
1228
1318
  */
1229
1319
  watermarkUncertain?: boolean;
1230
1320
  /** Unix SECONDS when close was initiated (withdraw flow). */
@@ -1568,6 +1658,13 @@ declare class BatchChannelManager {
1568
1658
  adoptConnectorWatermark(channelId: string, cumulativeClaimed: bigint, options?: {
1569
1659
  recovering?: boolean;
1570
1660
  }): void;
1661
+ /**
1662
+ * Mark `channelId`'s watermark as possibly out of step with the connector's.
1663
+ * Persisted, so the next invocation resyncs before it signs.
1664
+ */
1665
+ markInDoubt(channelId: string): void;
1666
+ /** Whether `channelId`'s watermark is in doubt, here or in an earlier invocation. */
1667
+ inDoubt(channelId: string): boolean;
1571
1668
  /** Whether this client still holds the watermark for `channelId`. */
1572
1669
  hasWatermark(channelId: string): boolean;
1573
1670
  /**
@@ -1729,10 +1826,9 @@ interface EvmWalletAccess {
1729
1826
  * RPC reports. Nothing connects until it is first used.
1730
1827
  */
1731
1828
  declare function evmWalletAccess(params: {
1732
- rpcUrl: string;
1829
+ /** The route chain RPC takes, with the fetch it dials through. */
1830
+ rpc: ChainRpcRoute;
1733
1831
  account: LocalAccount;
1734
- /** The proxy-bound dispatcher a hidden payer's RPC rides, if any. */
1735
- dispatcher?: unknown;
1736
1832
  }): EvmWalletAccess;
1737
1833
  /** How much of `token` Permit2 may move for `owner`. */
1738
1834
  declare function permit2Allowance(reader: ContractReader, token: string, owner: string): Promise<bigint>;
@@ -1741,7 +1837,11 @@ declare function permit2Allowance(reader: ContractReader, token: string, owner:
1741
1837
  * `nonces(address)` — and so, for this purpose, no permit.
1742
1838
  */
1743
1839
  declare function eip2612Nonce(reader: ContractReader, token: string, owner: string): Promise<bigint | undefined>;
1744
- /** The extensions a facilitator's `GET /supported` advertises. */
1840
+ /**
1841
+ * The extensions a facilitator's `GET /supported` advertises. `fetchImpl` defaults
1842
+ * to the global `fetch`, the clearnet behaviour for a direct caller; the client
1843
+ * always passes its own.
1844
+ */
1745
1845
  declare function facilitatorExtensions(facilitatorUrl: string, fetchImpl?: typeof fetch): Promise<string[]>;
1746
1846
  /** `paymentPayload.extensions`, as a facilitator reads them. */
1747
1847
  type DepositExtensions = Record<string, {
@@ -1909,7 +2009,7 @@ interface BatchSettlementPayerConfig {
1909
2009
  rpc: SolanaRpcTarget;
1910
2010
  };
1911
2011
  /** How the connector's sponsor endpoint and the facilitator are reached. */
1912
- fetch?: typeof fetch;
2012
+ fetch: typeof fetch;
1913
2013
  /**
1914
2014
  * The connector's own watermark for a channel (`POST /ilp/claim-state`),
1915
2015
  * asked with the voucher challenge this payer signs. It recovers a lost
@@ -1943,8 +2043,6 @@ declare class BatchSettlementPayer {
1943
2043
  private readonly config;
1944
2044
  /** Onboardings in flight, so concurrent first sends open one channel, not two. */
1945
2045
  private readonly onboarding;
1946
- /** Channels whose last refusal said the connector holds more, without saying how much. */
1947
- private readonly inDoubt;
1948
2046
  constructor(config: BatchSettlementPayerConfig);
1949
2047
  /**
1950
2048
  * A voucher for one packet charging `amount` on `chain`, or `undefined` when
@@ -2111,8 +2209,7 @@ interface ChannelFacadeDeps {
2111
2209
  describe(): Promise<NodeSelfDescription>;
2112
2210
  evm?: {
2113
2211
  privateKey: Uint8Array;
2114
- rpcUrl: string;
2115
- rpcDispatcher: unknown;
2212
+ rpc: ChainRpcRoute;
2116
2213
  };
2117
2214
  solana?: {
2118
2215
  signer: Signer;
@@ -3079,21 +3176,34 @@ declare function readEvmTokenBalance(opts: {
3079
3176
  chainKey: string;
3080
3177
  tokenAddress: string;
3081
3178
  owner: string;
3082
- /** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
3083
- rpcDispatcher?: unknown;
3179
+ /**
3180
+ * The `fetch` this read dials through; the hidden-service proxy's on a hidden
3181
+ * payer (ADR 0002). Defaults to the global `fetch`: the clearnet behaviour for
3182
+ * a direct caller. The client always passes its own.
3183
+ */
3184
+ evmRpcFetch?: typeof fetch;
3185
+ /** `evmRpcFetch` rides the proxy: allow a circuit's latency. Defaults to whether one was passed. */
3186
+ proxied?: boolean;
3084
3187
  }): Promise<WalletBalance>;
3085
3188
  /** Read the native ETH balance (wei) for `owner` via `eth_getBalance`. */
3086
3189
  declare function readEvmNativeBalance(opts: {
3087
3190
  rpcUrl: string;
3088
3191
  chainKey: string;
3089
3192
  owner: string;
3090
- /** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
3091
- rpcDispatcher?: unknown;
3193
+ /**
3194
+ * The `fetch` this read dials through; the hidden-service proxy's on a hidden
3195
+ * payer (ADR 0002). Defaults to the global `fetch`: the clearnet behaviour for
3196
+ * a direct caller. The client always passes its own.
3197
+ */
3198
+ evmRpcFetch?: typeof fetch;
3199
+ /** `evmRpcFetch` rides the proxy: allow a circuit's latency. Defaults to whether one was passed. */
3200
+ proxied?: boolean;
3092
3201
  }): Promise<WalletTokenAmount>;
3093
3202
  /** Read the native SOL balance (lamports) for `owner` via the `getBalance` RPC. */
3094
3203
  declare function readSolanaNativeBalance(opts: {
3095
3204
  rpcUrl: string;
3096
3205
  owner: string;
3206
+ /** Defaults to the global `fetch`: the clearnet behaviour for a direct caller. */
3097
3207
  fetchImpl?: typeof fetch;
3098
3208
  /** The fetch rides the SOCKS5h proxy: allow a circuit's latency. */
3099
3209
  proxied?: boolean;
@@ -3103,6 +3213,7 @@ declare function readSolanaTokenBalance(opts: {
3103
3213
  rpcUrl: string;
3104
3214
  mint: string;
3105
3215
  owner: string;
3216
+ /** Defaults to the global `fetch`: the clearnet behaviour for a direct caller. */
3106
3217
  fetchImpl?: typeof fetch;
3107
3218
  /** The fetch rides the SOCKS5h proxy: allow a circuit's latency. */
3108
3219
  proxied?: boolean;
@@ -3124,7 +3235,9 @@ interface WalletBalanceSources {
3124
3235
  * reads need no equivalent: they go through {@link WalletBalanceSources.fetchImpl},
3125
3236
  * which is already the proxied `fetch` on a hidden-service client.
3126
3237
  */
3127
- rpcDispatcher?: unknown;
3238
+ evmRpcFetch?: typeof fetch;
3239
+ /** `evmRpcFetch` rides the proxy. Defaults to whether one was passed. */
3240
+ proxied?: boolean;
3128
3241
  };
3129
3242
  solana?: {
3130
3243
  chainKey?: string;
@@ -3229,12 +3342,22 @@ interface EvmTransferConfig {
3229
3342
  signer: EvmSigner;
3230
3343
  /** ERC-20 settlement-token address. Required only for `asset: 'token'`. */
3231
3344
  tokenAddress?: string;
3232
- /** Send this transfer's RPC through the hidden-service proxy (ADR 0002). */
3233
- rpcDispatcher?: unknown;
3345
+ /**
3346
+ * The `fetch` this transfer's RPC dials through; the hidden-service proxy's
3347
+ * on a hidden payer (ADR 0002). Defaults to the global `fetch`: the clearnet
3348
+ * behaviour for a direct caller. The client always passes its own.
3349
+ */
3350
+ evmRpcFetch?: typeof fetch;
3351
+ /** `evmRpcFetch` rides the proxy. Defaults to whether one was passed. */
3352
+ proxied?: boolean;
3234
3353
  }
3235
3354
  interface SolanaTransferConfig {
3236
3355
  rpcUrl: string;
3237
- /** `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client (ADR 0002). */
3356
+ /**
3357
+ * `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client
3358
+ * (ADR 0002). Defaults to the global `fetch`: the clearnet behaviour for a
3359
+ * direct caller. The client always passes its own.
3360
+ */
3238
3361
  rpcFetch?: typeof fetch;
3239
3362
  /** Ed25519 signing seed (32 bytes) or a 64-byte seed||pubkey keypair. */
3240
3363
  keypair: Uint8Array;
@@ -3265,6 +3388,20 @@ interface TransferConfig {
3265
3388
  */
3266
3389
  declare function sendTransfer(config: TransferConfig, params: SendTransferParams): Promise<SendTransferResult>;
3267
3390
 
3391
+ /**
3392
+ * Path objects to test in place of the transports' own. For tests that need a
3393
+ * deliberately broken path (a fetch that drops its dispatcher, a viem transport
3394
+ * without `fetchFn`, a websocket without its agent). Never set in production.
3395
+ *
3396
+ * @internal
3397
+ */
3398
+ interface CanaryPathOverrides {
3399
+ clientEdgeFetch?: typeof fetch;
3400
+ evmRpcTransport?: typeof rpcTransport;
3401
+ solanaRpcFetch?: typeof fetch;
3402
+ createWebSocket?: (url: string) => unknown;
3403
+ }
3404
+
3268
3405
  /**
3269
3406
  * Devnet faucet helper.
3270
3407
  *
@@ -3345,6 +3482,16 @@ type ChannelState = BatchChannelSummary;
3345
3482
  /** Which carriage to pay over. */
3346
3483
  type TransportPreference = 'auto' | 'http' | 'btp';
3347
3484
 
3485
+ /**
3486
+ * A payer's per-carriage replacements for the carriage endpoints a connector
3487
+ * publishes (ADR 0006).
3488
+ */
3489
+ interface CarriageEndpoints {
3490
+ /** Replaces the published `httpEndpoint`. */
3491
+ http?: string;
3492
+ /** Replaces the published `btpEndpoint`. */
3493
+ btp?: string;
3494
+ }
3348
3495
  interface ToonClientConfig {
3349
3496
  /**
3350
3497
  * The connector's client-edge base URL. A trailing `/ilp` is normalized away,
@@ -3458,6 +3605,16 @@ interface ToonClientConfig {
3458
3605
  * Node only: a browser cannot dial a hidden service by any route.
3459
3606
  */
3460
3607
  socksProxy?: string;
3608
+ /**
3609
+ * Replace the carriage endpoint the connector publishes, per carriage. Each
3610
+ * value must be an absolute URL: `http` an `http:`/`https:` one, `btp` a
3611
+ * `ws:`/`wss:` one. A carriage with no override uses the published endpoint.
3612
+ * Everything else (self-description, prices, claim state, seal key) is still
3613
+ * read from `connector`. Nothing falls back to the client edge (ADR 0006).
3614
+ *
3615
+ * The `http` override also serves the HTTP fallback beneath a BTP session.
3616
+ */
3617
+ carriageEndpoints?: CarriageEndpoints;
3461
3618
  /**
3462
3619
  * Send chain RPC through `socksProxy` as well as the packets. Default `true`.
3463
3620
  *
@@ -3470,6 +3627,14 @@ interface ToonClientConfig {
3470
3627
  fetch?: typeof fetch;
3471
3628
  /** Injected websocket factory, for tests and runtimes without a global `WebSocket`. */
3472
3629
  createWebSocket?: (url: string) => unknown;
3630
+ /**
3631
+ * Path objects the hidden-payer canary tests in place of the proxy's own, so a
3632
+ * test can prove a deliberately broken path is caught (ADR 0005). Not for
3633
+ * production use.
3634
+ *
3635
+ * @internal
3636
+ */
3637
+ canaryPaths?: CanaryPathOverrides;
3473
3638
  }
3474
3639
  /**
3475
3640
  * The HTTP request to make of the app behind a route.
@@ -3942,13 +4107,12 @@ declare const DEFAULT_TIMEOUT_MS = 30000;
3942
4107
  /** What a channel is opened with, and topped up by, base units — 0.1 USDC at 6 decimals. */
3943
4108
  declare const DEFAULT_DEPOSIT = 100000n;
3944
4109
  /**
3945
- * How one chain's RPC leaves this process when it rides the proxy: two shapes of
3946
- * one pinned circuit, because the two chains' clients take different objects.
4110
+ * How one chain's RPC leaves this process when it rides the proxy: a `fetch`
4111
+ * bound to the chain's pinned circuit, handed to viem's `fetchFn` (EVM) or to
4112
+ * Solana's JSON-RPC client.
3947
4113
  */
3948
4114
  interface ProxiedChainRpc {
3949
- /** The undici dispatcher, for viem, which calls the global `fetch` itself (EVM). */
3950
- dispatcher: unknown;
3951
- /** `fetch` bound to that dispatcher, for Solana's JSON-RPC. */
4115
+ /** `fetch` bound to that circuit. */
3952
4116
  fetch: typeof fetch;
3953
4117
  }
3954
4118
  /** The keys this client holds, per chain. Absent means "no key for that chain". */
@@ -3974,6 +4138,8 @@ interface ResolvedConfig {
3974
4138
  connectorIsHiddenService: boolean;
3975
4139
  /** The `socks5h://` proxy to reach it through, when there is one. */
3976
4140
  socksProxy: string | undefined;
4141
+ /** Validated per-carriage replacements for the published endpoints. */
4142
+ carriageEndpoints: CarriageEndpoints;
3977
4143
  /** Whether chain RPC rides that proxy too (ADR 0002). */
3978
4144
  proxyRpc: boolean;
3979
4145
  /**
@@ -5175,10 +5341,12 @@ interface TransportChoice {
5175
5341
  * `ConnectorEdgeClient.describe` records; an absolute endpoint needs neither.
5176
5342
  * @param destination the ILP address this carriage will carry packets to, so
5177
5343
  * the route that governs it answers rather than the node-wide summary.
5344
+ * @param overrides the payer's `carriageEndpoints`, absolute, replacing the
5345
+ * published endpoint of that carriage only.
5178
5346
  * @throws {TransportRequiredError} the requested carriage is unavailable, or
5179
5347
  * the node publishes no usable endpoint at all.
5180
5348
  */
5181
- declare function selectTransport(description: NodeSelfDescription, preference?: TransportPreference, baseUrl?: string | undefined, destination?: string): TransportChoice;
5349
+ declare function selectTransport(description: NodeSelfDescription, preference?: TransportPreference, baseUrl?: string | undefined, destination?: string, overrides?: CarriageEndpoints): TransportChoice;
5182
5350
 
5183
5351
  /**
5184
5352
  * Canonical OER length primitives (RFC-0030), ported byte-for-byte from
@@ -5838,6 +6006,7 @@ declare function settleDeposit(params: {
5838
6006
  extensions?: Record<string, {
5839
6007
  info: Record<string, unknown>;
5840
6008
  }>;
6009
+ /** Defaults to the global `fetch`: the clearnet behaviour for a direct caller. The client always passes its own. */
5841
6010
  fetchImpl?: typeof fetch;
5842
6011
  }): Promise<SettledDeposit>;
5843
6012
 
@@ -5928,6 +6097,7 @@ declare function requestSponsoredOpen(params: {
5928
6097
  connector: string;
5929
6098
  sponsorEndpoint: string;
5930
6099
  transaction: string;
6100
+ /** Defaults to the global `fetch`: the clearnet behaviour for a direct caller. The client always passes its own. */
5931
6101
  fetchImpl?: typeof fetch;
5932
6102
  }): Promise<SponsoredOpen>;
5933
6103
 
@@ -6788,56 +6958,6 @@ declare function isHiddenServiceUrl(url: unknown): boolean;
6788
6958
  */
6789
6959
  declare function assertRoutableHsHostname(hostname: unknown): string;
6790
6960
 
6791
- /**
6792
- * The one place viem is told to send chain RPC through the hidden-service proxy.
6793
- *
6794
- * viem's HTTP transport calls the **global** `fetch` and accepts no injected one.
6795
- * Its only opening is `fetchOptions`, which it merges into the `fetch` init — and
6796
- * Node's `fetch` reads a `dispatcher` from there. So a dispatcher is how, and the
6797
- * only how, chain traffic joins the packet traffic inside the overlay (ADR 0002).
6798
- *
6799
- * Browser-safe: this module imports nothing but viem. The dispatcher itself is
6800
- * built in `./socks.js`, which is Node-only and dynamically imported; here it is
6801
- * an opaque `unknown` that is either present or not.
6802
- */
6803
-
6804
- /** Options a caller already wanted, independent of any proxy. */
6805
- interface RpcTransportOptions {
6806
- timeout?: number;
6807
- retryCount?: number;
6808
- retryDelay?: number;
6809
- }
6810
- /**
6811
- * What a proxied RPC request gets when its caller names nothing else, sized
6812
- * from connector ADR 0073's measurements through `anon` (decisions 4 and 5).
6813
- *
6814
- * - `timeout` 30s, not viem's 10s. The worst call measured that needed a new
6815
- * circuit took 13s. Under 10s that one would have been reported as a failure,
6816
- * and retried on another new circuit.
6817
- * - `retryDelay` 500ms, not viem's 150ms. viem already retries 403, 408, 429,
6818
- * 5xx and dropped connections. Exit IPs are shared, so a 429 is the error to
6819
- * expect, and retrying it at 150ms mostly earns another one.
6820
- * - `retryCount` 3, viem's own.
6821
- */
6822
- declare const PROXIED_RPC_DEFAULTS: {
6823
- readonly timeout: 30000;
6824
- readonly retryCount: 3;
6825
- readonly retryDelay: 500;
6826
- };
6827
- /**
6828
- * A viem HTTP transport for `url`, bound to `dispatcher` when there is one.
6829
- *
6830
- * `undefined` dispatcher means clearnet, and produces exactly the transport this
6831
- * package built before hidden services existed. A dispatcher also brings
6832
- * {@link PROXIED_RPC_DEFAULTS}, under anything the caller set explicitly.
6833
- */
6834
- declare function rpcTransport(url: string, dispatcher: unknown | undefined, options?: RpcTransportOptions): ReturnType<typeof http>;
6835
- /**
6836
- * `fetch` bound to `dispatcher`, for a JSON-RPC path that calls `fetch` itself
6837
- * rather than going through viem — Solana's, in practice.
6838
- */
6839
- declare function rpcFetch(dispatcher: unknown | undefined, fetchImpl?: typeof fetch): typeof fetch;
6840
-
6841
6961
  /**
6842
6962
  * Well-known values for the public TOON devnet.
6843
6963
  *
@@ -7008,4 +7128,4 @@ interface RetryOptions {
7008
7128
  */
7009
7129
  declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
7010
7130
 
7011
- export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BatchChannel, type BatchChannelConfig, BatchChannelManager, type BatchChannelSummary, type BatchDepositPayload, type BatchExitResult, type BatchSettlementBinding, type BatchSettlementEvmOffer, type BatchSettlementOffer, BatchSettlementPayer, type BatchSettlementPayerConfig, type BatchSettlementSvmOffer, type BatchSettlementTerms, type BatchVoucher, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_REASONS, CONNECTOR_MAX_TIMEOUT_SECONDS, ChainKind, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStore, type ChannelStoreEntry, type ClaimAck, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ContractReader, DEFAULT_DEPOSIT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DepositExtensions, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, EIP2612_GAS_SPONSORING, ERC20_APPROVAL_GAS_SPONSORING, ERC3009_DEPOSIT_COLLECTOR_ADDRESS, type EdgeIdentity, type Eip3009DepositPayload, type EncryptedKeystore, type EndpointSource, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmBatchChannelState, type EvmExitClients, EvmSigner, type EvmWalletAccess, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, FacilitatorError, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MAX_GRACE_PERIOD_SECONDS, MAX_WITHDRAW_DELAY_SECONDS, MIN_GRACE_PERIOD_SECONDS, MIN_WITHDRAW_DELAY_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_CHANNELS_PROGRAM_ID, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, PERMIT2_ADDRESS, PERMIT2_DEPOSIT_COLLECTOR_ADDRESS, PROXIED_RPC_DEFAULTS, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type Permit2DepositPayload, type PreparedVoucher, type ProxiedChainRpc, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SettledDeposit, type Signer as SolanaKeypair, type SolanaNetwork, SolanaRpcTransportError, type SolanaWireTransaction, SponsorRefusedError, type SponsoredOpen, StaleRpcReadError, type SvmBatchChannelConfig, type SvmBatchChannelState, type SvmBatchVoucher, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonGreeting, type ToonIdentity, type ToonTermsInfo, TransactionOutcomeError, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TypedDataSigner, UnknownChainError, ValidationError, type VoucherClaimEnvelope, type VoucherOutcome, type VoucherSigner, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, X402_BATCH_SETTLEMENT_ADDRESS, X402_BATCH_SETTLEMENT_DEPOSIT_ABI, X402_BATCH_SETTLEMENT_EXIT_ABI, X402_BATCH_SETTLEMENT_READ_ABI, addressFor, approvePermit2, assertRoutableHsHostname, batchChannelId, batchVoucherDigest, buildBatchChannelConfig, buildEip3009Deposit, buildJobEvent, buildPermit2Deposit, buildResponseMeta, buildSponsoredOpen, buildSvmBatchChannelConfig, buildSvmRequestCloseInstruction, buildSvmSealInstruction, buildSvmTopUpInstruction, buildSvmVoucherMessage, buildSvmWithdrawPayerInstruction, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, chooseBatchSettlement, connectorEdgeBaseUrl, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeSvmBatchChannel, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFacilitatorFor, defaultFaucetTimeout, defaultRpcUrl, depositDirectly, deriveFulfillment, deriveFullIdentity, describeEndpoint, deserializeIlpPacket, deserializeIlpPrepare, eip2612Nonce, eip2612PermitData, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, erc3009CollectorData, evmChainIdOf, evmChallengeDigest, evmDerivationPath, evmIdentityFromKey, evmVoucherClaim, evmWalletAccess, facilitatorExtensions, finalizeEvmBatchWithdraw, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, getSvmBatchChannel, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, initiateEvmBatchWithdraw, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, nextVoucherAmount, offerFromTerms, openKeystore, openRequest, openResponse, parseBatchSettlementOffer, parseBatchSettlementTerms, parseBtpMessage, parsePaymentTerms, parseSelfDescription, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, paymentChannelsEventAuthority, permit2Allowance, permit2CollectorData, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmBatchChannel, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readVoucherRefusal, readWalletBalances, requestSponsoredOpen, requestSvmBatchClose, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settleDeposit, signBatchVoucher, signEip2612GasSponsoring, signErc20ApprovalGasSponsoring, signEvmChallenge, signSolanaChallenge, signSolanaWireTransaction, signSvmVoucher, singleRecipientDistributionHash, solanaChallengeMessage, solanaKeypair, solanaVoucherClaim, spawnAnt, svmBatchChannelAddress, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, withdrawSvmBatchChannel, writeKeystoreFile };
7131
+ export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BatchChannel, type BatchChannelConfig, BatchChannelManager, type BatchChannelSummary, type BatchDepositPayload, type BatchExitResult, type BatchSettlementBinding, type BatchSettlementEvmOffer, type BatchSettlementOffer, BatchSettlementPayer, type BatchSettlementPayerConfig, type BatchSettlementSvmOffer, type BatchSettlementTerms, type BatchVoucher, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CHANNEL_CHALLENGE_MAX_LIFETIME_SECONDS, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_REASONS, CONNECTOR_MAX_TIMEOUT_SECONDS, type CarriageEndpoints, ChainKind, type ChainRpcRoute, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStore, type ChannelStoreEntry, type ClaimAck, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ContractReader, DEFAULT_DEPOSIT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DepositExtensions, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, EIP2612_GAS_SPONSORING, ERC20_APPROVAL_GAS_SPONSORING, ERC3009_DEPOSIT_COLLECTOR_ADDRESS, type EdgeIdentity, type Eip3009DepositPayload, type EncryptedKeystore, type EndpointSource, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmBatchChannelState, type EvmExitClients, EvmSigner, type EvmWalletAccess, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, FacilitatorError, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MAX_GRACE_PERIOD_SECONDS, MAX_WITHDRAW_DELAY_SECONDS, MIN_GRACE_PERIOD_SECONDS, MIN_WITHDRAW_DELAY_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_CHANNELS_PROGRAM_ID, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, PERMIT2_ADDRESS, PERMIT2_DEPOSIT_COLLECTOR_ADDRESS, PROXIED_RPC_DEFAULTS, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type Permit2DepositPayload, type PreparedVoucher, type ProxiedChainRpc, type ProxiedPath, ProxyBypassError, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SettledDeposit, type Signer as SolanaKeypair, type SolanaNetwork, SolanaRpcTransportError, type SolanaWireTransaction, SponsorRefusedError, type SponsoredOpen, StaleRpcReadError, type SvmBatchChannelConfig, type SvmBatchChannelState, type SvmBatchVoucher, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonGreeting, type ToonIdentity, type ToonTermsInfo, TransactionOutcomeError, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TypedDataSigner, UnknownChainError, ValidationError, type VoucherClaimEnvelope, type VoucherOutcome, type VoucherSigner, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, X402_BATCH_SETTLEMENT_ADDRESS, X402_BATCH_SETTLEMENT_DEPOSIT_ABI, X402_BATCH_SETTLEMENT_EXIT_ABI, X402_BATCH_SETTLEMENT_READ_ABI, addressFor, approvePermit2, assertRoutableHsHostname, batchChannelId, batchVoucherDigest, buildBatchChannelConfig, buildEip3009Deposit, buildJobEvent, buildPermit2Deposit, buildResponseMeta, buildSponsoredOpen, buildSvmBatchChannelConfig, buildSvmRequestCloseInstruction, buildSvmSealInstruction, buildSvmTopUpInstruction, buildSvmVoucherMessage, buildSvmWithdrawPayerInstruction, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, chooseBatchSettlement, connectorEdgeBaseUrl, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeSvmBatchChannel, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFacilitatorFor, defaultFaucetTimeout, defaultRpcUrl, depositDirectly, deriveFulfillment, deriveFullIdentity, describeEndpoint, deserializeIlpPacket, deserializeIlpPrepare, directFetch, eip2612Nonce, eip2612PermitData, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, erc3009CollectorData, evmChainIdOf, evmChallengeDigest, evmDerivationPath, evmIdentityFromKey, evmVoucherClaim, evmWalletAccess, facilitatorExtensions, finalizeEvmBatchWithdraw, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, getSvmBatchChannel, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, initiateEvmBatchWithdraw, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, nextVoucherAmount, offerFromTerms, openKeystore, openRequest, openResponse, parseBatchSettlementOffer, parseBatchSettlementTerms, parseBtpMessage, parsePaymentTerms, parseSelfDescription, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, paymentChannelsEventAuthority, permit2Allowance, permit2CollectorData, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmBatchChannel, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readVoucherRefusal, readWalletBalances, requestSponsoredOpen, requestSvmBatchClose, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settleDeposit, signBatchVoucher, signEip2612GasSponsoring, signErc20ApprovalGasSponsoring, signEvmChallenge, signSolanaChallenge, signSolanaWireTransaction, signSvmVoucher, singleRecipientDistributionHash, solanaChallengeMessage, solanaKeypair, solanaVoucherClaim, spawnAnt, svmBatchChannelAddress, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, withdrawSvmBatchChannel, writeKeystoreFile };