@toon-protocol/sdk 2.1.0 → 3.0.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.
@@ -162,6 +162,273 @@ declare function encryptFulfillClaim(params: EncryptFulfillClaimParams): Encrypt
162
162
  */
163
163
  declare function decryptFulfillClaim(params: DecryptFulfillClaimParams): Uint8Array;
164
164
 
165
+ /**
166
+ * rfc-0039-style stream receipts (issue #84, rolling-swap spec §7.2).
167
+ *
168
+ * Per fulfilled packet the maker attaches a compact SIGNED receipt to the
169
+ * FULFILL accept-metadata: a monotone cumulative proof of asset-B delivered
170
+ * in the session. The receipt chain is the sender's portable audit/dispute
171
+ * artifact today (it makes the maker-debt bound provable to a third party)
172
+ * and the natural input to a future escrow layer. Receipts are
173
+ * session-scoped via `streamNonce`; the latest receipt supersedes all
174
+ * earlier ones, mirroring the highest-nonce rule for claims.
175
+ *
176
+ * ## Deviations from Interledger rfc-0039 (documented per spec §7.2 — the
177
+ * TOON-native equivalent deliberately does not import the STREAM framing):
178
+ *
179
+ * - **Signature, not HMAC.** rfc-0039 authenticates receipts with
180
+ * HMAC-SHA256 over a pre-shared 32-byte Receipt Secret, so only a party
181
+ * holding the secret can verify. TOON receipts are BIP-340 Schnorr
182
+ * signatures by the maker's receipt key (default: the maker's Nostr
183
+ * identity key — the same `swapPubkey` the sender already discovered via
184
+ * kind:10032), making every receipt verifiable by ANY third party with
185
+ * the maker's pubkey. No Receipt Secret exists or is provisioned.
186
+ * - **Nonce provisioning.** rfc-0039's Verifier generates the Receipt Nonce
187
+ * and communicates it out-of-band (SPSP headers). Here the sender (who is
188
+ * its own verifier today) generates a 16-byte `streamNonce` per
189
+ * `streamSwap()` invocation and communicates it in-band as the rumor's
190
+ * `stream-nonce` tag. Legacy makers ignore the unknown tag.
191
+ * - **Encoding.** JSON object inside the accept-metadata dict rather than a
192
+ * CANONICAL-OER STREAM frame. A deterministic length-prefixed binary
193
+ * encoding ({@link encodeReceiptSigningPayload}) is used ONLY as the
194
+ * signing preimage.
195
+ * - **Fields.** `seq` (maker's per-session fulfill counter — enables hole
196
+ * detection, absent from rfc-0039), `rate` + `rateTimestamp` (the quote
197
+ * tape entry, attested under the maker signature) are added; the STREAM
198
+ * `Stream ID` is dropped (one logical stream per session — the
199
+ * `streamNonce` IS the stream identity); `Total Received` is a decimal
200
+ * string (bigint range) rather than UInt64.
201
+ *
202
+ * rfc-0039 semantics preserved: one receipt per fulfilled packet, each
203
+ * carrying a progressively higher cumulative total; latest supersedes;
204
+ * verification = authenticity check + monotonicity against previously seen
205
+ * receipts for the same nonce.
206
+ *
207
+ * @module
208
+ */
209
+ /** Wire version of the TOON stream receipt. */
210
+ declare const STREAM_RECEIPT_VERSION: 1;
211
+ /** Domain-separation tag prefixed to the receipt signing payload. */
212
+ declare const STREAM_RECEIPT_SIGNING_TAG = "toon.stream-receipt.v1";
213
+ /** The signed fields of a {@link StreamReceipt} (everything except `sig`). */
214
+ interface StreamReceiptFields {
215
+ /** Receipt wire version — always {@link STREAM_RECEIPT_VERSION}. */
216
+ v: typeof STREAM_RECEIPT_VERSION;
217
+ /**
218
+ * Session identifier: 32-char lowercase hex (16 bytes), generated by the
219
+ * sender per stream and echoed by the maker on every receipt.
220
+ */
221
+ streamNonce: string;
222
+ /**
223
+ * Maker's per-session fulfill counter, 1-based, strictly increasing by 1
224
+ * per fulfilled packet. Gaps observed by the sender indicate receipts it
225
+ * never received (hole detection).
226
+ */
227
+ seq: number;
228
+ /**
229
+ * Running total of asset B delivered in this session (target micro-units,
230
+ * decimal string). Monotone non-decreasing in `seq`; the latest receipt
231
+ * supersedes all earlier ones.
232
+ */
233
+ cumulativeDelivered: string;
234
+ /** The maker's quote `R_i` applied to the packet this receipt rode on (decimal string). */
235
+ rate: string;
236
+ /** Unix ms timestamp when the maker's rate source produced {@link rate}. */
237
+ rateTimestamp: number;
238
+ }
239
+ /**
240
+ * A signed stream receipt as carried on the FULFILL accept-metadata under
241
+ * the `receipt` key (rolling-swap spec §7.2).
242
+ */
243
+ interface StreamReceipt extends StreamReceiptFields {
244
+ /**
245
+ * 128-char lowercase hex BIP-340 Schnorr signature by the maker's receipt
246
+ * key over `sha256(encodeReceiptSigningPayload(fields))`.
247
+ */
248
+ sig: string;
249
+ }
250
+ /**
251
+ * Aggregate view of the receipts harvested from one stream — the serialized
252
+ * audit/dispute artifact's in-memory shape. Returned on
253
+ * `StreamSwapResult.receipts` (present on abort too, covering what filled).
254
+ */
255
+ interface StreamReceiptChain {
256
+ /** The sender-generated session nonce receipts were verified against. */
257
+ streamNonce: string;
258
+ /** All verified receipts, sorted by ascending `seq`. */
259
+ receipts: StreamReceipt[];
260
+ /** Highest-`seq` receipt — supersedes all others (rfc-0039 latest-wins). */
261
+ latest?: StreamReceipt;
262
+ /**
263
+ * `latest.cumulativeDelivered`, or `'0'` when no receipt was received —
264
+ * the signed total of asset B the maker attests to having delivered.
265
+ */
266
+ totalDelivered: string;
267
+ /**
268
+ * Missing `seq` values in `[1, latest.seq]`: fulfilled packets whose
269
+ * receipts the sender never received (lost FULFILLs, or maker skips).
270
+ */
271
+ holes: number[];
272
+ }
273
+ /** True iff `value` is a well-formed 32-char lowercase hex stream nonce. */
274
+ declare function isValidStreamNonce(value: unknown): value is string;
275
+ /**
276
+ * Structurally validate an untrusted metadata `receipt` value into a
277
+ * {@link StreamReceipt}. Checks shape ONLY — no signature or monotonicity
278
+ * verification (that is {@link verifyStreamReceipt} / {@link ReceiptChainTracker}).
279
+ *
280
+ * @throws {Error} with a human-readable reason when malformed. Callers
281
+ * (e.g. `decodeFulfillMetadata`) wrap into their own error taxonomy.
282
+ */
283
+ declare function parseStreamReceipt(value: unknown): StreamReceipt;
284
+ /**
285
+ * Deterministic binary encoding of the signed receipt fields — the signing
286
+ * preimage. Layout (all integers big-endian):
287
+ *
288
+ * ```
289
+ * len(tag):u32 || tag(utf8) || v:u8 || streamNonce(16 raw bytes)
290
+ * || seq:u64 || len:u32 || cumulativeDelivered(utf8)
291
+ * || len:u32 || rate(utf8) || rateTimestamp:u64
292
+ * ```
293
+ *
294
+ * Length prefixes remove concatenation ambiguity between the variable-width
295
+ * decimal strings (same rationale as the swap-handler replay packet-id hash).
296
+ */
297
+ declare function encodeReceiptSigningPayload(fields: StreamReceiptFields): Uint8Array;
298
+ /**
299
+ * Sign the receipt fields with the maker's receipt secret key (32-byte
300
+ * secp256k1 scalar — by default the maker's Nostr identity key). Returns
301
+ * the complete {@link StreamReceipt} with the BIP-340 Schnorr `sig` over
302
+ * `sha256(encodeReceiptSigningPayload(fields))`.
303
+ */
304
+ declare function signStreamReceipt(fields: StreamReceiptFields, secretKey: Uint8Array): StreamReceipt;
305
+ /**
306
+ * Verify a receipt's Schnorr signature against the maker's receipt pubkey
307
+ * (64-char lowercase hex x-only key — by default the maker's `swapPubkey`).
308
+ * Authenticity only; monotonicity/session checks live in
309
+ * {@link ReceiptChainTracker}.
310
+ */
311
+ declare function verifyStreamReceipt(receipt: StreamReceipt, makerPubkey: string): boolean;
312
+ /** Outcome of {@link ReceiptChainTracker.add}. */
313
+ type ReceiptAddResult = {
314
+ ok: true;
315
+ } | {
316
+ ok: false;
317
+ /** Machine-readable rejection reason. */
318
+ code: 'BAD_SIGNATURE' | 'WRONG_STREAM_NONCE' | 'DUPLICATE_SEQ' | 'NON_MONOTONIC';
319
+ message: string;
320
+ };
321
+ /**
322
+ * Accumulates and verifies the receipt chain for ONE stream session.
323
+ *
324
+ * Per added receipt it checks, in order:
325
+ * 1. `streamNonce` matches the session (a receipt for another session is
326
+ * worthless as proof for this one),
327
+ * 2. the Schnorr signature verifies against the maker's receipt pubkey,
328
+ * 3. `seq` is not a duplicate,
329
+ * 4. `cumulativeDelivered` is monotone in `seq` against every receipt seen
330
+ * so far: non-decreasing with ascending `seq` (rfc-0039 "progressively
331
+ * higher amount"; non-strict so a zero-target packet — possible under
332
+ * `applyRate` truncation — does not read as maker equivocation).
333
+ *
334
+ * Receipts may be added OUT OF ORDER (adaptive W>1 streams complete in
335
+ * arbitrary order); monotonicity is enforced against both the nearest lower
336
+ * and nearest higher `seq` neighbors.
337
+ */
338
+ declare class ReceiptChainTracker {
339
+ #private;
340
+ constructor(input: {
341
+ streamNonce: string;
342
+ makerPubkey: string;
343
+ });
344
+ get streamNonce(): string;
345
+ /** Number of verified receipts accumulated so far. */
346
+ get size(): number;
347
+ /**
348
+ * Verify + accumulate one receipt. On `{ok: false}` the receipt is NOT
349
+ * added and the chain is unchanged.
350
+ */
351
+ add(receipt: StreamReceipt): ReceiptAddResult;
352
+ /**
353
+ * Snapshot the accumulated chain: sorted receipts, the superseding latest,
354
+ * the signed total delivered, and any `seq` holes in `[1, latest.seq]`.
355
+ */
356
+ chain(): StreamReceiptChain;
357
+ }
358
+ /**
359
+ * Serialize a receipt chain into the portable audit/dispute artifact: a
360
+ * stable, versioned JSON document. Any third party holding the maker's
361
+ * receipt pubkey can re-verify every receipt in it offline (the enclosed
362
+ * receipts are self-contained signed statements).
363
+ */
364
+ declare function serializeReceiptChain(chain: StreamReceiptChain): string;
365
+ /** Per-session receipt issuance state kept by the maker. */
366
+ interface ReceiptSessionState {
367
+ /** Last issued seq (0 = none issued yet). */
368
+ seq: number;
369
+ /** Cumulative asset-B delivered in the session so far (target micro-units). */
370
+ cumulativeDelivered: bigint;
371
+ }
372
+ /**
373
+ * Minimal synchronous store contract for maker-side receipt session state,
374
+ * keyed by `streamNonce`.
375
+ *
376
+ * SYNCHRONOUS by design: the swap handler performs the read-increment-write
377
+ * inside one microtask so concurrent packets in the same session get
378
+ * distinct, gapless `seq` values and consistent cumulative totals. An
379
+ * operator-supplied store that persists (e.g. alongside the claim/channel
380
+ * store, so receipt state survives restarts like claims do) should
381
+ * write-through asynchronously in the background while serving reads from
382
+ * memory. The default is {@link BoundedReceiptSessions} (in-memory LRU).
383
+ */
384
+ interface ReceiptSessionStoreLike {
385
+ get(streamNonce: string): ReceiptSessionState | undefined;
386
+ set(streamNonce: string, state: ReceiptSessionState): unknown;
387
+ delete(streamNonce: string): boolean;
388
+ }
389
+ /**
390
+ * Default ceiling for the maker's receipt-session LRU. Same DoS rationale
391
+ * as `DEFAULT_SEEN_PACKET_IDS_CAP`: bounds memory against an attacker
392
+ * minting unlimited distinct stream nonces. An evicted (or maker-restarted)
393
+ * session restarts at seq 1 — the sender's tracker then rejects the
394
+ * duplicate seq loudly rather than accepting a forked chain.
395
+ */
396
+ declare const DEFAULT_RECEIPT_SESSIONS_CAP = 10000;
397
+ /**
398
+ * Bounded in-memory LRU {@link ReceiptSessionStoreLike}. Access-order
399
+ * eviction: active sessions stay pinned while stale ones age out.
400
+ */
401
+ declare class BoundedReceiptSessions implements ReceiptSessionStoreLike {
402
+ #private;
403
+ constructor(cap?: number);
404
+ get size(): number;
405
+ get cap(): number;
406
+ get(streamNonce: string): ReceiptSessionState | undefined;
407
+ set(streamNonce: string, state: ReceiptSessionState): this;
408
+ delete(streamNonce: string): boolean;
409
+ }
410
+ /**
411
+ * Maker-side: advance the session state for one fulfilled packet and issue
412
+ * the corresponding signed receipt. The read-increment-write against the
413
+ * store happens synchronously (no awaits) so concurrent handler invocations
414
+ * interleave safely.
415
+ *
416
+ * MUST only be called for a packet that is being ACCEPTED — a rejected
417
+ * packet gets no receipt and MUST NOT advance the session.
418
+ */
419
+ declare function issueSessionReceipt(input: {
420
+ sessions: ReceiptSessionStoreLike;
421
+ streamNonce: string;
422
+ /** Asset-B amount delivered by THIS packet (target micro-units). */
423
+ deliveredAmount: bigint;
424
+ /** The quote-tape rate applied to this packet. */
425
+ rate: string;
426
+ /** The quote-tape timestamp for {@link rate}. */
427
+ rateTimestamp: number;
428
+ /** Maker receipt secret key (32-byte secp256k1). */
429
+ secretKey: Uint8Array;
430
+ }): StreamReceipt;
431
+
165
432
  /**
166
433
  * Adaptive δ/W controller for rolling swaps (issue #83, rolling-swap spec §6).
167
434
  *
@@ -633,6 +900,29 @@ interface StreamSwapParams {
633
900
  * optional and only the soft deviation monitor applies.
634
901
  */
