@arkade-os/swap 0.1.9 → 0.1.10

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.
Files changed (45) hide show
  1. package/dist/advanced.cjs +1097 -541
  2. package/dist/advanced.d.cts +19 -21
  3. package/dist/advanced.d.ts +19 -21
  4. package/dist/advanced.js +40 -34
  5. package/dist/{chunk-FQNG4XMF.js → chunk-2HQZLIVX.js} +98 -37
  6. package/dist/{chunk-5QPJWOCN.js → chunk-6RJVT65W.js} +2 -0
  7. package/dist/chunk-AUJDREZN.js +445 -0
  8. package/dist/{chunk-I7WEXXZX.js → chunk-FWRDAL73.js} +157 -477
  9. package/dist/{chunk-552GDPBU.js → chunk-LCO6AJOS.js} +433 -59
  10. package/dist/index.cjs +1083 -530
  11. package/dist/index.d.cts +5 -6
  12. package/dist/index.d.ts +5 -6
  13. package/dist/index.js +24 -22
  14. package/dist/{lockupContract-DguuT7NK.d.cts → lockupContract-BTTRVwOt.d.cts} +1 -1
  15. package/dist/{lockupContract-BUOsghl1.d.ts → lockupContract-aFarhlxj.d.ts} +1 -1
  16. package/dist/node/index.d.cts +97 -67
  17. package/dist/node/index.d.ts +97 -67
  18. package/dist/nostr.cjs +925 -516
  19. package/dist/nostr.d.cts +1 -1
  20. package/dist/nostr.d.ts +1 -1
  21. package/dist/nostr.js +3 -2
  22. package/dist/{offerFillPlan-_AOLo6kh.d.ts → offerFillPlan-CJC5tnEd.d.ts} +10 -42
  23. package/dist/{offerFillPlan-Bp6-z6dS.d.cts → offerFillPlan-FmyaQoYT.d.cts} +10 -42
  24. package/dist/protocol.cjs +1054 -175
  25. package/dist/protocol.d.cts +42 -23
  26. package/dist/protocol.d.ts +42 -23
  27. package/dist/protocol.js +20 -7
  28. package/dist/repositories/realm/index.d.cts +3 -2
  29. package/dist/repositories/realm/index.d.ts +3 -2
  30. package/dist/repositories/sqlite/index.d.cts +3 -2
  31. package/dist/repositories/sqlite/index.d.ts +3 -2
  32. package/dist/{repository-CkKK0dGO.d.ts → repository-CwwhIAEd.d.cts} +406 -74
  33. package/dist/{repository--pfikw2R.d.cts → repository-DO6QKxBx.d.ts} +406 -74
  34. package/dist/{rfq-IzhOCG02.d.ts → rfq-CYxOyniL.d.ts} +52 -11
  35. package/dist/rfq-contract.cjs +3 -0
  36. package/dist/rfq-contract.d.cts +3 -1
  37. package/dist/rfq-contract.d.ts +3 -1
  38. package/dist/rfq-contract.js +3 -1
  39. package/dist/{rfq-BRpo5uWU.d.cts → rfq-nMGywkqI.d.cts} +52 -11
  40. package/dist/verify-ENO36VPK.js +33 -0
  41. package/dist/{watch-pvTVFp6-.d.cts → watch-DpDSP2tu.d.cts} +4 -3
  42. package/dist/{watch-DDNycuUa.d.ts → watch-_fZSgx_l.d.ts} +4 -3
  43. package/package.json +2 -2
  44. package/dist/offer-BhonWuKR.d.ts +0 -274
  45. package/dist/offer-D_qHpWo2.d.cts +0 -274
@@ -1,5 +1,7 @@
1
1
  import { VHTLC, IWallet, ProvisionedKey, ProvisionedClaimSecret, asset } from '@arkade-os/sdk';
2
2
  import { RFQ_CONTRACT_VERSION_KEY } from './rfq-contract.js';
3
+ import * as nostr_tools from 'nostr-tools';
4
+ import { DiscoveredMarket } from '@arkade-os/solver-discovery';
3
5
 
4
6
  /** L1 confirmation-depth and reorg margin between dependent timelocks. */
5
7
  declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
@@ -215,6 +217,50 @@ declare function classifyOnchainHtlc(chain: ChainSource, input: {
215
217
  };
216
218
  }): Promise<OnchainHtlcPhase>;
217
219
 
