@arkade-os/swap 0.1.8 → 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 +1125 -554
  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-ISWLKKSS.js → chunk-2HQZLIVX.js} +106 -39
  6. package/dist/{chunk-5QPJWOCN.js → chunk-6RJVT65W.js} +2 -0
  7. package/dist/chunk-AUJDREZN.js +445 -0
  8. package/dist/{chunk-ZBJGLLYV.js → chunk-FWRDAL73.js} +157 -477
  9. package/dist/{chunk-PDNVKH5L.js → chunk-LCO6AJOS.js} +453 -70
  10. package/dist/index.cjs +1110 -542
  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 +1082 -188
  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,14 +1,13 @@
1
1
  import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
2
- import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository--pfikw2R.cjs';
3
- export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository--pfikw2R.cjs';
4
- import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-BRpo5uWU.cjs';
5
- export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-BRpo5uWU.cjs';
6
- export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-DguuT7NK.cjs';
2
+ import { bk as SwapSecretsProjection, e as RfqSwapRecord, bj as OfferBinding, bl as Offer, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, b9 as RfqSwapState, bb as SwapOperator, bm as LockupContractSource, bn as RfqSwap, bo as ArkadeRefundResult, bp as LockupVtxo } from './repository-CwwhIAEd.cjs';
3
+ export { bq as ASSET_CARRIER_SATS, br as ASSET_SWAP_CONTRACT_VERSIONS, bs as ASSET_SWAP_DERIVABLE_VERSIONS, bt as AssetSwapContractVersion, c as AssetSwapStatus, bu as AvailableRfqSwapManagerCallbacks, bv as BTC_ASSET_ID, bg as FillFunding, bh as FillOutpoint, bw as LightningReceiveSwap, bx as LightningSendSwap, by as LockupFate, bz as LockupNeedsRecoveryError, bA as LockupParams, bB as LockupSpend, bC as NoSpendableDepositError, bD as OFFER_PACKET_TYPE, bE as OfferCovenantMismatchError, bF as OnchainReceiveAction, bG as OnchainReceiveNeedsChainSource, bH as OnchainReceiveSwap, bI as OnchainSendAction, bJ as OnchainSendSwap, bK as PersistableRfqSwap, bL as PreimageBlockedReason, bM as PreimageNotRecoverableError, bN as REFUND_MTP_LAG_SECONDS, bO as RFQ_SWAP_RETENTION_SECONDS, bP as ReceiveLockupSwap, bQ as RfqRestoreFailure, bR as RfqRestoreOptions, bS as RfqRestoreResult, be as RfqSwapActionName, bT as RfqSwapLockup, bU as RfqSwapManager, bd as RfqSwapManagerCallbacks, bV as RfqSwapManagerConfig, bW as RfqSwapManagerDeps, bX as RfqSwapManagerEvents, bY as RfqSwapOrigin, bZ as RfqSwapOriginRequired, b_ as RfqSwapOutcome, a as RfqSwapRecordStore, b$ as addAssetSwap, c0 as assetSwapContractVersion, c1 as awaitRfqResolution, c2 as bindingFromOffer, c3 as bindingProgram, c4 as cancelOffer, c5 as createOffer, c6 as createRfqSwapRecord, c7 as decodeOffer, c8 as encodeOffer, c9 as fillOffer, ca as findLockupVtxos, cb as getAssetSwaps, cc as isRfqTerminal, cd as nextOnchainAction, ce as nextOnchainReceiveAction, cf as normalizeRfqSwapRecord, cg as offerContract, ch as offerFromBinding, ci as offerVtxoScript, cj as preimageForSwapRecord, ck as pushRefundWithoutReceiver, cl as readLockupFate, cm as rebuildRfqSwap, cn as rfqSwapOriginOf, co as shouldRetainRfqSwap, cp as swapPrograms, cq as swapSecretsToRecord, cr as updateAssetSwap, cs as updateRfqSwapRecord } from './repository-CwwhIAEd.cjs';
4
+ import { l as OnchainNetwork, O as OnchainHtlc, k as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, m as RfqTransport, r as requestLightningSend, o as requestOnchainSend } from './rfq-nMGywkqI.cjs';
5
+ export { p as ARKADE_BTC, q as AddressMismatch, s as ChainUtxo, t as HtlcUtxo, u as LIGHTNING_BTC, v as LIGHTNING_RECEIVE_PAIR, w as LIGHTNING_SEND_PAIR, x as LOCKTIME_THRESHOLD, j as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, y as MIN_CLAIM_WINDOW_SECONDS, z as ONCHAIN_BTC, B as ONCHAIN_CLAIM_MARGIN_SECONDS, D as ONCHAIN_DUST_SATS, E as ONCHAIN_ORDER_MARGIN_SECONDS, F as ONCHAIN_RECEIVE_PAIR, G as ONCHAIN_SECONDS_PER_BLOCK, J as ONCHAIN_SEND_PAIR, K as OnchainHtlcPhase, N as RelaySocket, R as RfqQuote, Q as RfqRefusalReason, U as RfqStatus, V as arkadeAssetLeg, W as arkadeSwapRequest, X as assertArkadeFundable, Y as awaitOnchainFill, Z as buildHtlcClaim, _ as buildHtlcRefund, $ as canonicalAssetAmount, a0 as claimOnchainFill, a1 as classifyOnchainHtlc, a2 as deriveLightningReceive, a3 as deriveOnchainReceive, a4 as deriveOnchainSend, a5 as extractPreimage, a6 as httpTransport, a7 as l1ScriptForAddress, a8 as lightningReceiveContract, a9 as lightningReceiveRequest, aa as lightningSendContract, ab as lightningSendRequest, ac as newPreimage, ad as normalizeMakerPkScript, ae as normalizeMakerPublicKey, af as onchainHtlcScript, ag as onchainReceiveRequest, ah as onchainSendRequest, ai as paymentHashOf, aj as relayTransport, ak as requestArkadeSwap, al as requestLightningReceive, am as requestOnchainReceive, an as unilateralClaimDelay, ao as unilateralRefundDelay, ap as unilateralRefundWithoutReceiverDelay, aq as verifyLockupAddress, ar as verifyOfferAddress, as as verifyReceiveInvoice } from './rfq-nMGywkqI.cjs';
6
+ export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-BTTRVwOt.cjs';
7
7
  import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