635
902
  minExchangeRate?: string;
903
+ /**
904
+ * Maker receipt verification key (issue #84, rfc-0039 stream receipts;
905
+ * rolling-swap spec §7.2): 64-char lowercase hex x-only pubkey each
906
+ * per-fulfill receipt's BIP-340 signature is verified against. Defaults
907
+ * to `swapPubkey` (the maker identity key — the swap handler's default
908
+ * receipt signer). Set when the maker provisioned a dedicated receipt key
909
+ * (`CreateSwapHandlerConfig.receiptSecretKey`, e.g. the swap#47 coupled
910
+ * engine's chain-B claim signer key).
911
+ */
912
+ receiptPubkey?: string;
913
+ /**
914
+ * When true, every fulfilled packet MUST carry a verifiable receipt: a
915
+ * receipt-less FULFILL is recorded as a `RECEIPT_MISSING` rejection and
916
+ * the stream halts with `abortReason: 'receipt-invalid'` (a maker that
917
+ * doesn't attest deliveries cannot be audited, so keep the exposure at
918
+ * zero). When omitted/false, receipt-less fulfills from legacy makers
919
+ * degrade gracefully: the claim still accumulates, `result.receipts`
920
+ * is simply empty. A receipt that is PRESENT but fails verification
921
+ * (tampered, wrong key, wrong session, non-monotone, duplicate seq) is
922
+ * ALWAYS a loud `RECEIPT_INVALID` rejection + halt, regardless of this
923
+ * flag — the packet's claim is never accumulated.
924
+ */
925
+ requireReceipts?: boolean;
636
926
  /** Per-packet timeout in ms. Default 30000. */
