@toon-protocol/client 0.10.0 → 0.11.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/index.d.ts +440 -210
- package/dist/index.js +297 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _toon_protocol_core from '@toon-protocol/core';
|
|
2
|
-
import { IlpPeerInfo,
|
|
2
|
+
import { IlpPeerInfo, IlpClient, IlpSendResult, NetworkFamilyStatus, ConnectorAdminClient, ConnectorChannelClient, OpenChannelParams, OpenChannelResult, ChannelState } from '@toon-protocol/core';
|
|
3
3
|
import { NostrEvent, EventTemplate } from 'nostr-tools/pure';
|
|
4
4
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
5
5
|
|
|
@@ -509,6 +509,417 @@ interface RequestBlobStorageResult {
|
|
|
509
509
|
*/
|
|
510
510
|
declare function requestBlobStorage(client: ToonClient, secretKey: Uint8Array, params: RequestBlobStorageParams): Promise<RequestBlobStorageResult>;
|
|
511
511
|
|
|
512
|
+
interface BtpRuntimeClientConfig {
|
|
513
|
+
btpUrl: string;
|
|
514
|
+
peerId: string;
|
|
515
|
+
authToken: string;
|
|
516
|
+
/** Max reconnection attempts on send failure (default: 3) */
|
|
517
|
+
maxRetries?: number;
|
|
518
|
+
/** Delay between reconnection attempts in ms (default: 1000) */
|
|
519
|
+
retryDelay?: number;
|
|
520
|
+
/** Custom WebSocket constructor (for SOCKS5 proxy support). */
|
|
521
|
+
createWebSocket?: (url: string) => WebSocket;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* BTP transport implementing IlpClient.
|
|
525
|
+
* Uses IsomorphicBtpClient (browser-native, no Node.js dependencies).
|
|
526
|
+
*/
|
|
527
|
+
declare class BtpRuntimeClient implements IlpClient {
|
|
528
|
+
private btpClient;
|
|
529
|
+
private readonly config;
|
|
530
|
+
private _isConnected;
|
|
531
|
+
constructor(config: BtpRuntimeClientConfig);
|
|
532
|
+
/**
|
|
533
|
+
* Connects to the BTP peer via WebSocket.
|
|
534
|
+
*/
|
|
535
|
+
connect(): Promise<void>;
|
|
536
|
+
/**
|
|
537
|
+
* Attempts to reconnect by creating a fresh client and connecting.
|
|
538
|
+
*/
|
|
539
|
+
reconnect(): Promise<void>;
|
|
540
|
+
/**
|
|
541
|
+
* Disconnects from the BTP peer.
|
|
542
|
+
*/
|
|
543
|
+
disconnect(): Promise<void>;
|
|
544
|
+
get isConnected(): boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Sends an ILP packet via BTP with auto-reconnect on connection errors.
|
|
547
|
+
* Satisfies IlpClient interface.
|
|
548
|
+
*/
|
|
549
|
+
sendIlpPacket(params: {
|
|
550
|
+
destination: string;
|
|
551
|
+
amount: string;
|
|
552
|
+
data: string;
|
|
553
|
+
timeout?: number;
|
|
554
|
+
}): Promise<IlpSendResult>;
|
|
555
|
+
/**
|
|
556
|
+
* Sends a balance proof claim via BTP protocol data, then sends an ILP packet.
|
|
557
|
+
* Auto-reconnects on connection errors.
|
|
558
|
+
*/
|
|
559
|
+
sendIlpPacketWithClaim(params: {
|
|
560
|
+
destination: string;
|
|
561
|
+
amount: string;
|
|
562
|
+
data: string;
|
|
563
|
+
timeout?: number;
|
|
564
|
+
}, claim: Record<string, unknown>): Promise<IlpSendResult>;
|
|
565
|
+
/**
|
|
566
|
+
* Send a standalone `payment-channel-claim` BTP MESSAGE (no ILP packet
|
|
567
|
+
* attached). The connector's ClaimReceiver consumes this fire-and-forget
|
|
568
|
+
* to register cumulative claim state independently of the per-packet
|
|
569
|
+
* forwarding path. Auto-reconnects on connection errors.
|
|
570
|
+
*/
|
|
571
|
+
sendClaimMessage(claim: Record<string, unknown>): Promise<void>;
|
|
572
|
+
private _sendClaimMessageOnce;
|
|
573
|
+
/**
|
|
574
|
+
* Single-attempt ILP packet send. Reconnects if not connected.
|
|
575
|
+
*/
|
|
576
|
+
private _sendIlpPacketOnce;
|
|
577
|
+
/**
|
|
578
|
+
* Single-attempt claim + ILP packet send. Reconnects if not connected.
|
|
579
|
+
*/
|
|
580
|
+
private _sendIlpPacketWithClaimOnce;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* ILP-over-HTTP (RFC-0035) transport for the TOON client.
|
|
585
|
+
*
|
|
586
|
+
* The connector now serves ILP-over-HTTP on the SAME port as BTP (connector
|
|
587
|
+
* PR #181). This adapter lets a client do stateless one-shot writes over HTTP
|
|
588
|
+
* (`POST /ilp`) and upgrade to a duplex BTP session when it needs to receive
|
|
589
|
+
* server-initiated packets or act as a peer.
|
|
590
|
+
*
|
|
591
|
+
* Wire contract (targets connector PR #181's `/ilp`):
|
|
592
|
+
* - One-shot write: `POST /ilp`
|
|
593
|
+
* body: OER-encoded ILP PREPARE (`application/octet-stream`)
|
|
594
|
+
* header: `ILP-Payment-Channel-Claim: base64(JSON of the claim)` — the
|
|
595
|
+
* SAME claim JSON the BTP path attaches as the
|
|
596
|
+
* `payment-channel-claim` protocolData entry.
|
|
597
|
+
* optional: `ILP-Peer-Id` + `Authorization: Bearer <secret>` identity.
|
|
598
|
+
* response: `200 OK` with an OER FULFILL or REJECT body. HTTP non-2xx is
|
|
599
|
+
* reserved for TRANSPORT errors (400/401/413/5xx); ILP-level
|
|
600
|
+
* rejects come back as a 200 + REJECT body.
|
|
601
|
+
* - Upgrade to BTP: standard HTTP `Upgrade` with `Sec-WebSocket-Protocol: btp`
|
|
602
|
+
* plus the same `ILP-Peer-Id` + `Authorization` headers. The connector
|
|
603
|
+
* pre-authenticates the BTP session from those headers (continuity), so
|
|
604
|
+
* after `101` we send BTP frames WITHOUT a separate in-band auth frame.
|
|
605
|
+
* Omitting the auth headers falls back to the normal BTP auth-frame flow.
|
|
606
|
+
*
|
|
607
|
+
* Reuses `serializeIlpPrepare`/`deserializeIlpPacket` from `btp/protocol.ts` —
|
|
608
|
+
* the SAME OER codec the BTP path uses. Claim signing/construction is owned by
|
|
609
|
+
* the caller (BootstrapService); this transport never builds or signs claims.
|
|
610
|
+
*/
|
|
611
|
+
|
|
612
|
+
/** Header carrying the base64(JSON) payment-channel claim. */
|
|
613
|
+
declare const ILP_CLAIM_HEADER = "ILP-Payment-Channel-Claim";
|
|
614
|
+
/** Header carrying a NIP-59 wrapped (gift-wrapped) claim. */
|
|
615
|
+
declare const ILP_CLAIM_WRAPPED_HEADER = "ILP-Payment-Channel-Claim-Wrapped";
|
|
616
|
+
/** Header carrying the peer identity. */
|
|
617
|
+
declare const ILP_PEER_ID_HEADER = "ILP-Peer-Id";
|
|
618
|
+
interface HttpIlpClientConfig {
|
|
619
|
+
/** The peer's `POST /ilp` URL (the `httpEndpoint` from discovery). */
|
|
620
|
+
httpEndpoint: string;
|
|
621
|
+
/**
|
|
622
|
+
* Optional peer identity. With no `peerId`/`authToken` the connector treats
|
|
623
|
+
* the request as an anonymous no-auth peer (permissionless default) and
|
|
624
|
+
* derives an ephemeral id from the claim signer.
|
|
625
|
+
*/
|
|
626
|
+
peerId?: string;
|
|
627
|
+
/** Bearer secret for `Authorization`. Omit for the no-auth peer path. */
|
|
628
|
+
authToken?: string;
|
|
629
|
+
/** Request timeout in milliseconds (default: 30000). */
|
|
630
|
+
timeout?: number;
|
|
631
|
+
/** Max retry attempts for transport-level network failures (default: 3). */
|
|
632
|
+
maxRetries?: number;
|
|
633
|
+
/** Initial retry delay in milliseconds (default: 1000). */
|
|
634
|
+
retryDelay?: number;
|
|
635
|
+
/** Custom fetch implementation (SOCKS5 mode / testing). */
|
|
636
|
+
httpClient?: typeof fetch;
|
|
637
|
+
/**
|
|
638
|
+
* Custom WebSocket constructor for the BTP upgrade path (SOCKS5 mode).
|
|
639
|
+
* Forwarded to the underlying BtpRuntimeClient.
|
|
640
|
+
*/
|
|
641
|
+
createWebSocket?: (url: string) => WebSocket;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Stateless ILP-over-HTTP transport implementing `IlpClient`.
|
|
645
|
+
*
|
|
646
|
+
* Use this for pure one-shot consumers (publish-and-forget writes). When the
|
|
647
|
+
* client needs a duplex session — to receive server-initiated packets or to act
|
|
648
|
+
* as a peer — call {@link upgradeToBtp} to obtain a connected BtpRuntimeClient
|
|
649
|
+
* that reuses the existing BTP code path.
|
|
650
|
+
*/
|
|
651
|
+
declare class HttpIlpClient implements IlpClient {
|
|
652
|
+
private readonly httpEndpoint;
|
|
653
|
+
private readonly peerId;
|
|
654
|
+
private readonly authToken;
|
|
655
|
+
private readonly timeout;
|
|
656
|
+
private readonly retryConfig;
|
|
657
|
+
private readonly httpClient;
|
|
658
|
+
private readonly createWebSocket;
|
|
659
|
+
constructor(config: HttpIlpClientConfig);
|
|
660
|
+
/**
|
|
661
|
+
* Send an ILP PREPARE via `POST /ilp` WITHOUT a claim. The connector accepts
|
|
662
|
+
* this only on free/zero-amount routes; paid writes must use
|
|
663
|
+
* {@link sendIlpPacketWithClaim}. Satisfies the IlpClient interface.
|
|
664
|
+
*/
|
|
665
|
+
sendIlpPacket(params: {
|
|
666
|
+
destination: string;
|
|
667
|
+
amount: string;
|
|
668
|
+
data: string;
|
|
669
|
+
timeout?: number;
|
|
670
|
+
}): Promise<IlpSendResult>;
|
|
671
|
+
/**
|
|
672
|
+
* Send an ILP PREPARE via `POST /ilp` with the payment-channel claim attached
|
|
673
|
+
* as the `ILP-Payment-Channel-Claim` header. `claim` is the SAME JSON object
|
|
674
|
+
* the BTP path attaches as the `payment-channel-claim` protocolData entry —
|
|
675
|
+
* we base64(JSON.stringify(claim)) it, byte-for-byte identical to BTP.
|
|
676
|
+
*/
|
|
677
|
+
sendIlpPacketWithClaim(params: {
|
|
678
|
+
destination: string;
|
|
679
|
+
amount: string;
|
|
680
|
+
data: string;
|
|
681
|
+
timeout?: number;
|
|
682
|
+
}, claim: unknown): Promise<IlpSendResult>;
|
|
683
|
+
/**
|
|
684
|
+
* Upgrade to a duplex BTP session over the SAME endpoint.
|
|
685
|
+
*
|
|
686
|
+
* Derives the `ws(s)://` URL from `httpEndpoint`, opens a WebSocket with
|
|
687
|
+
* `Sec-WebSocket-Protocol: btp` and the same `ILP-Peer-Id` + `Authorization`
|
|
688
|
+
* headers, and returns a connected {@link BtpRuntimeClient}. When auth headers
|
|
689
|
+
* are present the connector pre-authenticates the session (no in-band auth
|
|
690
|
+
* frame); without them the BtpRuntimeClient falls back to the normal BTP
|
|
691
|
+
* auth-frame flow.
|
|
692
|
+
*
|
|
693
|
+
* NOTE: passing per-connection headers + a subprotocol to a WebSocket is
|
|
694
|
+
* Node-only (the `ws` package). Browsers cannot set arbitrary request headers
|
|
695
|
+
* on a WebSocket handshake, so a browser consumer must use the gateway
|
|
696
|
+
* transport or BTP-with-auth-frame instead.
|
|
697
|
+
*/
|
|
698
|
+
upgradeToBtp(): Promise<BtpRuntimeClient>;
|
|
699
|
+
private authHeaders;
|
|
700
|
+
/**
|
|
701
|
+
* Single attempt: serialize the PREPARE, POST it, and map the response.
|
|
702
|
+
* @throws {NetworkError} On connection/timeout failures (retried).
|
|
703
|
+
* @throws {ConnectorError} On non-retryable transport errors (5xx / unexpected).
|
|
704
|
+
*/
|
|
705
|
+
private postPrepare;
|
|
706
|
+
/**
|
|
707
|
+
* Map a `200 OK` body (OER FULFILL/REJECT) to an IlpSendResult; map a non-2xx
|
|
708
|
+
* to a transport error. Per the wire contract, ILP-level rejects arrive as a
|
|
709
|
+
* 200 + REJECT body — only HTTP non-2xx means a transport-layer failure.
|
|
710
|
+
*/
|
|
711
|
+
private mapResponse;
|
|
712
|
+
private mapTransportError;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Derive the BTP WebSocket URL from a `POST /ilp` HTTP endpoint. The connector
|
|
716
|
+
* serves BTP on the SAME path, so we only swap the scheme (http→ws, https→wss).
|
|
717
|
+
*/
|
|
718
|
+
declare function httpEndpointToBtpUrl(httpEndpoint: string): string;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Payment-aware HTTP fetch over TOON (the "h402" flow).
|
|
722
|
+
*
|
|
723
|
+
* This adapter makes paying for an HTTP resource transparent: it issues an
|
|
724
|
+
* ordinary HTTP request, and when the origin answers `402 Payment Required`
|
|
725
|
+
* with an x402-style challenge that offers a `toon-channel` payment option, it
|
|
726
|
+
* opens/reuses a payment channel, signs a balance-proof claim, and re-sends the
|
|
727
|
+
* SAME HTTP request as a "transparent HTTP-in-ILP" packet to the connector's
|
|
728
|
+
* `POST /ilp` endpoint (via {@link HttpIlpClient}). The connector terminates the
|
|
729
|
+
* payment, forwards the request to the origin, and returns the origin's HTTP
|
|
730
|
+
* response inside the ILP FULFILL `data`. We reconstruct a normal Web `Response`
|
|
731
|
+
* from those bytes — the caller never sees ILP.
|
|
732
|
+
*
|
|
733
|
+
* ─── x402 wire contract (the 402 challenge body) ────────────────────────────
|
|
734
|
+
* The connector side (the 402 greeting + the `accepts` entries) is a separate,
|
|
735
|
+
* NOT-YET-BUILT dependency, so we parse DEFENSIVELY (mirroring
|
|
736
|
+
* `readDiscoveredIlpPeer` in selectIlpTransport.ts): a slightly different
|
|
737
|
+
* connector shape should degrade gracefully (fall back to the vanilla 402)
|
|
738
|
+
* rather than throw.
|
|
739
|
+
*
|
|
740
|
+
* Expected 402 JSON body (x402 v1-ish):
|
|
741
|
+
* ```jsonc
|
|
742
|
+
* {
|
|
743
|
+
* "x402Version": 1,
|
|
744
|
+
* "accepts": [
|
|
745
|
+
* {
|
|
746
|
+
* "scheme": "toon-channel", // REQUIRED — selects the TOON option.
|
|
747
|
+
* "network": "evm:base:8453", // optional — chain key (informational).
|
|
748
|
+
* "destination": "g.toon.apex", // ILP destination address to pay (the
|
|
749
|
+
* // connector route that fronts the URL).
|
|
750
|
+
* "amount": "1000", // price in ILP base units (string|number).
|
|
751
|
+
* "httpEndpoint": "https://apex/ilp", // the connector's POST /ilp URL.
|
|
752
|
+
* "supportsUpgrade": true // optional — host accepts the BTP upgrade.
|
|
753
|
+
* }
|
|
754
|
+
* ]
|
|
755
|
+
* }
|
|
756
|
+
* ```
|
|
757
|
+
*
|
|
758
|
+
* Field aliases read defensively (first present wins):
|
|
759
|
+
* - destination: `destination` | `ilpAddress` | `payTo` | `maxAmountRequired`'s
|
|
760
|
+
* sibling `payTo`. (We do NOT invent a value — a missing destination makes
|
|
761
|
+
* the entry unusable and we fall back to the vanilla 402.)
|
|
762
|
+
* - amount: `amount` | `price` | `maxAmountRequired`.
|
|
763
|
+
* - httpEndpoint:`httpEndpoint` | `ilpEndpoint` | `endpoint`.
|
|
764
|
+
* - upgrade: `supportsUpgrade` | `upgradable`.
|
|
765
|
+
*
|
|
766
|
+
* ─── HTTP-in-ILP framing ────────────────────────────────────────────────────
|
|
767
|
+
* The raw HTTP request/response is serialized as minimal HTTP/1.1 wire bytes
|
|
768
|
+
* (request-line / status-line + headers + CRLFCRLF + body) and carried as the
|
|
769
|
+
* ILP packet `data` (base64). See {@link serializeHttpRequest} /
|
|
770
|
+
* {@link parseHttpResponse}. This keeps the connector free to forward the bytes
|
|
771
|
+
* verbatim and lets us rebuild a standard `Response`.
|
|
772
|
+
*
|
|
773
|
+
* Claim signing/construction is owned by the CALLER (ToonClient wires the live
|
|
774
|
+
* ChannelManager + signer). This adapter never builds or validates claims —
|
|
775
|
+
* payment-claim validation lives ONLY in the connector.
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
/** A single parsed `accepts` entry that offers the `toon-channel` scheme. */
|
|
779
|
+
interface ToonChannelAccept {
|
|
780
|
+
/** Always `'toon-channel'` for a matched entry. */
|
|
781
|
+
scheme: 'toon-channel';
|
|
782
|
+
/** Optional chain key, e.g. `evm:base:8453` — informational. */
|
|
783
|
+
network?: string;
|
|
784
|
+
/** ILP destination address to pay (the connector route fronting the URL). */
|
|
785
|
+
destination: string;
|
|
786
|
+
/** Price in ILP base units. */
|
|
787
|
+
amount: bigint;
|
|
788
|
+
/** The connector's `POST /ilp` URL. */
|
|
789
|
+
httpEndpoint: string;
|
|
790
|
+
/** Whether the host accepts the BTP upgrade over the HTTP endpoint. */
|
|
791
|
+
supportsUpgrade: boolean;
|
|
792
|
+
}
|
|
793
|
+
/** The parsed x402 402 body, with the selected `toon-channel` entry (if any). */
|
|
794
|
+
interface ParsedX402Challenge {
|
|
795
|
+
x402Version?: number;
|
|
796
|
+
/** The first usable `toon-channel` accepts entry, or `undefined`. */
|
|
797
|
+
toonChannel?: ToonChannelAccept;
|
|
798
|
+
}
|
|
799
|
+
/** Options for {@link Http402Client.fetch} / `ToonClient.h402Fetch`. */
|
|
800
|
+
interface H402FetchOptions {
|
|
801
|
+
/** HTTP method. Default `'GET'`. */
|
|
802
|
+
method?: string;
|
|
803
|
+
/** Request headers. */
|
|
804
|
+
headers?: Record<string, string>;
|
|
805
|
+
/** Request body. */
|
|
806
|
+
body?: string | Uint8Array;
|
|
807
|
+
/** Request timeout in milliseconds. */
|
|
808
|
+
timeout?: number;
|
|
809
|
+
/** Optional explicit ILP destination override (else the x402 entry's value). */
|
|
810
|
+
destination?: string;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Caller-supplied hook that signs a balance-proof claim for `(destination,
|
|
814
|
+
* amount)` and returns the chain-appropriate claim message to attach to the ILP
|
|
815
|
+
* PREPARE. ToonClient wires this to its ChannelManager + per-chain signer (the
|
|
816
|
+
* exact same plumbing as `publishEvent`). The returned value is forwarded
|
|
817
|
+
* opaquely as the `ILP-Payment-Channel-Claim` header by {@link HttpIlpClient}.
|
|
818
|
+
*/
|
|
819
|
+
type ClaimResolver = (destination: string, amount: bigint) => Promise<unknown>;
|
|
820
|
+
/** Factory for an {@link HttpIlpClient} given a resolved `POST /ilp` endpoint. */
|
|
821
|
+
type HttpIlpClientFactory = (httpEndpoint: string) => HttpIlpClient;
|
|
822
|
+
interface Http402ClientConfig {
|
|
823
|
+
/**
|
|
824
|
+
* Underlying HTTP fetch for the INITIAL (un-paid) request that probes for a
|
|
825
|
+
* 402. Default: global `fetch`.
|
|
826
|
+
*/
|
|
827
|
+
fetch?: typeof fetch;
|
|
828
|
+
/**
|
|
829
|
+
* Resolves + signs the payment-channel claim. REQUIRED to pay; if omitted,
|
|
830
|
+
* a 402 with a `toon-channel` offer is surfaced unchanged (vanilla challenge).
|
|
831
|
+
*/
|
|
832
|
+
resolveClaim?: ClaimResolver;
|
|
833
|
+
/**
|
|
834
|
+
* Builds the {@link HttpIlpClient} for a resolved endpoint. Default: construct
|
|
835
|
+
* a new `HttpIlpClient({ httpEndpoint })`. Injectable for tests / SOCKS5.
|
|
836
|
+
*/
|
|
837
|
+
createIlpClient?: HttpIlpClientFactory;
|
|
838
|
+
/**
|
|
839
|
+
* AC4: request a duplex transport for the paid send. When `true` and the
|
|
840
|
+
* toon-channel entry advertises `supportsUpgrade`, {@link selectIlpTransport}
|
|
841
|
+
* returns `http-upgradable` and the send path calls
|
|
842
|
+
* {@link HttpIlpClient.upgradeToBtp} before writing — the wiring for
|
|
843
|
+
* large/streaming responses. Default `false` (stateless one-shot HTTP).
|
|
844
|
+
*
|
|
845
|
+
* NOTE (v1 limitation): even on the upgrade path the actual write is still a
|
|
846
|
+
* one-shot `sendIlpPacketWithClaim`; full duplex body streaming over the BTP
|
|
847
|
+
* session is a documented follow-up. The selection + upgrade CALL PATH is
|
|
848
|
+
* wired and exercised here so the streaming consumer can take over the
|
|
849
|
+
* returned session in a later iteration.
|
|
850
|
+
*/
|
|
851
|
+
needsDuplex?: boolean;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Reusable h402 fetch engine. `ToonClient.h402Fetch` is a thin wrapper that
|
|
855
|
+
* constructs this with the live claim/channel plumbing.
|
|
856
|
+
*/
|
|
857
|
+
declare class Http402Client {
|
|
858
|
+
private readonly fetchImpl;
|
|
859
|
+
private readonly resolveClaim?;
|
|
860
|
+
private readonly createIlpClient;
|
|
861
|
+
private readonly needsDuplex;
|
|
862
|
+
constructor(config?: Http402ClientConfig);
|
|
863
|
+
/**
|
|
864
|
+
* `fetch()`-like entry point. Issues the request; on `402` parses the x402
|
|
865
|
+
* challenge and — when a usable `toon-channel` offer is present and a claim
|
|
866
|
+
* resolver is configured — pays over TOON and returns the reconstructed
|
|
867
|
+
* `Response`. Otherwise returns the original 402 unchanged (AC5).
|
|
868
|
+
*/
|
|
869
|
+
fetch(url: string, opts?: H402FetchOptions): Promise<Response>;
|
|
870
|
+
/**
|
|
871
|
+
* Open/reuse a channel (via the injected claim resolver), serialize the HTTP
|
|
872
|
+
* request into the ILP packet `data`, send it to `POST /ilp` with the claim,
|
|
873
|
+
* and reconstruct the origin `Response` from the FULFILL `data`.
|
|
874
|
+
*/
|
|
875
|
+
private payOverToon;
|
|
876
|
+
/**
|
|
877
|
+
* Send the serialized HTTP-in-ILP PREPARE over the selected transport.
|
|
878
|
+
*
|
|
879
|
+
* - `http` / `http-upgradable`: stateless one-shot `POST /ilp` with the claim.
|
|
880
|
+
* - `http-upgradable` additionally exercises {@link HttpIlpClient.upgradeToBtp}
|
|
881
|
+
* for the duplex/streaming path (AC4). v1 still drives the actual write over
|
|
882
|
+
* the one-shot HTTP method even after upgrading — full duplex body streaming
|
|
883
|
+
* is a documented follow-up — but the upgrade call path is wired here.
|
|
884
|
+
* - `btp`: not reachable from h402 (the x402 offer only carries an
|
|
885
|
+
* `httpEndpoint`); guarded for completeness.
|
|
886
|
+
*/
|
|
887
|
+
private sendOverChoice;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Parse a 402 `Response` body into a {@link ParsedX402Challenge}, selecting the
|
|
891
|
+
* first usable `toon-channel` entry. Reads every field defensively; a malformed
|
|
892
|
+
* body, a non-JSON body, or an entry missing its `destination`/`httpEndpoint`
|
|
893
|
+
* yields `{ toonChannel: undefined }` so the caller falls back to the vanilla
|
|
894
|
+
* 402 rather than throwing.
|
|
895
|
+
*/
|
|
896
|
+
declare function parseX402Challenge(response: Response): Promise<ParsedX402Challenge>;
|
|
897
|
+
/** Pure parser over an already-decoded x402 body (testable without a Response). */
|
|
898
|
+
declare function parseX402Body(body: unknown): ParsedX402Challenge;
|
|
899
|
+
/**
|
|
900
|
+
* Serialize a raw HTTP request to HTTP/1.1 wire bytes:
|
|
901
|
+
* `METHOD path HTTP/1.1\r\n` + `Host:` + headers + `\r\n\r\n` + body.
|
|
902
|
+
*
|
|
903
|
+
* The request-line target is the URL's path+query (origin-form); we add a
|
|
904
|
+
* `Host` header from the URL authority and a `Content-Length` when there's a
|
|
905
|
+
* body, unless the caller already supplied them. Header names are matched
|
|
906
|
+
* case-insensitively so we never duplicate `Host`/`Content-Length`.
|
|
907
|
+
*/
|
|
908
|
+
declare function serializeHttpRequest(req: {
|
|
909
|
+
method: string;
|
|
910
|
+
url: string;
|
|
911
|
+
headers?: Record<string, string>;
|
|
912
|
+
body?: string | Uint8Array;
|
|
913
|
+
}): Uint8Array;
|
|
914
|
+
/**
|
|
915
|
+
* Parse HTTP/1.1 wire bytes (status-line + headers + CRLFCRLF + body) into a
|
|
916
|
+
* standard Web `Response`. Used to reconstruct the origin response from the ILP
|
|
917
|
+
* FULFILL `data`.
|
|
918
|
+
*
|
|
919
|
+
* @throws {ConnectorError} If the bytes are not a parseable HTTP/1.1 response.
|
|
920
|
+
*/
|
|
921
|
+
declare function parseHttpResponse(bytes: Uint8Array): Response;
|
|
922
|
+
|
|
512
923
|
/**
|
|
513
924
|
* ToonClient - High-level client for interacting with TOON network.
|
|
514
925
|
*
|
|
@@ -668,6 +1079,33 @@ declare class ToonClient {
|
|
|
668
1079
|
claim?: SignedBalanceProof;
|
|
669
1080
|
ilpAmount?: bigint;
|
|
670
1081
|
}): Promise<PublishEventResult>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Payment-aware HTTP fetch over TOON (issue #50). A `fetch()`-like method that
|
|
1084
|
+
* makes paying for an HTTP resource transparent:
|
|
1085
|
+
*
|
|
1086
|
+
* 1. Issues the HTTP request to `url`.
|
|
1087
|
+
* 2. On `402`, parses the x402 `accepts` array and selects the
|
|
1088
|
+
* `toon-channel` entry (see {@link Http402Client} for the wire shape).
|
|
1089
|
+
* 3. Opens/reuses a payment channel for the entry's ILP destination (via
|
|
1090
|
+
* ChannelManager), signs a balance proof for the demanded price, and
|
|
1091
|
+
* re-sends the SAME HTTP request as a transparent HTTP-in-ILP packet to
|
|
1092
|
+
* the connector's `POST /ilp` (via {@link HttpIlpClient}), with the claim
|
|
1093
|
+
* in the `ILP-Payment-Channel-Claim` header.
|
|
1094
|
+
* 4. Reconstructs and returns a standard Web `Response` from the FULFILL
|
|
1095
|
+
* `data`. The caller never sees ILP.
|
|
1096
|
+
*
|
|
1097
|
+
* If the origin offers no `toon-channel` entry, the original `402` Response is
|
|
1098
|
+
* returned unchanged (the caller sees the vanilla x402 challenge).
|
|
1099
|
+
*
|
|
1100
|
+
* The channel/claim plumbing is wired to the live ChannelManager + per-chain
|
|
1101
|
+
* signer via `resolveClaimForDestination` — identical to `publishEvent`. The
|
|
1102
|
+
* `amount` paid comes from the selected x402 entry (the resource's price).
|
|
1103
|
+
*
|
|
1104
|
+
* @throws {ToonClientError} If the client is not started.
|
|
1105
|
+
* @throws {ConnectorError} If the connector rejects the payment or returns no
|
|
1106
|
+
* HTTP payload.
|
|
1107
|
+
*/
|
|
1108
|
+
h402Fetch(url: string, opts?: H402FetchOptions): Promise<Response>;
|
|
671
1109
|
/**
|
|
672
1110
|
* Sends a raw swap ILP packet (Story 12.5) to a Mill peer with an attached
|
|
673
1111
|
* balance-proof claim. This is a lower-level surface than `publishEvent`:
|
|
@@ -1183,214 +1621,6 @@ declare class HttpConnectorAdmin implements ConnectorAdminClient {
|
|
|
1183
1621
|
private handleErrorResponse;
|
|
1184
1622
|
}
|
|
1185
1623
|
|
|
1186
|
-
interface BtpRuntimeClientConfig {
|
|
1187
|
-
btpUrl: string;
|
|
1188
|
-
peerId: string;
|
|
1189
|
-
authToken: string;
|
|
1190
|
-
/** Max reconnection attempts on send failure (default: 3) */
|
|
1191
|
-
maxRetries?: number;
|
|
1192
|
-
/** Delay between reconnection attempts in ms (default: 1000) */
|
|
1193
|
-
retryDelay?: number;
|
|
1194
|
-
/** Custom WebSocket constructor (for SOCKS5 proxy support). */
|
|
1195
|
-
createWebSocket?: (url: string) => WebSocket;
|
|
1196
|
-
}
|
|
1197
|
-
/**
|
|
1198
|
-
* BTP transport implementing IlpClient.
|
|
1199
|
-
* Uses IsomorphicBtpClient (browser-native, no Node.js dependencies).
|
|
1200
|
-
*/
|
|
1201
|
-
declare class BtpRuntimeClient implements IlpClient {
|
|
1202
|
-
private btpClient;
|
|
1203
|
-
private readonly config;
|
|
1204
|
-
private _isConnected;
|
|
1205
|
-
constructor(config: BtpRuntimeClientConfig);
|
|
1206
|
-
/**
|
|
1207
|
-
* Connects to the BTP peer via WebSocket.
|
|
1208
|
-
*/
|
|
1209
|
-
connect(): Promise<void>;
|
|
1210
|
-
/**
|
|
1211
|
-
* Attempts to reconnect by creating a fresh client and connecting.
|
|
1212
|
-
*/
|
|
1213
|
-
reconnect(): Promise<void>;
|
|
1214
|
-
/**
|
|
1215
|
-
* Disconnects from the BTP peer.
|
|
1216
|
-
*/
|
|
1217
|
-
disconnect(): Promise<void>;
|
|
1218
|
-
get isConnected(): boolean;
|
|
1219
|
-
/**
|
|
1220
|
-
* Sends an ILP packet via BTP with auto-reconnect on connection errors.
|
|
1221
|
-
* Satisfies IlpClient interface.
|
|
1222
|
-
*/
|
|
1223
|
-
sendIlpPacket(params: {
|
|
1224
|
-
destination: string;
|
|
1225
|
-
amount: string;
|
|
1226
|
-
data: string;
|
|
1227
|
-
timeout?: number;
|
|
1228
|
-
}): Promise<IlpSendResult>;
|
|
1229
|
-
/**
|
|
1230
|
-
* Sends a balance proof claim via BTP protocol data, then sends an ILP packet.
|
|
1231
|
-
* Auto-reconnects on connection errors.
|
|
1232
|
-
*/
|
|
1233
|
-
sendIlpPacketWithClaim(params: {
|
|
1234
|
-
destination: string;
|
|
1235
|
-
amount: string;
|
|
1236
|
-
data: string;
|
|
1237
|
-
timeout?: number;
|
|
1238
|
-
}, claim: Record<string, unknown>): Promise<IlpSendResult>;
|
|
1239
|
-
/**
|
|
1240
|
-
* Send a standalone `payment-channel-claim` BTP MESSAGE (no ILP packet
|
|
1241
|
-
* attached). The connector's ClaimReceiver consumes this fire-and-forget
|
|
1242
|
-
* to register cumulative claim state independently of the per-packet
|
|
1243
|
-
* forwarding path. Auto-reconnects on connection errors.
|
|
1244
|
-
*/
|
|
1245
|
-
sendClaimMessage(claim: Record<string, unknown>): Promise<void>;
|
|
1246
|
-
private _sendClaimMessageOnce;
|
|
1247
|
-
/**
|
|
1248
|
-
* Single-attempt ILP packet send. Reconnects if not connected.
|
|
1249
|
-
*/
|
|
1250
|
-
private _sendIlpPacketOnce;
|
|
1251
|
-
/**
|
|
1252
|
-
* Single-attempt claim + ILP packet send. Reconnects if not connected.
|
|
1253
|
-
*/
|
|
1254
|
-
private _sendIlpPacketWithClaimOnce;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* ILP-over-HTTP (RFC-0035) transport for the TOON client.
|
|
1259
|
-
*
|
|
1260
|
-
* The connector now serves ILP-over-HTTP on the SAME port as BTP (connector
|
|
1261
|
-
* PR #181). This adapter lets a client do stateless one-shot writes over HTTP
|
|
1262
|
-
* (`POST /ilp`) and upgrade to a duplex BTP session when it needs to receive
|
|
1263
|
-
* server-initiated packets or act as a peer.
|
|
1264
|
-
*
|
|
1265
|
-
* Wire contract (targets connector PR #181's `/ilp`):
|
|
1266
|
-
* - One-shot write: `POST /ilp`
|
|
1267
|
-
* body: OER-encoded ILP PREPARE (`application/octet-stream`)
|
|
1268
|
-
* header: `ILP-Payment-Channel-Claim: base64(JSON of the claim)` — the
|
|
1269
|
-
* SAME claim JSON the BTP path attaches as the
|
|
1270
|
-
* `payment-channel-claim` protocolData entry.
|
|
1271
|
-
* optional: `ILP-Peer-Id` + `Authorization: Bearer <secret>` identity.
|
|
1272
|
-
* response: `200 OK` with an OER FULFILL or REJECT body. HTTP non-2xx is
|
|
1273
|
-
* reserved for TRANSPORT errors (400/401/413/5xx); ILP-level
|
|
1274
|
-
* rejects come back as a 200 + REJECT body.
|
|
1275
|
-
* - Upgrade to BTP: standard HTTP `Upgrade` with `Sec-WebSocket-Protocol: btp`
|
|
1276
|
-
* plus the same `ILP-Peer-Id` + `Authorization` headers. The connector
|
|
1277
|
-
* pre-authenticates the BTP session from those headers (continuity), so
|
|
1278
|
-
* after `101` we send BTP frames WITHOUT a separate in-band auth frame.
|
|
1279
|
-
* Omitting the auth headers falls back to the normal BTP auth-frame flow.
|
|
1280
|
-
*
|
|
1281
|
-
* Reuses `serializeIlpPrepare`/`deserializeIlpPacket` from `btp/protocol.ts` —
|
|
1282
|
-
* the SAME OER codec the BTP path uses. Claim signing/construction is owned by
|
|
1283
|
-
* the caller (BootstrapService); this transport never builds or signs claims.
|
|
1284
|
-
*/
|
|
1285
|
-
|
|
1286
|
-
/** Header carrying the base64(JSON) payment-channel claim. */
|
|
1287
|
-
declare const ILP_CLAIM_HEADER = "ILP-Payment-Channel-Claim";
|
|
1288
|
-
/** Header carrying a NIP-59 wrapped (gift-wrapped) claim. */
|
|
1289
|
-
declare const ILP_CLAIM_WRAPPED_HEADER = "ILP-Payment-Channel-Claim-Wrapped";
|
|
1290
|
-
/** Header carrying the peer identity. */
|
|
1291
|
-
declare const ILP_PEER_ID_HEADER = "ILP-Peer-Id";
|
|
1292
|
-
interface HttpIlpClientConfig {
|
|
1293
|
-
/** The peer's `POST /ilp` URL (the `httpEndpoint` from discovery). */
|
|
1294
|
-
httpEndpoint: string;
|
|
1295
|
-
/**
|
|
1296
|
-
* Optional peer identity. With no `peerId`/`authToken` the connector treats
|
|
1297
|
-
* the request as an anonymous no-auth peer (permissionless default) and
|
|
1298
|
-
* derives an ephemeral id from the claim signer.
|
|
1299
|
-
*/
|
|
1300
|
-
peerId?: string;
|
|
1301
|
-
/** Bearer secret for `Authorization`. Omit for the no-auth peer path. */
|
|
1302
|
-
authToken?: string;
|
|
1303
|
-
/** Request timeout in milliseconds (default: 30000). */
|
|
1304
|
-
timeout?: number;
|
|
1305
|
-
/** Max retry attempts for transport-level network failures (default: 3). */
|
|
1306
|
-
maxRetries?: number;
|
|
1307
|
-
/** Initial retry delay in milliseconds (default: 1000). */
|
|
1308
|
-
retryDelay?: number;
|
|
1309
|
-
/** Custom fetch implementation (SOCKS5 mode / testing). */
|
|
1310
|
-
httpClient?: typeof fetch;
|
|
1311
|
-
/**
|
|
1312
|
-
* Custom WebSocket constructor for the BTP upgrade path (SOCKS5 mode).
|
|
1313
|
-
* Forwarded to the underlying BtpRuntimeClient.
|
|
1314
|
-
*/
|
|
1315
|
-
createWebSocket?: (url: string) => WebSocket;
|
|
1316
|
-
}
|
|
1317
|
-
/**
|
|
1318
|
-
* Stateless ILP-over-HTTP transport implementing `IlpClient`.
|
|
1319
|
-
*
|
|
1320
|
-
* Use this for pure one-shot consumers (publish-and-forget writes). When the
|
|
1321
|
-
* client needs a duplex session — to receive server-initiated packets or to act
|
|
1322
|
-
* as a peer — call {@link upgradeToBtp} to obtain a connected BtpRuntimeClient
|
|
1323
|
-
* that reuses the existing BTP code path.
|
|
1324
|
-
*/
|
|
1325
|
-
declare class HttpIlpClient implements IlpClient {
|
|
1326
|
-
private readonly httpEndpoint;
|
|
1327
|
-
private readonly peerId;
|
|
1328
|
-
private readonly authToken;
|
|
1329
|
-
private readonly timeout;
|
|
1330
|
-
private readonly retryConfig;
|
|
1331
|
-
private readonly httpClient;
|
|
1332
|
-
private readonly createWebSocket;
|
|
1333
|
-
constructor(config: HttpIlpClientConfig);
|
|
1334
|
-
/**
|
|
1335
|
-
* Send an ILP PREPARE via `POST /ilp` WITHOUT a claim. The connector accepts
|
|
1336
|
-
* this only on free/zero-amount routes; paid writes must use
|
|
1337
|
-
* {@link sendIlpPacketWithClaim}. Satisfies the IlpClient interface.
|
|
1338
|
-
*/
|
|
1339
|
-
sendIlpPacket(params: {
|
|
1340
|
-
destination: string;
|
|
1341
|
-
amount: string;
|
|
1342
|
-
data: string;
|
|
1343
|
-
timeout?: number;
|
|
1344
|
-
}): Promise<IlpSendResult>;
|
|
1345
|
-
/**
|
|
1346
|
-
* Send an ILP PREPARE via `POST /ilp` with the payment-channel claim attached
|
|
1347
|
-
* as the `ILP-Payment-Channel-Claim` header. `claim` is the SAME JSON object
|
|
1348
|
-
* the BTP path attaches as the `payment-channel-claim` protocolData entry —
|
|
1349
|
-
* we base64(JSON.stringify(claim)) it, byte-for-byte identical to BTP.
|
|
1350
|
-
*/
|
|
1351
|
-
sendIlpPacketWithClaim(params: {
|
|
1352
|
-
destination: string;
|
|
1353
|
-
amount: string;
|
|
1354
|
-
data: string;
|
|
1355
|
-
timeout?: number;
|
|
1356
|
-
}, claim: unknown): Promise<IlpSendResult>;
|
|
1357
|
-
/**
|
|
1358
|
-
* Upgrade to a duplex BTP session over the SAME endpoint.
|
|
1359
|
-
*
|
|
1360
|
-
* Derives the `ws(s)://` URL from `httpEndpoint`, opens a WebSocket with
|
|
1361
|
-
* `Sec-WebSocket-Protocol: btp` and the same `ILP-Peer-Id` + `Authorization`
|
|
1362
|
-
* headers, and returns a connected {@link BtpRuntimeClient}. When auth headers
|
|
1363
|
-
* are present the connector pre-authenticates the session (no in-band auth
|
|
1364
|
-
* frame); without them the BtpRuntimeClient falls back to the normal BTP
|
|
1365
|
-
* auth-frame flow.
|
|
1366
|
-
*
|
|
1367
|
-
* NOTE: passing per-connection headers + a subprotocol to a WebSocket is
|
|
1368
|
-
* Node-only (the `ws` package). Browsers cannot set arbitrary request headers
|
|
1369
|
-
* on a WebSocket handshake, so a browser consumer must use the gateway
|
|
1370
|
-
* transport or BTP-with-auth-frame instead.
|
|
1371
|
-
*/
|
|
1372
|
-
upgradeToBtp(): Promise<BtpRuntimeClient>;
|
|
1373
|
-
private authHeaders;
|
|
1374
|
-
/**
|
|
1375
|
-
* Single attempt: serialize the PREPARE, POST it, and map the response.
|
|
1376
|
-
* @throws {NetworkError} On connection/timeout failures (retried).
|
|
1377
|
-
* @throws {ConnectorError} On non-retryable transport errors (5xx / unexpected).
|
|
1378
|
-
*/
|
|
1379
|
-
private postPrepare;
|
|
1380
|
-
/**
|
|
1381
|
-
* Map a `200 OK` body (OER FULFILL/REJECT) to an IlpSendResult; map a non-2xx
|
|
1382
|
-
* to a transport error. Per the wire contract, ILP-level rejects arrive as a
|
|
1383
|
-
* 200 + REJECT body — only HTTP non-2xx means a transport-layer failure.
|
|
1384
|
-
*/
|
|
1385
|
-
private mapResponse;
|
|
1386
|
-
private mapTransportError;
|
|
1387
|
-
}
|
|
1388
|
-
/**
|
|
1389
|
-
* Derive the BTP WebSocket URL from a `POST /ilp` HTTP endpoint. The connector
|
|
1390
|
-
* serves BTP on the SAME path, so we only swap the scheme (http→ws, https→wss).
|
|
1391
|
-
*/
|
|
1392
|
-
declare function httpEndpointToBtpUrl(httpEndpoint: string): string;
|
|
1393
|
-
|
|
1394
1624
|
/**
|
|
1395
1625
|
* Transport selection policy for the client ILP layer.
|
|
1396
1626
|
*
|
|
@@ -3077,4 +3307,4 @@ declare function loadKeystore(path: string, password: string): string;
|
|
|
3077
3307
|
*/
|
|
3078
3308
|
declare function writeKeystoreFile(path: string, keystore: EncryptedKeystore): void;
|
|
3079
3309
|
|
|
3080
|
-
export { ANON_ASSETS, ANON_VERSION, type AnonAsset, type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, type ChainMetadata, type ChainSigner, ChannelManager, type ClaimMessage, type ClientTransportConfig, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpConnectorAdmin, type HttpConnectorAdminConfig, HttpIlpClient, type HttpIlpClientConfig, HttpRuntimeClient, type HttpRuntimeClientConfig, ILP_CLAIM_HEADER, ILP_CLAIM_WRAPPED_HEADER, ILP_PEER_ID_HEADER, type IlpTransportChoice, type InteractionResultContent, KeyManager, type KeyManagerConfig, type ManagedAnonProxy, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type PasskeyInfo, type PetDvmProvider, type PetInteractionEventData, type PetInteractionRequestParams, type PetInteractionResultData, type PetListing, type PetListingFilterOptions, type PetListingParams, type PetPurchaseRequestParams, type ProofStatus, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type StartManagedAnonProxyOptions, type StatValues, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, type UnsignedNostrEvent, ValidationError, type VaultData, applyDefaults, applyNetworkPresets, assertRoutableHsHostname, buildBackupEvent, buildBackupFilter, buildPetInteractionRequest, buildPetListingEvent, buildPetPurchaseRequest, buildSettlementInfo, decryptMnemonic, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, filterPetDvmProviders, filterPetListings, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isPrfSupported, isRoutableHsHostname, loadKeystore, parseBackupPayload, parsePetInteractionEvent, parsePetInteractionResult, parsePetListing, readDiscoveredIlpPeer, readMinaDepositTotal, requestBlobStorage, selectAnonAsset, selectIlpTransport, startManagedAnonProxy, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
|
|
3310
|
+
export { ANON_ASSETS, ANON_VERSION, type AnonAsset, type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, type ChainMetadata, type ChainSigner, ChannelManager, type ClaimMessage, type ClaimResolver, type ClientTransportConfig, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, type H402FetchOptions, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, Http402Client, type Http402ClientConfig, HttpConnectorAdmin, type HttpConnectorAdminConfig, HttpIlpClient, type HttpIlpClientConfig, type HttpIlpClientFactory, HttpRuntimeClient, type HttpRuntimeClientConfig, ILP_CLAIM_HEADER, ILP_CLAIM_WRAPPED_HEADER, ILP_PEER_ID_HEADER, type IlpTransportChoice, type InteractionResultContent, KeyManager, type KeyManagerConfig, type ManagedAnonProxy, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type ParsedX402Challenge, type PasskeyInfo, type PetDvmProvider, type PetInteractionEventData, type PetInteractionRequestParams, type PetInteractionResultData, type PetListing, type PetListingFilterOptions, type PetListingParams, type PetPurchaseRequestParams, type ProofStatus, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type StartManagedAnonProxyOptions, type StatValues, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, type UnsignedNostrEvent, ValidationError, type VaultData, applyDefaults, applyNetworkPresets, assertRoutableHsHostname, buildBackupEvent, buildBackupFilter, buildPetInteractionRequest, buildPetListingEvent, buildPetPurchaseRequest, buildSettlementInfo, decryptMnemonic, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, filterPetDvmProviders, filterPetListings, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isPrfSupported, isRoutableHsHostname, loadKeystore, parseBackupPayload, parseHttpResponse, parsePetInteractionEvent, parsePetInteractionResult, parsePetListing, parseX402Body, parseX402Challenge, readDiscoveredIlpPeer, readMinaDepositTotal, requestBlobStorage, selectAnonAsset, selectIlpTransport, serializeHttpRequest, startManagedAnonProxy, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
|