@arkade-os/swap 0.1.10 → 0.1.12

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 (48) hide show
  1. package/README.md +58 -0
  2. package/dist/advanced.cjs +1058 -414
  3. package/dist/advanced.d.cts +7 -64
  4. package/dist/advanced.d.ts +7 -64
  5. package/dist/advanced.js +29 -5
  6. package/dist/{chunk-AUJDREZN.js → chunk-CIDVLDDM.js} +1 -1
  7. package/dist/{chunk-FWRDAL73.js → chunk-F3BGKWIB.js} +758 -104
  8. package/dist/{chunk-LCO6AJOS.js → chunk-ISKJIONJ.js} +58 -285
  9. package/dist/{chunk-2HQZLIVX.js → chunk-JBTU7Y6M.js} +1 -1
  10. package/dist/chunk-UXK7YDA4.js +568 -0
  11. package/dist/{chunk-6RJVT65W.js → chunk-VPVSSBY2.js} +2 -4
  12. package/dist/index.cjs +1045 -414
  13. package/dist/index.d.cts +6 -4
  14. package/dist/index.d.ts +6 -4
  15. package/dist/index.js +15 -5
  16. package/dist/{lockupContract-BTTRVwOt.d.cts → lockupContract-B1mr672c.d.cts} +1 -1
  17. package/dist/{lockupContract-aFarhlxj.d.ts → lockupContract-BRpk0NxT.d.ts} +1 -1
  18. package/dist/node/index.d.cts +18 -18
  19. package/dist/node/index.d.ts +18 -18
  20. package/dist/nostr.cjs +276 -302
  21. package/dist/nostr.d.cts +20 -2
  22. package/dist/nostr.d.ts +20 -2
  23. package/dist/nostr.js +21 -357
  24. package/dist/{offerFillPlan-CJC5tnEd.d.ts → offerFillPlan-BMZXiVMB.d.ts} +213 -28
  25. package/dist/{offerFillPlan-FmyaQoYT.d.cts → offerFillPlan-CqJerwXd.d.cts} +213 -28
  26. package/dist/openRfq-Dx-vxOzl.d.cts +32 -0
  27. package/dist/openRfq-Dx-vxOzl.d.ts +32 -0
  28. package/dist/openRfqTransport-MQZ7JWYN.js +9 -0
  29. package/dist/protocol.cjs +301 -322
  30. package/dist/protocol.d.cts +5 -5
  31. package/dist/protocol.d.ts +5 -5
  32. package/dist/protocol.js +6 -8
  33. package/dist/repositories/realm/index.d.cts +1 -1
  34. package/dist/repositories/realm/index.d.ts +1 -1
  35. package/dist/repositories/sqlite/index.d.cts +1 -1
  36. package/dist/repositories/sqlite/index.d.ts +1 -1
  37. package/dist/{repository-CwwhIAEd.d.cts → repository-CFC0fHAy.d.cts} +26 -26
  38. package/dist/{repository-DO6QKxBx.d.ts → repository-suGldzOK.d.ts} +26 -26
  39. package/dist/rfq-contract.cjs +3 -6
  40. package/dist/rfq-contract.d.cts +3 -4
  41. package/dist/rfq-contract.d.ts +3 -4
  42. package/dist/rfq-contract.js +3 -5
  43. package/dist/transportErrors-DZuZqnF4.d.cts +8 -0
  44. package/dist/transportErrors-DZuZqnF4.d.ts +8 -0
  45. package/dist/{verify-ENO36VPK.js → verify-HU5COTNO.js} +3 -3
  46. package/dist/{watch-_fZSgx_l.d.ts → watch-C2z6Onak.d.ts} +1 -1
  47. package/dist/{watch-DpDSP2tu.d.cts → watch-CpYjItYX.d.cts} +1 -1
  48. package/package.json +3 -3
@@ -1,7 +1,8 @@
1
1
  import { IWallet, NetworkName, Network, SignerSet, OnchainProvider, OperatorInfo, VHTLC, ProvisionedKey, ProvisionedClaimSecret, Transaction } from '@arkade-os/sdk';