637
927
  packetTimeoutMs?: number;
638
928
  /**
@@ -703,6 +993,13 @@ interface PacketProgress {
703
993
  rate?: string;
704
994
  /** Unix ms timestamp when the maker's rate source produced {@link rate}. Present iff `rate` is. */
705
995
  rateTimestamp?: number;
996
+ /**
997
+ * Verified per-fulfill stream receipt (issue #84, rolling-swap spec §7.2).
998
+ * Present iff the maker emitted a receipt AND it verified (signature,
999
+ * session nonce, monotonicity) — an invalid receipt halts the stream
1000
+ * before the callback ever fires for that packet.
1001
+ */
1002
+ receipt?: StreamReceipt;
706
1003
  /** Controller state at callback time. */
707
1004
  state: 'running' | 'paused' | 'stopped';
708
1005
  }
@@ -757,6 +1054,12 @@ interface AccumulatedClaim {
757
1054
  rate?: string;
758
1055
  /** Unix ms timestamp when the maker's rate source produced `rate`. Present iff `rate` is. */
759
1056
  rateTimestamp?: number;
1057
+ /**
1058
+ * The VERIFIED signed receipt that rode on this packet's FULFILL
1059
+ * (issue #84, rolling-swap spec §7.2) — receipts persist wherever the
1060
+ * claim does. Present iff the maker emitted receipts for this session.
1061
+ */
1062
+ receipt?: StreamReceipt;
760
1063
  }
