@arkade-os/swap 0.1.0-rc.21 → 0.1.0-rc.23

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 (37) hide show
  1. package/README.md +7 -2
  2. package/dist/advanced.cjs +875 -129
  3. package/dist/advanced.d.cts +158 -14
  4. package/dist/advanced.d.ts +158 -14
  5. package/dist/advanced.js +255 -4
  6. package/dist/{chunk-ITFCQWPG.js → chunk-DQ2DY2L2.js} +223 -11
  7. package/dist/{chunk-HUQQVBC4.js → chunk-MZX62KMU.js} +220 -12
  8. package/dist/{chunk-PVB7EBAM.js → chunk-UFJEO4VV.js} +47 -21
  9. package/dist/{errors-hm7aqnRM.d.cts → errors-5q4e3PnH.d.cts} +48 -16
  10. package/dist/{errors-C3h8ANmE.d.ts → errors-DQ35FKJf.d.ts} +48 -16
  11. package/dist/index.cjs +670 -185
  12. package/dist/index.d.cts +5 -5
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.js +5 -3
  15. package/dist/node/index.d.cts +26 -4
  16. package/dist/node/index.d.ts +26 -4
  17. package/dist/nostr.cjs +12 -9
  18. package/dist/nostr.d.cts +1 -1
  19. package/dist/nostr.d.ts +1 -1
  20. package/dist/nostr.js +3 -1
  21. package/dist/{offer-Bd9Yvd8Z.d.ts → offer--IpfzhIm.d.ts} +1 -1
  22. package/dist/{offer-F88rtL_I.d.cts → offer-DqTXQeP1.d.cts} +1 -1
  23. package/dist/protocol.cjs +395 -156
  24. package/dist/protocol.d.cts +45 -8
  25. package/dist/protocol.d.ts +45 -8
  26. package/dist/protocol.js +10 -3
  27. package/dist/repositories/realm/index.d.cts +2 -2
  28. package/dist/repositories/realm/index.d.ts +2 -2
  29. package/dist/repositories/sqlite/index.d.cts +2 -2
  30. package/dist/repositories/sqlite/index.d.ts +2 -2
  31. package/dist/{repository-DYnRLPt-.d.ts → repository-B4rQWmS2.d.cts} +88 -20
  32. package/dist/{repository-BuYWGAKz.d.cts → repository-D_qvJk1S.d.ts} +88 -20
  33. package/dist/{rfq-60PGpQ_x.d.cts → rfq-BgdgO9OO.d.cts} +16 -7
  34. package/dist/{rfq-60PGpQ_x.d.ts → rfq-BgdgO9OO.d.ts} +16 -7
  35. package/dist/{watch-BTyiBLSd.d.ts → watch-BkPz0vf8.d.ts} +1 -1
  36. package/dist/{watch-M_KY-5ho.d.cts → watch-RRhKuBkh.d.cts} +1 -1
  37. package/package.json +3 -3
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-hm7aqnRM.cjs';
2
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-BuYWGAKz.cjs';
3
- export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-BuYWGAKz.cjs';
4
- export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-60PGpQ_x.cjs';
1
+ export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, d as DiscoverySnapshot, I as DiscoverySnapshotUnavailable, J as DriveMode, N as ExchangeOptions, Q as FeeCeiling, V as InconsistentRoute, W as InsufficientFunds, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a5 as OperatorUnreachable, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ac as QuoteVerificationFailed, ad as REGISTRY_URL, ae as ReceiveArtifact, af as ReceiveOptions, ag as ReceiveRequest, ah as RecoveryResult, ai as RegisteredAsset, aj as RfqAuctionPolicy, an as RfqTransportFactory, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, S as SwapPolicy, ay as UnsupportedRoute, az as VerbDeps, aD as canonicalAssetId, aI as createSwapClient, aN as exchange, aT as isSwapError, a$ as pay, b3 as receive } from './errors-5q4e3PnH.cjs';
2
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-B4rQWmS2.cjs';
3
+ export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-B4rQWmS2.cjs';
4
+ export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-BgdgO9OO.cjs';
5
5
  import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
