@toon-protocol/client 2.1.0 → 2.2.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/dist/anon-daemon-ZFBL6EYA.js +230 -0
- package/dist/anon-daemon-ZFBL6EYA.js.map +1 -0
- package/dist/chunk-32MD3CXE.js +27 -0
- package/dist/chunk-32MD3CXE.js.map +1 -0
- package/dist/{chunk-DD7TJKP6.js → chunk-4I3JQ7KA.js} +2 -2
- package/dist/{chunk-J6JVCKNV.js → chunk-7MPONJW5.js} +39 -1
- package/dist/chunk-7MPONJW5.js.map +1 -0
- package/dist/{chunk-NPRW2CZ7.js → chunk-A3JKQOWQ.js} +197 -43
- package/dist/chunk-A3JKQOWQ.js.map +1 -0
- package/dist/chunk-GOLBDUNV.js +143 -0
- package/dist/chunk-GOLBDUNV.js.map +1 -0
- package/dist/cli/main.js +63 -11
- package/dist/cli/main.js.map +1 -1
- package/dist/{client-R4BIX4BL.js → client-VA4727SQ.js} +4 -3
- package/dist/index.d.ts +196 -5
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/socks-CCMHMB35.js +15 -0
- package/dist/socks-CCMHMB35.js.map +1 -0
- package/dist/transport/hidden-service.d.ts +116 -0
- package/dist/transport/hidden-service.js +15 -0
- package/dist/transport/hidden-service.js.map +1 -0
- package/package.json +7 -1
- package/dist/chunk-J6JVCKNV.js.map +0 -1
- package/dist/chunk-NPRW2CZ7.js.map +0 -1
- /package/dist/{chunk-DD7TJKP6.js.map → chunk-4I3JQ7KA.js.map} +0 -0
- /package/dist/{client-R4BIX4BL.js.map → client-VA4727SQ.js.map} +0 -0
|
@@ -30,8 +30,9 @@ import {
|
|
|
30
30
|
send,
|
|
31
31
|
settlementToTerms,
|
|
32
32
|
toEnvelopeRequest
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-A3JKQOWQ.js";
|
|
34
|
+
import "./chunk-7MPONJW5.js";
|
|
35
|
+
import "./chunk-32MD3CXE.js";
|
|
35
36
|
export {
|
|
36
37
|
ChainUnavailableError,
|
|
37
38
|
ChannelFundingError,
|
|
@@ -65,4 +66,4 @@ export {
|
|
|
65
66
|
settlementToTerms,
|
|
66
67
|
toEnvelopeRequest
|
|
67
68
|
};
|
|
68
|
-
//# sourceMappingURL=client-
|
|
69
|
+
//# sourceMappingURL=client-VA4727SQ.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
2
|
+
export { HiddenServiceTransport, HiddenServiceTransportOptions, validateSocks5hUrl } from './transport/hidden-service.js';
|
|
3
|
+
import { http } from 'viem';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* The on-chain channel port: what the client needs a chain to be able to do,
|
|
@@ -362,7 +364,32 @@ interface IlpSendParams {
|
|
|
362
364
|
* both paths regardless of which representation it arrived in.
|
|
363
365
|
*/
|
|
364
366
|
declare function resolveExecutionCondition(condition: Uint8Array | string | undefined): Uint8Array | undefined;
|
|
365
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* How much longer a packet lives on the wire than the sender is prepared to wait.
|
|
369
|
+
*
|
|
370
|
+
* The packet's expiry and the sender's own abort used to be the same number, and
|
|
371
|
+
* on clearnet nothing showed: both are far longer than a round trip. They are not
|
|
372
|
+
* the same thing, though, and over a slow carriage the difference is money. If a
|
|
373
|
+
* PREPARE expires at the instant the client gives up, then a late answer arrives
|
|
374
|
+
* to a client that has already stopped listening, having *already presented a
|
|
375
|
+
* signed claim* — the packet is paid for and the verdict is lost. Worse, the
|
|
376
|
+
* expiry is stamped when the packet is built, which over a hidden service is
|
|
377
|
+
* before the circuit even exists, so seconds of it are spent before the connector
|
|
378
|
+
* has seen a byte.
|
|
379
|
+
*
|
|
380
|
+
* Giving the wire the longer deadline means the client is always the first of the
|
|
381
|
+
* two to give up: whatever the client stops waiting for is still, briefly, a live
|
|
382
|
+
* packet the connector can answer and this client can reconcile — never one that
|
|
383
|
+
* expired underneath a claim.
|
|
384
|
+
*/
|
|
385
|
+
declare const PACKET_EXPIRY_HEADROOM_MS = 15000;
|
|
386
|
+
/**
|
|
387
|
+
* Normalize an `IlpSendParams.expiresAt` to a `Date`.
|
|
388
|
+
*
|
|
389
|
+
* Default: now + timeout + {@link PACKET_EXPIRY_HEADROOM_MS}. An explicit
|
|
390
|
+
* `expiresAt` is honoured exactly as given — a caller who names a deadline has
|
|
391
|
+
* one, and it is not this function's business to extend it.
|
|
392
|
+
*/
|
|
366
393
|
declare function resolveExpiresAt(expiresAt: Date | string | undefined, timeoutMs: number): Date;
|
|
367
394
|
/**
|
|
368
395
|
* `IlpSendResult` plus the FULFILL preimage when a sender-chosen condition
|
|
@@ -385,9 +412,8 @@ declare const FULFILLMENT_MISMATCH_MESSAGE: string;
|
|
|
385
412
|
* whose fulfillment is absent, not exactly 32 bytes, or does not sha256-hash
|
|
386
413
|
* to the condition yields `accepted: false` (code F99). The result shape —
|
|
387
414
|
* not a thrown error — is deliberate: transports only retry thrown
|
|
388
|
-
* `NetworkError`s, so a forged/wrong FULFILL is never retried
|
|
389
|
-
* would re-spend the attached claim
|
|
390
|
-
* rejections) count it failed.
|
|
415
|
+
* `NetworkError`s, so a forged/wrong FULFILL is never retried — re-sending
|
|
416
|
+
* would re-spend the attached claim.
|
|
391
417
|
*/
|
|
392
418
|
declare function mapIlpResponse(packet: ILPResponsePacket, sentCondition?: Uint8Array): IlpSendResultWithFulfillment;
|
|
393
419
|
|
|
@@ -1698,12 +1724,16 @@ declare function readEvmTokenBalance(opts: {
|
|
|
1698
1724
|
chainKey: string;
|
|
1699
1725
|
tokenAddress: string;
|
|
1700
1726
|
owner: string;
|
|
1727
|
+
/** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
|
|
1728
|
+
rpcDispatcher?: unknown;
|
|
1701
1729
|
}): Promise<WalletBalance>;
|
|
1702
1730
|
/** Read the native ETH balance (wei) for `owner` via `eth_getBalance`. */
|
|
1703
1731
|
declare function readEvmNativeBalance(opts: {
|
|
1704
1732
|
rpcUrl: string;
|
|
1705
1733
|
chainKey: string;
|
|
1706
1734
|
owner: string;
|
|
1735
|
+
/** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
|
|
1736
|
+
rpcDispatcher?: unknown;
|
|
1707
1737
|
}): Promise<WalletTokenAmount>;
|
|
1708
1738
|
/** Read the native SOL balance (lamports) for `owner` via the `getBalance` RPC. */
|
|
1709
1739
|
declare function readSolanaNativeBalance(opts: {
|
|
@@ -1730,6 +1760,12 @@ interface WalletBalanceSources {
|
|
|
1730
1760
|
rpcUrl: string;
|
|
1731
1761
|
owner: string;
|
|
1732
1762
|
tokenAddress?: string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Send the EVM reads through the hidden-service proxy (ADR 0002). The Solana
|
|
1765
|
+
* reads need no equivalent: they go through {@link WalletBalanceSources.fetchImpl},
|
|
1766
|
+
* which is already the proxied `fetch` on a hidden-service client.
|
|
1767
|
+
*/
|
|
1768
|
+
rpcDispatcher?: unknown;
|
|
1733
1769
|
};
|
|
1734
1770
|
solana?: {
|
|
1735
1771
|
chainKey?: string;
|
|
@@ -1988,9 +2024,13 @@ interface EvmTransferConfig {
|
|
|
1988
2024
|
signer: EvmSigner;
|
|
1989
2025
|
/** ERC-20 settlement-token address. Required only for `asset: 'token'`. */
|
|
1990
2026
|
tokenAddress?: string;
|
|
2027
|
+
/** Send this transfer's RPC through the hidden-service proxy (ADR 0002). */
|
|
2028
|
+
rpcDispatcher?: unknown;
|
|
1991
2029
|
}
|
|
1992
2030
|
interface SolanaTransferConfig {
|
|
1993
2031
|
rpcUrl: string;
|
|
2032
|
+
/** `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client (ADR 0002). */
|
|
2033
|
+
rpcFetch?: typeof fetch;
|
|
1994
2034
|
/** Ed25519 signing seed (32 bytes) or a 64-byte seed||pubkey keypair. */
|
|
1995
2035
|
keypair: Uint8Array;
|
|
1996
2036
|
/** SPL settlement-token mint. Required only for `asset: 'token'`. */
|
|
@@ -2167,6 +2207,26 @@ interface ToonClientConfig {
|
|
|
2167
2207
|
};
|
|
2168
2208
|
/** Faucet base URL for {@link WalletFacade.faucet}. Devnet only. */
|
|
2169
2209
|
faucetUrl?: string;
|
|
2210
|
+
/**
|
|
2211
|
+
* The `socks5h://` proxy through which a hidden-service connector is reached —
|
|
2212
|
+
* a running Anyone Protocol `anon` daemon's SOCKS port, e.g.
|
|
2213
|
+
* `socks5h://127.0.0.1:9050`.
|
|
2214
|
+
*
|
|
2215
|
+
* Required when `connector` is a `.anyone` address, and rejected as pointless
|
|
2216
|
+
* misdirection when it is not. This library never starts a daemon itself; the
|
|
2217
|
+
* `toon` CLI will start one for you (ADR 0001).
|
|
2218
|
+
*
|
|
2219
|
+
* Node only: a browser cannot dial a hidden service by any route.
|
|
2220
|
+
*/
|
|
2221
|
+
socksProxy?: string;
|
|
2222
|
+
/**
|
|
2223
|
+
* Send chain RPC through `socksProxy` as well as the packets. Default `true`.
|
|
2224
|
+
*
|
|
2225
|
+
* Set `false` only when the RPC endpoint is already private — your own node on
|
|
2226
|
+
* loopback — where the extra hop buys nothing and costs latency. Leaving it on
|
|
2227
|
+
* for a public provider is the point: see ADR 0002.
|
|
2228
|
+
*/
|
|
2229
|
+
proxyRpc?: boolean;
|
|
2170
2230
|
/** Injected `fetch`, for tests and non-standard runtimes. */
|
|
2171
2231
|
fetch?: typeof fetch;
|
|
2172
2232
|
/** Injected websocket factory, for tests and runtimes without a global `WebSocket`. */
|
|
@@ -2491,6 +2551,7 @@ declare class ToonClient implements ToonClientLike {
|
|
|
2491
2551
|
private onChain;
|
|
2492
2552
|
private carriage;
|
|
2493
2553
|
private btpSession;
|
|
2554
|
+
private readonly hiddenService;
|
|
2494
2555
|
private closed;
|
|
2495
2556
|
private constructor();
|
|
2496
2557
|
/**
|
|
@@ -2620,6 +2681,18 @@ declare class ToonClient implements ToonClientLike {
|
|
|
2620
2681
|
* perform here — the watermark is already durable when this is called.
|
|
2621
2682
|
*/
|
|
2622
2683
|
close(): Promise<void>;
|
|
2684
|
+
/**
|
|
2685
|
+
* Refuse an endpoint this client has no way to dial.
|
|
2686
|
+
*
|
|
2687
|
+
* A node's endpoints are its own strings, and a hidden-service node may publish
|
|
2688
|
+
* absolute `.anyone` ones. The configured client edge always wins on *whether*
|
|
2689
|
+
* we can reach the node — but a carriage resolved from the description can
|
|
2690
|
+
* still point somewhere the configured transport cannot go. Without a proxy
|
|
2691
|
+
* that address does not merely fail: the hostname goes out in a plaintext DNS
|
|
2692
|
+
* query first, which is precisely what a hidden service exists to prevent. So
|
|
2693
|
+
* this fails loudly, naming the proxy, before anything dials.
|
|
2694
|
+
*/
|
|
2695
|
+
private assertEndpointReachable;
|
|
2623
2696
|
/** The port {@link send} runs against. */
|
|
2624
2697
|
private sendContext;
|
|
2625
2698
|
/**
|
|
@@ -2705,6 +2778,20 @@ interface ResolvedIdentity {
|
|
|
2705
2778
|
interface ResolvedConfig {
|
|
2706
2779
|
/** The client-edge base URL, with any trailing `/ilp` normalised away. */
|
|
2707
2780
|
connector: string;
|
|
2781
|
+
/** True when {@link connector} is a `.anyone` hidden service. */
|
|
2782
|
+
connectorIsHiddenService: boolean;
|
|
2783
|
+
/** The `socks5h://` proxy to reach it through, when there is one. */
|
|
2784
|
+
socksProxy: string | undefined;
|
|
2785
|
+
/** Whether chain RPC rides that proxy too (ADR 0002). */
|
|
2786
|
+
proxyRpc: boolean;
|
|
2787
|
+
/**
|
|
2788
|
+
* The undici dispatcher built from {@link socksProxy}, for chain RPC.
|
|
2789
|
+
* Deliberately not filled in here: building it means loading a Node-only
|
|
2790
|
+
* module, and resolving a config must stay synchronous and browser-safe. It is
|
|
2791
|
+
* the client's job to construct one, so {@link resolveConfig} only reserves
|
|
2792
|
+
* the slot and leaves it `undefined`.
|
|
2793
|
+
*/
|
|
2794
|
+
rpcDispatcher: unknown;
|
|
2708
2795
|
identity: ResolvedIdentity;
|
|
2709
2796
|
/** The caller's chain preference, or `undefined` to take the node's first. */
|
|
2710
2797
|
chain: ChainKind | undefined;
|
|
@@ -3248,6 +3335,12 @@ interface TokenNetworkClientConfig {
|
|
|
3248
3335
|
rpcUrl: string;
|
|
3249
3336
|
signer: EvmSigner;
|
|
3250
3337
|
readConsistency?: EvmReadConsistencyConfig;
|
|
3338
|
+
/**
|
|
3339
|
+
* An undici dispatcher to send RPC through — present when the client is
|
|
3340
|
+
* talking to a hidden service, so chain traffic rides the same overlay as the
|
|
3341
|
+
* packets rather than announcing this address on clearnet (ADR 0002).
|
|
3342
|
+
*/
|
|
3343
|
+
rpcDispatcher?: unknown;
|
|
3251
3344
|
}
|
|
3252
3345
|
/** What one channel's `channels(id)` view says. */
|
|
3253
3346
|
interface EvmChannelRecord {
|
|
@@ -3432,6 +3525,8 @@ declare function parseEvmChainId(chain: string): number;
|
|
|
3432
3525
|
|
|
3433
3526
|
interface SolanaChannelConfig {
|
|
3434
3527
|
rpcUrl: string;
|
|
3528
|
+
/** `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client. */
|
|
3529
|
+
rpcFetch?: typeof fetch;
|
|
3435
3530
|
/**
|
|
3436
3531
|
* Ed25519 keypair material. Accepts either a 32-byte seed or a 64-byte
|
|
3437
3532
|
* `secretKey` (seed ‖ pubkey, as produced by `deriveFullIdentity`). The first
|
|
@@ -3468,6 +3563,13 @@ interface OnChainChannelClientConfig {
|
|
|
3468
3563
|
solanaConfig?: SolanaChannelConfig;
|
|
3469
3564
|
/** How hard the EVM opener works to survive a stale-read RPC (#489). */
|
|
3470
3565
|
readConsistency?: EvmReadConsistencyConfig;
|
|
3566
|
+
/**
|
|
3567
|
+
* An undici dispatcher to send chain RPC through, when this client is talking
|
|
3568
|
+
* to a hidden service. Reaching the connector inside the overlay while reading
|
|
3569
|
+
* chain state on clearnet would announce, from this IP and beside every paid
|
|
3570
|
+
* request, the settlement address the overlay exists to keep unlinked (ADR 0002).
|
|
3571
|
+
*/
|
|
3572
|
+
rpcDispatcher?: unknown;
|
|
3471
3573
|
}
|
|
3472
3574
|
/** What this class remembers about a channel it opened or adopted. */
|
|
3473
3575
|
interface ChannelContext {
|
|
@@ -3481,6 +3583,7 @@ declare class OnChainChannelClient implements ChannelClient {
|
|
|
3481
3583
|
private readonly chainRpcUrls;
|
|
3482
3584
|
private solanaConfig?;
|
|
3483
3585
|
private readonly readConsistency;
|
|
3586
|
+
private readonly rpcDispatcher;
|
|
3484
3587
|
private readonly channelContext;
|
|
3485
3588
|
private readonly evmClients;
|
|
3486
3589
|
private readonly solanaClients;
|
|
@@ -6337,6 +6440,94 @@ type ArnsNameWithAntOutcome = {
|
|
|
6337
6440
|
*/
|
|
6338
6441
|
declare function buyArnsNameWithNewAnt(params: AntSpawnParams & Pick<ArnsBuyParams, 'type' | 'years'>): Promise<ArnsNameWithAntOutcome>;
|
|
6339
6442
|
|
|
6443
|
+
/**
|
|
6444
|
+
* Hidden-service hostname validation for the Anyone Protocol network.
|
|
6445
|
+
*
|
|
6446
|
+
* The `anon` binary routes hidden-service hostnames under the **`.anyone`** TLD
|
|
6447
|
+
* ONLY. A `<host>.anon` name is NOT recognized as a hidden service — anon treats
|
|
6448
|
+
* it as a clearnet name and tries to exit-resolve it, which fails
|
|
6449
|
+
* (`resolve failed` / `HostUnreachable`). Only `<host>.anyone` triggers anon's
|
|
6450
|
+
* `parse_extended_hostname: Anyone dns address lookup` and is validated.
|
|
6451
|
+
*
|
|
6452
|
+
* Historically this client accepted BOTH `.anon` and `.anyone`, so a `.anon`
|
|
6453
|
+
* address was silently accepted and then failed deep in the transport with an
|
|
6454
|
+
* opaque error. This module makes `.anyone` the single accepted HS TLD and
|
|
6455
|
+
* rejects the near-misses up front with an actionable message.
|
|
6456
|
+
*
|
|
6457
|
+
* `.onion` is a near-miss too, and a more tempting one: it is a real hidden
|
|
6458
|
+
* service, just on a network this client does not dial. We route through `anon`,
|
|
6459
|
+
* not `tor`, so accepting a `.onion` address would repeat the exact mistake
|
|
6460
|
+
* `.anon` taught us — an address we cannot reach, failing late and cryptically.
|
|
6461
|
+
*
|
|
6462
|
+
* This is a pure, browser-safe helper (no Node built-ins) so it can be imported
|
|
6463
|
+
* from any path, including config validation.
|
|
6464
|
+
*/
|
|
6465
|
+
/**
|
|
6466
|
+
* A `<host>.anyone` hidden-service hostname. The label is base32 (`a-z2-7`),
|
|
6467
|
+
* matching the on-wire onion-style address alphabet anon uses.
|
|
6468
|
+
*/
|
|
6469
|
+
declare const HS_HOSTNAME_REGEX: RegExp;
|
|
6470
|
+
/** Max length of an HS hostname (defensive bound against pathological input). */
|
|
6471
|
+
declare const HS_HOSTNAME_MAX_LENGTH = 80;
|
|
6472
|
+
/**
|
|
6473
|
+
* Returns true iff `s` is a routable `.anyone` hidden-service hostname.
|
|
6474
|
+
* Does NOT accept `.anon` or `.onion` (see {@link assertRoutableHsHostname}).
|
|
6475
|
+
*/
|
|
6476
|
+
declare function isRoutableHsHostname(s: unknown): s is string;
|
|
6477
|
+
/**
|
|
6478
|
+
* Returns true iff `url` addresses a hidden service — i.e. its host is a
|
|
6479
|
+
* routable `.anyone` address.
|
|
6480
|
+
*
|
|
6481
|
+
* Takes a URL string rather than a hostname because that is what a caller
|
|
6482
|
+
* actually holds: a `connector` config value, an `httpEndpoint` off a
|
|
6483
|
+
* self-description. A string that is not a URL at all is not a hidden service.
|
|
6484
|
+
*/
|
|
6485
|
+
declare function isHiddenServiceUrl(url: unknown): boolean;
|
|
6486
|
+
/**
|
|
6487
|
+
* Validates that `hostname` is a routable `.anyone` hidden-service address.
|
|
6488
|
+
*
|
|
6489
|
+
* - `<host>.anyone` → returns the hostname unchanged.
|
|
6490
|
+
* - `<host>.anon` → throws, pointing at `.anyone` (anon does NOT route
|
|
6491
|
+
* `.anon`; it is treated as a clearnet address and fails `HostUnreachable`).
|
|
6492
|
+
* - `<host>.onion` → throws, naming the network mismatch: that is Tor, and
|
|
6493
|
+
* this client dials the Anyone Protocol.
|
|
6494
|
+
* - anything else → throws a generic format error.
|
|
6495
|
+
*
|
|
6496
|
+
* @throws {Error} if the hostname is not a routable `.anyone` HS address.
|
|
6497
|
+
*/
|
|
6498
|
+
declare function assertRoutableHsHostname(hostname: unknown): string;
|
|
6499
|
+
|
|
6500
|
+
/**
|
|
6501
|
+
* The one place viem is told to send chain RPC through the hidden-service proxy.
|
|
6502
|
+
*
|
|
6503
|
+
* viem's HTTP transport calls the **global** `fetch` and accepts no injected one.
|
|
6504
|
+
* Its only opening is `fetchOptions`, which it merges into the `fetch` init — and
|
|
6505
|
+
* Node's `fetch` reads a `dispatcher` from there. So a dispatcher is how, and the
|
|
6506
|
+
* only how, chain traffic joins the packet traffic inside the overlay (ADR 0002).
|
|
6507
|
+
*
|
|
6508
|
+
* Browser-safe: this module imports nothing but viem. The dispatcher itself is
|
|
6509
|
+
* built in `./socks.js`, which is Node-only and dynamically imported; here it is
|
|
6510
|
+
* an opaque `unknown` that is either present or not.
|
|
6511
|
+
*/
|
|
6512
|
+
|
|
6513
|
+
/** Options a caller already wanted, independent of any proxy. */
|
|
6514
|
+
interface RpcTransportOptions {
|
|
6515
|
+
timeout?: number;
|
|
6516
|
+
retryCount?: number;
|
|
6517
|
+
}
|
|
6518
|
+
/**
|
|
6519
|
+
* A viem HTTP transport for `url`, bound to `dispatcher` when there is one.
|
|
6520
|
+
*
|
|
6521
|
+
* `undefined` dispatcher means clearnet, and produces exactly the transport this
|
|
6522
|
+
* package built before hidden services existed.
|
|
6523
|
+
*/
|
|
6524
|
+
declare function rpcTransport(url: string, dispatcher: unknown | undefined, options?: RpcTransportOptions): ReturnType<typeof http>;
|
|
6525
|
+
/**
|
|
6526
|
+
* `fetch` bound to `dispatcher`, for a JSON-RPC path that calls `fetch` itself
|
|
6527
|
+
* rather than going through viem — Solana's, in practice.
|
|
6528
|
+
*/
|
|
6529
|
+
declare function rpcFetch(dispatcher: unknown | undefined, fetchImpl?: typeof fetch): typeof fetch;
|
|
6530
|
+
|
|
6340
6531
|
/**
|
|
6341
6532
|
* Well-known values for the public TOON devnet.
|
|
6342
6533
|
*
|
|
@@ -6493,4 +6684,4 @@ interface RetryOptions {
|
|
|
6493
6684
|
*/
|
|
6494
6685
|
declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
6495
6686
|
|
|
6496
|
-
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 BalanceProofParams, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS, type ChainKind, type ChainMetadata, type ChainSigner, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelClient, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelManager, type ChannelManagerConfig, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStatus, type ChannelStore, type ChannelStoreEntry, type ChannelTerms, type ClaimAck, type ClaimMessage, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, type ConnectorChainSettlementTerms, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ConnectorSettlementTerms, type ConnectorSolanaSettlementTerms, type CounterpartyVerdict, DEFAULT_DEPOSIT, DEFAULT_SETTLEMENT_TIMEOUT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC20_ABI, type EVMClaimMessage, type EdgeIdentity, type EncryptedKeystore, type EnsureChannelOptions, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmChannelRecord, type EvmReadConsistencyConfig, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, 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, 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, MIN_SETTLEMENT_TIMEOUT_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, OnChainChannelClient, type OnChainChannelClientConfig, type OnChainChannelStatus, type OpenChannelOptions, type OpenChannelParams, type OpenChannelResult, type OpenOrAdoptParams, type OpenedKeystore, type OpenedRequest, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, 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 SignedBalanceProof, type SolanaChannelConfig, type SolanaClaimMessage, type Signer as SolanaKeypair, type SolanaNetwork, SolanaSigner, type SolanaWireTransaction, StaleRpcReadError, TOKEN_NETWORK_ABI, TOKEN_NETWORK_REGISTRY_ABI, TokenNetworkClient, type TokenNetworkClientConfig, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonIdentity, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TxRef, UnknownChainError, ValidationError, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, type X402ChannelExtra, addressFor, buildJobEvent, buildResponseMeta, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, connectorEdgeBaseUrl, counterpartyMatch, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFaucetTimeout, defaultRpcUrl, deriveCondition, deriveEvmChannelId, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmDerivationPath, evmIdentityFromKey, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, isGasStationFailure, isInsufficientGasError, isUnknownChannelReject, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, openKeystore, openRequest, openResponse, parseBtpMessage, parseEvmChainId, parsePaymentTerms, parseSelfDescription, parseSettlementEntry, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, rejectNamesChannel, resolveConfig, resolveExecutionCondition, resolveExpiresAt, routeFor, routePriceFor, sameSettlementAddress, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settlementToTerms, signSolanaWireTransaction, solanaKeypair, sortParticipants, spawnAnt, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, writeKeystoreFile };
|
|
6687
|
+
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 BalanceProofParams, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS, type ChainKind, type ChainMetadata, type ChainSigner, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelClient, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelManager, type ChannelManagerConfig, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStatus, type ChannelStore, type ChannelStoreEntry, type ChannelTerms, type ClaimAck, type ClaimMessage, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, type ConnectorChainSettlementTerms, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ConnectorSettlementTerms, type ConnectorSolanaSettlementTerms, type CounterpartyVerdict, DEFAULT_DEPOSIT, DEFAULT_SETTLEMENT_TIMEOUT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC20_ABI, type EVMClaimMessage, type EdgeIdentity, type EncryptedKeystore, type EnsureChannelOptions, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmChannelRecord, type EvmReadConsistencyConfig, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, 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, MIN_SETTLEMENT_TIMEOUT_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, OnChainChannelClient, type OnChainChannelClientConfig, type OnChainChannelStatus, type OpenChannelOptions, type OpenChannelParams, type OpenChannelResult, type OpenOrAdoptParams, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, 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 SignedBalanceProof, type SolanaChannelConfig, type SolanaClaimMessage, type Signer as SolanaKeypair, type SolanaNetwork, SolanaSigner, type SolanaWireTransaction, StaleRpcReadError, TOKEN_NETWORK_ABI, TOKEN_NETWORK_REGISTRY_ABI, TokenNetworkClient, type TokenNetworkClientConfig, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonIdentity, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TxRef, UnknownChainError, ValidationError, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, type X402ChannelExtra, addressFor, assertRoutableHsHostname, buildJobEvent, buildResponseMeta, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, connectorEdgeBaseUrl, counterpartyMatch, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFaucetTimeout, defaultRpcUrl, deriveCondition, deriveEvmChannelId, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmDerivationPath, evmIdentityFromKey, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, isUnknownChannelReject, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, openKeystore, openRequest, openResponse, parseBtpMessage, parseEvmChainId, parsePaymentTerms, parseSelfDescription, parseSettlementEntry, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, rejectNamesChannel, resolveConfig, resolveExecutionCondition, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sameSettlementAddress, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settlementToTerms, signSolanaWireTransaction, solanaKeypair, sortParticipants, spawnAnt, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, writeKeystoreFile };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
loadKeystore,
|
|
9
9
|
openKeystore,
|
|
10
10
|
writeKeystoreFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4I3JQ7KA.js";
|
|
12
12
|
import {
|
|
13
13
|
ACCUMULATED_COST_HEADER,
|
|
14
14
|
ACCUMULATED_COST_PROTOCOL,
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
OerError,
|
|
63
63
|
OerErrorKind,
|
|
64
64
|
OnChainChannelClient,
|
|
65
|
+
PACKET_EXPIRY_HEADROOM_MS,
|
|
65
66
|
PAYMENT_REQUIRED_HEADER,
|
|
66
67
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
67
68
|
PaymentRequiredError,
|
|
@@ -142,6 +143,8 @@ import {
|
|
|
142
143
|
resolveExpiresAt,
|
|
143
144
|
routeFor,
|
|
144
145
|
routePriceFor,
|
|
146
|
+
rpcFetch,
|
|
147
|
+
rpcTransport,
|
|
145
148
|
sameSettlementAddress,
|
|
146
149
|
sealExchange,
|
|
147
150
|
sealRequest,
|
|
@@ -162,9 +165,12 @@ import {
|
|
|
162
165
|
toHex,
|
|
163
166
|
trimTrailingSlashes,
|
|
164
167
|
withRetry
|
|
165
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-A3JKQOWQ.js";
|
|
166
169
|
import {
|
|
167
170
|
DEVNET,
|
|
171
|
+
HS_HOSTNAME_MAX_LENGTH,
|
|
172
|
+
HS_HOSTNAME_REGEX,
|
|
173
|
+
assertRoutableHsHostname,
|
|
168
174
|
base58Decode,
|
|
169
175
|
base58Encode,
|
|
170
176
|
defaultRpcUrl,
|
|
@@ -173,8 +179,13 @@ import {
|
|
|
173
179
|
evmIdentityFromKey,
|
|
174
180
|
generateMnemonic,
|
|
175
181
|
generateRandomIdentity,
|
|
182
|
+
isHiddenServiceUrl,
|
|
183
|
+
isRoutableHsHostname,
|
|
176
184
|
validateMnemonic
|
|
177
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-7MPONJW5.js";
|
|
186
|
+
import {
|
|
187
|
+
validateSocks5hUrl
|
|
188
|
+
} from "./chunk-32MD3CXE.js";
|
|
178
189
|
|
|
179
190
|
// src/channel/solana/wire-transaction.ts
|
|
180
191
|
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
@@ -420,6 +431,9 @@ function decodeReceipt(envelope) {
|
|
|
420
431
|
if (envelope.result !== null && typeof envelope.result === "object") {
|
|
421
432
|
return envelope.result;
|
|
422
433
|
}
|
|
434
|
+
if (typeof envelope.txId === "string" && envelope.txId.length > 0) {
|
|
435
|
+
return { txId: envelope.txId };
|
|
436
|
+
}
|
|
423
437
|
return void 0;
|
|
424
438
|
}
|
|
425
439
|
function truncate(text) {
|
|
@@ -702,6 +716,8 @@ export {
|
|
|
702
716
|
GIFTWRAP_TYPE_RESPONSE,
|
|
703
717
|
GiftWrapError,
|
|
704
718
|
GiftWrapErrorKind,
|
|
719
|
+
HS_HOSTNAME_MAX_LENGTH,
|
|
720
|
+
HS_HOSTNAME_REGEX,
|
|
705
721
|
HttpIlpClient,
|
|
706
722
|
ILPPacketType,
|
|
707
723
|
ILP_CLAIM_HEADER,
|
|
@@ -717,6 +733,7 @@ export {
|
|
|
717
733
|
OerError,
|
|
718
734
|
OerErrorKind,
|
|
719
735
|
OnChainChannelClient,
|
|
736
|
+
PACKET_EXPIRY_HEADROOM_MS,
|
|
720
737
|
PAYMENT_REQUIRED_HEADER,
|
|
721
738
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
722
739
|
PaymentRequiredError,
|
|
@@ -736,6 +753,7 @@ export {
|
|
|
736
753
|
UnknownChainError,
|
|
737
754
|
ValidationError,
|
|
738
755
|
addressFor,
|
|
756
|
+
assertRoutableHsHostname,
|
|
739
757
|
buildJobEvent,
|
|
740
758
|
buildResponseMeta,
|
|
741
759
|
buyArnsName,
|
|
@@ -781,7 +799,9 @@ export {
|
|
|
781
799
|
httpEndpointToBtpUrl,
|
|
782
800
|
importKeystore,
|
|
783
801
|
isGasStationFailure,
|
|
802
|
+
isHiddenServiceUrl,
|
|
784
803
|
isInsufficientGasError,
|
|
804
|
+
isRoutableHsHostname,
|
|
785
805
|
isUnknownChannelReject,
|
|
786
806
|
jobEventParam,
|
|
787
807
|
keystoreDerivation,
|
|
@@ -816,6 +836,8 @@ export {
|
|
|
816
836
|
resolveExpiresAt,
|
|
817
837
|
routeFor,
|
|
818
838
|
routePriceFor,
|
|
839
|
+
rpcFetch,
|
|
840
|
+
rpcTransport,
|
|
819
841
|
sameSettlementAddress,
|
|
820
842
|
sealExchange,
|
|
821
843
|
sealRequest,
|
|
@@ -838,6 +860,7 @@ export {
|
|
|
838
860
|
toEnvelopeRequest,
|
|
839
861
|
trimTrailingSlashes,
|
|
840
862
|
validateMnemonic,
|
|
863
|
+
validateSocks5hUrl,
|
|
841
864
|
withRetry,
|
|
842
865
|
writeKeystoreFile
|
|
843
866
|
};
|