220
+ /**
221
+ * The two string aliases the v2 surface is written in. Aliases rather than branded types, so
222
+ * literals need no constructor.
223
+ */
224
+ /** Lowercase hex, no `0x` prefix — the encoding `@scure/base`'s `hex` emits. */
225
+ type Hex = string;
226
+ /** A secp256k1 public key as {@link Hex}: x-only (32 bytes) or compressed (33). */
227
+ type Pubkey = Hex;
228
+
229
+ /** An {@link RfqTransport} that can prove who answered. Absent means "attests nobody". */
230
+ interface AttestingRfqTransport extends RfqTransport {
231
+ /**
232
+ * The x-only key every reply on this transport is proven to come from. Must be a claim the
233
+ * transport ENFORCES (an author filter plus a conversation key only that author can decrypt
234
+ * to); setting it otherwise turns a check into a decoration.
235
+ */
236
+ readonly attestedResponder?: Pubkey;
237
+ }
238
+ /** What a factory is told about the card it is opening a rendezvous to. */
239
+ interface RfqRendezvous {
240
+ readonly card: DiscoveredMarket;
241
+ /** The card's `discovery_pubkey` — who the request is addressed to. */
242
+ readonly solverPubkey: Pubkey;
243
+ /** The card's relays. */
244
+ readonly relays: readonly string[];
245
+ }
246
+ type RfqTransportFactory = (rendezvous: RfqRendezvous) => AttestingRfqTransport | Promise<AttestingRfqTransport>;
247
+ /** Declare that `transport` proves every reply came from `responder`. */
248
+ declare const attesting: <T extends RfqTransport>(transport: T, responder: Pubkey) => AttestingRfqTransport;
249
+ /**
250
+ * Build the card's Nostr rendezvous bound to one pool, so discovery, quotes, and an
251
+ * app's own readers share one socket per relay. Pass the process-wide
252
+ * `sharedNostrPool()` from `@arkade-os/swap/nostr`, or one the caller owns from
253
+ * `createNostrPool()` (a bare `SimplePool` lets one double close drop the shared socket);
254
+ * omitting it keeps the shared default.
255
+ */
256
+ declare const createNostrTransportFactory: (pool?: nostr_tools.SimplePool) => RfqTransportFactory;
257
+ /**
258
+ * The default: the card's own Nostr rendezvous. It attests the discovery key because
259
+ * `nostrRfqTransport` drops any reply that is not a valid event signed by that key, whatever pool
260
+ * delivered it.
261
+ */
262
+ declare const nostrTransportFactory: RfqTransportFactory;
263
+
218
264
  /** Legs are `<corridor>:<asset>`; a pair is directional, `from->to`. */
219
265
  declare const ARKADE_BTC = "arkade:BTC";
220
266
  declare const LIGHTNING_BTC = "lightning:BTC";
