@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
@@ -1,14 +1,134 @@
1
- import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-hm7aqnRM.cjs';
2
- export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, 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, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-hm7aqnRM.cjs';
1
+ import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-5q4e3PnH.cjs';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, H as DiscoveryIndexInput, I as DiscoverySnapshotUnavailable, J as DriveMode, K as DriveRefusal, N as ExchangeOptions, P as FEED_TTL_MS, Q as FeeCeiling, R as FeedFetch, T as FeedQuoteInput, U as INDEXED_NETWORKS, V as InconsistentRoute, W as InsufficientFunds, X as LockupOwner, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a0 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a1 as ObservationSeam, a2 as OfferPreparation, a3 as OnchainClaim, a4 as OnchainRefund, a5 as OperatorUnreachable, a6 as ParsedRfqQuote, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ab as QuotePreparation, 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, ak as RfqPreparation, al as RfqQuoteInput, am as RfqRendezvous, an as RfqTransportFactory, ao as RouteSide, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, as as SwapDrive, at as SwapDriveConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, ay as UnsupportedRoute, az as VerbDeps, aA as acceptQuote, aB as attesting, aC as cancelSwap, aD as canonicalAssetId, aE as cardMarketOf, aF as chooseMarket, aG as conflictingFields, aH as corridorSet, aI as createSwapClient, aJ as createSwapDrive, aK as discoveryIndex, aL as eligibleMarkets, aM as enforceFeeCeiling, aN as exchange, aO as feedFetch, aP as feedSpread, aQ as isAddressable, aR as isCardMarket, aS as isIndexedNetwork, aT as isSwapError, aU as isUsableCard, aV as liveArkadeInfo, aW as marketBackendOf, aX as marketKeyOf, aY as marketRefOf, aZ as nostrTransportFactory, a_ as parseRfqQuote, a$ as pay, b0 as quoteFromFeed, b1 as quoteViaRfq, b2 as readableRecord, b3 as receive, b4 as resolveCorridorBase, b5 as resolveCorridorDeps, b6 as rfqLeg, b7 as rfqPairFor, b8 as swapRecordOf, b9 as toDiscoveryLeg, ba as usableMarkets, bb as verifyPlanLegs, bc as withCanonicalAmount } from './errors-5q4e3PnH.cjs';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
4
- import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-BuYWGAKz.cjs';
5
- export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, 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, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-BuYWGAKz.cjs';
6
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-60PGpQ_x.cjs';
7
- export { S as SwapRefusal } from './rfq-60PGpQ_x.cjs';
4
+ import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-B4rQWmS2.cjs';
5
+ export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, 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, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-B4rQWmS2.cjs';
6
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-BgdgO9OO.cjs';
7
+ export { S as SwapRefusal } from './rfq-BgdgO9OO.cjs';
8
8
  import * as btc from '@scure/btc-signer';
9
9
  import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