6
  export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-5r5RlgOJ.cjs';
7
7
  import '@arkade-os/solver-discovery';
8
- import './offer-F88rtL_I.cjs';
8
+ import './offer-DqTXQeP1.cjs';
9
9
 
10
10
  /** Browser backend over the SDK's shared IndexedDB manager. */
11
11
  declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DiscoveryConfig, d as DiscoverySnapshot, H as DiscoverySnapshotUnavailable, I as DriveMode, K as ExchangeOptions, P as FeeCeiling, U as InconsistentRoute, V as InsufficientFunds, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, a3 as OperatorUnreachable, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, aa as QuoteVerificationFailed, ab as REGISTRY_URL, ac as ReceiveArtifact, ad as ReceiveOptions, ae as ReceiveRequest, af as RecoveryResult, ag as RegisteredAsset, ah as RfqAuctionPolicy, al as RfqTransportFactory, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, S as SwapPolicy, aw as UnsupportedRoute, ax as VerbDeps, aB as canonicalAssetId, aG as createSwapClient, aL as exchange, aR as isSwapError, aZ as pay, b1 as receive } from './errors-C3h8ANmE.js';
2
- import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-DYnRLPt-.js';
3
- export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-DYnRLPt-.js';
4
- export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-60PGpQ_x.js';
1
+ export { e as AcceptConflict, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, A as AssetAliasTable, n as CancelOutcome, p as ClientDisposed, z as CorridorOverrides, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, d as DiscoverySnapshot, I as DiscoverySnapshotUnavailable, J as DriveMode, N as ExchangeOptions, Q as FeeCeiling, V as InconsistentRoute, W as InsufficientFunds, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a5 as OperatorUnreachable, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ac as QuoteVerificationFailed, ad as REGISTRY_URL, ae as ReceiveArtifact, af as ReceiveOptions, ag as ReceiveRequest, ah as RecoveryResult, ai as RegisteredAsset, aj as RfqAuctionPolicy, an as RfqTransportFactory, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, S as SwapPolicy, ay as UnsupportedRoute, az as VerbDeps, aD as canonicalAssetId, aI as createSwapClient, aN as exchange, aT as isSwapError, a$ as pay, b3 as receive } from './errors-DQ35FKJf.js';
2
+ import { d as AssetSwapRepository, h as AssetSwap, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, S as SwapRecord, b1 as MarketsCacheEntry, a4 as Outcome, ak as Swap, l as QuoteInput, i as RouteResolution, a6 as Quote, an as SwapUpdate, ao as Unsubscribe } from './repository-D_qvJk1S.js';
3
+ export { o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, s as AmountRefusal, t as Artifact, A as AssetId, u as AssetIdError, v as AssetIdRefusal, w as AssetNamespace, x as AssetOn, y as AssetPart, z as AssetRef, B as AssetScale, D as AssetSwapId, E as AtomicDecimal, F as AuctionMarketRef, G as AuctionProvenance, H as BITCOIN_RAILS, J as BTC_ASSET_PART, K as BitcoinRail, U as CardMarketRef, V as CorridorId, W as CorridorKind, b as CorridorSwapRecord, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, b2 as InMemoryAssetSwapRepository, I as Instrument, L as LockupSpendIndexer, a1 as MarketBackend, a2 as MarketRef, N as NetworkRef, O as OfferSwapRecord, a5 as ParsedAssetId, P as PinnedAmount, Q as QuoteId, a7 as QuoteLeg, a8 as RAILS, R as Rail, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, j as ResolvedEndpoint, ah as RestoredMarketRef, b3 as RfqSwapState, k as Route, aj as SnapshotRef, b4 as SwapContractRegistry, al as SwapFamily, b5 as SwapOperator, am as SwapRecordCommon, ap as arkadeAsset, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, b6 as isRfqSwapTerminal, aL as issuanceOf, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aY as sameAsset, a_ as toAtomicDecimal } from './repository-D_qvJk1S.js';
4
+ export { C as ChainSource, I as InvoiceFacts, a as RFQ_REFUSAL_ERROR_CODES, b as RfqRefusalDetail, c as RfqRefusalErrorCode, d as RfqRefusalUnit, S as SwapRefusal, i as isRfqRefusalErrorCode } from './rfq-BgdgO9OO.js';
5
5
  import { PageRequest, PageResult, PaymentHandle, PaymentRail, RouterPreferences, Wallet, PaymentRouter, PaymentStatus } from '@arkade-os/sdk';