2
- import { bb as SwapOperator, d as AssetSwapRepository, bd as RfqSwapManagerCallbacks, C as Corridor, I as Instrument, be as RfqSwapActionName, N as NetworkRef, A as AssetId, am as SnapshotRef, a2 as MarketBackend, W as CardMarketRef, a3 as MarketRef, D as AssetRef, q as AmountOn, an as Swap, X as CorridorId, Z as DepositArtifact, l as QuoteInput, a7 as Quote, ac as RankedBid, aq as SwapUpdate, as as Unsubscribe, S as SwapRecord, Q as QuoteId, a5 as Outcome, L as LockupSpendIndexer, ba as SwapContractRegistry, j as ResolvedEndpoint, P as PinnedAmount, B as AssetPaymentTerms, bf as DerivedOffer, z as AssetPaymentInput, O as OfferSwapRecord, F as AssetSwapId, ao as SwapFamily, i as RouteResolution, bg as FillFunding, bh as FillOutpoint, bi as FillInputOwner, bj as OfferBinding } from './repository-DO6QKxBx.js';
2
+ import { bb as SwapOperator, d as AssetSwapRepository, bd as RfqSwapManagerCallbacks, C as Corridor, W as Instrument, be as RfqSwapActionName, N as NetworkRef, A as AssetId, am as SnapshotRef, Y as MarketBackend, J as CardMarketRef, Z as MarketRef, x as AssetRef, m as AmountOn, an as Swap, K as CorridorId, P as DepositArtifact, a4 as QuoteInput, a3 as Quote, al as RouteResolution, ah as ResolvedEndpoint, a2 as PinnedAmount, ak as Route, aq as SwapUpdate, as as Unsubscribe, S as SwapRecord, Q as QuoteId, a0 as Outcome, L as LockupSpendIndexer, ba as SwapContractRegistry, w as AssetPaymentTerms, bf as DerivedOffer, v as AssetPaymentInput, O as OfferSwapRecord, z as AssetSwapId, ao as SwapFamily, bg as FillFunding, bh as FillOutpoint, bi as FillInputOwner, bj as OfferBinding } from './repository-suGldzOK.js';
3
3
  import { I as InvoiceFacts, P as Pubkey, C as ChainSource, R as RfqQuote, L as LightningSendContractParams, j as LightningReceiveContractParams, O as OnchainHtlc, k as OnchainHtlcParams, l as OnchainNetwork, A as AttestingRfqTransport, b as RfqTransportFactory, S as SwapRefusal } from './rfq-CYxOyniL.js';
4
- import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, OfferPlan } from '@arkade-os/solver-discovery';
4
+ import { Network as Network$1, LocalCardInput, TransportCardFetcher, DiscoveredMarket, Side, SolverRoutingPreferences, OfferPlan, QuoteOfferOptions, Card } from '@arkade-os/solver-discovery';
5
+ import { O as OpenRfqBid } from './openRfq-Dx-vxOzl.js';
5
6
 
6
7
  /**
7
8
  * What a corridor is given, what a caller may replace, and where "overridden to nothing" is refused.
@@ -668,6 +669,139 @@ declare const receive: <C extends CorridorId = CorridorId>(deps: VerbDeps, optio
668
669
  /** Swap one Arkade asset for another. */
669
670
  declare const exchange: (deps: VerbDeps, options: ExchangeOptions) => Promise<Swap>;
670
671
 