10
- import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-M_KY-5ho.cjs';
11
- import './offer-F88rtL_I.cjs';
10
+ import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-RRhKuBkh.cjs';
11
+ import './offer-DqTXQeP1.cjs';
12
+
13
+ /** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
14
+ declare const EVM_CHAIN = "ethereum";
15
+ /** `ethereum:<token>`, lowercased: the solver's pair regex is lowercase-only while its profile
16
+ * address fields accept a checksum, so normalising only one of them yields `unsupported_pair`. */
17
+ declare const evmTokenLeg: (tokenAddress: string) => string;
18
+ /** `arkade:BTC->ethereum:<token>`: the client locks sats, the solver pays tokens. */
19
+ declare const evmSendPair: (tokenAddress: string) => string;
20
+ /** `ethereum:<token>->arkade:BTC`: the client locks tokens, the solver pays sats. */
21
+ declare const evmReceivePair: (tokenAddress: string) => string;
22
+ declare const evmDirectionOf: (pair: string) => "send" | "receive" | null;
23
+ /** The lowercase ERC20 an EVM pair names, or `null`. */
24
+ declare const evmTokenOf: (pair: string) => string | null;
25
+ declare const evmAmountToWire: (units: bigint) => string;
26
+ /** Refuses a JSON number outright: by the time it is here the parser may already have rounded it. */
27
+ declare const evmAmountFromWire: (value: unknown, field: string) => bigint;
28
+ /** Exact-in only: `amount` is sats, and the solver's schema pins `amount_side: "from"`. */
29
+ declare const evmSendRequest: (input: {
30
+ rfqId: string;
31
+ tokenAddress: string;
32
+ /** `sha256(P)`, hex. */
33
+ paymentHash: string;
34
+ /** Where the client takes the tokens; sent as given, keeping any EIP-55 checksum. */
35
+ evmClaimAddress: string;
36
+ /** The client's Arkade address, where the covenant refund pays. */
37
+ refundAddress: string;
38
+ /** The client's x-only key for the covenant's refund leaves. */
39
+ senderPubkey: Uint8Array;
40
+ amountSats: number;
41
+ }) => Record<string, unknown>;
42
+ /** The token amount rides the profile as `evm_amount`; the envelope has no `amount`, and the
43
+ * solver's strict schema refuses one. No `claim_packet`: the client must be online to claim. */
44
+ declare const evmReceiveRequest: (input: {
45
+ rfqId: string;
46
+ tokenAddress: string;
47
+ paymentHash: string;
48
+ evmAmount: bigint;
49
+ /** The client's own lock deadline, as a block height. */
50
+ evmTimeoutBlock: number;
51
+ evmRefundAddress: string;
52
+ payoutAddress: string;
53
+ /** The covenant's `receiver` role. */
54
+ payoutPubkey: Uint8Array;
55
+ }) => Record<string, unknown>;
56
+ interface EvmQuoteProfileCommon {
57
+ payment_hash: string;
58
+ /** Compare-only: never fund it without deriving the covenant locally. */
59
+ lockup_address: string;
60
+ evm_contract_address: string;
61
+ evm_chain_id: number;
62
+ /** Wait for both: a rollup can bury a lock in seconds before its L1 batch finalizes. */
63
+ min_confirmations: number;
64
+ min_age_seconds: number;
65
+ [key: string]: unknown;
66
+ }
67
+ interface EvmSendQuoteProfile extends EvmQuoteProfileCommon {
68
+ /** The solver's claim pkScript, needed to rebuild the covenant's merkle root. */
69
+ receiver_pk_script: string;
70
+ /** The solver's address, the refund role of its lock: the sixth swap-key field, and an
71
+ * explicit argument to `claim`. */
72
+ evm_refund_address: string;
73
+ /** A block height, unlike the unix-seconds `refund_locktime` beside it. */
74
+ evm_timeout_block: number;
75
+ }
76
+ interface EvmReceiveQuoteProfile extends EvmQuoteProfileCommon {
77
+ /** The solver's refund pkScript, needed to rebuild the covenant's merkle root. */
78
+ solver_refund_pk_script: string;
79
+ /** The `claimAddress` the client must lock to. */
80
+ evm_claim_address: string;
81
+ }
82
+ interface EvmSendQuote {
83
+ v: 1;
84
+ type: "rfq_quote";
85
+ rfq_id: string;
86
+ pair: string;
87
+ from_amount: number;
88
+ to_amount: string;
89
+ solver_pubkey: string;
90
+ valid_until: number;
91
+ refund_locktime: number;
92
+ profile: EvmSendQuoteProfile;
93
+ [key: string]: unknown;
94
+ }
95
+ interface EvmReceiveQuote {
96
+ v: 1;
97
+ type: "rfq_quote";
98
+ rfq_id: string;
99
+ pair: string;
100
+ from_amount: string;
101
+ to_amount: number;
102
+ solver_pubkey: string;
103
+ valid_until: number;
104
+ refund_locktime: number;
105
+ profile: EvmReceiveQuoteProfile;
106
+ [key: string]: unknown;
107
+ }
108
+ type EvmRfqQuote = EvmSendQuote | EvmReceiveQuote;
109
+ /**
110
+ * Checks a reply's shape and binds it to the request (rfq id, token, payment hash, chain, exact
111
+ * input). It does not make `lockup_address` safe to fund. Unknown fields are tolerated.
112
+ */
113
+ declare const readEvmSendQuote: (payload: unknown, expected: {
114
+ tokenAddress: string;
115
+ rfqId: string;
116
+ paymentHash: string;
117
+ chainId: number;
118
+ amountSats: number;
119
+ }) => EvmSendQuote;
120
+ /** The receive-direction counterpart of {@link readEvmSendQuote}. */
121
+ declare const readEvmReceiveQuote: (payload: unknown, expected: {
122
+ tokenAddress: string;
123
+ rfqId: string;
124
+ paymentHash: string;
125
+ chainId: number;
126
+ evmAmount: bigint;
127
+ }) => EvmReceiveQuote;
128
+ /** The token leg of a quote, picked by its pair so the sats leg can never be read as tokens. */
129
+ declare const evmQuoteTokenAmount: (quote: EvmRfqQuote) => bigint;
130
+ /** The sats leg of a quote; see {@link evmQuoteTokenAmount}. */
131
+ declare const evmQuoteSats: (quote: EvmRfqQuote) => number;
12
132
 
