@toon-protocol/client 0.15.0 → 0.17.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 +272 -26
- package/dist/index.js +352 -69
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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, IlpSendResult, IlpClient, NetworkFamilyStatus, ConnectorAdminClient, ConnectorChannelClient, OpenChannelParams, OpenChannelResult, ChannelState } from '@toon-protocol/core';
|
|
3
3
|
export { UI_RENDERER_KIND, UI_TAG, UiCoordinate, buildUiCoordinate, getUiCoordinate, parseUiCoordinate, selectLatestAddressable } from '@toon-protocol/core';
|
|
4
4
|
import { NostrEvent, EventTemplate } from 'nostr-tools/pure';
|
|
5
5
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
@@ -15,6 +15,108 @@ interface WalletBalance {
|
|
|
15
15
|
/** Token decimals, when resolved. */
|
|
16
16
|
assetScale?: number;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* One asset amount within a chain's wallet view — the native coin or one token.
|
|
20
|
+
* `amount` is a base-unit integer, decimal string.
|
|
21
|
+
*/
|
|
22
|
+
interface WalletTokenAmount {
|
|
23
|
+
/** Asset symbol (e.g. `'ETH'`, `'SOL'`, `'MINA'`, `'USDC'`), when known. */
|
|
24
|
+
symbol?: string;
|
|
25
|
+
/** Base-unit integer, decimal string. */
|
|
26
|
+
amount: string;
|
|
27
|
+
/** Decimals for formatting (ETH 18, SOL 9, MINA 9, USDC 6). */
|
|
28
|
+
decimals?: number;
|
|
29
|
+
/** Token contract / SPL mint address. Absent for the native coin. */
|
|
30
|
+
address?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The full wallet view for ONE chain the identity is configured for: the native
|
|
34
|
+
* coin plus every configured token, keyed by the chain's full key (e.g.
|
|
35
|
+
* `'evm:31337'`). `unreadable` marks a chain whose RPC could not be reached at
|
|
36
|
+
* all — the caller renders a per-chain notice rather than crashing.
|
|
37
|
+
*/
|
|
38
|
+
interface WalletChainBalances {
|
|
39
|
+
chain: 'evm' | 'solana' | 'mina';
|
|
40
|
+
/** Full chain key, e.g. `'evm:31337'`, `'solana'`, `'mina'`. */
|
|
41
|
+
chainKey: string;
|
|
42
|
+
address: string;
|
|
43
|
+
/** Native-coin balance, when readable. */
|
|
44
|
+
native?: WalletTokenAmount;
|
|
45
|
+
/** Configured token balances (e.g. USDC), each best-effort. */
|
|
46
|
+
tokens: WalletTokenAmount[];
|
|
47
|
+
/** True when nothing on this chain could be read (RPC unreachable). */
|
|
48
|
+
unreadable?: boolean;
|
|
49
|
+
/** First read error, when any read failed (for diagnostics). */
|
|
50
|
+
error?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Read an ERC-20 token balance (balance + decimals + symbol) for `owner`. */
|
|
53
|
+
declare function readEvmTokenBalance(opts: {
|
|
54
|
+
rpcUrl: string;
|
|
55
|
+
chainKey: string;
|
|
56
|
+
tokenAddress: string;
|
|
57
|
+
owner: string;
|
|
58
|
+
}): Promise<WalletBalance>;
|
|
59
|
+
/** Read the native ETH balance (wei) for `owner` via `eth_getBalance`. */
|
|
60
|
+
declare function readEvmNativeBalance(opts: {
|
|
61
|
+
rpcUrl: string;
|
|
62
|
+
chainKey: string;
|
|
63
|
+
owner: string;
|
|
64
|
+
}): Promise<WalletTokenAmount>;
|
|
65
|
+
/** Read the native SOL balance (lamports) for `owner` via the `getBalance` RPC. */
|
|
66
|
+
declare function readSolanaNativeBalance(opts: {
|
|
67
|
+
rpcUrl: string;
|
|
68
|
+
owner: string;
|
|
69
|
+
fetchImpl?: typeof fetch;
|
|
70
|
+
}): Promise<WalletTokenAmount>;
|
|
71
|
+
/** Read the SPL-token balance for `owner`'s token account(s) of `mint`. */
|
|
72
|
+
declare function readSolanaTokenBalance(opts: {
|
|
73
|
+
rpcUrl: string;
|
|
74
|
+
mint: string;
|
|
75
|
+
owner: string;
|
|
76
|
+
fetchImpl?: typeof fetch;
|
|
77
|
+
}): Promise<WalletBalance>;
|
|
78
|
+
/** Read the native MINA balance (nanomina) for `owner` via the Mina GraphQL API. */
|
|
79
|
+
declare function readMinaBalance(opts: {
|
|
80
|
+
graphqlUrl: string;
|
|
81
|
+
owner: string;
|
|
82
|
+
fetchImpl?: typeof fetch;
|
|
83
|
+
}): Promise<WalletBalance>;
|
|
84
|
+
/**
|
|
85
|
+
* Per-chain inputs for {@link readWalletBalances}: the resolved RPC URL, the
|
|
86
|
+
* identity's address on that chain, and the configured token (USDC) — sourced by
|
|
87
|
+
* the caller from the network topology / presets, never hardcoded here. A chain
|
|
88
|
+
* key absent from the object is simply not read.
|
|
89
|
+
*/
|
|
90
|
+
interface WalletBalanceSources {
|
|
91
|
+
evm?: {
|
|
92
|
+
chainKey: string;
|
|
93
|
+
rpcUrl: string;
|
|
94
|
+
owner: string;
|
|
95
|
+
tokenAddress?: string;
|
|
96
|
+
};
|
|
97
|
+
solana?: {
|
|
98
|
+
chainKey?: string;
|
|
99
|
+
rpcUrl: string;
|
|
100
|
+
owner: string;
|
|
101
|
+
tokenMint?: string;
|
|
102
|
+
};
|
|
103
|
+
mina?: {
|
|
104
|
+
chainKey?: string;
|
|
105
|
+
graphqlUrl: string;
|
|
106
|
+
owner: string;
|
|
107
|
+
};
|
|
108
|
+
/** Injectable fetch (Solana/Mina JSON-RPC & GraphQL) for tests. */
|
|
109
|
+
fetchImpl?: typeof fetch;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Read the full wallet view — native coin + configured tokens — for every chain
|
|
113
|
+
* in `sources`, keyed per chain. FREE: read-only RPC, no signing. Each chain is
|
|
114
|
+
* read independently and in parallel; a chain whose RPC is unreachable degrades
|
|
115
|
+
* to `{ unreadable: true, error }` instead of failing the others. Within a chain
|
|
116
|
+
* the native and token reads are independent, so a native read can succeed even
|
|
117
|
+
* if the token read fails (and vice versa).
|
|
118
|
+
*/
|
|
119
|
+
declare function readWalletBalances(sources: WalletBalanceSources): Promise<WalletChainBalances[]>;
|
|
18
120
|
|
|
19
121
|
/**
|
|
20
122
|
* Solana payment-channel parameters supplied via `ToonClientConfig.solanaChannel`.
|
|
@@ -538,6 +640,62 @@ declare function requestBlobStorage(client: ToonClient, secretKey: Uint8Array, p
|
|
|
538
640
|
*/
|
|
539
641
|
declare function extractArweaveTxId(base64Data: string): string;
|
|
540
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Shared sender-side plumbing for sender-chosen execution conditions
|
|
645
|
+
* (toon-client#350; contract: connector `docs/local-delivery-fulfillment-contract.md`,
|
|
646
|
+
* connector#309; spec: toon-meta `docs/rolling-swap.md` §3).
|
|
647
|
+
*
|
|
648
|
+
* Both ILP transports (HTTP `POST /ilp` and BTP) take the SAME extended send
|
|
649
|
+
* params and map FULFILL/REJECT responses through the SAME verifier so the
|
|
650
|
+
* two paths cannot drift:
|
|
651
|
+
*
|
|
652
|
+
* - absent/all-zero `executionCondition` → legacy class: today's behavior,
|
|
653
|
+
* byte-for-byte (zero condition on the wire, no FULFILL verification);
|
|
654
|
+
* - non-zero `executionCondition` → sender-chosen: the condition goes on
|
|
655
|
+
* the PREPARE verbatim and the FULFILL's 32-byte fulfillment MUST hash
|
|
656
|
+
* back to it — a missing/malformed/mismatching preimage is surfaced as a
|
|
657
|
+
* FAILED result (never a silent accept, never retried).
|
|
658
|
+
*/
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Send parameters accepted by both ILP transports. Extends the
|
|
662
|
+
* `@toon-protocol/core` `IlpClient` param shape with the sender-chosen
|
|
663
|
+
* condition and an explicit expiry — plain `IlpClient` callers keep working
|
|
664
|
+
* unchanged (both extras are optional; omitting them is the legacy path).
|
|
665
|
+
*/
|
|
666
|
+
interface IlpSendParams {
|
|
667
|
+
destination: string;
|
|
668
|
+
amount: string;
|
|
669
|
+
/** Base64 ILP `data` payload. */
|
|
670
|
+
data: string;
|
|
671
|
+
/** Transport timeout in ms; also the default expiry window. */
|
|
672
|
+
timeout?: number;
|
|
673
|
+
/**
|
|
674
|
+
* Sender-chosen 32-byte execution condition `C = sha256(P)` (spec R2).
|
|
675
|
+
* Absent or all-zero = legacy unverified packet (default — ordinary
|
|
676
|
+
* publish/upload writes MUST keep this default).
|
|
677
|
+
*/
|
|
678
|
+
executionCondition?: Uint8Array;
|
|
679
|
+
/**
|
|
680
|
+
* Explicit PREPARE `expiresAt` (spec R7). Defaults to `now + timeout`,
|
|
681
|
+
* preserving pre-#350 behavior.
|
|
682
|
+
*/
|
|
683
|
+
expiresAt?: Date;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* `IlpSendResult` plus the FULFILL preimage when a sender-chosen condition
|
|
687
|
+
* was verified. Only populated on the sender-chosen path so legacy result
|
|
688
|
+
* objects stay byte-identical.
|
|
689
|
+
*/
|
|
690
|
+
interface IlpSendResultWithFulfillment extends IlpSendResult {
|
|
691
|
+
/** Base64 32-byte fulfillment preimage (verified: sha256 == condition). */
|
|
692
|
+
fulfillment?: string;
|
|
693
|
+
}
|
|
694
|
+
/** ILP code used for a client-side fulfillment-verification failure. */
|
|
695
|
+
declare const FULFILLMENT_MISMATCH_CODE = "F99";
|
|
696
|
+
/** Message for a client-side fulfillment-verification failure. */
|
|
697
|
+
declare const FULFILLMENT_MISMATCH_MESSAGE: string;
|
|
698
|
+
|
|
541
699
|
interface BtpRuntimeClientConfig {
|
|
542
700
|
btpUrl: string;
|
|
543
701
|
peerId: string;
|
|
@@ -574,23 +732,22 @@ declare class BtpRuntimeClient implements IlpClient {
|
|
|
574
732
|
/**
|
|
575
733
|
* Sends an ILP packet via BTP with auto-reconnect on connection errors.
|
|
576
734
|
* Satisfies IlpClient interface.
|
|
735
|
+
*
|
|
736
|
+
* `params` may carry a sender-chosen `executionCondition` and an explicit
|
|
737
|
+
* `expiresAt` (toon-client#350); omitting both is the legacy zero-condition
|
|
738
|
+
* path, unchanged. With a non-zero condition the FULFILL preimage is
|
|
739
|
+
* verified (`sha256(fulfillment) == condition`) and a mismatch is surfaced
|
|
740
|
+
* as a failed result — see `mapIlpResponse`.
|
|
577
741
|
*/
|
|
578
|
-
sendIlpPacket(params:
|
|
579
|
-
destination: string;
|
|
580
|
-
amount: string;
|
|
581
|
-
data: string;
|
|
582
|
-
timeout?: number;
|
|
583
|
-
}): Promise<IlpSendResult>;
|
|
742
|
+
sendIlpPacket(params: IlpSendParams): Promise<IlpSendResult>;
|
|
584
743
|
/**
|
|
585
744
|
* Sends a balance proof claim via BTP protocol data, then sends an ILP packet.
|
|
586
745
|
* Auto-reconnects on connection errors.
|
|
746
|
+
*
|
|
747
|
+
* Sender-chosen `executionCondition` / explicit `expiresAt` semantics are
|
|
748
|
+
* identical to {@link sendIlpPacket}.
|
|
587
749
|
*/
|
|
588
|
-
sendIlpPacketWithClaim(params:
|
|
589
|
-
destination: string;
|
|
590
|
-
amount: string;
|
|
591
|
-
data: string;
|
|
592
|
-
timeout?: number;
|
|
593
|
-
}, claim: Record<string, unknown>): Promise<IlpSendResult>;
|
|
750
|
+
sendIlpPacketWithClaim(params: IlpSendParams, claim: Record<string, unknown>): Promise<IlpSendResult>;
|
|
594
751
|
/**
|
|
595
752
|
* Send a standalone `payment-channel-claim` BTP MESSAGE (no ILP packet
|
|
596
753
|
* attached). The connector's ClaimReceiver consumes this fire-and-forget
|
|
@@ -599,6 +756,14 @@ declare class BtpRuntimeClient implements IlpClient {
|
|
|
599
756
|
*/
|
|
600
757
|
sendClaimMessage(claim: Record<string, unknown>): Promise<void>;
|
|
601
758
|
private _sendClaimMessageOnce;
|
|
759
|
+
/**
|
|
760
|
+
* Build the ILP PREPARE for a send, applying the sender-chosen condition /
|
|
761
|
+
* explicit expiry when provided (toon-client#350) and validating that a
|
|
762
|
+
* non-zero condition is exactly 32 bytes (the OER serializer would
|
|
763
|
+
* otherwise silently zero-fill it, downgrading the packet to the legacy
|
|
764
|
+
* unverified class).
|
|
765
|
+
*/
|
|
766
|
+
private buildPrepare;
|
|
602
767
|
/**
|
|
603
768
|
* Single-attempt ILP packet send. Reconnects if not connected.
|
|
604
769
|
*/
|
|
@@ -690,25 +855,24 @@ declare class HttpIlpClient implements IlpClient {
|
|
|
690
855
|
* Send an ILP PREPARE via `POST /ilp` WITHOUT a claim. The connector accepts
|
|
691
856
|
* this only on free/zero-amount routes; paid writes must use
|
|
692
857
|
* {@link sendIlpPacketWithClaim}. Satisfies the IlpClient interface.
|
|
858
|
+
*
|
|
859
|
+
* `params` may carry a sender-chosen `executionCondition` and an explicit
|
|
860
|
+
* `expiresAt` (toon-client#350); omitting both is the legacy zero-condition
|
|
861
|
+
* path, unchanged. With a non-zero condition the FULFILL preimage is
|
|
862
|
+
* verified (`sha256(fulfillment) == condition`) and a mismatch is surfaced
|
|
863
|
+
* as a failed result — see {@link mapIlpResponse}.
|
|
693
864
|
*/
|
|
694
|
-
sendIlpPacket(params:
|
|
695
|
-
destination: string;
|
|
696
|
-
amount: string;
|
|
697
|
-
data: string;
|
|
698
|
-
timeout?: number;
|
|
699
|
-
}): Promise<IlpSendResult>;
|
|
865
|
+
sendIlpPacket(params: IlpSendParams): Promise<IlpSendResult>;
|
|
700
866
|
/**
|
|
701
867
|
* Send an ILP PREPARE via `POST /ilp` with the payment-channel claim attached
|
|
702
868
|
* as the `ILP-Payment-Channel-Claim` header. `claim` is the SAME JSON object
|
|
703
869
|
* the BTP path attaches as the `payment-channel-claim` protocolData entry —
|
|
704
870
|
* we base64(JSON.stringify(claim)) it, byte-for-byte identical to BTP.
|
|
871
|
+
*
|
|
872
|
+
* Sender-chosen `executionCondition` / explicit `expiresAt` semantics are
|
|
873
|
+
* identical to {@link sendIlpPacket}.
|
|
705
874
|
*/
|
|
706
|
-
sendIlpPacketWithClaim(params:
|
|
707
|
-
destination: string;
|
|
708
|
-
amount: string;
|
|
709
|
-
data: string;
|
|
710
|
-
timeout?: number;
|
|
711
|
-
}, claim: unknown): Promise<IlpSendResult>;
|
|
875
|
+
sendIlpPacketWithClaim(params: IlpSendParams, claim: unknown): Promise<IlpSendResult>;
|
|
712
876
|
/**
|
|
713
877
|
* Upgrade to a duplex BTP session over the SAME endpoint.
|
|
714
878
|
*
|
|
@@ -736,6 +900,10 @@ declare class HttpIlpClient implements IlpClient {
|
|
|
736
900
|
* Map a `200 OK` body (OER FULFILL/REJECT) to an IlpSendResult; map a non-2xx
|
|
737
901
|
* to a transport error. Per the wire contract, ILP-level rejects arrive as a
|
|
738
902
|
* 200 + REJECT body — only HTTP non-2xx means a transport-layer failure.
|
|
903
|
+
*
|
|
904
|
+
* When `sentCondition` is non-zero the FULFILL preimage is verified against
|
|
905
|
+
* it; a mismatch yields `accepted: false` (shared `mapIlpResponse` logic,
|
|
906
|
+
* identical to the BTP path).
|
|
739
907
|
*/
|
|
740
908
|
private mapResponse;
|
|
741
909
|
private mapTransportError;
|
|
@@ -1152,6 +1320,14 @@ declare class ToonClient {
|
|
|
1152
1320
|
* matching `destination`,
|
|
1153
1321
|
* (c) neither -> throw MISSING_CLAIM.
|
|
1154
1322
|
*
|
|
1323
|
+
* A caller may supply a sender-chosen 32-byte `executionCondition`
|
|
1324
|
+
* (`C = sha256(P)`, one fresh preimage per packet — toon-client#350,
|
|
1325
|
+
* rolling-swap spec §3 R1/R2) and an explicit `expiresAt` (R7). Both are
|
|
1326
|
+
* set on the wire by either transport (HTTP `POST /ilp` and BTP), and on
|
|
1327
|
+
* FULFILL the transport verifies `sha256(fulfillment) == condition` —
|
|
1328
|
+
* a mismatch comes back as `accepted: false` (code F99), never a silent
|
|
1329
|
+
* accept. Omitting them keeps today's zero-condition legacy packet.
|
|
1330
|
+
*
|
|
1155
1331
|
* @throws {ToonClientError} INVALID_STATE / NO_ILP_TRANSPORT / MISSING_CLAIM
|
|
1156
1332
|
*/
|
|
1157
1333
|
sendSwapPacket(params: {
|
|
@@ -1160,6 +1336,10 @@ declare class ToonClient {
|
|
|
1160
1336
|
toonData: Uint8Array;
|
|
1161
1337
|
timeout?: number;
|
|
1162
1338
|
claim?: SignedBalanceProof;
|
|
1339
|
+
/** Sender-chosen 32-byte execution condition; absent/zero = legacy. */
|
|
1340
|
+
executionCondition?: Uint8Array;
|
|
1341
|
+
/** Explicit ILP expiry; defaults to `now + timeout` in the transport. */
|
|
1342
|
+
expiresAt?: Date;
|
|
1163
1343
|
}): Promise<IlpSendResult>;
|
|
1164
1344
|
/**
|
|
1165
1345
|
* Build a BTP claim message from a pre-signed balance proof using the
|
|
@@ -1317,6 +1497,22 @@ declare class ToonClient {
|
|
|
1317
1497
|
* are derived there).
|
|
1318
1498
|
*/
|
|
1319
1499
|
getBalances(): Promise<WalletBalance[]>;
|
|
1500
|
+
/**
|
|
1501
|
+
* The FULL multi-chain wallet view (#299): for every chain the identity is
|
|
1502
|
+
* configured for, the native coin (ETH / SOL / MINA) AND every configured
|
|
1503
|
+
* token (USDC), grouped per chain with the identity's address on that chain.
|
|
1504
|
+
* A superset of {@link getBalances} — which stays scoped to the channel's
|
|
1505
|
+
* settlement token — kept as a separate reader so channel-settlement callers
|
|
1506
|
+
* are unaffected.
|
|
1507
|
+
*
|
|
1508
|
+
* FREE: read-only RPC, no signing, no payment. Works on an UNSTARTED client:
|
|
1509
|
+
* the Solana/Mina addresses (which the signers only register during
|
|
1510
|
+
* `start()`) are derived on demand from the retained mnemonic — the SAME keys
|
|
1511
|
+
* `start()` would register and that `rig fund` prints — so all configured
|
|
1512
|
+
* chains appear even before a start. Best-effort per chain: an unreachable
|
|
1513
|
+
* RPC yields `{ unreadable: true }` for that chain, never failing the others.
|
|
1514
|
+
*/
|
|
1515
|
+
getWalletBalances(): Promise<WalletChainBalances[]>;
|
|
1320
1516
|
/**
|
|
1321
1517
|
* Resolves an ILP destination address to a peer ID.
|
|
1322
1518
|
* Convention: destination "g.toon.peer1" → peerId "peer1" (last segment).
|
|
@@ -2691,6 +2887,56 @@ declare function parseFulfillHttpBytes(bytes: Uint8Array): ParsedFulfillHttp;
|
|
|
2691
2887
|
*/
|
|
2692
2888
|
declare function parseFulfillHttp(base64Data: string): ParsedFulfillHttp;
|
|
2693
2889
|
|
|
2890
|
+
/**
|
|
2891
|
+
* Sender-chosen ILP execution conditions (toon-client#350, rolling-swap
|
|
2892
|
+
* prerequisite — toon-meta#145 §3 R1/R2).
|
|
2893
|
+
*
|
|
2894
|
+
* Contract (normative: connector `docs/local-delivery-fulfillment-contract.md`,
|
|
2895
|
+
* connector#309):
|
|
2896
|
+
* - An ABSENT or ALL-ZERO (32×0x00) `executionCondition` is the LEGACY
|
|
2897
|
+
* class: no hashlock, no verification — today's publish/upload writes.
|
|
2898
|
+
* - Any NON-ZERO condition is SENDER-CHOSEN: the sender mints a fresh
|
|
2899
|
+
* random 32-byte preimage `P` per packet, sets `C = sha256(P)` on the
|
|
2900
|
+
* PREPARE, and on FULFILL MUST verify that the returned fulfillment
|
|
2901
|
+
* hashes back to `C` — a missing/malformed/mismatching fulfillment is a
|
|
2902
|
+
* hard failure (the packet is counted failed, never silently accepted).
|
|
2903
|
+
*
|
|
2904
|
+
* Isomorphic: @noble/hashes only (no Buffer, no node:crypto).
|
|
2905
|
+
*/
|
|
2906
|
+
/** Exact byte length of an ILP execution condition / fulfillment preimage. */
|
|
2907
|
+
declare const CONDITION_LENGTH = 32;
|
|
2908
|
+
/** A freshly minted per-packet hashlock: `condition = sha256(preimage)`. */
|
|
2909
|
+
interface ExecutionConditionPair {
|
|
2910
|
+
/** Random 32-byte preimage `P` — reveal is the commit act; never reuse. */
|
|
2911
|
+
preimage: Uint8Array;
|
|
2912
|
+
/** `C = sha256(P)` — goes on the PREPARE's `executionCondition`. */
|
|
2913
|
+
condition: Uint8Array;
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* Mint a fresh random 32-byte preimage and its sha256 condition (spec R1).
|
|
2917
|
+
* Mint one PER PACKET: a reused preimage lets any observer of packet *i*
|
|
2918
|
+
* fulfill packet *i+1* without the sender's consent.
|
|
2919
|
+
*/
|
|
2920
|
+
declare function mintExecutionCondition(): ExecutionConditionPair;
|
|
2921
|
+
/**
|
|
2922
|
+
* True when `condition` selects the LEGACY (unverified) class: absent or
|
|
2923
|
+
* all-zero. The OER wire treats absent and 32×0x00 identically.
|
|
2924
|
+
*/
|
|
2925
|
+
declare function isZeroCondition(condition: Uint8Array | undefined): boolean;
|
|
2926
|
+
/**
|
|
2927
|
+
* Validate a caller-supplied execution condition before it goes on the wire.
|
|
2928
|
+
* @throws {Error} When the condition is not exactly 32 bytes — the OER
|
|
2929
|
+
* serializer would otherwise silently zero-fill it, downgrading a
|
|
2930
|
+
* sender-chosen packet to the legacy unverified class.
|
|
2931
|
+
*/
|
|
2932
|
+
declare function assertValidCondition(condition: Uint8Array): void;
|
|
2933
|
+
/**
|
|
2934
|
+
* True iff `fulfillment` is exactly 32 bytes and `sha256(fulfillment)`
|
|
2935
|
+
* equals `condition` — the sender-side FULFILL check (spec R6's mirror).
|
|
2936
|
+
* Fail-closed: an undefined/short/long fulfillment never matches.
|
|
2937
|
+
*/
|
|
2938
|
+
declare function fulfillmentMatchesCondition(fulfillment: Uint8Array | undefined, condition: Uint8Array): boolean;
|
|
2939
|
+
|
|
2694
2940
|
/**
|
|
2695
2941
|
* Settlement info produced by buildSettlementInfo().
|
|
2696
2942
|
* Extends the core SettlementConfig shape with ilpAddress for client use.
|
|
@@ -3208,4 +3454,4 @@ declare function loadKeystore(path: string, password: string): string;
|
|
|
3208
3454
|
*/
|
|
3209
3455
|
declare function writeKeystoreFile(path: string, keystore: EncryptedKeystore): void;
|
|
3210
3456
|
|
|
3211
|
-
export { type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, type ChainMetadata, type ChainSigner, ChannelFundingError, ChannelManager, type ClaimMessage, type ClaimResolver, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, type FaucetChain, type FundWalletOptions, type FundWalletResult, type H402FetchOptions, 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, KeyManager, type KeyManagerConfig, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type ParsedFulfillHttp, type ParsedX402Challenge, type PasskeyInfo, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, ValidationError, type VaultData, applyDefaults, applyNetworkPresets, buildBackupEvent, buildBackupFilter, buildSettlementInfo, buildStoreWriteEnvelope, decryptMnemonic, defaultFaucetTimeout, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, extractArweaveTxId, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isInsufficientGasError, isPrfSupported, loadKeystore, parseBackupPayload, parseFulfillHttp, parseFulfillHttpBytes, parseHttpResponse, parseX402Body, parseX402Challenge, proxyIlpEndpoint, readDiscoveredIlpPeer, readMinaDepositTotal, requestBlobStorage, selectIlpTransport, serializeHttpRequest, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
|
|
3457
|
+
export { type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, CONDITION_LENGTH, type ChainMetadata, type ChainSigner, ChannelFundingError, ChannelManager, type ClaimMessage, type ClaimResolver, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, type ExecutionConditionPair, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, type FaucetChain, type FundWalletOptions, type FundWalletResult, type H402FetchOptions, 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 IlpSendParams, type IlpSendResultWithFulfillment, type IlpTransportChoice, KeyManager, type KeyManagerConfig, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type ParsedFulfillHttp, type ParsedX402Challenge, type PasskeyInfo, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, ValidationError, type VaultData, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletTokenAmount, applyDefaults, applyNetworkPresets, assertValidCondition, buildBackupEvent, buildBackupFilter, buildSettlementInfo, buildStoreWriteEnvelope, decryptMnemonic, defaultFaucetTimeout, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, extractArweaveTxId, fulfillmentMatchesCondition, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isInsufficientGasError, isPrfSupported, isZeroCondition, loadKeystore, mintExecutionCondition, parseBackupPayload, parseFulfillHttp, parseFulfillHttpBytes, parseHttpResponse, parseX402Body, parseX402Challenge, proxyIlpEndpoint, readDiscoveredIlpPeer, readEvmNativeBalance, readEvmTokenBalance, readMinaBalance, readMinaDepositTotal, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, requestBlobStorage, selectIlpTransport, serializeHttpRequest, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
|