672
+ /**
673
+ * Route resolution: the single place `to` is parsed, the corridor pair decided, the
674
+ * amount pinned and the market chosen — everything before a solver is told anything.
675
+ *
676
+ * The order (§3.1) is load-bearing: `to` first (needs no market data); the pair selects
677
+ * the `Route` variant, refusing unsupported pairs before any round trip or record; only
678
+ * then the market index, since tickers resolve against the cards themselves. Exactly one
679
+ * amount may be pinned; two is `AmountMismatch`, thrown here so nothing is disclosed.
680
+ */
681
+
682
+ /** The five implemented corridor pairs, spelled as the route union spells them. */
683
+ declare const SUPPORTED_PAIRS: readonly ["arkade->arkade", "arkade->lightning", "lightning->arkade", "arkade->onchain", "onchain->arkade"];
684
+ type SupportedPair = (typeof SUPPORTED_PAIRS)[number];
685
+ interface ResolveDeps {
686
+ readonly corridors: CorridorSet;
687
+ /** The network the wallet reported; every defaulted asset id is on it. */
688
+ readonly network: NetworkName;
689
+ readonly discovery: DiscoveryIndex;
690
+ readonly policy?: SwapPolicy;
691
+ /**
692
+ * `resolve()` reads what is in hand; `quote()` may fetch. A flag, not two functions,
693
+ * so the resolution a caller vetoed is exactly the one they quote.
694
+ */
695
+ readonly mode: "resolve" | "quote";
696
+ }
697
+ /** What the quote path needs from a resolution, over what a caller sees. */
698
+ interface ResolvedRoute {
699
+ readonly resolution: RouteResolution;
700
+ /** Both legs in discovery's vocabulary — what the market lookup matched on. */
701
+ readonly legs: {
702
+ readonly give: DiscoveryLeg;
703
+ readonly take: DiscoveryLeg;
704
+ };
705
+ readonly give: ResolvedEndpoint;
706
+ readonly take: ResolvedEndpoint;
707
+ readonly pair: SupportedPair;
708
+ readonly candidates: readonly MarketCandidate[];
709
+ /** The chosen card, absent when nothing eligible survived. */
710
+ readonly market?: MarketCandidate;
711
+ readonly snapshot: DiscoverySnapshot;
712
+ readonly amount?: PinnedAmount;
713
+ /** The alias table the snapshot produced, so the quote path can reuse it. */
714
+ readonly aliases: AssetAliasTable;
715
+ }
716
+ /**
717
+ * Assemble the closed `Route` from two fully-instrumented legs.
718
+ *
719
+ * The quote path's one cast: the type checker cannot correlate `corridor` and `asset`,
720
+ * so the runtime re-check turns a broken invariant into a throw rather than a covenant
721
+ * built against the wrong rail.
722
+ */
723
+ declare const assembleRoute: (give: ResolvedEndpoint & {
724
+ instrument: Instrument;
725
+ }, take: ResolvedEndpoint & {
726
+ instrument: Instrument;
727
+ }) => Route;
728
+ declare const resolveRoute: (input: QuoteInput, deps: ResolveDeps) => Promise<ResolvedRoute>;
729
+
730
+ interface SolverHealthScope {
731
+ readonly network: string;
732
+ readonly direction: string;
733
+ }
734
+ interface SolverHealthEntry {
735
+ readonly failures: number;
736
+ readonly lastFailureAt: number;
737
+ }
738
+ interface SolverHealthStorage {
739
+ load(scope: SolverHealthScope): unknown | Promise<unknown>;
740
+ save(scope: SolverHealthScope, records: Readonly<Record<string, SolverHealthEntry>>): void | Promise<void>;
741
+ }
742
+ interface SolverHealth {
743
+ deprioritized(scope: SolverHealthScope): Promise<string[]>;
744
+ record(scope: SolverHealthScope, solverId: string, outcome: "success" | "failure"): Promise<void>;
745
+ }
746
+ /** Session-local by default; inject storage to retain per-network/direction quote reliability.
747
+ * Two failures demote for one minute, doubling to fifteen; thirty quiet minutes forget the streak.
748
+ * onChange reports active demotion changes, so one failure need not restart a live preview.
749
+ * A verified quote clears it. Storage errors are advisory; acceptance never updates this state. */
750
+ declare function createSolverHealth(options?: {
751
+ storage?: SolverHealthStorage;
752
+ now?: () => number;
753
+ onChange?: () => void;
754
+ }): SolverHealth;
755
+
756
+ interface SolverCandidate extends MarketCandidate {
757
+ readonly solverId: string;
758
+ readonly direction: string;
759
+ }
760
+ interface SolverRoutingContext {
761
+ readonly network: NetworkName;
762
+ readonly direction: string;
763
+ readonly candidates: readonly SolverCandidate[];
764
+ }
765
+ /** Optional direction-specific policy for quote preparation; accepted swaps keep their solver. */
766
+ interface SolverRoutingPolicy {
767
+ /** Shared reliability tracker; defaults to per-client memory when routing is enabled. */
768
+ readonly health?: SolverHealth;
769
+ /** Try another candidate on solver-local quote failure; defaults to true. Every candidate
770
+ * passes full verification before funding. Custom transports throw {@link SolverUnavailable}
771
+ * for retryable failures; exhausted attempts throw {@link SolverRoutesUnavailable}.
772
+ * Each attempt discloses the request to that solver: a Lightning send's BOLT11 (payment
773
+ * hash, amount, route hints) reaches every solver tried before a verified quote lands. Set
774
+ * false to limit that to one solver.
775
+ * Feed/fetchImpl failures are retryable; AbortError stops the operation. Authenticate before
776
+ * quoting, or set false to surface feed errors. Explicit `selectMarket` disables failover. */
777
+ readonly failover?: boolean;
778
+ /** Read current preferences before selection. Absent means discovery order; rejection stops
779
+ * the operation before negotiation. Modes, priority, usage and disabled solver IDs follow
780
+ * {@link SolverRoutingPreferences}. `preferFirst` precedes heuristic ordering without disabling
781
+ * failover. Cost estimates include directional flat fees, feed prices and carrier charges:
782
+ * most received for exact give, least deposited for exact take; unavailable estimates follow.
783
+ * They do not poll every RFQ solver or guarantee the cheapest final quote. Pauses affect new
784
+ * selection; issued quotes and accepted swaps retain their selected solver. */
785
+ readonly preferences?: (context: SolverRoutingContext) => SolverRoutingPreferences | Promise<SolverRoutingPreferences>;
786
+ }
787
+ declare const orderedSolverCandidates: (route: ResolvedRoute, network: NetworkName, policy: SwapPolicy | undefined, fetchImpl: typeof fetch, estimate?: boolean, health?: SolverHealth) => Promise<SolverCandidate[]>;
788
+ declare const canFailoverQuote: (error: unknown) => boolean;
789
+ declare const isSolverReliabilityFailure: (error: unknown) => boolean;
790
+ /** Exhausted candidates, outside the closed SwapError taxonomy; narrow with instanceof. */
791
+ declare class SolverRoutesUnavailable extends AggregateError {
792
+ readonly attempts: readonly {
793
+ solverId: string;
794
+ error: unknown;
795
+ }[];
796
+ readonly name = "SolverRoutesUnavailable";
797
+ constructor(attempts: readonly {
798
+ solverId: string;
799
+ error: unknown;
800
+ }[]);
801
+ }
802
+ /** Count unique successful swap IDs for a `solverDirectionKey` or `SolverRoutingContext.direction`. */
803
+ declare const completedSolverUsage: (swaps: readonly Swap[], network: string, direction: string) => Record<string, number>;
804
+
671
805
  /**
672
806
  * Application policy: the vetoes and floors a client applies before it discloses anything.
673
807
  *
@@ -678,16 +812,13 @@ declare const exchange: (deps: VerbDeps, options: ExchangeOptions) => Promise<Sw
678
812
  /**
679
813
  * A published-RFQ auction's parameters (§10, Q9).
680
814
  *
681
- * Reserved and inert: nothing reads it. Shaped after ts-sdk #777's draft so the name isn't taken
682
- * by something narrower meanwhile.
815
+ * Defaults for explicit openRfq calls. Ordinary quote() remains addressed.
683
816
  */