13
133
  /**
14
134
  * The alias table, filled from discovery: the inverse of `toDiscoveryLeg`, mapping a card's
@@ -134,9 +254,9 @@ declare const LIGHTNING_DRIVE: {
134
254
  declare const lightningCorridor: CorridorFactory<LightningCorridorDeps>;
135
255
 
136
256
  /**
137
- * One direction only. `onchain -> arkade` is deliberately absent: it adds an L1 half the
138
- * trader funds and must refund itself, and declaring only the lockup half would yield a
139
- * manager that silently lets the trader's L1 refund window pass.
257
+ * On `onchain -> arkade` the Arkade lockup is the solver's and the L1 HTLC's refund leaf the
258
+ * trader's own: the trader claims the lockup, or takes its L1 funding back after
259
+ * `htlc.refundLocktime`.
140
260
  *
141
261
  * On `arkade -> onchain` the two covenants have different owners: the Arkade lockup is
142
262
  * the trader's (`refundLocktime` = money comes back), but the L1 HTLC's refund leaf is
@@ -156,6 +276,19 @@ declare const ONCHAIN_DRIVE: {
156
276
  readonly actions: readonly ["claimOnchain", "refundArkade"];
157
277
  readonly seams: readonly ["indexer", "chain"];
158
278
  };
279
+ readonly give: {
280
+ readonly lockups: readonly [{
281
+ readonly covenant: "arkade_lockup";
282
+ readonly owner: "solver";
283
+ readonly deadline: "refund_locktime";
284
+ }, {
285
+ readonly covenant: "onchain_htlc";
286
+ readonly owner: "trader";
287
+ readonly deadline: "htlc_refund_locktime";
288
+ }];
289
+ readonly actions: readonly ["claimLockup", "refundOnchain"];
290
+ readonly seams: readonly ["indexer", "chain"];
291
+ };
159
292
  };
160
293
  declare const onchainCorridor: CorridorFactory<OnchainCorridorDeps>;
161
294
 
@@ -270,8 +403,8 @@ declare const walletLockupIndexer: (wallet: IWallet) => LockupSpendIndexer;
270
403
  * amount may be pinned; two is `AmountMismatch`, thrown here so nothing is disclosed.
271
404
  */
272
405
 
273
- /** The four implemented corridor pairs, spelled as the route union spells them. */
274
- declare const SUPPORTED_PAIRS: readonly ["arkade->arkade", "arkade->lightning", "lightning->arkade", "arkade->onchain"];
406
+ /** The five implemented corridor pairs, spelled as the route union spells them. */
407
+ declare const SUPPORTED_PAIRS: readonly ["arkade->arkade", "arkade->lightning", "lightning->arkade", "arkade->onchain", "onchain->arkade"];
275
408
  type SupportedPair = (typeof SUPPORTED_PAIRS)[number];