761
1064
  /**
762
1065
  * Aggregate result of a `streamSwap()` invocation.
@@ -776,11 +1079,21 @@ interface StreamSwapResult {
776
1079
  packetIndex: number;
777
1080
  cause: Error;
778
1081
  }[];
779
- abortReason: 'complete' | 'aborted' | 'stopped' | 'callback-stop' | 'callback-throw' | 'rate-deviation' | 'below-floor' | 'all-rejected';
1082
+ abortReason: 'complete' | 'aborted' | 'stopped' | 'callback-stop' | 'callback-throw' | 'rate-deviation' | 'below-floor' | 'receipt-invalid' | 'all-rejected';
780
1083
  cumulativeSource: bigint;
781
1084
  cumulativeTarget: bigint;
782
1085
  packetsSent: number;
783
1086
  packetsScheduled: number;
1087
+ /**
1088
+ * The verified receipt chain for this stream (issue #84, rolling-swap
1089
+ * spec §7.2): every receipt that verified against the maker receipt key,
1090
+ * sorted by `seq`, plus the superseding `latest`, the signed
1091
+ * `totalDelivered`, and any `seq` holes. ALWAYS present — on abort it
1092
+ * covers exactly what filled before the halt; against a legacy maker
1093
+ * (no receipt support) it is simply empty. Feed to
1094
+ * `serializeReceiptChain()` for the portable audit/dispute artifact.
1095
+ */
1096
+ receipts: StreamReceiptChain;
784
1097
  }