684
817
  interface RfqAuctionPolicy {
685
818
  /** How long to hold the bid window open, in ms. */
686
819
  readonly windowMs: number;
687
- /** Relays to publish the open request on. Unioned across the pair's cards. */
820
+ /** Default relays for explicit openRfq calls; absent means the current cards or public defaults. */
688
821
  readonly relays?: readonly string[];
689
- /** §4.6's SHOULD: a fresh transport key per open, so bids are unlinkable. */
690
- readonly freshTransportKey?: boolean;
691
822
  }
692
823
  /**
693
824
  * How much the client drives on its own, so a consumer can inspect its swaps without being made to
@@ -709,6 +840,8 @@ type DriveMode =
709
840
  /** Default {@link SwapPolicy.maxRefundWindowSeconds}: 30 days. */
710
841
  declare const DEFAULT_MAX_REFUND_WINDOW_SECONDS: number;
711
842
  interface SwapPolicy {
843
+ /** Opt in to direction-specific ordering and quote-only failover. Explicit selectMarket stays pinned. */
844
+ readonly solverRouting?: SolverRoutingPolicy;
712
845
  /** How much the client drives on its own. Default `"auto"`. */
713
846
  readonly drive?: DriveMode;
714
847
  /**
@@ -720,13 +853,9 @@ interface SwapPolicy {
720
853
  * asset than the quoted fee is refused, not converted.
721
854
  */
722
855
  readonly maxFee?: FeeCeiling;
723
- /**
724
- * The last word on which market prices a swap.
725
- *
726
- * Called with every eligible candidate, best-ranked first; `undefined` vetoes them all
727
- * (surfacing as `UnsupportedRoute`). The answer must be one of the candidates: a card from
728
- * elsewhere has not passed the pair, corridor and addressability checks.
729
- */
856
+ /** Choose from eligible candidates in discovery order, before routing preferences; `undefined` vetoes all.
857
+ * The answer must be one of those candidates, which passed pair, corridor and addressability
858
+ * checks. An explicit selection disables quote failover; routing pauses can still veto it. */
730
859
  readonly selectMarket?: (candidates: readonly MarketCandidate[]) => MarketCandidate | undefined;
731
860
  /**
732
861
  * The registries whose cards may price a swap, matched exactly against
@@ -749,13 +878,9 @@ interface SwapPolicy {
749
878
  */
750
879
  readonly maxRefundWindowSeconds?: number;
751
880
  /**
752
- * §10, reserved and inert: the published-RFQ auction's parameters.
881
+ * Defaults for explicit openRfq calls; never makes quote() public.
753
882
  */
754
883
  readonly rfq?: RfqAuctionPolicy;
755
- /**
756
- * §10, reserved and inert: which bid to close a published auction with.
757
- */
758
- readonly selectBid?: (bids: readonly RankedBid[]) => RankedBid | undefined;
759
884
  }
760
885
 