@@ -548,14 +594,14 @@ declare const assertArkadeFundable: (input: {
548
594
  * whatever it quotes.
549
595
  *
550
596
  * Maker keys are read once here so the request profile and the local `createOffer` derivation
551
- * cannot diverge. Throws {@link SwapRefusal}, {@link AddressMismatch} (never fund), or a gate error
552
- * with a stable `reason`.
597
+ * cannot diverge. Throws {@link SwapRefusal}, {@link AddressMismatch} (never fund),
598
+ * `QuoteVerificationFailed` (`responder`), or a gate error with a stable `reason`.
553
599
  *
554
600
  * `client.exchange()` now covers this route end to end — it opens the card's
555
601
  * Nostr rendezvous, sends this same request, runs the full verification set,
556
602
  * and registers, persists and funds in one step — so there is nothing left here
557
- * that it does not do. What it additionally refuses is a transport that cannot
558
- * say who answered, which this function, taking one from its caller, cannot.
603
+ * that it does not do. A transport that cannot say who answered is refused here
604
+ * too, but only once its quote is back; `exchange()` refuses it before asking.
559
605
  *
560
606
  * Funding (caller's job, immediately after, before `valid_until`):
561
607
  * - BTC->asset (`wantAsset`): `wallet.send({ address, amount: Number(fundAmount), extensions: [extension] })`
@@ -563,7 +609,7 @@ declare const assertArkadeFundable: (input: {
563
609
  *
564
610
  * @deprecated Use `client.exchange()`. Moved off the package root to `@arkade-os/swap/protocol`.
565
611
  */
566
- declare function requestArkadeSwap(wallet: IWallet, transport: RfqTransport, params: {
612
+ declare function requestArkadeSwap(wallet: IWallet, transport: AttestingRfqTransport, params: {
567
613
  /** Asset the trader deposits; omit when depositing BTC. */
568
614
  offerAsset?: asset.AssetId;
569
615
  /** Asset the trader wants; omit when wanting BTC. */
@@ -575,16 +621,11 @@ declare function requestArkadeSwap(wallet: IWallet, transport: RfqTransport, par
575
621
  * so asserting it proves nothing and an unbounded caller funds what it is asked. */
576
622
  maxFromAmount?: bigint | number | string;
577
623
  minToAmount?: bigint | number | string;
578
- /** A retry without `contract_versions` goes out under a fresh rfq_id, so the
579
- * returned `rfqId` can differ from this one. */
580
624
  rfqId?: string;
581
625
  /** Co-signer key override (33-byte compressed hex); see `createOffer`. */
582
626
  emulatorPubkey?: string;
583
627
  /** Canonical Arkade payout destination; the maker signing key stays this wallet's. */
584
628
  receiveAddress?: string;
585
- /** Contract versions to advertise, most preferred first; the quote's choice must be one of them.
586
- * Defaults to every covenant this build derives. */
587
- contractVersions?: readonly string[];
588
629
  now?: number;
589
630
  }): Promise<{
590
631
  rfqId: string;
@@ -992,4 +1033,4 @@ declare function requestOnchainReceive(wallet: IWallet, transport: RfqTransport,
992
1033
  secrets: ProvisionedClaimSecret;
993
1034
  }>;
994
1035
 
995
- export { l1ScriptForAddress as $, ARKADE_BTC as A, type RelaySocket as B, type ChainSource as C, type RfqRefusalReason as D, type RfqStatus as E, arkadeAssetLeg as F, arkadeSwapRequest as G, type HtlcUtxo as H, type InvoiceFacts as I, assertArkadeFundable as J, awaitOnchainFill as K, type LightningSendContractParams as L, MAX_MIN_CONFIRMATIONS as M, buildHtlcClaim as N, type OnchainHtlc as O, buildHtlcRefund as P, canonicalAssetAmount as Q, type RfqQuote as R, SwapRefusal as S, type TxStatus as T, claimOnchainFill as U, classifyOnchainHtlc as V, deriveLightningReceive as W, deriveOnchainReceive as X, deriveOnchainSend as Y, extractPreimage as Z, httpTransport as _, RFQ_REFUSAL_ERROR_CODES as a, lightningReceiveContract as a0, lightningReceiveRequest as a1, lightningSendContract as a2, lightningSendRequest as a3, newPreimage as a4, normalizeMakerPkScript as a5, normalizeMakerPublicKey as a6, onchainHtlcScript as a7, onchainReceiveRequest as a8, onchainSendRequest as a9, paymentHashOf as aa, relayTransport as ab, requestArkadeSwap as ac, requestLightningReceive as ad, requestOnchainReceive as ae, unilateralClaimDelay as af, unilateralRefundDelay as ag, unilateralRefundWithoutReceiverDelay as ah, verifyLockupAddress as ai, verifyOfferAddress as aj, verifyReceiveInvoice as ak, type RfqRefusalDetail as b, type RfqRefusalErrorCode as c, type RfqRefusalUnit as d, type RfqTransport as e, type LightningReceiveContractParams as f, type OnchainHtlcParams as g, type OnchainNetwork as h, isRfqRefusalErrorCode as i, requestOnchainSend as j, AddressMismatch as k, type ChainUtxo as l, LIGHTNING_BTC as m, LIGHTNING_RECEIVE_PAIR as n, LIGHTNING_SEND_PAIR as o, LOCKTIME_THRESHOLD as p, MIN_CLAIM_WINDOW_SECONDS as q, requestLightningSend as r, ONCHAIN_BTC as s, ONCHAIN_CLAIM_MARGIN_SECONDS as t, ONCHAIN_DUST_SATS as u, ONCHAIN_ORDER_MARGIN_SECONDS as v, ONCHAIN_RECEIVE_PAIR as w, ONCHAIN_SECONDS_PER_BLOCK as x, ONCHAIN_SEND_PAIR as y, type OnchainHtlcPhase as z };
1036
+ export { canonicalAssetAmount as $, type AttestingRfqTransport as A, ONCHAIN_CLAIM_MARGIN_SECONDS as B, type ChainSource as C, ONCHAIN_DUST_SATS as D, ONCHAIN_ORDER_MARGIN_SECONDS as E, ONCHAIN_RECEIVE_PAIR as F, ONCHAIN_SECONDS_PER_BLOCK as G, type Hex as H, type InvoiceFacts as I, ONCHAIN_SEND_PAIR as J, type OnchainHtlcPhase as K, type LightningSendContractParams as L, MAX_MIN_CONFIRMATIONS as M, type RelaySocket as N, type OnchainHtlc as O, type Pubkey as P, type RfqRefusalReason as Q, type RfqQuote as R, SwapRefusal as S, type TxStatus as T, type RfqStatus as U, arkadeAssetLeg as V, arkadeSwapRequest as W, assertArkadeFundable as X, awaitOnchainFill as Y, buildHtlcClaim as Z, buildHtlcRefund as _, type RfqRendezvous as a, claimOnchainFill as a0, classifyOnchainHtlc as a1, deriveLightningReceive as a2, deriveOnchainReceive as a3, deriveOnchainSend as a4, extractPreimage as a5, httpTransport as a6, l1ScriptForAddress as a7, lightningReceiveContract as a8, lightningReceiveRequest as a9, lightningSendContract as aa, lightningSendRequest as ab, newPreimage as ac, normalizeMakerPkScript as ad, normalizeMakerPublicKey as ae, onchainHtlcScript as af, onchainReceiveRequest as ag, onchainSendRequest as ah, paymentHashOf as ai, relayTransport as aj, requestArkadeSwap as ak, requestLightningReceive as al, requestOnchainReceive as am, unilateralClaimDelay as an, unilateralRefundDelay as ao, unilateralRefundWithoutReceiverDelay as ap, verifyLockupAddress as aq, verifyOfferAddress as ar, verifyReceiveInvoice as as, type RfqTransportFactory as b, attesting as c, createNostrTransportFactory as d, RFQ_REFUSAL_ERROR_CODES as e, type RfqRefusalDetail as f, type RfqRefusalErrorCode as g, type RfqRefusalUnit as h, isRfqRefusalErrorCode as i, type LightningReceiveContractParams as j, type OnchainHtlcParams as k, type OnchainNetwork as l, type RfqTransport as m, nostrTransportFactory as n, requestOnchainSend as o, ARKADE_BTC as p, AddressMismatch as q, requestLightningSend as r, type ChainUtxo as s, type HtlcUtxo as t, LIGHTNING_BTC as u, LIGHTNING_RECEIVE_PAIR as v, LIGHTNING_SEND_PAIR as w, LOCKTIME_THRESHOLD as x, MIN_CLAIM_WINDOW_SECONDS as y, ONCHAIN_BTC as z };
@@ -23,6 +23,7 @@ __export(rfq_contract_exports, {
23
23
  ASSET_SWAP_BASELINE: () => ASSET_SWAP_BASELINE,
24
24
  ASSET_SWAP_V2: () => ASSET_SWAP_V2,
25
25
  ASSET_SWAP_V3: () => ASSET_SWAP_V3,
26
+ ASSET_SWAP_V4: () => ASSET_SWAP_V4,
26
27
  RFQ_CONTRACT_VERSIONS_KEY: () => RFQ_CONTRACT_VERSIONS_KEY,
27
28
  RFQ_CONTRACT_VERSION_KEY: () => RFQ_CONTRACT_VERSION_KEY,
28
29
  RFQ_CONTRACT_VERSION_UNSUPPORTED: () => RFQ_CONTRACT_VERSION_UNSUPPORTED
@@ -33,12 +34,14 @@ var RFQ_CONTRACT_VERSION_KEY = "contract_version";
33
34
  var RFQ_CONTRACT_VERSION_UNSUPPORTED = "contract_version_unsupported";
34
35
  var ASSET_SWAP_V2 = "asset-swap-v2";
35
36
  var ASSET_SWAP_V3 = "asset-swap-v3";
37
+ var ASSET_SWAP_V4 = "asset-swap-v4";
36
38
  var ASSET_SWAP_BASELINE = ASSET_SWAP_V2;
37
39
  // Annotate the CommonJS export names for ESM import in node:
38
40
  0 && (module.exports = {
39
41
  ASSET_SWAP_BASELINE,
40
42
  ASSET_SWAP_V2,
41
43
  ASSET_SWAP_V3,
44
+ ASSET_SWAP_V4,
42
45
  RFQ_CONTRACT_VERSIONS_KEY,
43
46
  RFQ_CONTRACT_VERSION_KEY,
44
47
  RFQ_CONTRACT_VERSION_UNSUPPORTED
@@ -3,7 +3,9 @@ declare const RFQ_CONTRACT_VERSION_KEY = "contract_version";
3
3
  declare const RFQ_CONTRACT_VERSION_UNSUPPORTED = "contract_version_unsupported";
4
4
  declare const ASSET_SWAP_V2 = "asset-swap-v2";
5
5
  declare const ASSET_SWAP_V3 = "asset-swap-v3";
6
+ /** v3 whose `fulfill` also needs the quoting solver's `taker` signature. */
7
+ declare const ASSET_SWAP_V4 = "asset-swap-v4";
6
8
  /** A quote without a negotiated version uses this tree. */
7
9
  declare const ASSET_SWAP_BASELINE = "asset-swap-v2";
8
10
 
9
- export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, RFQ_CONTRACT_VERSIONS_KEY, RFQ_CONTRACT_VERSION_KEY, RFQ_CONTRACT_VERSION_UNSUPPORTED };
11
+ export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, ASSET_SWAP_V4, RFQ_CONTRACT_VERSIONS_KEY, RFQ_CONTRACT_VERSION_KEY, RFQ_CONTRACT_VERSION_UNSUPPORTED };
@@ -3,7 +3,9 @@ declare const RFQ_CONTRACT_VERSION_KEY = "contract_version";
3
3
  declare const RFQ_CONTRACT_VERSION_UNSUPPORTED = "contract_version_unsupported";
4
4
  declare const ASSET_SWAP_V2 = "asset-swap-v2";
5
5
  declare const ASSET_SWAP_V3 = "asset-swap-v3";
6
+ /** v3 whose `fulfill` also needs the quoting solver's `taker` signature. */
7
+ declare const ASSET_SWAP_V4 = "asset-swap-v4";
6
8
  /** A quote without a negotiated version uses this tree. */
7
9
  declare const ASSET_SWAP_BASELINE = "asset-swap-v2";
8
10
 
9
- export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, RFQ_CONTRACT_VERSIONS_KEY, RFQ_CONTRACT_VERSION_KEY, RFQ_CONTRACT_VERSION_UNSUPPORTED };
11
+ export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, ASSET_SWAP_V4, RFQ_CONTRACT_VERSIONS_KEY, RFQ_CONTRACT_VERSION_KEY, RFQ_CONTRACT_VERSION_UNSUPPORTED };
@@ -2,14 +2,16 @@ import {
2
2
  ASSET_SWAP_BASELINE,
3
3
  ASSET_SWAP_V2,
4
4
  ASSET_SWAP_V3,
5
+ ASSET_SWAP_V4,
5
6
  RFQ_CONTRACT_VERSIONS_KEY,
6
7
  RFQ_CONTRACT_VERSION_KEY,
7
8
  RFQ_CONTRACT_VERSION_UNSUPPORTED
8
- } from "./chunk-5QPJWOCN.js";
9
+ } from "./chunk-6RJVT65W.js";
9
10
  export {
10
11
  ASSET_SWAP_BASELINE,
11
12
  ASSET_SWAP_V2,
12
13
  ASSET_SWAP_V3,
14
+ ASSET_SWAP_V4,
13
15
  RFQ_CONTRACT_VERSIONS_KEY,
14
16
  RFQ_CONTRACT_VERSION_KEY,
15
17
  RFQ_CONTRACT_VERSION_UNSUPPORTED
@@ -1,5 +1,7 @@
1
1
  import { VHTLC, IWallet, ProvisionedKey, ProvisionedClaimSecret, asset } from '@arkade-os/sdk';
2
2
  import { RFQ_CONTRACT_VERSION_KEY } from './rfq-contract.cjs';
3
+ import * as nostr_tools from 'nostr-tools';
4
+ import { DiscoveredMarket } from '@arkade-os/solver-discovery';
3
5
 
4
6
  /** L1 confirmation-depth and reorg margin between dependent timelocks. */
5
7
  declare const ONCHAIN_ORDER_MARGIN_SECONDS: number;
@@ -215,6 +217,50 @@ declare function classifyOnchainHtlc(chain: ChainSource, input: {
215
217
  };
216
218
  }): Promise<OnchainHtlcPhase>;
217
219
 
220
+ /**
221
+ * The two string aliases the v2 surface is written in. Aliases rather than branded types, so
222
+ * literals need no constructor.
223
+ */
224
+ /** Lowercase hex, no `0x` prefix — the encoding `@scure/base`'s `hex` emits. */
225
+ type Hex = string;
226
+ /** A secp256k1 public key as {@link Hex}: x-only (32 bytes) or compressed (33). */
227
+ type Pubkey = Hex;
228
+
229
+ /** An {@link RfqTransport} that can prove who answered. Absent means "attests nobody". */
230
+ interface AttestingRfqTransport extends RfqTransport {
231
+ /**
232
+ * The x-only key every reply on this transport is proven to come from. Must be a claim the
233
+ * transport ENFORCES (an author filter plus a conversation key only that author can decrypt
234
+ * to); setting it otherwise turns a check into a decoration.
235
+ */
236
+ readonly attestedResponder?: Pubkey;
237
+ }
238
+ /** What a factory is told about the card it is opening a rendezvous to. */
239
+ interface RfqRendezvous {
240
+ readonly card: DiscoveredMarket;
241
+ /** The card's `discovery_pubkey` — who the request is addressed to. */
242
+ readonly solverPubkey: Pubkey;
243
+ /** The card's relays. */
244
+ readonly relays: readonly string[];
245
+ }
246
+ type RfqTransportFactory = (rendezvous: RfqRendezvous) => AttestingRfqTransport | Promise<AttestingRfqTransport>;
247
+ /** Declare that `transport` proves every reply came from `responder`. */
248
+ declare const attesting: <T extends RfqTransport>(transport: T, responder: Pubkey) => AttestingRfqTransport;
249
+ /**
250
+ * Build the card's Nostr rendezvous bound to one pool, so discovery, quotes, and an
251
+ * app's own readers share one socket per relay. Pass the process-wide
252
+ * `sharedNostrPool()` from `@arkade-os/swap/nostr`, or one the caller owns from
253
+ * `createNostrPool()` (a bare `SimplePool` lets one double close drop the shared socket);
254
+ * omitting it keeps the shared default.
255
+ */
256
+ declare const createNostrTransportFactory: (pool?: nostr_tools.SimplePool) => RfqTransportFactory;
257
+ /**
258
+ * The default: the card's own Nostr rendezvous. It attests the discovery key because
259
+ * `nostrRfqTransport` drops any reply that is not a valid event signed by that key, whatever pool
260
+ * delivered it.
261
+ */
262
+ declare const nostrTransportFactory: RfqTransportFactory;
263
+
218
264
  /** Legs are `<corridor>:<asset>`; a pair is directional, `from->to`. */
219
265
  declare const ARKADE_BTC = "arkade:BTC";
220
266
  declare const LIGHTNING_BTC = "lightning:BTC";
@@ -548,14 +594,14 @@ declare const assertArkadeFundable: (input: {
548
594
  * whatever it quotes.
549
595
  *
550
596
  * Maker keys are read once here so the request profile and the local `createOffer` derivation
551
- * cannot diverge. Throws {@link SwapRefusal}, {@link AddressMismatch} (never fund), or a gate error
552
- * with a stable `reason`.
597
+ * cannot diverge. Throws {@link SwapRefusal}, {@link AddressMismatch} (never fund),
598
+ * `QuoteVerificationFailed` (`responder`), or a gate error with a stable `reason`.
553
599
  *
554
600
  * `client.exchange()` now covers this route end to end — it opens the card's
555
601
  * Nostr rendezvous, sends this same request, runs the full verification set,
556
602
  * and registers, persists and funds in one step — so there is nothing left here
557
- * that it does not do. What it additionally refuses is a transport that cannot
558
- * say who answered, which this function, taking one from its caller, cannot.
603
+ * that it does not do. A transport that cannot say who answered is refused here
604
+ * too, but only once its quote is back; `exchange()` refuses it before asking.
559
605
  *
560
606
  * Funding (caller's job, immediately after, before `valid_until`):
561
607
  * - BTC->asset (`wantAsset`): `wallet.send({ address, amount: Number(fundAmount), extensions: [extension] })`
@@ -563,7 +609,7 @@ declare const assertArkadeFundable: (input: {
563
609
  *
564
610
  * @deprecated Use `client.exchange()`. Moved off the package root to `@arkade-os/swap/protocol`.
565
611
  */
566
- declare function requestArkadeSwap(wallet: IWallet, transport: RfqTransport, params: {
612
+ declare function requestArkadeSwap(wallet: IWallet, transport: AttestingRfqTransport, params: {
567
613
  /** Asset the trader deposits; omit when depositing BTC. */
568
614
  offerAsset?: asset.AssetId;
569
615
  /** Asset the trader wants; omit when wanting BTC. */
@@ -575,16 +621,11 @@ declare function requestArkadeSwap(wallet: IWallet, transport: RfqTransport, par
575
621
  * so asserting it proves nothing and an unbounded caller funds what it is asked. */
576
622
  maxFromAmount?: bigint | number | string;
577
623
  minToAmount?: bigint | number | string;
578
- /** A retry without `contract_versions` goes out under a fresh rfq_id, so the
579
- * returned `rfqId` can differ from this one. */
580
624
  rfqId?: string;
581
625
  /** Co-signer key override (33-byte compressed hex); see `createOffer`. */
582
626
  emulatorPubkey?: string;
583
627
  /** Canonical Arkade payout destination; the maker signing key stays this wallet's. */
584
628
  receiveAddress?: string;
585
- /** Contract versions to advertise, most preferred first; the quote's choice must be one of them.
586
- * Defaults to every covenant this build derives. */
587
- contractVersions?: readonly string[];
588
629
  now?: number;
589
630
  }): Promise<{
590
631
  rfqId: string;
@@ -992,4 +1033,4 @@ declare function requestOnchainReceive(wallet: IWallet, transport: RfqTransport,
992
1033
  secrets: ProvisionedClaimSecret;
993
1034
  }>;
994
1035
 
995
- export { l1ScriptForAddress as $, ARKADE_BTC as A, type RelaySocket as B, type ChainSource as C, type RfqRefusalReason as D, type RfqStatus as E, arkadeAssetLeg as F, arkadeSwapRequest as G, type HtlcUtxo as H, type InvoiceFacts as I, assertArkadeFundable as J, awaitOnchainFill as K, type LightningSendContractParams as L, MAX_MIN_CONFIRMATIONS as M, buildHtlcClaim as N, type OnchainHtlc as O, buildHtlcRefund as P, canonicalAssetAmount as Q, type RfqQuote as R, SwapRefusal as S, type TxStatus as T, claimOnchainFill as U, classifyOnchainHtlc as V, deriveLightningReceive as W, deriveOnchainReceive as X, deriveOnchainSend as Y, extractPreimage as Z, httpTransport as _, RFQ_REFUSAL_ERROR_CODES as a, lightningReceiveContract as a0, lightningReceiveRequest as a1, lightningSendContract as a2, lightningSendRequest as a3, newPreimage as a4, normalizeMakerPkScript as a5, normalizeMakerPublicKey as a6, onchainHtlcScript as a7, onchainReceiveRequest as a8, onchainSendRequest as a9, paymentHashOf as aa, relayTransport as ab, requestArkadeSwap as ac, requestLightningReceive as ad, requestOnchainReceive as ae, unilateralClaimDelay as af, unilateralRefundDelay as ag, unilateralRefundWithoutReceiverDelay as ah, verifyLockupAddress as ai, verifyOfferAddress as aj, verifyReceiveInvoice as ak, type RfqRefusalDetail as b, type RfqRefusalErrorCode as c, type RfqRefusalUnit as d, type RfqTransport as e, type LightningReceiveContractParams as f, type OnchainHtlcParams as g, type OnchainNetwork as h, isRfqRefusalErrorCode as i, requestOnchainSend as j, AddressMismatch as k, type ChainUtxo as l, LIGHTNING_BTC as m, LIGHTNING_RECEIVE_PAIR as n, LIGHTNING_SEND_PAIR as o, LOCKTIME_THRESHOLD as p, MIN_CLAIM_WINDOW_SECONDS as q, requestLightningSend as r, ONCHAIN_BTC as s, ONCHAIN_CLAIM_MARGIN_SECONDS as t, ONCHAIN_DUST_SATS as u, ONCHAIN_ORDER_MARGIN_SECONDS as v, ONCHAIN_RECEIVE_PAIR as w, ONCHAIN_SECONDS_PER_BLOCK as x, ONCHAIN_SEND_PAIR as y, type OnchainHtlcPhase as z };
1036
+ export { canonicalAssetAmount as $, type AttestingRfqTransport as A, ONCHAIN_CLAIM_MARGIN_SECONDS as B, type ChainSource as C, ONCHAIN_DUST_SATS as D, ONCHAIN_ORDER_MARGIN_SECONDS as E, ONCHAIN_RECEIVE_PAIR as F, ONCHAIN_SECONDS_PER_BLOCK as G, type Hex as H, type InvoiceFacts as I, ONCHAIN_SEND_PAIR as J, type OnchainHtlcPhase as K, type LightningSendContractParams as L, MAX_MIN_CONFIRMATIONS as M, type RelaySocket as N, type OnchainHtlc as O, type Pubkey as P, type RfqRefusalReason as Q, type RfqQuote as R, SwapRefusal as S, type TxStatus as T, type RfqStatus as U, arkadeAssetLeg as V, arkadeSwapRequest as W, assertArkadeFundable as X, awaitOnchainFill as Y, buildHtlcClaim as Z, buildHtlcRefund as _, type RfqRendezvous as a, claimOnchainFill as a0, classifyOnchainHtlc as a1, deriveLightningReceive as a2, deriveOnchainReceive as a3, deriveOnchainSend as a4, extractPreimage as a5, httpTransport as a6, l1ScriptForAddress as a7, lightningReceiveContract as a8, lightningReceiveRequest as a9, lightningSendContract as aa, lightningSendRequest as ab, newPreimage as ac, normalizeMakerPkScript as ad, normalizeMakerPublicKey as ae, onchainHtlcScript as af, onchainReceiveRequest as ag, onchainSendRequest as ah, paymentHashOf as ai, relayTransport as aj, requestArkadeSwap as ak, requestLightningReceive as al, requestOnchainReceive as am, unilateralClaimDelay as an, unilateralRefundDelay as ao, unilateralRefundWithoutReceiverDelay as ap, verifyLockupAddress as aq, verifyOfferAddress as ar, verifyReceiveInvoice as as, type RfqTransportFactory as b, attesting as c, createNostrTransportFactory as d, RFQ_REFUSAL_ERROR_CODES as e, type RfqRefusalDetail as f, type RfqRefusalErrorCode as g, type RfqRefusalUnit as h, isRfqRefusalErrorCode as i, type LightningReceiveContractParams as j, type OnchainHtlcParams as k, type OnchainNetwork as l, type RfqTransport as m, nostrTransportFactory as n, requestOnchainSend as o, ARKADE_BTC as p, AddressMismatch as q, requestLightningSend as r, type ChainUtxo as s, type HtlcUtxo as t, LIGHTNING_BTC as u, LIGHTNING_RECEIVE_PAIR as v, LIGHTNING_SEND_PAIR as w, LOCKTIME_THRESHOLD as x, MIN_CLAIM_WINDOW_SECONDS as y, ONCHAIN_BTC as z };
@@ -0,0 +1,33 @@
1
+ import {
2
+ verifiedCarrierSats,
3
+ verifyCrossAssetAmount,
4
+ verifyPair,
5
+ verifyQuoteTtl,
6
+ verifyQuotedAmount,
7
+ verifyReceiveInvoiceFacts,
8
+ verifyReceiveWindow,
9
+ verifyRefundWindow,
10
+ verifyResponder,
11
+ verifySendInvoice,
12
+ verifySendWindow,
13
+ verifyTaker,
14
+ verifyingDerivation
15
+ } from "./chunk-AUJDREZN.js";
16
+ import "./chunk-LCO6AJOS.js";
17
+ import "./chunk-6RJVT65W.js";
18
+ import "./chunk-A3SHHRX4.js";
19
+ export {
20
+ verifiedCarrierSats,
21
+ verifyCrossAssetAmount,
22
+ verifyPair,
23
+ verifyQuoteTtl,
24
+ verifyQuotedAmount,
25
+ verifyReceiveInvoiceFacts,
26
+ verifyReceiveWindow,
27
+ verifyRefundWindow,
28
+ verifyResponder,
29
+ verifySendInvoice,
30
+ verifySendWindow,
31
+ verifyTaker,
32
+ verifyingDerivation
33
+ };
@@ -1,5 +1,5 @@
1
1
  import { IWallet } from '@arkade-os/sdk';
2
- import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository--pfikw2R.cjs';
2
+ import { c as AssetSwapStatus, ct as RecordedOfferBinding, d as AssetSwapRepository, h as AssetSwap } from './repository-CwwhIAEd.cjs';
3
3
 
4
4
  /**
5
5
  * What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
@@ -12,8 +12,9 @@ import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from '
12
12
  interface OfferSwapFacts {
13
13
  readonly id: string;
14
14
  readonly status: AssetSwapStatus;
15
- /** The TLV offer, hex — what {@link classifyDepositSpend} needs. */
16
- readonly offerHex: string;
15
+ /** What {@link classifyDepositSpend} rebuilds the covenant from: the binding, else the TLV. */
16
+ readonly offerHex?: string;
17
+ readonly binding?: RecordedOfferBinding;
17
18
  readonly swapPkScript: string;
18
19
  readonly fundingTxid?: string;
19
20
  readonly spentTxid?: string;
@@ -1,5 +1,5 @@
1
1
  import { IWallet } from '@arkade-os/sdk';
2
- import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from './repository-CkKK0dGO.js';
2
+ import { c as AssetSwapStatus, ct as RecordedOfferBinding, d as AssetSwapRepository, h as AssetSwap } from './repository-DO6QKxBx.js';
3
3
 
4
4
  /**
5
5
  * What this watcher needs to know about an offer swap, narrower than {@link AssetSwap}
@@ -12,8 +12,9 @@ import { c as AssetSwapStatus, d as AssetSwapRepository, h as AssetSwap } from '
12
12
  interface OfferSwapFacts {
13
13
  readonly id: string;
14
14
  readonly status: AssetSwapStatus;
15
- /** The TLV offer, hex — what {@link classifyDepositSpend} needs. */
16
- readonly offerHex: string;
15
+ /** What {@link classifyDepositSpend} rebuilds the covenant from: the binding, else the TLV. */
16
+ readonly offerHex?: string;
17
+ readonly binding?: RecordedOfferBinding;
17
18
  readonly swapPkScript: string;
18
19
  readonly fundingTxid?: string;
19
20
  readonly spentTxid?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/swap",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Client-side Arkade Intents asset swaps: state a route, get an outcome. Pay a bolt11 invoice, receive over Lightning, exchange assets, or withdraw onchain.",
6
6
  "repository": {
@@ -114,7 +114,7 @@
114
114
  "@scure/base": "2.4.0",
115
115
  "@scure/btc-signer": "2.4.1",
116
116
  "light-bolt11-decoder": "3.2.0",
117
- "@arkade-os/sdk": "0.5.9"
117
+ "@arkade-os/sdk": "0.5.10"
118
118
  },
119
119
  "peerDependencies": {
120
120
  "nostr-tools": "2.24.1"