8
- import { O as Offer } from './offer-D_qHpWo2.cjs';
9
- export { A as ASSET_CARRIER_SATS, c as ASSET_SWAP_CONTRACT_VERSIONS, d as AssetSwapContractVersion, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, e as OFFER_PACKET_TYPE, f as OfferCovenantMismatchError, g as assetSwapContractVersion, h as cancelOffer, i as createOffer, j as decodeOffer, k as encodeOffer, l as fillOffer, o as offerContract, m as offerVtxoScript, s as swapPrograms } from './offer-D_qHpWo2.cjs';
10
- export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-pvTVFp6-.cjs';
11
- export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3 } from './rfq-contract.cjs';
8
+ export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-DpDSP2tu.cjs';
9
+ export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, ASSET_SWAP_V4 } from './rfq-contract.cjs';
10
+ import 'nostr-tools';
12
11
 
13
12
  /** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
14
13
  * whose leg this wallet never signs. */
@@ -207,9 +206,10 @@ type SpendKind = "cancelled" | "fulfilled" | "indeterminate";
207
206
  * `indeterminate`. {@link classifyDepositSpend} tries both.
208
207
  *
209
208
  * @param operatorPubkey - The key the covenant was *funded* against. A rotated key fails
210
- * the script match and yields `indeterminate` rather than a guess.
209
+ * the script match and yields `indeterminate` rather than a guess. Unused for an
210
+ * {@link OfferBinding}, which pins its own.
211
211
  */