276
409
  interface ResolveDeps {
277
410
  readonly corridors: CorridorSet;
@@ -431,6 +564,17 @@ declare const verifyQuoteTtl: (input: {
431
564
  readonly now: number;
432
565
  readonly floorSeconds?: number;
433
566
  }) => void;
567
+ /**
568
+ * The policy ceiling on how long a send's funds stay locked: a solver that never pays could
569
+ * otherwise hold them for as long as it quotes.
570
+ */
571
+ declare const verifyRefundWindow: (input: {
572
+ readonly refundLocktime: number;
573
+ /** Lightning send's solo-refund CSV delay. */
574
+ readonly refundWithoutReceiverDelay?: number;
575
+ readonly now: number;
576
+ readonly maxSeconds?: number;
577
+ }) => void;
434
578
  /**
435
579
  * The quote answers the request that was made: the pinned side must not be repriced.
436
580
  *
@@ -547,4 +691,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
547
691
  ciphertext: string;
548
692
  }>;
549
693
 
550
- export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
694
+ export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
@@ -1,14 +1,134 @@
1
- import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-C3h8ANmE.js';
2
- export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DiscoveryConfig, G as DiscoveryIndexInput, H as DiscoverySnapshotUnavailable, I as DriveMode, J as DriveRefusal, K as ExchangeOptions, N as FEED_TTL_MS, P as FeeCeiling, Q as FeedFetch, R as FeedQuoteInput, T as INDEXED_NETWORKS, U as InconsistentRoute, V as InsufficientFunds, W as LockupOwner, X as Market, Y as MaxFeeExceeded, Z as MissingCorridorDep, _ as NotCancellable, $ as ONCHAIN_CLAIM_FEE_RATE_SATVB, a0 as ObservationSeam, a1 as OfferPreparation, a2 as OnchainClaim, a3 as OperatorUnreachable, a4 as ParsedRfqQuote, a5 as PayOptions, a6 as PayResult, a7 as QuoteCheck, a8 as QuoteExpired, a9 as QuotePreparation, 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, ai as RfqPreparation, aj as RfqQuoteInput, ak as RfqRendezvous, al as RfqTransportFactory, am as RouteSide, an as SWAP_ERROR_NAMES, ao as SwapClient, ap as SwapClientConfig, aq as SwapDrive, ar as SwapDriveConfig, as as SwapDriveRefusedError, at as SwapError, au as SwapErrorName, av as SwapFilter, aw as UnsupportedRoute, ax as VerbDeps, ay as acceptQuote, az as attesting, aA as cancelSwap, aB as canonicalAssetId, aC as cardMarketOf, aD as chooseMarket, aE as conflictingFields, aF as corridorSet, aG as createSwapClient, aH as createSwapDrive, aI as discoveryIndex, aJ as eligibleMarkets, aK as enforceFeeCeiling, aL as exchange, aM as feedFetch, aN as feedSpread, aO as isAddressable, aP as isCardMarket, aQ as isIndexedNetwork, aR as isSwapError, aS as isUsableCard, aT as liveArkadeInfo, aU as marketBackendOf, aV as marketKeyOf, aW as marketRefOf, aX as nostrTransportFactory, aY as parseRfqQuote, aZ as pay, a_ as quoteFromFeed, a$ as quoteViaRfq, b0 as readableRecord, b1 as receive, b2 as resolveCorridorBase, b3 as resolveCorridorDeps, b4 as rfqLeg, b5 as rfqPairFor, b6 as swapRecordOf, b7 as toDiscoveryLeg, b8 as usableMarkets, b9 as verifyPlanLegs, ba as withCanonicalAmount } from './errors-C3h8ANmE.js';
1
+ import { A as AssetAliasTable, C as CorridorFactory, a as ArkadeCorridorDeps, L as LightningCorridorDeps, O as OnchainCorridorDeps, b as CorridorSet, D as DiscoveryIndex, S as SwapPolicy, c as DiscoveryLeg, M as MarketCandidate, d as DiscoverySnapshot } from './errors-DQ35FKJf.js';
2
+ export { e as AcceptConflict, f as AcceptInput, g as AmbiguousDestination, h as AmountEncodingUnsupported, i as AmountMismatch, j as AssetRfqPreparation, k as AttestingRfqTransport, l as CORRIDOR_FACTORIES, m as CancelInput, n as CancelOutcome, o as ClaimedDestination, p as ClientDisposed, q as CorridorBase, r as CorridorClaim, s as CorridorCovenant, t as CorridorDeadline, u as CorridorDeps, v as CorridorDepsByCorridor, w as CorridorDrive, x as CorridorLockup, y as CorridorModule, z as CorridorOverrides, B as CorridorPass, E as CorridorRfqPreparation, F as DEFAULT_MAX_REFUND_WINDOW_SECONDS, G as DiscoveryConfig, H as DiscoveryIndexInput, I as DiscoverySnapshotUnavailable, J as DriveMode, K as DriveRefusal, N as ExchangeOptions, P as FEED_TTL_MS, Q as FeeCeiling, R as FeedFetch, T as FeedQuoteInput, U as INDEXED_NETWORKS, V as InconsistentRoute, W as InsufficientFunds, X as LockupOwner, Y as Market, Z as MaxFeeExceeded, _ as MissingCorridorDep, $ as NotCancellable, a0 as ONCHAIN_CLAIM_FEE_RATE_SATVB, a1 as ObservationSeam, a2 as OfferPreparation, a3 as OnchainClaim, a4 as OnchainRefund, a5 as OperatorUnreachable, a6 as ParsedRfqQuote, a7 as PayOptions, a8 as PayResult, a9 as QuoteCheck, aa as QuoteExpired, ab as QuotePreparation, 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, ak as RfqPreparation, al as RfqQuoteInput, am as RfqRendezvous, an as RfqTransportFactory, ao as RouteSide, ap as SWAP_ERROR_NAMES, aq as SwapClient, ar as SwapClientConfig, as as SwapDrive, at as SwapDriveConfig, au as SwapDriveRefusedError, av as SwapError, aw as SwapErrorName, ax as SwapFilter, ay as UnsupportedRoute, az as VerbDeps, aA as acceptQuote, aB as attesting, aC as cancelSwap, aD as canonicalAssetId, aE as cardMarketOf, aF as chooseMarket, aG as conflictingFields, aH as corridorSet, aI as createSwapClient, aJ as createSwapDrive, aK as discoveryIndex, aL as eligibleMarkets, aM as enforceFeeCeiling, aN as exchange, aO as feedFetch, aP as feedSpread, aQ as isAddressable, aR as isCardMarket, aS as isIndexedNetwork, aT as isSwapError, aU as isUsableCard, aV as liveArkadeInfo, aW as marketBackendOf, aX as marketKeyOf, aY as marketRefOf, aZ as nostrTransportFactory, a_ as parseRfqQuote, a$ as pay, b0 as quoteFromFeed, b1 as quoteViaRfq, b2 as readableRecord, b3 as receive, b4 as resolveCorridorBase, b5 as resolveCorridorDeps, b6 as rfqLeg, b7 as rfqPairFor, b8 as swapRecordOf, b9 as toDiscoveryLeg, ba as usableMarkets, bb as verifyPlanLegs, bc as withCanonicalAmount } from './errors-DQ35FKJf.js';
3
3
  import { DiscoveredMarket } from '@arkade-os/solver-discovery';
4
- import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-DYnRLPt-.js';
5
- export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, 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, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-DYnRLPt-.js';
6
- import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-60PGpQ_x.js';
7
- export { S as SwapRefusal } from './rfq-60PGpQ_x.js';
4
+ import { N as NetworkRef, C as Corridor, A as AssetId, R as Rail, a as RfqSwapRecordStore, b as CorridorSwapRecord, Q as QuoteId, c as AssetSwapStatus, S as SwapRecord, O as OfferSwapRecord, d as AssetSwapRepository, e as RfqSwapRecord, f as RfqSwapPageFilter, g as RfqSwapPageCursor, h as AssetSwap, L as LockupSpendIndexer, i as RouteResolution, j as ResolvedEndpoint, P as PinnedAmount, I as Instrument, k as Route, l as QuoteInput, m as Pubkey } from './repository-D_qvJk1S.js';
5
+ export { n as ACTIVITY_TOKEN, o as ARKADE_ASSET_NAMESPACE, p as Amount, q as AmountFormatError, r as AmountOn, s as AmountRefusal, t as Artifact, 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, M as CORRIDORS, T as CORRIDOR_PASS, U as CardMarketRef, V as CorridorId, W as CorridorKind, X as DepositArtifact, Y as DisplayDecimal, Z as Endpoint, _ as Ep, $ as Hex, a0 as LOCKUP_OWNER, a1 as MarketBackend, a2 as MarketRef, a3 as OFFER_SWAP_ID_PREFIX, a4 as Outcome, a5 as ParsedAssetId, a6 as Quote, a7 as QuoteLeg, a8 as RAILS, a9 as RFQ_SWAP_ID_PREFIX, aa as RailOf, ab as RankedBid, ac as RawState, ad as RecordedArtifact, ae as RecordedEndpoint, af as RecordedInstrument, ag as RecordedLeg, ah as RestoredMarketRef, ai as RfqAmountSide, aj as SnapshotRef, ak as Swap, al as SwapFamily, am as SwapRecordCommon, an as SwapUpdate, ao as Unsubscribe, ap as arkadeAsset, aq as artifactOf, ar as assetPartOf, as as assetSwapIdOf, at as bitcoinNetworkOf, au as btcAssetPart, av as btcOn, aw as corridorOfRail, ax as corridorOutcome, ay as decodeRfqAmount, az as encodeRfqAmount, aA as familyOfSwapId, aB as formatAssetId, aC as fromAtomicDecimal, aD as fromRfqAmountSide, aE as fundsFromWallet, aF as instrumentOf, aG as isAssetId, aH as isAtomicDecimal, aI as isBtcAsset, aJ as isBtcAssetLenient, aK as isNetworkRef, aL as issuanceOf, aM as legOf, aN as offerOutcome, aO as parseAssetId, aP as quoteIdOfSwapId, aQ as railOf, aR as railOfCorridor, aS as readsChain, aT as recordArtifact, aU as recordEndpoint, aV as recordInstrument, aW as recordLeg, aX as recordOutcome, aY as sameAsset, aZ as swapOf, a_ as toAtomicDecimal, a$ as toRfqAmountSide, b0 as toSafeNumber } from './repository-D_qvJk1S.js';
6
+ import { I as InvoiceFacts, C as ChainSource, R as RfqQuote } from './rfq-BgdgO9OO.js';
7
+ export { S as SwapRefusal } from './rfq-BgdgO9OO.js';
8
8
  import * as btc from '@scure/btc-signer';
9
9
  import { OnchainProvider, NetworkName, PageRequest, PageResult, IWallet, VHTLC } from '@arkade-os/sdk';
10
- import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-BTyiBLSd.js';
11
- import './offer-Bd9Yvd8Z.js';
10
+ import { O as OfferSpendChanges, a as OfferSwapFacts, b as OfferSwapSource } from './watch-BkPz0vf8.js';
11
+ import './offer--IpfzhIm.js';
12
+
13
+ /** The EVM leg's namespace. Which chain is the quote's `evm_chain_id`, not the pair. */
14
+ declare const EVM_CHAIN = "ethereum";
15
+ /** `ethereum:<token>`, lowercased: the solver's pair regex is lowercase-only while its profile
16
+ * address fields accept a checksum, so normalising only one of them yields `unsupported_pair`. */
17
+ declare const evmTokenLeg: (tokenAddress: string) => string;
18
+ /** `arkade:BTC->ethereum:<token>`: the client locks sats, the solver pays tokens. */
19
+ declare const evmSendPair: (tokenAddress: string) => string;
20
+ /** `ethereum:<token>->arkade:BTC`: the client locks tokens, the solver pays sats. */
21
+ declare const evmReceivePair: (tokenAddress: string) => string;
22
+ declare const evmDirectionOf: (pair: string) => "send" | "receive" | null;
23
+ /** The lowercase ERC20 an EVM pair names, or `null`. */
24
+ declare const evmTokenOf: (pair: string) => string | null;
25
+ declare const evmAmountToWire: (units: bigint) => string;
26
+ /** Refuses a JSON number outright: by the time it is here the parser may already have rounded it. */
27
+ declare const evmAmountFromWire: (value: unknown, field: string) => bigint;
28
+ /** Exact-in only: `amount` is sats, and the solver's schema pins `amount_side: "from"`. */
29
+ declare const evmSendRequest: (input: {
30
+ rfqId: string;
31
+ tokenAddress: string;
32
+ /** `sha256(P)`, hex. */
33
+ paymentHash: string;
34
+ /** Where the client takes the tokens; sent as given, keeping any EIP-55 checksum. */
35
+ evmClaimAddress: string;
36
+ /** The client's Arkade address, where the covenant refund pays. */
37
+ refundAddress: string;
38
+ /** The client's x-only key for the covenant's refund leaves. */
39
+ senderPubkey: Uint8Array;
40
+ amountSats: number;
41
+ }) => Record<string, unknown>;
42
+ /** The token amount rides the profile as `evm_amount`; the envelope has no `amount`, and the
43
+ * solver's strict schema refuses one. No `claim_packet`: the client must be online to claim. */
44
+ declare const evmReceiveRequest: (input: {
45
+ rfqId: string;
46
+ tokenAddress: string;
47
+ paymentHash: string;
48
+ evmAmount: bigint;
49
+ /** The client's own lock deadline, as a block height. */
50
+ evmTimeoutBlock: number;
51
+ evmRefundAddress: string;
52
+ payoutAddress: string;
53
+ /** The covenant's `receiver` role. */
54
+ payoutPubkey: Uint8Array;
55
+ }) => Record<string, unknown>;
56
+ interface EvmQuoteProfileCommon {
57
+ payment_hash: string;
58
+ /** Compare-only: never fund it without deriving the covenant locally. */
59
+ lockup_address: string;
60
+ evm_contract_address: string;
61
+ evm_chain_id: number;
62
+ /** Wait for both: a rollup can bury a lock in seconds before its L1 batch finalizes. */
63
+ min_confirmations: number;
64
+ min_age_seconds: number;
65
+ [key: string]: unknown;
66
+ }
67
+ interface EvmSendQuoteProfile extends EvmQuoteProfileCommon {
68
+ /** The solver's claim pkScript, needed to rebuild the covenant's merkle root. */
69
+ receiver_pk_script: string;
70
+ /** The solver's address, the refund role of its lock: the sixth swap-key field, and an
71
+ * explicit argument to `claim`. */
72
+ evm_refund_address: string;
73
+ /** A block height, unlike the unix-seconds `refund_locktime` beside it. */
74
+ evm_timeout_block: number;
75
+ }
76
+ interface EvmReceiveQuoteProfile extends EvmQuoteProfileCommon {
77
+ /** The solver's refund pkScript, needed to rebuild the covenant's merkle root. */
78
+ solver_refund_pk_script: string;
79
+ /** The `claimAddress` the client must lock to. */
80
+ evm_claim_address: string;
81
+ }
82
+ interface EvmSendQuote {
83
+ v: 1;
84
+ type: "rfq_quote";
85
+ rfq_id: string;
86
+ pair: string;
87
+ from_amount: number;
88
+ to_amount: string;
89
+ solver_pubkey: string;
90
+ valid_until: number;
91
+ refund_locktime: number;
92
+ profile: EvmSendQuoteProfile;
93
+ [key: string]: unknown;
94
+ }
95
+ interface EvmReceiveQuote {
96
+ v: 1;
97
+ type: "rfq_quote";
98
+ rfq_id: string;
99
+ pair: string;
100
+ from_amount: string;
101
+ to_amount: number;
102
+ solver_pubkey: string;
103
+ valid_until: number;
104
+ refund_locktime: number;
105
+ profile: EvmReceiveQuoteProfile;
106
+ [key: string]: unknown;
107
+ }
108
+ type EvmRfqQuote = EvmSendQuote | EvmReceiveQuote;
109
+ /**
110
+ * Checks a reply's shape and binds it to the request (rfq id, token, payment hash, chain, exact
111
+ * input). It does not make `lockup_address` safe to fund. Unknown fields are tolerated.
112
+ */
113
+ declare const readEvmSendQuote: (payload: unknown, expected: {
114
+ tokenAddress: string;
115
+ rfqId: string;
116
+ paymentHash: string;
117
+ chainId: number;
118
+ amountSats: number;
119
+ }) => EvmSendQuote;
120
+ /** The receive-direction counterpart of {@link readEvmSendQuote}. */
121
+ declare const readEvmReceiveQuote: (payload: unknown, expected: {
122
+ tokenAddress: string;
123
+ rfqId: string;
124
+ paymentHash: string;
125
+ chainId: number;
126
+ evmAmount: bigint;
127
+ }) => EvmReceiveQuote;
128
+ /** The token leg of a quote, picked by its pair so the sats leg can never be read as tokens. */
129
+ declare const evmQuoteTokenAmount: (quote: EvmRfqQuote) => bigint;
130
+ /** The sats leg of a quote; see {@link evmQuoteTokenAmount}. */
131
+ declare const evmQuoteSats: (quote: EvmRfqQuote) => number;
12
132
 
13
133
  /**
14
134
  * The alias table, filled from discovery: the inverse of `toDiscoveryLeg`, mapping a card's
@@ -134,9 +254,9 @@ declare const LIGHTNING_DRIVE: {
134
254
  declare const lightningCorridor: CorridorFactory<LightningCorridorDeps>;
135
255
 
136
256
  /**
137
- * One direction only. `onchain -> arkade` is deliberately absent: it adds an L1 half the
138
- * trader funds and must refund itself, and declaring only the lockup half would yield a
139
- * manager that silently lets the trader's L1 refund window pass.
257
+ * On `onchain -> arkade` the Arkade lockup is the solver's and the L1 HTLC's refund leaf the
258
+ * trader's own: the trader claims the lockup, or takes its L1 funding back after
259
+ * `htlc.refundLocktime`.
140
260
  *
141
261
  * On `arkade -> onchain` the two covenants have different owners: the Arkade lockup is
142
262
  * the trader's (`refundLocktime` = money comes back), but the L1 HTLC's refund leaf is
@@ -156,6 +276,19 @@ declare const ONCHAIN_DRIVE: {
156
276
  readonly actions: readonly ["claimOnchain", "refundArkade"];
157
277
  readonly seams: readonly ["indexer", "chain"];
158
278
  };
279
+ readonly give: {
280
+ readonly lockups: readonly [{
281
+ readonly covenant: "arkade_lockup";
282
+ readonly owner: "solver";
283
+ readonly deadline: "refund_locktime";
284
+ }, {
285
+ readonly covenant: "onchain_htlc";
286
+ readonly owner: "trader";
287
+ readonly deadline: "htlc_refund_locktime";
288
+ }];
289
+ readonly actions: readonly ["claimLockup", "refundOnchain"];
290
+ readonly seams: readonly ["indexer", "chain"];
291
+ };
159
292
  };
160
293
  declare const onchainCorridor: CorridorFactory<OnchainCorridorDeps>;
161
294
 
@@ -270,8 +403,8 @@ declare const walletLockupIndexer: (wallet: IWallet) => LockupSpendIndexer;
270
403
  * amount may be pinned; two is `AmountMismatch`, thrown here so nothing is disclosed.
271
404
  */
272
405
 
273
- /** The four implemented corridor pairs, spelled as the route union spells them. */
274
- declare const SUPPORTED_PAIRS: readonly ["arkade->arkade", "arkade->lightning", "lightning->arkade", "arkade->onchain"];
406
+ /** The five implemented corridor pairs, spelled as the route union spells them. */
407
+ declare const SUPPORTED_PAIRS: readonly ["arkade->arkade", "arkade->lightning", "lightning->arkade", "arkade->onchain", "onchain->arkade"];
275
408
  type SupportedPair = (typeof SUPPORTED_PAIRS)[number];
276
409
  interface ResolveDeps {
277
410
  readonly corridors: CorridorSet;
@@ -431,6 +564,17 @@ declare const verifyQuoteTtl: (input: {
431
564
  readonly now: number;
432
565
  readonly floorSeconds?: number;
433
566
  }) => void;
567
+ /**
568
+ * The policy ceiling on how long a send's funds stay locked: a solver that never pays could
569
+ * otherwise hold them for as long as it quotes.
570
+ */
571
+ declare const verifyRefundWindow: (input: {
572
+ readonly refundLocktime: number;
573
+ /** Lightning send's solo-refund CSV delay. */
574
+ readonly refundWithoutReceiverDelay?: number;
575
+ readonly now: number;
576
+ readonly maxSeconds?: number;
577
+ }) => void;
434
578
  /**
435
579
  * The quote answers the request that was made: the pinned side must not be repriced.
436
580
  *
@@ -547,4 +691,4 @@ declare function revealClaimPacket(client: CovclaimdClient, input: {
547
691
  ciphertext: string;
548
692
  }>;
549
693
 
550
- export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };
694
+ export { type AddressParams, ArkadeCorridorDeps, AssetAliasTable, AssetId, type ChainSourceBackend, Corridor, CorridorFactory, type CorridorRecordStore, CorridorSet, CorridorSwapRecord, type CovclaimdClient, type CovclaimdInfo, CovclaimdRevealError, DEFAULT_INVOICE_EXPIRY_SECONDS, type DepositFate, DiscoveryIndex, DiscoveryLeg, DiscoverySnapshot, EVM_CHAIN, type EvmReceiveQuote, type EvmReceiveQuoteProfile, type EvmRfqQuote, type EvmSendQuote, type EvmSendQuoteProfile, INVOICE_HRPS, Instrument, type L1Tip, LIGHTNING_DRIVE, LightningCorridorDeps, MarketCandidate, NetworkRef, ONCHAIN_DRIVE, OfferSwapRecord, OnchainCorridorDeps, PinnedAmount, Pubkey, QuoteId, QuoteInput, Rail, type RecordSink, type ResolveDeps, ResolvedEndpoint, type ResolvedRoute, type RevealParams, Route, RouteResolution, SwapPolicy, SwapRecord, aliasTableFrom, applyOfferSpend, arkadeCorridor, assembleRoute, chainSourceOver, corridorRecordStore, covclaimdClient, decodeBolt11, esploraChainSource, esploraTip, evmAmountFromWire, evmAmountToWire, evmDirectionOf, evmQuoteSats, evmQuoteTokenAmount, evmReceivePair, evmReceiveRequest, evmSendPair, evmSendRequest, evmTokenLeg, evmTokenOf, fateMoved, lightningCorridor, networksOfInvoiceHrp, offerFactsOf, offerRecordSource, onchainCorridor, pageRfqRecords, publicAssetId, readEvmReceiveQuote, readEvmSendQuote, resolveRoute, restoredCorridorRecord, restoredOfferRecord, revealClaimPacket, revealFieldsFromScript, rfqRecordOf, satsOf, scopedToRail, splitRecords, verifiedCarrierSats, verifyCrossAssetAmount, verifyPair, verifyQuoteTtl, verifyQuotedAmount, verifyReceiveInvoiceFacts, verifyReceiveWindow, verifyRefundWindow, verifyResponder, verifySendInvoice, verifySendWindow, verifyingDerivation, walletLockupIndexer, withDepositFate, withRfqState };