761
886
  /**
@@ -931,6 +1056,7 @@ interface FeedQuoteInput {
931
1056
  /** Unix seconds. */
932
1057
  readonly now: number;
933
1058
  }
1059
+ declare const quoteAdvertisedPlan: (card: DiscoveredMarket, options: QuoteOfferOptions, policy?: SwapPolicy) => Promise<OfferPlan>;
934
1060
  declare const quoteFromFeed: (input: FeedQuoteInput) => Promise<{
935
1061
  quote: Quote;
936
1062
  preparation: OfferPreparation;
@@ -1144,6 +1270,21 @@ declare const quoteViaRfq: (input: RfqQuoteInput) => Promise<{
1144
1270
  quote: Quote;
1145
1271
  preparation: RfqPreparation;
1146
1272
  }>;
1273
+ /**
1274
+ * The pin a solver is shown, and the claim fee folded into it. Open RFQ broadcasts the same
1275
+ * figure, so a bid and its directed quote price one amount.
1276
+ *
1277
+ * **An onchain send's take pin is recipient-EXACT.** The claim's miner fee comes out of the HTLC
1278
+ * output (`payout = utxo.amount - fee`), so with a resolvable
1279
+ * {@link OnchainCorridorDeps.claimFeeRateSatVb} the solver is asked for `pinned.value + claimFee`
1280
+ * (same arithmetic as the `onchain-swap` rail). No rate: verbatim, no invented fee. A give pin is
1281
+ * untouched: the take leg is the solver's to size. The recipient's own number never reaches the
1282
+ * wire: a solver who knew it would know what to short us by.
1283
+ */
1284
+ declare const solverFacingAmount: (route: RfqQuoteInput["route"], pinned: PinnedAmount, corridors: CorridorSet) => {
1285
+ quoted: PinnedAmount;
1286
+ claimFee?: bigint;
1287
+ };
1147
1288
 
1148
1289
  /** What a quote derived, kept in memory for the accept that may follow. */
1149
1290
  type QuotePreparation = RfqPreparation | OfferPreparation;
@@ -1204,6 +1345,42 @@ declare const cancelSwap: (input: CancelInput) => Promise<{
1204
1345
  outcome: CancelOutcome;
1205
1346
  }>;
1206
1347
 
1348
+ interface OpenRfqOffer {
1349
+ readonly id: string;
1350
+ readonly solverPubkey: string;
1351
+ readonly solverName: string;
1352
+ readonly market: DiscoveredMarket;
1353
+ readonly signedCard: Card;
1354
+ readonly fromAmount: bigint;
1355
+ readonly toAmount: bigint;
1356
+ readonly expiresAt: number;
1357
+ }
1358
+ interface OpenRfqAuction {
1359
+ readonly id: string;
1360
+ readonly input: QuoteInput;
1361
+ readonly pair: string;
1362
+ readonly bids: readonly OpenRfqOffer[];
1363
+ readonly closedAt: number;
1364
+ }
1365
+ /** Public pair and size discovery. Bids are indicative until quoteBid verifies binding terms. */
1366
+ interface OpenRfqOptions {
1367
+ /** Conversation-only key supplied by the application; use a fresh key for every request. */
1368
+ readonly secretKey: Uint8Array;
1369
+ /** Shared rendezvous with bidders. Absent means card relays, then opportunistic public defaults;
1370
+ * no relay discovers operators that do not listen there. */
1371
+ readonly relays?: readonly string[];
1372
+ readonly windowMs?: number;
1373
+ readonly signal?: AbortSignal;
1374
+ readonly onBids?: (bids: readonly OpenRfqOffer[]) => void;
1375
+ }
1376
+ declare const DEFAULT_OPEN_RFQ_RELAYS: readonly ["wss://relay.damus.io", "wss://nos.lol"];
1377
+ declare const freezeOpenRfqValue: <T>(value: T) => T;
1378
+ declare const openBidCandidates: (bid: OpenRfqBid, route: ResolvedRoute, network: string, policy?: SwapPolicy) => {
1379
+ signedCard: Card;
1380
+ candidates: MarketCandidate[];
1381
+ } | undefined;
1382
+ declare const hasPausedKnownBidder: (signer: string, name: string, route: ResolvedRoute, network: NetworkName, policy?: SwapPolicy) => Promise<boolean>;
1383
+
1207
1384
  interface SwapClientConfig {
1208
1385
  /** The wallet, and through it the operator: operator info, chain reads and broadcast all come from
1209
1386
  * it; no operator URL is accepted anywhere. */
@@ -1237,6 +1414,13 @@ interface AcceptOptions {
1237
1414
  readonly attachOfferPacket?: boolean;
1238
1415
  }
1239
1416
  interface SwapClient {
1417
+ /** Public pair/size discovery; no destination, invoice or wallet identity is broadcast. */
1418
+ openRfq(input: QuoteInput, options: OpenRfqOptions): Promise<OpenRfqAuction>;
1419
+ /** Verify binding terms with the explicitly chosen bidder; never routes to another solver. */
1420
+ quoteBid(auction: OpenRfqAuction, bid: OpenRfqOffer): Promise<Quote>;
1421
+ /** Eligible solvers in routing order, without negotiating or accepting a swap.
1422
+ * Cost estimates may fetch advertised feeds; debounce frequent UI calls. */
1423
+ candidates(input: QuoteInput): Promise<readonly SolverCandidate[]>;
1240
1424
  /**
1241
1425
  * The restore-read, and — when it armed — the first pass after it. Under `drive: "auto"` the
1242
1426
  * read arms the loop on live work; arming runs a pass immediately since a resumed swap may be
@@ -1258,7 +1442,7 @@ interface SwapClient {
1258
1442
  */
1259
1443
  stop(): Promise<void>;
1260
1444
  /**
1261
- * Terminal cleanup: {@link stop}, drain in-flight work (nothing takes an `AbortSignal`), drop
1445
+ * Terminal cleanup: {@link stop}, abort open auctions, drain in-flight work, drop
1262
1446
  * every listener. Durable state survives; an injected repository is never closed. Afterwards
1263
1447
  * members refuse with {@link ClientDisposed}, except teardown: a second dispose and an issued
1264
1448
  * {@link Unsubscribe} are no-ops, so React-effect teardown never throws.
@@ -1320,7 +1504,9 @@ interface SwapClient {
1320
1504
  * veto before an RFQ round trip discloses an invoice or amount.
1321
1505
  */
1322
1506
  resolve(input: QuoteInput): Promise<RouteResolution>;
1323
- /** Verified, binding terms. Nothing is persisted, funded or watched. */
1507
+ /** Verified, binding terms; no swap is persisted, funded or watched. Advisory health may update.
1508
+ * Routing errors include SolverUnavailable, SolverResponseInvalid and SolverRoutesUnavailable;
1509
+ * narrow them with instanceof, separately from the closed SwapError taxonomy. */
1324
1510
  quote(input: QuoteInput): Promise<Quote>;
1325
1511
  /**
1326
1512
  * Make the quote durable, then move the value: record and secrets are at rest before anything
@@ -1388,7 +1574,7 @@ declare const createSwapClient: (config: SwapClientConfig) => SwapClient;
1388
1574
  * transport but *run* as a check, so verification cannot be skipped by configuring a dev
1389
1575
  * transport that authenticates nobody. Published RFQ (§10) attributes bids by signature instead.
1390
1576
  */
1391
- type QuoteCheck = "pair" | "lockup_address" | "invoice" | "refund_window" | "responder";
1577
+ type QuoteCheck = "pair" | "lockup_address" | "invoice" | "refund_window" | "responder" | "amount";
1392
1578
  /**
1393
1579
  * `to` is underdetermined — it parses as nothing, as more than one thing, or as one thing the
1394
1580
  * corridor that owns it refuses (a `tb1…` on mainnet, another operator's Arkade address, a
@@ -1444,11 +1630,10 @@ declare class AmountMismatch extends Error {
1444
1630
  constructor(sources: readonly [string, string]);
1445
1631
  }
1446
1632
  /**
1447
- * The amount cannot cross this encoding without an unsafe narrowing — a quote
1448
- * field arriving as a JSON number past 2^53, a non-canonical decimal string, or
1449
- * a `bigint` too large for a foreign `number` amount.
1450
- *
1451
- * Boundary: the RFQ adapter, both directions; core's payment rails.
1633
+ * An unsafe amount encoding: a JSON number past 2^53, non-canonical decimal string,
1634
+ * or bigint too large for a foreign number. Applies to RFQ adapters and core payment rails.
1635
+ * With solver routing, malformed incoming RFQ replies wrap this error in
1636
+ * `SolverResponseInvalid.cause` so the client can try another solver.
1452
1637
  */
1453
1638
  declare class AmountEncodingUnsupported extends Error {
1454
1639
  readonly field: string;
@@ -1641,4 +1826,4 @@ interface BuildOfferFillPlanOpts {
1641
1826
  declare function buildOfferFillPlan(wallet: IWallet, arkServerUrl: string, offerHex: string | OfferBinding, opts: BuildOfferFillPlanOpts): Promise<JointGraph>;
1642
1827
  declare function verifyOfferFillPlan(plan: JointGraph): boolean;
1643
1828
 
1644
- export { type LockupOwner as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, type DiscoveryIndex as D, type CorridorPass as E, type CorridorRfqPreparation as F, DEFAULT_MAX_REFUND_WINDOW_SECONDS as G, type DiscoveryConfig as H, type DiscoveryIndexInput as I, DiscoverySnapshotUnavailable as J, type DriveMode as K, type LightningCorridorDeps as L, type MarketCandidate as M, type DriveRefusal as N, type OnchainCorridorDeps as O, type ExchangeOptions as P, FEED_TTL_MS as Q, type FeeCeiling as R, type SwapPolicy as S, type FeedFetch as T, type FeedQuoteInput as U, type FillSponsor as V, type FillSponsorFare as W, INDEXED_NETWORKS as X, InconsistentRoute as Y, InsufficientFunds as Z, type JointGraph as _, type ArkadeCorridorDeps as a, isUsableCard as a$, type Market as a0, type MarketLeg as a1, MaxFeeExceeded as a2, MissingCorridorDep as a3, NotCancellable as a4, OFFER_FILL_OWNERS as a5, OFFER_FILL_TEMPLATE as a6, ONCHAIN_CLAIM_FEE_RATE_SATVB as a7, type ObservationSeam as a8, type OfferPreparation as a9, type SwapError as aA, type SwapErrorName as aB, type SwapFilter as aC, UnsupportedRoute as aD, type VerbDeps as aE, acceptQuote as aF, buildOfferFillPlan as aG, cancelSwap as aH, canonicalAssetId as aI, cardMarketOf as aJ, chooseMarket as aK, conflictingFields as aL, corridorSet as aM, createSwapClient as aN, createSwapDrive as aO, deepFreeze as aP, digestJointGraph as aQ, discoveryIndex as aR, eligibleMarkets as aS, enforceFeeCeiling as aT, exchange as aU, feedFetch as aV, feedSpread as aW, isAddressable as aX, isCardMarket as aY, isIndexedNetwork as aZ, isSwapError as a_, type OnchainClaim as aa, type OnchainRefund as ab, OperatorUnreachable as ac, type ParsedRfqQuote as ad, type PayOptions as ae, type PayResult as af, type QuoteCheck as ag, QuoteExpired as ah, type QuotePreparation as ai, QuoteVerificationFailed as aj, REGISTRY_URL as ak, type ReceiveArtifact as al, type ReceiveOptions as am, type ReceiveRequest as an, type RecoveryResult as ao, type RegisteredAsset as ap, type RfqAuctionPolicy as aq, type RfqPreparation as ar, type RfqQuoteInput as as, type RouteSide as at, SWAP_ERROR_NAMES as au, type SwapClient as av, type SwapClientConfig as aw, type SwapDrive as ax, type SwapDriveConfig as ay, SwapDriveRefusedError as az, type CorridorSet as b, liveArkadeInfo as b0, liveOperatorInfo as b1, marketBackendOf as b2, marketKeyOf as b3, marketOf as b4, marketRefOf as b5, parseRfqQuote as b6, pay as b7, quoteFromFeed as b8, quoteViaRfq as b9, readableRecord as ba, receive as bb, resolveCorridorBase as bc, resolveCorridorDeps as bd, rfqLeg as be, rfqPairFor as bf, swapRecordOf as bg, toDiscoveryLeg as bh, unsignedPsbtBytes as bi, usableMarkets as bj, verifyJointGraph as bk, verifyOfferFillPlan as bl, verifyPlanLegs as bm, withCanonicalAmount as bn, type DiscoveryLeg as c, type DiscoverySnapshot as d, AcceptConflict as e, type AcceptInput as f, type AcceptOptions as g, AmbiguousDestination as h, AmountEncodingUnsupported as i, AmountMismatch as j, type AssetRfqPreparation as k, CORRIDOR_FACTORIES as l, type CancelInput as m, type CancelOutcome as n, type ClaimedDestination as o, ClientDisposed as p, type CorridorBase as q, type CorridorClaim as r, type CorridorCovenant as s, type CorridorDeadline as t, type CorridorDeps as u, type CorridorDepsByCorridor as v, type CorridorDrive as w, type CorridorLockup as x, type CorridorModule as y, type CorridorOverrides as z };
1829
+ export { type Market as $, type AssetAliasTable as A, type BuildOfferFillPlanOpts as B, type CorridorFactory as C, DEFAULT_MAX_REFUND_WINDOW_SECONDS as D, DEFAULT_OPEN_RFQ_RELAYS as E, type DiscoveryConfig as F, type DiscoveryIndex as G, type DiscoveryIndexInput as H, type DiscoveryLeg as I, type DiscoverySnapshot as J, DiscoverySnapshotUnavailable as K, type LightningCorridorDeps as L, type DriveMode as M, type DriveRefusal as N, type OnchainCorridorDeps as O, type ExchangeOptions as P, FEED_TTL_MS as Q, type FeeCeiling as R, type FeedFetch as S, type FeedQuoteInput as T, type FillSponsor as U, type FillSponsorFare as V, INDEXED_NETWORKS as W, InconsistentRoute as X, InsufficientFunds as Y, type JointGraph as Z, type LockupOwner as _, type ArkadeCorridorDeps as a, completedSolverUsage as a$, type MarketCandidate as a0, type MarketLeg as a1, MaxFeeExceeded as a2, MissingCorridorDep as a3, NotCancellable as a4, OFFER_FILL_OWNERS as a5, OFFER_FILL_TEMPLATE as a6, ONCHAIN_CLAIM_FEE_RATE_SATVB as a7, type ObservationSeam as a8, type OfferPreparation as a9, type SolverCandidate as aA, type SolverHealth as aB, type SolverHealthEntry as aC, type SolverHealthScope as aD, type SolverHealthStorage as aE, SolverRoutesUnavailable as aF, type SolverRoutingContext as aG, type SolverRoutingPolicy as aH, type SwapClient as aI, type SwapClientConfig as aJ, type SwapDrive as aK, type SwapDriveConfig as aL, SwapDriveRefusedError as aM, type SwapError as aN, type SwapErrorName as aO, type SwapFilter as aP, type SwapPolicy as aQ, UnsupportedRoute as aR, type VerbDeps as aS, acceptQuote as aT, assembleRoute as aU, buildOfferFillPlan as aV, canFailoverQuote as aW, cancelSwap as aX, canonicalAssetId as aY, cardMarketOf as aZ, chooseMarket as a_, type OnchainClaim as aa, type OnchainRefund as ab, type OpenRfqAuction as ac, type OpenRfqOffer as ad, type OpenRfqOptions as ae, OperatorUnreachable as af, type ParsedRfqQuote as ag, type PayOptions as ah, type PayResult as ai, type QuoteCheck as aj, QuoteExpired as ak, type QuotePreparation as al, QuoteVerificationFailed as am, REGISTRY_URL as an, type ReceiveArtifact as ao, type ReceiveOptions as ap, type ReceiveRequest as aq, type RecoveryResult as ar, type RegisteredAsset as as, type ResolveDeps as at, type ResolvedRoute as au, type RfqAuctionPolicy as av, type RfqPreparation as aw, type RfqQuoteInput as ax, type RouteSide as ay, SWAP_ERROR_NAMES as az, AcceptConflict as b, conflictingFields as b0, corridorSet as b1, createSolverHealth as b2, createSwapClient as b3, createSwapDrive as b4, deepFreeze as b5, digestJointGraph as b6, discoveryIndex as b7, eligibleMarkets as b8, enforceFeeCeiling as b9, resolveCorridorBase as bA, resolveCorridorDeps as bB, resolveRoute as bC, rfqLeg as bD, rfqPairFor as bE, solverFacingAmount as bF, swapRecordOf as bG, toDiscoveryLeg as bH, unsignedPsbtBytes as bI, usableMarkets as bJ, verifyJointGraph as bK, verifyOfferFillPlan as bL, verifyPlanLegs as bM, withCanonicalAmount as bN, exchange as ba, feedFetch as bb, feedSpread as bc, freezeOpenRfqValue as bd, hasPausedKnownBidder as be, isAddressable as bf, isCardMarket as bg, isIndexedNetwork as bh, isSolverReliabilityFailure as bi, isSwapError as bj, isUsableCard as bk, liveArkadeInfo as bl, liveOperatorInfo as bm, marketBackendOf as bn, marketKeyOf as bo, marketOf as bp, marketRefOf as bq, openBidCandidates as br, orderedSolverCandidates as bs, parseRfqQuote as bt, pay as bu, quoteAdvertisedPlan as bv, quoteFromFeed as bw, quoteViaRfq as bx, readableRecord as by, receive as bz, type AcceptInput as c, type AcceptOptions as d, AmbiguousDestination as e, AmountEncodingUnsupported as f, AmountMismatch as g, type AssetRfqPreparation as h, CORRIDOR_FACTORIES as i, type CancelInput as j, type CancelOutcome as k, type ClaimedDestination as l, ClientDisposed as m, type CorridorBase as n, type CorridorClaim as o, type CorridorCovenant as p, type CorridorDeadline as q, type CorridorDeps as r, type CorridorDepsByCorridor as s, type CorridorDrive as t, type CorridorLockup as u, type CorridorModule as v, type CorridorOverrides as w, type CorridorPass as x, type CorridorRfqPreparation as y, type CorridorSet as z };