785
1098
  /** External controller returned by {@link streamSwapControlled}. */
786
1099
  interface StreamSwapController {
@@ -798,6 +1111,12 @@ declare function chunkAmount(total: bigint, count: number): bigint[];
798
1111
  * `pair.to.chain`. The value is echoed verbatim per packet — no case-folding
799
1112
  * or transformation beyond what the sender-side `validateChainAddress`
800
1113
  * accepts.
1114
+ *
1115
+ * Issue #84 (rfc-0039 stream receipts): when `streamNonce` is provided, the
1116
+ * rumor also carries a `stream-nonce` tag — the sender-generated session
1117
+ * identifier a receipt-capable maker echoes on every per-fulfill receipt.
1118
+ * This is the TOON analogue of rfc-0039's Verifier→Receiver Receipt-Nonce
1119
+ * provisioning (in-band, per stream). Legacy makers ignore the unknown tag.
801
1120
  */
802
1121
  declare function buildSwapRumor(input: {
803
1122
  senderPubkey: string;
@@ -808,6 +1127,8 @@ declare function buildSwapRumor(input: {
808
1127
  nonce: Uint8Array;
809
1128
  createdAt: number;
810
1129
  chainRecipient: string;
1130
+ /** 32-char lowercase hex session nonce (issue #84 stream receipts). */
1131
+ streamNonce?: string;
811
1132
  }): UnsignedEvent;
812
1133
  /**
813
1134
  * Decode the FULFILL response `data` (base64-encoded JSON metadata) into
@@ -832,6 +1153,16 @@ declare function buildSwapRumor(input: {
832
1153
  * permitted for legacy makers unless `opts.requireQuoteTape` is set (which
833
1154
  * `runLoop` does whenever `minExchangeRate` is armed).
834
1155
  *
1156
+ * Issue #84 extension (rfc-0039 stream receipts, spec §7.2): parses the
1157
+ * optional `receipt` object into a structurally-validated {@link StreamReceipt}.
1158
+ * Like the tape, a PRESENT-but-malformed receipt is a loud
1159
+ * `FULFILL_DECODE_FAILED` (a garbled proof must never be silently dropped —
1160
+ * the sender would keep streaming while its audit artifact rots); a wholly
1161
+ * absent receipt is legacy-maker territory and tolerated here (the
1162
+ * `requireReceipts` policy is enforced by the caller, which has the halt
1163
+ * machinery). Signature/monotonicity verification is NOT done here — that is
1164
+ * `processAcceptedPacket`'s ReceiptChainTracker.
1165
+ *
835
1166
  * @param chain Optional `pair.to.chain` string for per-chain format validation
836
1167
  * of channelId / recipient / swapSignerAddress. When omitted, format checks
837
1168
  * fall back to a length-only sanity check.
@@ -850,6 +1181,8 @@ declare function decodeFulfillMetadata(data: string | undefined, chain?: string,
850
1181
  rate?: string;
851
1182
  /** Quote-tape timestamp (unix ms). Present iff `rate` is. */
852
1183
  rateTimestamp?: number;
1184
+ /** Per-fulfill stream receipt (issue #84) — structurally validated, NOT yet signature-verified. */
1185
+ receipt?: StreamReceipt;
853
1186
  channelId?: string;
854
1187
  nonce?: string;
855
1188
  cumulativeAmount?: string;
@@ -908,4 +1241,4 @@ declare const __testing: {
908
1241
  compareDecimalRates: typeof compareDecimalRates;
909
1242
  };
910
1243
 
911
- export { type AccumulatedClaim as A, type StreamSwapClient as B, type DecryptFulfillClaimParams as D, type EncryptFulfillClaimParams as E, InMemorySwapControllerStateStore as I, JsonFileSwapControllerStateStore as J, type PacketObservation as P, type RateMonitorCallback as R, type StreamSwapAdaptiveController as S, type UnwrapSwapPacketFromToonParams as U, type WrapSwapPacketParams as W, __testing as _, AdaptiveDeltaController as a, type AdaptiveDeltaControllerConfig as b, type EncryptFulfillClaimResult as c, type PacketProgress as d, type PacketResolution as e, type StreamSwapController as f, type StreamSwapParams as g, type StreamSwapResult as h, SwapControllerError as i, type SwapControllerState as j, type SwapControllerStateStore as k, type UnwrapSwapPacketParams as l, type UnwrapSwapPacketResult as m, type WrapSwapPacketResult as n, type WrapSwapPacketToToonParams as o, type WrapSwapPacketToToonResult as p, decryptFulfillClaim as q, encryptFulfillClaim as r, isSwapControllerState as s, streamSwap as t, streamSwapControlled as u, swapControllerStateKey as v, unwrapSwapPacket as w, unwrapSwapPacketFromToon as x, wrapSwapPacket as y, wrapSwapPacketToToon as z };
1244
+ export { wrapSwapPacket as $, type AccumulatedClaim as A, BoundedReceiptSessions as B, decryptFulfillClaim as C, DEFAULT_RECEIPT_SESSIONS_CAP as D, type EncryptFulfillClaimParams as E, encodeReceiptSigningPayload as F, encryptFulfillClaim as G, isSwapControllerState as H, InMemorySwapControllerStateStore as I, JsonFileSwapControllerStateStore as J, isValidStreamNonce as K, issueSessionReceipt as L, parseStreamReceipt as M, serializeReceiptChain as N, signStreamReceipt as O, type PacketObservation as P, streamSwap as Q, type ReceiptSessionStoreLike as R, STREAM_RECEIPT_SIGNING_TAG as S, streamSwapControlled as T, type UnwrapSwapPacketFromToonParams as U, swapControllerStateKey as V, type WrapSwapPacketParams as W, unwrapSwapPacket as X, unwrapSwapPacketFromToon as Y, verifyStreamReceipt as Z, __testing as _, AdaptiveDeltaController as a, wrapSwapPacketToToon as a0, type StreamSwapClient as a1, type AdaptiveDeltaControllerConfig as b, type DecryptFulfillClaimParams as c, type EncryptFulfillClaimResult as d, type PacketProgress as e, type PacketResolution as f, type RateMonitorCallback as g, type ReceiptAddResult as h, ReceiptChainTracker as i, type ReceiptSessionState as j, STREAM_RECEIPT_VERSION as k, type StreamReceipt as l, type StreamReceiptChain as m, type StreamReceiptFields as n, type StreamSwapAdaptiveController as o, type StreamSwapController as p, type StreamSwapParams as q, type StreamSwapResult as r, SwapControllerError as s, type SwapControllerState as t, type SwapControllerStateStore as u, type UnwrapSwapPacketParams as v, type UnwrapSwapPacketResult as w, type WrapSwapPacketResult as x, type WrapSwapPacketToToonParams as y, type WrapSwapPacketToToonResult as z };
package/dist/swap.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AccumulatedClaim, d as PacketProgress, R as RateMonitorCallback, B as StreamSwapClient, f as StreamSwapController, g as StreamSwapParams, h as StreamSwapResult, q as decryptFulfillClaim, t as streamSwap, u as streamSwapControlled, z as wrapSwapPacketToToon } from './swap-Oub-0vqU.js';
1
+ export { A as AccumulatedClaim, B as BoundedReceiptSessions, e as PacketProgress, g as RateMonitorCallback, h as ReceiptAddResult, i as ReceiptChainTracker, j as ReceiptSessionState, R as ReceiptSessionStoreLike, k as STREAM_RECEIPT_VERSION, l as StreamReceipt, m as StreamReceiptChain, n as StreamReceiptFields, a1 as StreamSwapClient, p as StreamSwapController, q as StreamSwapParams, r as StreamSwapResult, C as decryptFulfillClaim, F as encodeReceiptSigningPayload, K as isValidStreamNonce, L as issueSessionReceipt, M as parseStreamReceipt, N as serializeReceiptChain, O as signStreamReceipt, Q as streamSwap, T as streamSwapControlled, Z as verifyStreamReceipt, a0 as wrapSwapPacketToToon } from './swap-PFQTJZA7.js';
2
2
  import 'nostr-tools/pure';
3
3
  import '@toon-protocol/core';
package/dist/swap.js CHANGED
@@ -1,14 +1,34 @@
1
1
  import {
2
+ BoundedReceiptSessions,
3
+ ReceiptChainTracker,
4
+ STREAM_RECEIPT_VERSION,
2
5
  decryptFulfillClaim,
6
+ encodeReceiptSigningPayload,
7
+ isValidStreamNonce,
8
+ issueSessionReceipt,
9
+ parseStreamReceipt,
10
+ serializeReceiptChain,
11
+ signStreamReceipt,
3
12
  streamSwap,
4
13
  streamSwapControlled,
14
+ verifyStreamReceipt,
5
15
  wrapSwapPacketToToon
6
- } from "./chunk-7LBYFU4L.js";
16
+ } from "./chunk-RAZRWSJF.js";
7
17
  import "./chunk-UP2VWCW5.js";
8
18
  export {
19
+ BoundedReceiptSessions,
20
+ ReceiptChainTracker,
21
+ STREAM_RECEIPT_VERSION,
9
22
  decryptFulfillClaim,
23
+ encodeReceiptSigningPayload,
24
+ isValidStreamNonce,
25
+ issueSessionReceipt,
26
+ parseStreamReceipt,
27
+ serializeReceiptChain,
28
+ signStreamReceipt,
10
29
  streamSwap,
11
30
  streamSwapControlled,
31
+ verifyStreamReceipt,
12
32
  wrapSwapPacketToToon
13
33
  };
14
34
  //# sourceMappingURL=swap.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toon-protocol/sdk",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "description": "TOON SDK for building ILP-gated Nostr services",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "@scure/bip39": "^2.0.0",
47
47
  "@ardrive/turbo-sdk": "^1.19.0",
48
48
  "nostr-tools": "^2.20.0",
49
- "@toon-protocol/core": "2.1.0"
49
+ "@toon-protocol/core": "3.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@toon-protocol/connector": ">=3.3.3",