212
- declare function classifySpend(offer: Offer, operatorPubkey: Uint8Array, spendTx: Transaction, deposit: {
212
+ declare function classifySpend(offer: Offer | OfferBinding, operatorPubkey: Uint8Array, spendTx: Transaction, deposit: {
213
213
  txid: string;
214
214
  vout: number;
215
215
  }): SpendKind;
@@ -222,10 +222,36 @@ declare const spendTxidsOf: (vtxo: {
222
222
  * Classify a deposit's spend across both halves of it (`spentBy` and `arkTxId`, which
223
223
  * may be the same id for a settlement), taking the first definite answer.
224
224
  */
225
- declare function classifyDepositSpend(offer: Offer, operatorPubkey: Uint8Array, spendTxs: Iterable<Transaction>, deposit: {
225
+ declare function classifyDepositSpend(offer: Offer | OfferBinding, operatorPubkey: Uint8Array, spendTxs: Iterable<Transaction>, deposit: {
226
226
  txid: string;
227
227
  vout: number;
228
228
  }): SpendKind;
229
+ /** A way to learn of a deposit this wallet funded but holds no record for. */
230
+ interface OfferRecoverySource {
231
+ readonly name: string;
232
+ /**
233
+ * Bindings for candidate deposits, by funding txid (identical offers share an address).
234
+ * `declined` names txids this source positively ruled out as swaps, so they are marked
235
+ * scanned; a txid in neither list is asked again by a later scan.
236
+ */
237
+ discover(opts: {
238
+ readonly candidateTxids: readonly string[];
239
+ readonly operatorPubkey: Uint8Array;
240
+ }): Promise<{
241
+ readonly found: readonly {
242
+ readonly fundingTxid: string;
243
+ readonly binding: OfferBinding;
244
+ /** The packet the binding came from, when the source read one. */
245
+ readonly offerHex?: string;
246
+ }[];
247
+ readonly declined: readonly string[];
248
+ }>;
249
+ }
250
+ /**
251
+ * The funding tx's own `0x03` packet, as a source. A packet that is present but does not
252
+ * decode is neither found nor declined: a later build may read it.
253
+ */
254
+ declare const packetRecoverySource: (indexer: RestoreIndexer) => OfferRecoverySource;
229
255
  /**
230
256
  * Scan the given candidates for offer packets and rebuild the AssetSwap records the store
231
257
  * lost. Returns the rebuilt swaps plus the txids that got an authoritative answer, which
@@ -246,6 +272,8 @@ declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingI
246
272
  hrp?: string;
247
273
  /** Commitment txids of recovery rounds this wallet ran (`recoverVtxos()`'s return). */
248
274
  recoveredIn?: ReadonlySet<string>;
275
+ /** Asked in order, first answer per deposit kept. Default: the packet scan alone. */
276
+ sources?: readonly OfferRecoverySource[];
249
277
  }): Promise<{
250
278
  restored: AssetSwap[];
251
279
  scannedTxids: string[];
@@ -470,15 +498,6 @@ type PlanError = "insufficient-balance" | "side-disabled" | "below-min" | "above
470
498
  /** Validate a plan against the user's balance and the server dust limit.*/
471
499
  declare const validatePlan: (plan: OfferPlan, giveBalance: bigint, dust: bigint) => PlanError | undefined;
472
500
 
473
- /**
474
- * `cross-asset` — pay an asset the wallet does not hold, by swapping into it
475
- * first. Both legs are quotable up front, so they price into one `RouteQuote`
476
- * and the router needs no multi-hop primitive.
477
- *
478
- * BTC -> asset only: `createOffer` refuses anything but BTC<->asset, and
479
- * keying `findMarket` on BTC is what enforces that.
480
- */
481
-
482
501
  /** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
483
502
  declare const CROSS_ASSET_RAIL = "cross-asset";
484
503
  /**
@@ -509,7 +528,7 @@ interface CrossAssetRailDeps {
509
528
  btcBalance(): Promise<bigint>;
510
529
  dust(): Promise<bigint>;
511
530
  /** Before every irreversible step and once after the last. See
512
- * {@link CrossAssetPhase}. Keyed by `offerHex`. */
531
+ * {@link CrossAssetPhase}. Keyed by `swapPkScript`. */
513
532
  persist(swap: CrossAssetSwap): Promise<void>;
514
533
  /** Resolve once a filler has delivered the asset to this wallet.
515
534
  *
@@ -674,4 +693,4 @@ declare function senderIdentityForSwapRecord(wallet: IWallet, record: {
674
693
  signingDescriptor?: string;
675
694
  }): Promise<Identity>;
676
695
 
677
- export { ArkadeRefundResult, type ArkadeRefunderDeps, CROSS_ASSET_RAIL, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractSource, LockupVtxo, Offer, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainReceiveProfile, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, type RefundBlockedReason, RefundNotLocallyPossibleError, type RestoreIndexer, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqTransport, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, arkadeRefunder, chainSourceFrom, classifyDepositSpend, classifySpend, crossAssetRail, discoverMarkets, findMarket, makeCachedFeedFetch, onchainReceiveProfile, onchainSendProfile, pushClaim, requestLightningSend, requestOnchainSend, restoreAssetSwaps, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, swapActivityResolver, validatePlan, watchMarkets };
696
+ export { ArkadeRefundResult, type ArkadeRefunderDeps, CROSS_ASSET_RAIL, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractSource, LockupVtxo, Offer, OfferBinding, type OfferRecoverySource, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainReceiveProfile, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, type RefundBlockedReason, RefundNotLocallyPossibleError, type RestoreIndexer, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqTransport, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, arkadeRefunder, chainSourceFrom, classifyDepositSpend, classifySpend, crossAssetRail, discoverMarkets, findMarket, makeCachedFeedFetch, onchainReceiveProfile, onchainSendProfile, packetRecoverySource, pushClaim, requestLightningSend, requestOnchainSend, restoreAssetSwaps, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, swapActivityResolver, validatePlan, watchMarkets };
@@ -1,14 +1,13 @@
1
1
  import { ProvisionedKey, ProvisionedClaimSecret, RestIndexerProvider, Transaction, ActivityResolver, IWallet, Network, OnchainProvider, VHTLC, Identity, Asset, PaymentRail } from '@arkade-os/sdk';
2
- import { bh as SwapSecretsProjection, e as RfqSwapRecord, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, bb as RfqSwapState, bd as SwapOperator, bi as LockupContractSource, bj as RfqSwap, bk as ArkadeRefundResult, bl as LockupVtxo } from './repository-CkKK0dGO.js';
3
- export { c as AssetSwapStatus, bm as AvailableRfqSwapManagerCallbacks, bn as BTC_ASSET_ID, bo as LightningReceiveSwap, bp as LightningSendSwap, bq as LockupFate, br as LockupNeedsRecoveryError, bs as LockupParams, bt as LockupSpend, bu as OnchainReceiveAction, bv as OnchainReceiveNeedsChainSource, bw as OnchainReceiveSwap, bx as OnchainSendAction, by as OnchainSendSwap, bz as PersistableRfqSwap, bA as PreimageBlockedReason, bB as PreimageNotRecoverableError, bC as REFUND_MTP_LAG_SECONDS, bD as RFQ_SWAP_RETENTION_SECONDS, bE as ReceiveLockupSwap, bF as RfqRestoreFailure, bG as RfqRestoreOptions, bH as RfqRestoreResult, bg as RfqSwapActionName, bI as RfqSwapLockup, bJ as RfqSwapManager, bf as RfqSwapManagerCallbacks, bK as RfqSwapManagerConfig, bL as RfqSwapManagerDeps, bM as RfqSwapManagerEvents, bN as RfqSwapOrigin, bO as RfqSwapOriginRequired, bP as RfqSwapOutcome, a as RfqSwapRecordStore, bQ as addAssetSwap, bR as awaitRfqResolution, bS as createRfqSwapRecord, bT as findLockupVtxos, bU as getAssetSwaps, bV as isRfqTerminal, bW as nextOnchainAction, bX as nextOnchainReceiveAction, bY as normalizeRfqSwapRecord, bZ as preimageForSwapRecord, b_ as pushRefundWithoutReceiver, b$ as readLockupFate, c0 as rebuildRfqSwap, c1 as rfqSwapOriginOf, c2 as shouldRetainRfqSwap, c3 as swapSecretsToRecord, c4 as updateAssetSwap, c5 as updateRfqSwapRecord } from './repository-CkKK0dGO.js';
4
- import { h as OnchainNetwork, O as OnchainHtlc, g as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, e as RfqTransport, r as requestLightningSend, j as requestOnchainSend } from './rfq-IzhOCG02.js';
5
- export { A as ARKADE_BTC, k as AddressMismatch, l as ChainUtxo, H as HtlcUtxo, m as LIGHTNING_BTC, n as LIGHTNING_RECEIVE_PAIR, o as LIGHTNING_SEND_PAIR, p as LOCKTIME_THRESHOLD, f as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, q as MIN_CLAIM_WINDOW_SECONDS, s as ONCHAIN_BTC, t as ONCHAIN_CLAIM_MARGIN_SECONDS, u as ONCHAIN_DUST_SATS, v as ONCHAIN_ORDER_MARGIN_SECONDS, w as ONCHAIN_RECEIVE_PAIR, x as ONCHAIN_SECONDS_PER_BLOCK, y as ONCHAIN_SEND_PAIR, z as OnchainHtlcPhase, B as RelaySocket, R as RfqQuote, D as RfqRefusalReason, E as RfqStatus, F as arkadeAssetLeg, G as arkadeSwapRequest, J as assertArkadeFundable, K as awaitOnchainFill, N as buildHtlcClaim, P as buildHtlcRefund, Q as canonicalAssetAmount, U as claimOnchainFill, V as classifyOnchainHtlc, W as deriveLightningReceive, X as deriveOnchainReceive, Y as deriveOnchainSend, Z as extractPreimage, _ as httpTransport, $ as l1ScriptForAddress, a0 as lightningReceiveContract, a1 as lightningReceiveRequest, a2 as lightningSendContract, a3 as lightningSendRequest, a4 as newPreimage, a5 as normalizeMakerPkScript, a6 as normalizeMakerPublicKey, a7 as onchainHtlcScript, a8 as onchainReceiveRequest, a9 as onchainSendRequest, aa as paymentHashOf, ab as relayTransport, ac as requestArkadeSwap, ad as requestLightningReceive, ae as requestOnchainReceive, af as unilateralClaimDelay, ag as unilateralRefundDelay, ah as unilateralRefundWithoutReceiverDelay, ai as verifyLockupAddress, aj as verifyOfferAddress, ak as verifyReceiveInvoice } from './rfq-IzhOCG02.js';
6
- export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-BUOsghl1.js';
2
+ import { bk as SwapSecretsProjection, e as RfqSwapRecord, bj as OfferBinding, bl as Offer, h as AssetSwap, d as AssetSwapRepository, L as LockupSpendIndexer, b9 as RfqSwapState, bb as SwapOperator, bm as LockupContractSource, bn as RfqSwap, bo as ArkadeRefundResult, bp as LockupVtxo } from './repository-DO6QKxBx.js';
3
+ export { bq as ASSET_CARRIER_SATS, br as ASSET_SWAP_CONTRACT_VERSIONS, bs as ASSET_SWAP_DERIVABLE_VERSIONS, bt as AssetSwapContractVersion, c as AssetSwapStatus, bu as AvailableRfqSwapManagerCallbacks, bv as BTC_ASSET_ID, bg as FillFunding, bh as FillOutpoint, bw as LightningReceiveSwap, bx as LightningSendSwap, by as LockupFate, bz as LockupNeedsRecoveryError, bA as LockupParams, bB as LockupSpend, bC as NoSpendableDepositError, bD as OFFER_PACKET_TYPE, bE as OfferCovenantMismatchError, bF as OnchainReceiveAction, bG as OnchainReceiveNeedsChainSource, bH as OnchainReceiveSwap, bI as OnchainSendAction, bJ as OnchainSendSwap, bK as PersistableRfqSwap, bL as PreimageBlockedReason, bM as PreimageNotRecoverableError, bN as REFUND_MTP_LAG_SECONDS, bO as RFQ_SWAP_RETENTION_SECONDS, bP as ReceiveLockupSwap, bQ as RfqRestoreFailure, bR as RfqRestoreOptions, bS as RfqRestoreResult, be as RfqSwapActionName, bT as RfqSwapLockup, bU as RfqSwapManager, bd as RfqSwapManagerCallbacks, bV as RfqSwapManagerConfig, bW as RfqSwapManagerDeps, bX as RfqSwapManagerEvents, bY as RfqSwapOrigin, bZ as RfqSwapOriginRequired, b_ as RfqSwapOutcome, a as RfqSwapRecordStore, b$ as addAssetSwap, c0 as assetSwapContractVersion, c1 as awaitRfqResolution, c2 as bindingFromOffer, c3 as bindingProgram, c4 as cancelOffer, c5 as createOffer, c6 as createRfqSwapRecord, c7 as decodeOffer, c8 as encodeOffer, c9 as fillOffer, ca as findLockupVtxos, cb as getAssetSwaps, cc as isRfqTerminal, cd as nextOnchainAction, ce as nextOnchainReceiveAction, cf as normalizeRfqSwapRecord, cg as offerContract, ch as offerFromBinding, ci as offerVtxoScript, cj as preimageForSwapRecord, ck as pushRefundWithoutReceiver, cl as readLockupFate, cm as rebuildRfqSwap, cn as rfqSwapOriginOf, co as shouldRetainRfqSwap, cp as swapPrograms, cq as swapSecretsToRecord, cr as updateAssetSwap, cs as updateRfqSwapRecord } from './repository-DO6QKxBx.js';
4
+ import { l as OnchainNetwork, O as OnchainHtlc, k as OnchainHtlcParams, C as ChainSource, I as InvoiceFacts, m as RfqTransport, r as requestLightningSend, o as requestOnchainSend } from './rfq-CYxOyniL.js';
5
+ export { p as ARKADE_BTC, q as AddressMismatch, s as ChainUtxo, t as HtlcUtxo, u as LIGHTNING_BTC, v as LIGHTNING_RECEIVE_PAIR, w as LIGHTNING_SEND_PAIR, x as LOCKTIME_THRESHOLD, j as LightningReceiveContractParams, L as LightningSendContractParams, M as MAX_MIN_CONFIRMATIONS, y as MIN_CLAIM_WINDOW_SECONDS, z as ONCHAIN_BTC, B as ONCHAIN_CLAIM_MARGIN_SECONDS, D as ONCHAIN_DUST_SATS, E as ONCHAIN_ORDER_MARGIN_SECONDS, F as ONCHAIN_RECEIVE_PAIR, G as ONCHAIN_SECONDS_PER_BLOCK, J as ONCHAIN_SEND_PAIR, K as OnchainHtlcPhase, N as RelaySocket, R as RfqQuote, Q as RfqRefusalReason, U as RfqStatus, V as arkadeAssetLeg, W as arkadeSwapRequest, X as assertArkadeFundable, Y as awaitOnchainFill, Z as buildHtlcClaim, _ as buildHtlcRefund, $ as canonicalAssetAmount, a0 as claimOnchainFill, a1 as classifyOnchainHtlc, a2 as deriveLightningReceive, a3 as deriveOnchainReceive, a4 as deriveOnchainSend, a5 as extractPreimage, a6 as httpTransport, a7 as l1ScriptForAddress, a8 as lightningReceiveContract, a9 as lightningReceiveRequest, aa as lightningSendContract, ab as lightningSendRequest, ac as newPreimage, ad as normalizeMakerPkScript, ae as normalizeMakerPublicKey, af as onchainHtlcScript, ag as onchainReceiveRequest, ah as onchainSendRequest, ai as paymentHashOf, aj as relayTransport, ak as requestArkadeSwap, al as requestLightningReceive, am as requestOnchainReceive, an as unilateralClaimDelay, ao as unilateralRefundDelay, ap as unilateralRefundWithoutReceiverDelay, aq as verifyLockupAddress, ar as verifyOfferAddress, as as verifyReceiveInvoice } from './rfq-CYxOyniL.js';
6
+ export { d as ClaimPacketInput, e as LockupContractMissing, f as LockupContractReader, g as LockupContractWriter, h as SWAP_LOCKUP_CONTRACT_KIND, i as SWAP_LOCKUP_CONTRACT_LABEL, j as SWAP_LOCKUP_CONTRACT_TYPE, k as SealedClaimPacket, l as lockupContractParams, r as registerLockupContract, s as sealClaimPacket } from './lockupContract-aFarhlxj.js';
7
7
  import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
8
- import { O as Offer } from './offer-BhonWuKR.js';
9
- export { A as ASSET_CARRIER_SATS, c as ASSET_SWAP_CONTRACT_VERSIONS, d as AssetSwapContractVersion, F as FillFunding, a as FillOutpoint, N as NoSpendableDepositError, e as OFFER_PACKET_TYPE, f as OfferCovenantMismatchError, g as assetSwapContractVersion, h as cancelOffer, i as createOffer, j as decodeOffer, k as encodeOffer, l as fillOffer, o as offerContract, m as offerVtxoScript, s as swapPrograms } from './offer-BhonWuKR.js';
10
- export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-DDNycuUa.js';
11
- export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3 } from './rfq-contract.js';
8
+ export { c as OfferSwapWatcher, W as WatchOfferSwapsParams, w as watchOfferSwaps } from './watch-_fZSgx_l.js';
9
+ export { ASSET_SWAP_BASELINE, ASSET_SWAP_V2, ASSET_SWAP_V3, ASSET_SWAP_V4 } from './rfq-contract.js';
10
+ import 'nostr-tools';
12
11
 
13
12
  /** Which wallet key signs this leg, at `profile.signer`. Omitted entirely (not blank) by a corridor
14
13
  * whose leg this wallet never signs. */
@@ -207,9 +206,10 @@ type SpendKind = "cancelled" | "fulfilled" | "indeterminate";
207
206
  * `indeterminate`. {@link classifyDepositSpend} tries both.
208
207
  *
209
208
  * @param operatorPubkey - The key the covenant was *funded* against. A rotated key fails
210
- * the script match and yields `indeterminate` rather than a guess.
209
+ * the script match and yields `indeterminate` rather than a guess. Unused for an
210
+ * {@link OfferBinding}, which pins its own.
211
211
  */
212
- declare function classifySpend(offer: Offer, operatorPubkey: Uint8Array, spendTx: Transaction, deposit: {
212
+ declare function classifySpend(offer: Offer | OfferBinding, operatorPubkey: Uint8Array, spendTx: Transaction, deposit: {
213
213
  txid: string;
214
214
  vout: number;
215
215
  }): SpendKind;
@@ -222,10 +222,36 @@ declare const spendTxidsOf: (vtxo: {
222
222
  * Classify a deposit's spend across both halves of it (`spentBy` and `arkTxId`, which
223
223
  * may be the same id for a settlement), taking the first definite answer.
224
224
  */
225
- declare function classifyDepositSpend(offer: Offer, operatorPubkey: Uint8Array, spendTxs: Iterable<Transaction>, deposit: {
225
+ declare function classifyDepositSpend(offer: Offer | OfferBinding, operatorPubkey: Uint8Array, spendTxs: Iterable<Transaction>, deposit: {
226
226
  txid: string;
227
227
  vout: number;
228
228
  }): SpendKind;
229
+ /** A way to learn of a deposit this wallet funded but holds no record for. */
230
+ interface OfferRecoverySource {
231
+ readonly name: string;
232
+ /**
233
+ * Bindings for candidate deposits, by funding txid (identical offers share an address).
234
+ * `declined` names txids this source positively ruled out as swaps, so they are marked
235
+ * scanned; a txid in neither list is asked again by a later scan.
236
+ */
237
+ discover(opts: {
238
+ readonly candidateTxids: readonly string[];
239
+ readonly operatorPubkey: Uint8Array;
240
+ }): Promise<{
241
+ readonly found: readonly {
242
+ readonly fundingTxid: string;
243
+ readonly binding: OfferBinding;
244
+ /** The packet the binding came from, when the source read one. */
245
+ readonly offerHex?: string;
246
+ }[];
247
+ readonly declined: readonly string[];
248
+ }>;
249
+ }
250
+ /**
251
+ * The funding tx's own `0x03` packet, as a source. A packet that is present but does not
252
+ * decode is neither found nor declined: a later build may read it.
253
+ */
254
+ declare const packetRecoverySource: (indexer: RestoreIndexer) => OfferRecoverySource;
229
255
  /**
230
256
  * Scan the given candidates for offer packets and rebuild the AssetSwap records the store
231
257
  * lost. Returns the rebuilt swaps plus the txids that got an authoritative answer, which
@@ -246,6 +272,8 @@ declare function restoreAssetSwaps(indexer: RestoreIndexer, txs: Tx[], existingI
246
272
  hrp?: string;
247
273
  /** Commitment txids of recovery rounds this wallet ran (`recoverVtxos()`'s return). */
248
274
  recoveredIn?: ReadonlySet<string>;
275
+ /** Asked in order, first answer per deposit kept. Default: the packet scan alone. */
276
+ sources?: readonly OfferRecoverySource[];
249
277
  }): Promise<{
250
278
  restored: AssetSwap[];
251
279
  scannedTxids: string[];
@@ -470,15 +498,6 @@ type PlanError = "insufficient-balance" | "side-disabled" | "below-min" | "above
470
498
  /** Validate a plan against the user's balance and the server dust limit.*/
471
499
  declare const validatePlan: (plan: OfferPlan, giveBalance: bigint, dust: bigint) => PlanError | undefined;
472
500
 
473
- /**
474
- * `cross-asset` — pay an asset the wallet does not hold, by swapping into it
475
- * first. Both legs are quotable up front, so they price into one `RouteQuote`
476
- * and the router needs no multi-hop primitive.
477
- *
478
- * BTC -> asset only: `createOffer` refuses anything but BTC<->asset, and
479
- * keying `findMarket` on BTC is what enforces that.
480
- */
481
-
482
501
  /** @deprecated A v1 RFQ rail; use `lightningRail` / `onchainSwapRail` with `createSwapPaymentRouter`. Moved off the package root to `@arkade-os/swap/protocol`. */
483
502
  declare const CROSS_ASSET_RAIL = "cross-asset";
484
503
  /**
@@ -509,7 +528,7 @@ interface CrossAssetRailDeps {
509
528
  btcBalance(): Promise<bigint>;
510
529
  dust(): Promise<bigint>;
511
530
  /** Before every irreversible step and once after the last. See
512
- * {@link CrossAssetPhase}. Keyed by `offerHex`. */
531
+ * {@link CrossAssetPhase}. Keyed by `swapPkScript`. */
513
532
  persist(swap: CrossAssetSwap): Promise<void>;
514
533
  /** Resolve once a filler has delivered the asset to this wallet.
515
534
  *
@@ -674,4 +693,4 @@ declare function senderIdentityForSwapRecord(wallet: IWallet, record: {
674
693
  signingDescriptor?: string;
675
694
  }): Promise<Identity>;
676
695
 
677
- export { ArkadeRefundResult, type ArkadeRefunderDeps, CROSS_ASSET_RAIL, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractSource, LockupVtxo, Offer, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainReceiveProfile, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, type RefundBlockedReason, RefundNotLocallyPossibleError, type RestoreIndexer, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqTransport, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, arkadeRefunder, chainSourceFrom, classifyDepositSpend, classifySpend, crossAssetRail, discoverMarkets, findMarket, makeCachedFeedFetch, onchainReceiveProfile, onchainSendProfile, pushClaim, requestLightningSend, requestOnchainSend, restoreAssetSwaps, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, swapActivityResolver, validatePlan, watchMarkets };
696
+ export { ArkadeRefundResult, type ArkadeRefunderDeps, CROSS_ASSET_RAIL, type CrossAssetPhase, type CrossAssetRailDeps, type CrossAssetSwap, type DiscoverMarketsOptions, type LightningReceiveProfile, type LightningSendProfile, LockupAmountMismatchError, LockupContractSource, LockupVtxo, Offer, OfferBinding, type OfferRecoverySource, OnchainHtlc, OnchainHtlcParams, OnchainNetwork, type OnchainReceiveProfile, type OnchainSendProfile, type PlanError, QUOTE_OPTIONS, type RefundBlockedReason, RefundNotLocallyPossibleError, type RestoreIndexer, type RfqClaimSecretProjection, type RfqHashlockProjection, type RfqSignerProjection, RfqSwap, type RfqSwapActivityDeps, RfqSwapRecord, RfqTransport, SOLVER_LIGHTNING_RAIL, SOLVER_ONCHAIN_RAIL, type SolverLightningRailDeps, type SolverLightningSend, type SolverOnchainRailDeps, type SolverOnchainSend, type SolverRendezvous, type SpendKind, type SwapActivityInput, SwapSecretsProjection, type Tx, arkadeRefunder, chainSourceFrom, classifyDepositSpend, classifySpend, crossAssetRail, discoverMarkets, findMarket, makeCachedFeedFetch, onchainReceiveProfile, onchainSendProfile, packetRecoverySource, pushClaim, requestLightningSend, requestOnchainSend, restoreAssetSwaps, rfqClaimSecretOf, rfqSecretsProfile, rfqSignerOf, rfqSwapActivityInputs, senderIdentityForSwapRecord, solverLightningRail, solverLightningRendezvous, solverOnchainRail, solverOnchainRendezvous, solverRendezvous, spendTxidsOf, swapActivityResolver, validatePlan, watchMarkets };
package/dist/protocol.js CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  normalizeRfqSwapRecord,
30
30
  onchainReceiveProfile,
31
31
  onchainSendProfile,
32
+ packetRecoverySource,
32
33
  pushClaim,
33
34
  pushRefundWithoutReceiver,
34
35
  readLockupFate,
@@ -42,11 +43,12 @@ import {
42
43
  validatePlan,
43
44
  watchMarkets,
44
45
  watchOfferSwaps
45
- } from "./chunk-ISWLKKSS.js";
46
+ } from "./chunk-2HQZLIVX.js";
46
47
  import {
47
48
  ARKADE_BTC,
48
49
  ASSET_CARRIER_SATS,
49
50
  ASSET_SWAP_CONTRACT_VERSIONS,
51
+ ASSET_SWAP_DERIVABLE_VERSIONS,
50
52
  AddressMismatch,
51
53
  BTC_ASSET_ID,
52
54
  LIGHTNING_BTC,
@@ -77,6 +79,8 @@ import {
77
79
  assertFundable,
78
80
  assetSwapContractVersion,
79
81
  awaitOnchainFill,
82
+ bindingFromOffer,
83
+ bindingProgram,
80
84
  buildHtlcClaim,
81
85
  buildHtlcRefund,
82
86
  cancelOffer,
@@ -103,6 +107,7 @@ import {
103
107
  normalizeMakerPkScript,
104
108
  normalizeMakerPublicKey,
105
109
  offerContract,
110
+ offerFromBinding,
106
111
  offerVtxoScript,
107
112
  onchainHtlcScript,
108
113
  onchainReceiveRequest,
@@ -130,12 +135,13 @@ import {
130
135
  verifyLockupAddress,
131
136
  verifyOfferAddress,
132
137
  verifyReceiveInvoice
133
- } from "./chunk-PDNVKH5L.js";
138
+ } from "./chunk-LCO6AJOS.js";
134
139
  import {
135
140
  ASSET_SWAP_BASELINE,
136
141
  ASSET_SWAP_V2,
137
- ASSET_SWAP_V3
138
- } from "./chunk-5QPJWOCN.js";
142
+ ASSET_SWAP_V3,
143
+ ASSET_SWAP_V4
144
+ } from "./chunk-6RJVT65W.js";
139
145
  import {
140
146
  collectRfqSwaps
141
147
  } from "./chunk-A3SHHRX4.js";
@@ -231,6 +237,7 @@ async function lockupTxids(indexer, record, wantFunding) {
231
237
  }
232
238
 
233
239
  // src/payment/crossAsset.ts
240
+ import { hex as hex2 } from "@scure/base";
234
241
  import {
235
242
  ASSET_CARRIER_SATS as ASSET_CARRIER_SATS2,
236
243
  arkTarget,
@@ -349,7 +356,7 @@ function crossAssetRail(deps) {
349
356
  const result = {
350
357
  railId: CROSS_ASSET_RAIL,
351
358
  txid,
352
- swapId: offer.offerHex
359
+ swapId: hex2.encode(offer.swapPkScript)
353
360
  };
354
361
  emit({ status: "settled", result });
355
362
  return result;
@@ -361,7 +368,7 @@ function crossAssetRail(deps) {
361
368
 
362
369
  // src/payment/rendezvous.ts
363
370
  import { sideLimits } from "@arkade-os/solver-discovery";
364
- import { hex as hex2 } from "@scure/base";
371
+ import { hex as hex3 } from "@scure/base";
365
372
  var XONLY_HEX = /^[0-9a-f]{64}$/;
366
373
  var rendezvousOf = (market, pinned) => {
367
374
  const transports = { nostr: { relays: market.transports?.nostr?.relays ?? [] } };
@@ -380,7 +387,7 @@ var rendezvousOf = (market, pinned) => {
380
387
  };
381
388
  };
382
389
  var solverRendezvous = (markets, payoutCorridor, amountSats, fallbackEmulatorPubkey) => {
383
- const pinned = fallbackEmulatorPubkey ? hex2.encode(fallbackEmulatorPubkey) : void 0;
390
+ const pinned = fallbackEmulatorPubkey ? hex3.encode(fallbackEmulatorPubkey) : void 0;
384
391
  if (pinned !== void 0 && !XONLY_HEX.test(pinned)) return void 0;
385
392
  const quoteCorridor = payoutCorridor === "lightning" ? "bolt11" : "bitcoin";
386
393
  const isBtc = (id) => id === "btc" || /^(?:arkade|bolt11|bitcoin):[^/]+\/slip44:(?:0|1)$/.test(id ?? "");
@@ -612,8 +619,10 @@ export {
612
619
  ASSET_CARRIER_SATS,
613
620
  ASSET_SWAP_BASELINE,
614
621
  ASSET_SWAP_CONTRACT_VERSIONS,
622
+ ASSET_SWAP_DERIVABLE_VERSIONS,
615
623
  ASSET_SWAP_V2,
616
624
  ASSET_SWAP_V3,
625
+ ASSET_SWAP_V4,
617
626
  AddressMismatch,
618
627
  BTC_ASSET_ID,
619
628
  CROSS_ASSET_RAIL,
@@ -657,6 +666,8 @@ export {
657
666
  assetSwapContractVersion,
658
667
  awaitOnchainFill,
659
668
  awaitRfqResolution,
669
+ bindingFromOffer,
670
+ bindingProgram,
660
671
  buildHtlcClaim,
661
672
  buildHtlcRefund,
662
673
  cancelOffer,
@@ -696,12 +707,14 @@ export {
696
707
  normalizeMakerPublicKey,
697
708
  normalizeRfqSwapRecord,
698
709
  offerContract,
710
+ offerFromBinding,
699
711
  offerVtxoScript,
700
712
  onchainHtlcScript,
701
713
  onchainReceiveProfile,
702
714
  onchainReceiveRequest,
703
715
  onchainSendProfile,
704
716
  onchainSendRequest,
717
+ packetRecoverySource,
705
718
  paymentHashOf,
706
719
  preimageForSwapRecord,
707
720
  pushClaim,
@@ -1,9 +1,10 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
2
  import { PageRequest, PageResult } from '@arkade-os/sdk';
3
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository--pfikw2R.cjs';
3
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b7 as MarketsCacheEntry } from '../../repository-CwwhIAEd.cjs';
4
4
  import '@arkade-os/solver-discovery';
5
- import '../../rfq-BRpo5uWU.cjs';
6
5
  import '../../rfq-contract.cjs';
6
+ import '../../rfq-nMGywkqI.cjs';
7
+ import 'nostr-tools';
7
8
 
8
9
  /**
9
10
  * Realm backend for React Native.
@@ -1,9 +1,10 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
2
  import { PageRequest, PageResult } from '@arkade-os/sdk';
3
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-CkKK0dGO.js';
3
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b7 as MarketsCacheEntry } from '../../repository-DO6QKxBx.js';
4
4
  import '@arkade-os/solver-discovery';
5
- import '../../rfq-IzhOCG02.js';
6
5
  import '../../rfq-contract.js';
6
+ import '../../rfq-CYxOyniL.js';
7
+ import 'nostr-tools';
7
8
 
8
9
  /**
9
10
  * Realm backend for React Native.
@@ -1,9 +1,10 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
2
  import { PageRequest, PageResult } from '@arkade-os/sdk';
3
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository--pfikw2R.cjs';
3
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b7 as MarketsCacheEntry } from '../../repository-CwwhIAEd.cjs';
4
4
  import '@arkade-os/solver-discovery';
5
- import '../../rfq-BRpo5uWU.cjs';
6
5
  import '../../rfq-contract.cjs';
6
+ import '../../rfq-nMGywkqI.cjs';
7
+ import 'nostr-tools';
7
8
 
8
9
  /**
9
10
  * SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in
@@ -1,9 +1,10 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
2
  import { PageRequest, PageResult } from '@arkade-os/sdk';
3
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b9 as MarketsCacheEntry } from '../../repository-CkKK0dGO.js';
3
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b7 as MarketsCacheEntry } from '../../repository-DO6QKxBx.js';
4
4
  import '@arkade-os/solver-discovery';
5
- import '../../rfq-IzhOCG02.js';
6
5
  import '../../rfq-contract.js';
6
+ import '../../rfq-CYxOyniL.js';
7
+ import 'nostr-tools';
7
8
 
8
9
  /**
9
10
  * SQLite backend over the SDK's `SQLExecutor`, so any driver plugs in