@toon-protocol/client 2.1.1 → 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.
@@ -30,8 +30,9 @@ import {
30
30
  send,
31
31
  settlementToTerms,
32
32
  toEnvelopeRequest
33
- } from "./chunk-ENNSPYP4.js";
34
- import "./chunk-J6JVCKNV.js";
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-ACUZCR5A.js.map
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
- /** Normalize an `IlpSendParams.expiresAt` to a `Date` (default: now + timeout). */
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
@@ -1697,12 +1724,16 @@ declare function readEvmTokenBalance(opts: {
1697
1724
  chainKey: string;
1698
1725
  tokenAddress: string;
1699
1726
  owner: string;
1727
+ /** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
1728
+ rpcDispatcher?: unknown;
1700
1729
  }): Promise<WalletBalance>;
1701
1730
  /** Read the native ETH balance (wei) for `owner` via `eth_getBalance`. */
1702
1731
  declare function readEvmNativeBalance(opts: {
1703
1732
  rpcUrl: string;
1704
1733
  chainKey: string;
1705
1734
  owner: string;
1735
+ /** Send this read through the hidden-service proxy, when there is one (ADR 0002). */
1736
+ rpcDispatcher?: unknown;
1706
1737
  }): Promise<WalletTokenAmount>;
1707
1738
  /** Read the native SOL balance (lamports) for `owner` via the `getBalance` RPC. */
1708
1739
  declare function readSolanaNativeBalance(opts: {
@@ -1729,6 +1760,12 @@ interface WalletBalanceSources {
1729
1760
  rpcUrl: string;
1730
1761
  owner: string;
1731
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;
1732
1769
  };
1733
1770
  solana?: {
1734
1771
  chainKey?: string;
@@ -1987,9 +2024,13 @@ interface EvmTransferConfig {
1987
2024
  signer: EvmSigner;
1988
2025
  /** ERC-20 settlement-token address. Required only for `asset: 'token'`. */
1989
2026
  tokenAddress?: string;
2027
+ /** Send this transfer's RPC through the hidden-service proxy (ADR 0002). */
2028
+ rpcDispatcher?: unknown;
1990
2029
  }
1991
2030
  interface SolanaTransferConfig {
1992
2031
  rpcUrl: string;
2032
+ /** `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client (ADR 0002). */
2033
+ rpcFetch?: typeof fetch;
1993
2034
  /** Ed25519 signing seed (32 bytes) or a 64-byte seed||pubkey keypair. */
1994
2035
  keypair: Uint8Array;
1995
2036
  /** SPL settlement-token mint. Required only for `asset: 'token'`. */
@@ -2166,6 +2207,26 @@ interface ToonClientConfig {
2166
2207
  };
2167
2208
  /** Faucet base URL for {@link WalletFacade.faucet}. Devnet only. */
2168
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;
2169
2230
  /** Injected `fetch`, for tests and non-standard runtimes. */
2170
2231
  fetch?: typeof fetch;
2171
2232
  /** Injected websocket factory, for tests and runtimes without a global `WebSocket`. */
@@ -2490,6 +2551,7 @@ declare class ToonClient implements ToonClientLike {
2490
2551
  private onChain;
2491
2552
  private carriage;
2492
2553
  private btpSession;
2554
+ private readonly hiddenService;
2493
2555
  private closed;
2494
2556
  private constructor();
2495
2557
  /**
@@ -2619,6 +2681,18 @@ declare class ToonClient implements ToonClientLike {
2619
2681
  * perform here — the watermark is already durable when this is called.
2620
2682
  */
2621
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;
2622
2696
  /** The port {@link send} runs against. */
2623
2697
  private sendContext;
2624
2698
  /**
@@ -2704,6 +2778,20 @@ interface ResolvedIdentity {
2704
2778
  interface ResolvedConfig {
2705
2779
  /** The client-edge base URL, with any trailing `/ilp` normalised away. */
2706
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;
2707
2795
  identity: ResolvedIdentity;
2708
2796
  /** The caller's chain preference, or `undefined` to take the node's first. */
2709
2797
  chain: ChainKind | undefined;
@@ -3247,6 +3335,12 @@ interface TokenNetworkClientConfig {
3247
3335
  rpcUrl: string;
3248
3336
  signer: EvmSigner;
3249
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;
3250
3344
  }
3251
3345
  /** What one channel's `channels(id)` view says. */
3252
3346
  interface EvmChannelRecord {
@@ -3431,6 +3525,8 @@ declare function parseEvmChainId(chain: string): number;
3431
3525
 
3432
3526
  interface SolanaChannelConfig {
3433
3527
  rpcUrl: string;
3528
+ /** `fetch` for Solana JSON-RPC — the proxied one on a hidden-service client. */
3529
+ rpcFetch?: typeof fetch;
3434
3530
  /**
3435
3531
  * Ed25519 keypair material. Accepts either a 32-byte seed or a 64-byte
3436
3532
  * `secretKey` (seed ‖ pubkey, as produced by `deriveFullIdentity`). The first
@@ -3467,6 +3563,13 @@ interface OnChainChannelClientConfig {
3467
3563
  solanaConfig?: SolanaChannelConfig;
3468
3564
  /** How hard the EVM opener works to survive a stale-read RPC (#489). */
3469
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;
3470
3573
  }
3471
3574
  /** What this class remembers about a channel it opened or adopted. */
3472
3575
  interface ChannelContext {
@@ -3480,6 +3583,7 @@ declare class OnChainChannelClient implements ChannelClient {
3480
3583
  private readonly chainRpcUrls;
3481
3584
  private solanaConfig?;
3482
3585
  private readonly readConsistency;
3586
+ private readonly rpcDispatcher;
3483
3587
  private readonly channelContext;
3484
3588
  private readonly evmClients;
3485
3589
  private readonly solanaClients;
@@ -6336,6 +6440,94 @@ type ArnsNameWithAntOutcome = {
6336
6440
  */
6337
6441
  declare function buyArnsNameWithNewAnt(params: AntSpawnParams & Pick<ArnsBuyParams, 'type' | 'years'>): Promise<ArnsNameWithAntOutcome>;
6338
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
+
6339
6531
  /**
6340
6532
  * Well-known values for the public TOON devnet.
6341
6533
  *
@@ -6492,4 +6684,4 @@ interface RetryOptions {
6492
6684
  */
6493
6685
  declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
6494
6686
 
6495
- 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-DD7TJKP6.js";
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-ENNSPYP4.js";
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-J6JVCKNV.js";
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";
@@ -705,6 +716,8 @@ export {
705
716
  GIFTWRAP_TYPE_RESPONSE,
706
717
  GiftWrapError,
707
718
  GiftWrapErrorKind,
719
+ HS_HOSTNAME_MAX_LENGTH,
720
+ HS_HOSTNAME_REGEX,
708
721
  HttpIlpClient,
709
722
  ILPPacketType,
710
723
  ILP_CLAIM_HEADER,
@@ -720,6 +733,7 @@ export {
720
733
  OerError,
721
734
  OerErrorKind,
722
735
  OnChainChannelClient,
736
+ PACKET_EXPIRY_HEADROOM_MS,
723
737
  PAYMENT_REQUIRED_HEADER,
724
738
  PAYMENT_REQUIRED_PROTOCOL,
725
739
  PaymentRequiredError,
@@ -739,6 +753,7 @@ export {
739
753
  UnknownChainError,
740
754
  ValidationError,
741
755
  addressFor,
756
+ assertRoutableHsHostname,
742
757
  buildJobEvent,
743
758
  buildResponseMeta,
744
759
  buyArnsName,
@@ -784,7 +799,9 @@ export {
784
799
  httpEndpointToBtpUrl,
785
800
  importKeystore,
786
801
  isGasStationFailure,
802
+ isHiddenServiceUrl,
787
803
  isInsufficientGasError,
804
+ isRoutableHsHostname,
788
805
  isUnknownChannelReject,
789
806
  jobEventParam,
790
807
  keystoreDerivation,
@@ -819,6 +836,8 @@ export {
819
836
  resolveExpiresAt,
820
837
  routeFor,
821
838
  routePriceFor,
839
+ rpcFetch,
840
+ rpcTransport,
822
841
  sameSettlementAddress,
823
842
  sealExchange,
824
843
  sealRequest,
@@ -841,6 +860,7 @@ export {
841
860
  toEnvelopeRequest,
842
861
  trimTrailingSlashes,
843
862
  validateMnemonic,
863
+ validateSocks5hUrl,
844
864
  withRetry,
845
865
  writeKeystoreFile
846
866
  };