6
6
  export { C as CLAIM_PACKET_TYPE, a as ClaimPacketShape, L as LockupRegistrationFailed, S as SEALED_CIPHERTEXT_LENGTH, b as appendArkadeScript, c as claimPacketShape } from './lockupContract-5r5RlgOJ.js';
7
7
  import '@arkade-os/solver-discovery';
8
- import './offer-Bd9Yvd8Z.js';
8
+ import './offer--IpfzhIm.js';
9
9
 
10
10
  /** Browser backend over the SDK's shared IndexedDB manager. */
11
11
  declare class IndexedDbAssetSwapRepository implements AssetSwapRepository {
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  BITCOIN_RAILS,
11
11
  BTC_ASSET_PART,
12
12
  ClientDisposed,
13
+ DEFAULT_MAX_REFUND_WINDOW_SECONDS,
13
14
  DiscoverySnapshotUnavailable,
14
15
  InconsistentRoute,
15
16
  InsufficientFunds,
@@ -61,10 +62,10 @@ import {
61
62
  sameAsset,
62
63
  swapHandle,
63
64
  toAtomicDecimal
64
- } from "./chunk-HUQQVBC4.js";
65
+ } from "./chunk-MZX62KMU.js";
65
66
  import {
66
67
  isRfqSwapTerminal
67
- } from "./chunk-ITFCQWPG.js";
68
+ } from "./chunk-DQ2DY2L2.js";
68
69
  import {
69
70
  CLAIM_PACKET_TYPE,
70
71
  LockupRegistrationFailed,
@@ -74,7 +75,7 @@ import {
74
75
  appendArkadeScript,
75
76
  claimPacketShape,
76
77
  isRfqRefusalErrorCode
77
- } from "./chunk-PVB7EBAM.js";
78
+ } from "./chunk-UFJEO4VV.js";
78
79
  import {
79
80
  InMemoryAssetSwapRepository,
80
81
  assertRfqSwapPageFilter,
@@ -353,6 +354,7 @@ export {
353
354
  BTC_ASSET_PART,
354
355
  CLAIM_PACKET_TYPE,
355
356
  ClientDisposed,
357
+ DEFAULT_MAX_REFUND_WINDOW_SECONDS,
356
358
  DiscoverySnapshotUnavailable,
357
359
  InMemoryAssetSwapRepository,
358
360
  InconsistentRoute,
@@ -179,7 +179,8 @@ interface RfqSwapCommon {
179
179
  refundLocktime: number;
180
180
  createdAt: number;
181
181
  updatedAt: number;
182
- /** Set once the trader's own `refundWithoutReceiver` push landed. */
182
+ /** The trader's own refund: the `refundWithoutReceiver` push that landed, or on
183
+ * `onchain_receive` the L1 HTLC refund. */
183
184
  refundTxid?: string;
184
185
  /**
185
186
  * The ark transactions that SPENT the lockup, from the chain read that ended the swap
@@ -257,12 +258,33 @@ interface LightningReceiveSwap extends RfqSwapCommon {
257
258
  * and never from a chain read — the chain's answer is `settled`. */
258
259
  claimTxid?: string;
259
260
  }
261
+ /**
262
+ * `onchain:BTC->arkade:BTC`. A {@link LightningReceiveSwap}'s lockup plus an L1
263
+ * HTLC the trader funds and must take back itself. That refund leaf does not
264
+ * expire, so the failure to drive against is the manager finishing the swap
265
+ * while the output still holds the trader's money.
266
+ */
267
+ interface OnchainReceiveSwap extends RfqSwapCommon {
268
+ kind: "onchain_receive";
269
+ expectedAmount: number;
270
+ /** Its `refundLocktime` is the trader's own, NOT {@link RfqSwapCommon}'s. */
271
+ htlc: OnchainHtlc;
272
+ minConfirmations: number;
273
+ /** Required, unlike the send leg's optional `payoutPkScript`: without it
274
+ * the refund cannot be built at all. */
275
+ refundPkScript: Uint8Array;
276
+ funding?: {
277
+ txid: string;
278
+ vout: number;
279
+ };
280
+ claimTxid?: string;
281
+ }
260
282
 
261
283
  /**
262
- * The swap kinds this projection covers — all three the manager monitors. `onchain_send`'s L1 keys
263
- * ride in its profile, since no contract row or `OnchainHtlc` field can give them back.
284
+ * The swap kinds this projection covers — all four the manager monitors. The onchain legs' L1 keys
285
+ * ride in their profiles, since no contract row or `OnchainHtlc` field can give them back.
264
286
  */
265
- type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap;
287
+ type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap | OnchainReceiveSwap;
266
288
  /** The immutable request-time half, and only what EVERY corridor has. Hex for
267
289
  * everything binary, so the record is plain JSON and survives any
268
290
  * structured-clone backend unchanged. */
@@ -179,7 +179,8 @@ interface RfqSwapCommon {
179
179
  refundLocktime: number;
180
180
  createdAt: number;
181
181
  updatedAt: number;
182
- /** Set once the trader's own `refundWithoutReceiver` push landed. */
182
+ /** The trader's own refund: the `refundWithoutReceiver` push that landed, or on
183
+ * `onchain_receive` the L1 HTLC refund. */
183
184
  refundTxid?: string;
184
185
  /**
185
186
  * The ark transactions that SPENT the lockup, from the chain read that ended the swap
@@ -257,12 +258,33 @@ interface LightningReceiveSwap extends RfqSwapCommon {
257
258
  * and never from a chain read — the chain's answer is `settled`. */
258
259
  claimTxid?: string;
259
260
  }
261
+ /**
262
+ * `onchain:BTC->arkade:BTC`. A {@link LightningReceiveSwap}'s lockup plus an L1
263
+ * HTLC the trader funds and must take back itself. That refund leaf does not
264
+ * expire, so the failure to drive against is the manager finishing the swap
265
+ * while the output still holds the trader's money.
266
+ */
267
+ interface OnchainReceiveSwap extends RfqSwapCommon {
268
+ kind: "onchain_receive";
269
+ expectedAmount: number;
270
+ /** Its `refundLocktime` is the trader's own, NOT {@link RfqSwapCommon}'s. */
271
+ htlc: OnchainHtlc;
272
+ minConfirmations: number;
273
+ /** Required, unlike the send leg's optional `payoutPkScript`: without it
274
+ * the refund cannot be built at all. */
275
+ refundPkScript: Uint8Array;
276
+ funding?: {
277
+ txid: string;
278
+ vout: number;
279
+ };
280
+ claimTxid?: string;
281
+ }
260
282
 
261
283
  /**
262
- * The swap kinds this projection covers — all three the manager monitors. `onchain_send`'s L1 keys
263
- * ride in its profile, since no contract row or `OnchainHtlc` field can give them back.
284
+ * The swap kinds this projection covers — all four the manager monitors. The onchain legs' L1 keys
285
+ * ride in their profiles, since no contract row or `OnchainHtlc` field can give them back.
264
286
  */
265
- type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap;
287
+ type PersistableRfqSwap = LightningSendSwap | LightningReceiveSwap | OnchainSendSwap | OnchainReceiveSwap;
266
288
  /** The immutable request-time half, and only what EVERY corridor has. Hex for
267
289
  * everything binary, so the record is plain JSON and survives any
268
290
  * structured-clone backend unchanged. */
package/dist/nostr.cjs CHANGED
@@ -42,13 +42,14 @@ module.exports = __toCommonJS(nostr_exports);
42
42
  var import_base6 = require("@scure/base");
43
43
  var import_solver_discovery = require("@arkade-os/solver-discovery");
44
44
  var import_legacy2 = require("@noble/hashes/legacy.js");
45
- var import_sdk5 = require("@arkade-os/sdk");
45
+ var import_sdk6 = require("@arkade-os/sdk");
46
46
 
47
47
  // src/onchainHtlc.ts
48
48
  var import_base = require("@scure/base");
49
49
  var import_sha2 = require("@noble/hashes/sha2.js");
50
50
  var import_legacy = require("@noble/hashes/legacy.js");
51
51
  var btc = __toESM(require("@scure/btc-signer"), 1);
52
+ var import_sdk = require("@arkade-os/sdk");
52
53
  var ONCHAIN_ORDER_MARGIN_SECONDS = 2 * 60 * 60;
53
54
  var ONCHAIN_CLAIM_MARGIN_SECONDS = 90 * 60;
54
55
  var ONCHAIN_DUST_SATS = BigInt(330);
@@ -59,7 +60,7 @@ var L1_NETWORKS = {
59
60
  };
60
61
 
61
62
  // src/rfq.ts
62
- var import_sdk6 = require("@arkade-os/sdk");
63
+ var import_sdk7 = require("@arkade-os/sdk");
63
64
 
64
65
  // src/claimPacket.ts
65
66
  var import_base2 = require("@scure/base");
@@ -72,12 +73,12 @@ var HKDF_INFO = new TextEncoder().encode("covclaimd/preimage/v1");
72
73
 
73
74
  // src/lockupContract.ts
74
75
  var import_base3 = require("@scure/base");
75
- var import_sdk = require("@arkade-os/sdk");
76
+ var import_sdk2 = require("@arkade-os/sdk");
76
77
 
77
78
  // src/offer.ts
78
79
  var import_base5 = require("@scure/base");
79
80
  var import_utils2 = require("@scure/btc-signer/utils.js");
80
- var import_sdk4 = require("@arkade-os/sdk");
81
+ var import_sdk5 = require("@arkade-os/sdk");
81
82
 
82
83
  // src/swap-want-asset.program.json
83
84
  var swap_want_asset_program_default = {
@@ -157,15 +158,15 @@ var swap_want_btc_program_default = {
157
158
  // src/store.ts
158
159
  var import_base4 = require("@scure/base");
159
160
  var import_sha23 = require("@noble/hashes/sha2.js");
160
- var import_sdk3 = require("@arkade-os/sdk");
161
+ var import_sdk4 = require("@arkade-os/sdk");
161
162
 
162
163
  // src/repository.ts
163
- var import_sdk2 = require("@arkade-os/sdk");
164
+ var import_sdk3 = require("@arkade-os/sdk");
164
165
 
165
166
  // src/offer.ts
166
167
  var swapPrograms = {
167
- wantAsset: import_sdk4.arkade.parseArtifact(swap_want_asset_program_default),
168
- wantBtc: import_sdk4.arkade.parseArtifact(swap_want_btc_program_default)
168
+ wantAsset: import_sdk5.arkade.parseArtifact(swap_want_asset_program_default),
169
+ wantBtc: import_sdk5.arkade.parseArtifact(swap_want_btc_program_default)
169
170
  };
170
171
  var FIELDS = {
171
172
  swapPkScript: { tag: 1, width: 34 },
@@ -180,7 +181,7 @@ var FIELDS = {
180
181
  exitTimelock: { tag: 12, width: 9 }
181
182
  };
182
183
  var NAMES = Object.fromEntries(Object.entries(FIELDS).map(([k, f]) => [f.tag, k]));
183
- var ASSET_CARRIER_SATS = BigInt(import_sdk4.ASSET_CARRIER_SATS);
184
+ var ASSET_CARRIER_SATS = BigInt(import_sdk5.ASSET_CARRIER_SATS);
184
185
 
185
186
  // src/rfq.ts
186
187
  var ARKADE_BTC = "arkade:BTC";
@@ -296,6 +297,7 @@ var SOLO_REFUND_HEADROOM_SECONDS = 8 * SEQUENCE_GRANULARITY_SECONDS;
296
297
  var MIN_CLAIM_WINDOW_SECONDS = 30 * 60;
297
298
 
298
299
  // src/nostr.ts
300
+ var import_sdk8 = require("@arkade-os/sdk");
299
301
  var import_nostr_tools = require("nostr-tools");
300
302
  var RFQ_DIRECTED_KIND = 24859;
301
303
  var RFQ_AD_KIND = 38859;
@@ -320,6 +322,7 @@ var closeReasons = (raw) => raw.map((entry) => {
320
322
  return url ? `${url}: ${reason ?? "closed"}` : reason ?? "closed";
321
323
  });
322
324
  var nostrRfqTransport = (options) => {
325
+ (0, import_sdk8.assertTimerMs)("timeoutMs", options.timeoutMs);
323
326
  const relays = options.relays;
324
327
  const solverPubkey = options.solverPubkey;
325
328
  const secretKey = options.secretKey ?? (0, import_nostr_tools.generateSecretKey)();
package/dist/nostr.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { e as RfqTransport } from './rfq-60PGpQ_x.cjs';
1
+ import { e as RfqTransport } from './rfq-BgdgO9OO.cjs';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
4
 
package/dist/nostr.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { e as RfqTransport } from './rfq-60PGpQ_x.js';
1
+ import { e as RfqTransport } from './rfq-BgdgO9OO.js';
2
2
  import { SimplePool } from 'nostr-tools';
3
3
  import '@arkade-os/sdk';
4
4
 
package/dist/nostr.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  expectQuote,
3
3
  pairOf
4
- } from "./chunk-PVB7EBAM.js";
4
+ } from "./chunk-UFJEO4VV.js";
5
5
  import "./chunk-A3SHHRX4.js";
6
6
 
7
7
  // src/nostr.ts
8
+ import { assertTimerMs } from "@arkade-os/sdk";
8
9
  import {
9
10
  finalizeEvent,
10
11
  generateSecretKey,
@@ -35,6 +36,7 @@ var closeReasons = (raw) => raw.map((entry) => {
35
36
  return url ? `${url}: ${reason ?? "closed"}` : reason ?? "closed";
36
37
  });
37
38
  var nostrRfqTransport = (options) => {
39
+ assertTimerMs("timeoutMs", options.timeoutMs);
38
40
  const relays = options.relays;
39
41
  const solverPubkey = options.solverPubkey;
40
42
  const secretKey = options.secretKey ?? generateSecretKey();
@@ -1,5 +1,5 @@
1
1
  import { asset, RelativeTimelock, ArkadeInfo, ArkTxInput, IWallet, EmulatorProvider, arkade } from '@arkade-os/sdk';
2
- import { d as AssetSwapRepository } from './repository-DYnRLPt-.js';
2
+ import { d as AssetSwapRepository } from './repository-D_qvJk1S.js';
3
3
 
4
4
  /**
5
5
  * The contracts, one per WANT side — pure data, shared verbatim with any other implementation.
@@ -1,5 +1,5 @@
1
1
  import { asset, RelativeTimelock, ArkadeInfo, ArkTxInput, IWallet, EmulatorProvider, arkade } from '@arkade-os/sdk';
2
- import { d as AssetSwapRepository } from './repository-BuYWGAKz.cjs';
2
+ import { d as AssetSwapRepository } from './repository-B4rQWmS2.cjs';
3
3
 
4
4
  /**
5
5
  * The contracts, one per WANT side — pure data, shared verbatim with any other implementation.