@arkade-os/boltz-swap 0.3.32 → 0.3.33

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 (31) hide show
  1. package/README.md +22 -26
  2. package/dist/{arkade-swaps-CS8FZSVL.d.cts → arkade-swaps-9M7FRuq1.d.cts} +57 -5
  3. package/dist/{arkade-swaps-WiKCanCL.d.ts → arkade-swaps-DNsyWeFr.d.ts} +57 -5
  4. package/dist/{chunk-NHBWNN6H.js → chunk-HNQDJOLM.js} +8 -27
  5. package/dist/{chunk-B3Q4TFWT.js → chunk-SJ5SYSMK.js} +551 -779
  6. package/dist/chunk-SJQJQO7P.js +25 -0
  7. package/dist/expo/background.cjs +573 -805
  8. package/dist/expo/background.d.cts +3 -3
  9. package/dist/expo/background.d.ts +3 -3
  10. package/dist/expo/background.js +8 -20
  11. package/dist/expo/index.cjs +574 -783
  12. package/dist/expo/index.d.cts +7 -5
  13. package/dist/expo/index.d.ts +7 -5
  14. package/dist/expo/index.js +17 -20
  15. package/dist/index.cjs +732 -931
  16. package/dist/index.d.cts +80 -10
  17. package/dist/index.d.ts +80 -10
  18. package/dist/index.js +126 -115
  19. package/dist/repositories/realm/index.cjs +10 -22
  20. package/dist/repositories/realm/index.d.cts +7 -5
  21. package/dist/repositories/realm/index.d.ts +7 -5
  22. package/dist/repositories/realm/index.js +8 -22
  23. package/dist/repositories/sqlite/index.cjs +12 -23
  24. package/dist/repositories/sqlite/index.d.cts +1 -1
  25. package/dist/repositories/sqlite/index.d.ts +1 -1
  26. package/dist/repositories/sqlite/index.js +10 -23
  27. package/dist/{swapsPollProcessor-wYOMzldd.d.ts → swapsPollProcessor-CEgeGlbP.d.ts} +3 -3
  28. package/dist/{swapsPollProcessor-BF3uTFae.d.cts → swapsPollProcessor-CuITxZie.d.cts} +3 -3
  29. package/dist/{types-BBI7-KJ0.d.cts → types-CrKkVzBB.d.cts} +9 -3
  30. package/dist/{types-BBI7-KJ0.d.ts → types-CrKkVzBB.d.ts} +9 -3
  31. package/package.json +10 -25
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-CS8FZSVL.cjs';
2
- export { A as ArkadeSwaps } from './arkade-swaps-CS8FZSVL.cjs';
3
- import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as SwapRepository, n as SwapManagerClient, o as GetSwapsFilter } from './types-BBI7-KJ0.cjs';
4
- export { _ as ArkadeSwapsCreateConfig, p as BoltzSwapProvider, q as BoltzSwapStatus, Z as IncomingPaymentSubscription, a1 as PendingChainSwap, a0 as PendingReverseSwap, $ as PendingSubmarineSwap, a2 as PendingSwap, a4 as SubmarineRecoveryStatus, Y as SwapManager, a7 as SwapManagerCallbacks, a5 as SwapManagerConfig, a6 as SwapManagerEvents, a3 as Vtxo, r as isChainClaimableStatus, s as isChainFailedStatus, t as isChainFinalStatus, u as isChainPendingStatus, v as isChainRefundableStatus, w as isChainSignableStatus, x as isChainSuccessStatus, y as isChainSwapClaimable, z as isChainSwapRefundable, E as isPendingChainSwap, H as isPendingReverseSwap, I as isPendingSubmarineSwap, J as isReverseClaimableStatus, K as isReverseFailedStatus, M as isReverseFinalStatus, O as isReversePendingStatus, P as isReverseSuccessStatus, Q as isReverseSwapClaimable, R as isSubmarineFailedStatus, T as isSubmarineFinalStatus, U as isSubmarinePendingStatus, W as isSubmarineRefundableStatus, V as isSubmarineSuccessStatus, X as isSubmarineSwapRefundable } from './types-BBI7-KJ0.cjs';
1
+ import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-9M7FRuq1.cjs';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-9M7FRuq1.cjs';
3
+ import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as SwapRepository, n as SwapManagerClient, o as GetSwapsFilter } from './types-CrKkVzBB.cjs';
4
+ export { p as ArkadeSwapsCreateConfig, q as BoltzSwapProvider, r as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, s as PendingReverseSwap, t as PendingSubmarineSwap, u as PendingSwap, v as SubmarineRecoveryStatus, w as SwapManager, x as SwapManagerCallbacks, y as SwapManagerConfig, z as SwapManagerEvents, V as Vtxo, E as isChainClaimableStatus, H as isChainFailedStatus, J as isChainFinalStatus, K as isChainPendingStatus, M as isChainRefundableStatus, O as isChainSignableStatus, Q as isChainSuccessStatus, R as isChainSwapClaimable, T as isChainSwapRefundable, U as isPendingChainSwap, W as isPendingReverseSwap, X as isPendingSubmarineSwap, Y as isReverseClaimableStatus, Z as isReverseFailedStatus, _ as isReverseFinalStatus, $ as isReversePendingStatus, a0 as isReverseSuccessStatus, a1 as isReverseSwapClaimable, a2 as isSubmarineFailedStatus, a3 as isSubmarineFinalStatus, a4 as isSubmarinePendingStatus, a5 as isSubmarineRefundableStatus, a6 as isSubmarineSuccessStatus, a7 as isSubmarineSwapRefundable } from './types-CrKkVzBB.cjs';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { MessageHandler, RequestEnvelope, ArkInfo, ResponseEnvelope, IWallet, IReadonlyWallet, VHTLC, Identity, ArkTxInput } from '@arkade-os/sdk';
7
7
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
@@ -16,6 +16,12 @@ interface ErrorOptions {
16
16
  isRefundable?: boolean;
17
17
  /** The associated pending swap, if available. */
18
18
  pendingSwap?: BoltzSwap;
19
+ /**
20
+ * Underlying cause. Preserved on the resulting `Error.cause`, so callers
21
+ * that wrap a typed error (e.g. autopilot wrapping `QuoteRejectedError`)
22
+ * can still recover the inner instance for programmatic branching.
23
+ */
24
+ cause?: unknown;
19
25
  }
20
26
  /**
21
27
  * Base error class for all swap-related errors.
@@ -86,6 +92,43 @@ declare class TransactionFailedError extends SwapError {
86
92
  declare class PreimageFetchError extends SwapError {
87
93
  constructor(options?: ErrorOptions);
88
94
  }
95
+ /** Reason a `quoteSwap` was rejected before being posted to Boltz. */
96
+ type QuoteRejectionReason = "below_floor" | "non_positive" | "no_baseline";
97
+ type QuoteRejectedOptions = ErrorOptions & ({
98
+ reason: "below_floor";
99
+ quotedAmount: number;
100
+ floor: number;
101
+ } | {
102
+ reason: "non_positive";
103
+ quotedAmount: number;
104
+ } | {
105
+ reason: "no_baseline";
106
+ });
107
+ /**
108
+ * Thrown when a Boltz-returned chain-swap quote fails local validation
109
+ * (below the acceptable floor, non-positive, or missing a baseline to
110
+ * compare against). The acceptance is never posted on failure.
111
+ */
112
+ declare class QuoteRejectedError extends SwapError {
113
+ readonly reason: QuoteRejectionReason;
114
+ readonly quotedAmount?: number;
115
+ readonly floor?: number;
116
+ constructor(options: QuoteRejectedOptions);
117
+ private static defaultMessage;
118
+ /**
119
+ * Serialize into a plain `Error` whose `.message` carries the full
120
+ * rejection payload as JSON behind a marker prefix. Structured clone
121
+ * (used by `postMessage` between page and service worker) preserves
122
+ * `Error.message` reliably but strips custom `.name` and own properties,
123
+ * so we move the typed data into the message field for transport.
124
+ */
125
+ toTransportError(): Error;
126
+ /**
127
+ * Inverse of `toTransportError`. Returns a real `QuoteRejectedError` if
128
+ * `error` carries the transport prefix, else `null`.
129
+ */
130
+ static fromTransportError(error: unknown): QuoteRejectedError | null;
131
+ }
89
132
  /**
90
133
  * Thrown when the Boltz API rejects a refund request
91
134
  * (e.g. outpoint mismatch after an Ark round).
@@ -480,6 +523,7 @@ type RequestQuoteSwap = RequestEnvelope & {
480
523
  type: "QUOTE_SWAP";
481
524
  payload: {
482
525
  swapId: string;
526
+ options?: QuoteSwapOptions;
483
527
  };
484
528
  };
485
529
  type ResponseQuoteSwap = ResponseEnvelope & {
@@ -488,6 +532,32 @@ type ResponseQuoteSwap = ResponseEnvelope & {
488
532
  amount: number;
489
533
  };
490
534
  };
535
+ type RequestGetSwapQuote = RequestEnvelope & {
536
+ type: "GET_SWAP_QUOTE";
537
+ payload: {
538
+ swapId: string;
539
+ };
540
+ };
541
+ type ResponseGetSwapQuote = ResponseEnvelope & {
542
+ type: "SWAP_QUOTE_RETRIEVED";
543
+ payload: {
544
+ amount: number;
545
+ };
546
+ };
547
+ type RequestAcceptSwapQuote = RequestEnvelope & {
548
+ type: "ACCEPT_SWAP_QUOTE";
549
+ payload: {
550
+ swapId: string;
551
+ amount: number;
552
+ options?: QuoteSwapOptions;
553
+ };
554
+ };
555
+ type ResponseAcceptSwapQuote = ResponseEnvelope & {
556
+ type: "SWAP_QUOTE_ACCEPTED";
557
+ payload: {
558
+ amount: number;
559
+ };
560
+ };
491
561
  type RequestSwapManagerStart = RequestEnvelope & {
492
562
  type: "SM-START";
493
563
  };
@@ -573,8 +643,8 @@ type ResponseSwapManagerWaitForCompletion = ResponseEnvelope & {
573
643
  txid: string;
574
644
  };
575
645
  };
576
- type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
577
- type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
646
+ type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
647
+ type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
578
648
  declare class ArkadeSwapsMessageHandler implements MessageHandler<ArkadeSwapsUpdaterRequest, ArkadeSwapsUpdaterResponse> {
579
649
  private readonly swapRepository;
580
650
  static messageTag: string;
@@ -687,7 +757,9 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
687
757
  swap: BoltzChainSwap;
688
758
  arkInfo: ArkInfo;
689
759
  }): Promise<boolean>;
690
- quoteSwap(swapId: string): Promise<number>;
760
+ quoteSwap(swapId: string, options?: QuoteSwapOptions): Promise<number>;
761
+ getSwapQuote(swapId: string): Promise<number>;
762
+ acceptSwapQuote(swapId: string, amount: number, options?: QuoteSwapOptions): Promise<number>;
691
763
  enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
692
764
  enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
693
765
  createVHTLCScript(_args: {
@@ -779,10 +851,8 @@ declare class IndexedDbSwapRepository implements SwapRepository {
779
851
  clear(): Promise<void>;
780
852
  private getSwapsByIndexValues;
781
853
  private getAllSwapsFromStore;
782
- private applySwapsFilter;
783
854
  private getAllSwapsByCreatedAt;
784
- private sortIfNeeded;
785
855
  [Symbol.asyncDispose](): Promise<void>;
786
856
  }
787
857
 
788
- export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
858
+ export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, QuoteRejectedError, type QuoteRejectionReason, QuoteSwapOptions, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-WiKCanCL.js';
2
- export { A as ArkadeSwaps } from './arkade-swaps-WiKCanCL.js';
3
- import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as SwapRepository, n as SwapManagerClient, o as GetSwapsFilter } from './types-BBI7-KJ0.js';
4
- export { _ as ArkadeSwapsCreateConfig, p as BoltzSwapProvider, q as BoltzSwapStatus, Z as IncomingPaymentSubscription, a1 as PendingChainSwap, a0 as PendingReverseSwap, $ as PendingSubmarineSwap, a2 as PendingSwap, a4 as SubmarineRecoveryStatus, Y as SwapManager, a7 as SwapManagerCallbacks, a5 as SwapManagerConfig, a6 as SwapManagerEvents, a3 as Vtxo, r as isChainClaimableStatus, s as isChainFailedStatus, t as isChainFinalStatus, u as isChainPendingStatus, v as isChainRefundableStatus, w as isChainSignableStatus, x as isChainSuccessStatus, y as isChainSwapClaimable, z as isChainSwapRefundable, E as isPendingChainSwap, H as isPendingReverseSwap, I as isPendingSubmarineSwap, J as isReverseClaimableStatus, K as isReverseFailedStatus, M as isReverseFinalStatus, O as isReversePendingStatus, P as isReverseSuccessStatus, Q as isReverseSwapClaimable, R as isSubmarineFailedStatus, T as isSubmarineFinalStatus, U as isSubmarinePendingStatus, W as isSubmarineRefundableStatus, V as isSubmarineSuccessStatus, X as isSubmarineSwapRefundable } from './types-BBI7-KJ0.js';
1
+ import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-DNsyWeFr.js';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-DNsyWeFr.js';
3
+ import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, f as SendLightningPaymentResponse, g as SubmarineRefundOutcome, h as SubmarineRecoveryInfo, i as SubmarineRecoveryResult, j as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, k as ArkToBtcResponse, l as BtcToArkResponse, m as SwapRepository, n as SwapManagerClient, o as GetSwapsFilter } from './types-CrKkVzBB.js';
4
+ export { p as ArkadeSwapsCreateConfig, q as BoltzSwapProvider, r as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, s as PendingReverseSwap, t as PendingSubmarineSwap, u as PendingSwap, v as SubmarineRecoveryStatus, w as SwapManager, x as SwapManagerCallbacks, y as SwapManagerConfig, z as SwapManagerEvents, V as Vtxo, E as isChainClaimableStatus, H as isChainFailedStatus, J as isChainFinalStatus, K as isChainPendingStatus, M as isChainRefundableStatus, O as isChainSignableStatus, Q as isChainSuccessStatus, R as isChainSwapClaimable, T as isChainSwapRefundable, U as isPendingChainSwap, W as isPendingReverseSwap, X as isPendingSubmarineSwap, Y as isReverseClaimableStatus, Z as isReverseFailedStatus, _ as isReverseFinalStatus, $ as isReversePendingStatus, a0 as isReverseSuccessStatus, a1 as isReverseSwapClaimable, a2 as isSubmarineFailedStatus, a3 as isSubmarineFinalStatus, a4 as isSubmarinePendingStatus, a5 as isSubmarineRefundableStatus, a6 as isSubmarineSuccessStatus, a7 as isSubmarineSwapRefundable } from './types-CrKkVzBB.js';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { MessageHandler, RequestEnvelope, ArkInfo, ResponseEnvelope, IWallet, IReadonlyWallet, VHTLC, Identity, ArkTxInput } from '@arkade-os/sdk';
7
7
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
@@ -16,6 +16,12 @@ interface ErrorOptions {
16
16
  isRefundable?: boolean;
17
17
  /** The associated pending swap, if available. */
18
18
  pendingSwap?: BoltzSwap;
19
+ /**
20
+ * Underlying cause. Preserved on the resulting `Error.cause`, so callers
21
+ * that wrap a typed error (e.g. autopilot wrapping `QuoteRejectedError`)
22
+ * can still recover the inner instance for programmatic branching.
23
+ */
24
+ cause?: unknown;
19
25
  }
20
26
  /**
21
27
  * Base error class for all swap-related errors.
@@ -86,6 +92,43 @@ declare class TransactionFailedError extends SwapError {
86
92
  declare class PreimageFetchError extends SwapError {
87
93
  constructor(options?: ErrorOptions);
88
94
  }
95
+ /** Reason a `quoteSwap` was rejected before being posted to Boltz. */
96
+ type QuoteRejectionReason = "below_floor" | "non_positive" | "no_baseline";
97
+ type QuoteRejectedOptions = ErrorOptions & ({
98
+ reason: "below_floor";
99
+ quotedAmount: number;
100
+ floor: number;
101
+ } | {
102
+ reason: "non_positive";
103
+ quotedAmount: number;
104
+ } | {
105
+ reason: "no_baseline";
106
+ });
107
+ /**
108
+ * Thrown when a Boltz-returned chain-swap quote fails local validation
109
+ * (below the acceptable floor, non-positive, or missing a baseline to
110
+ * compare against). The acceptance is never posted on failure.
111
+ */
112
+ declare class QuoteRejectedError extends SwapError {
113
+ readonly reason: QuoteRejectionReason;
114
+ readonly quotedAmount?: number;
115
+ readonly floor?: number;
116
+ constructor(options: QuoteRejectedOptions);
117
+ private static defaultMessage;
118
+ /**
119
+ * Serialize into a plain `Error` whose `.message` carries the full
120
+ * rejection payload as JSON behind a marker prefix. Structured clone
121
+ * (used by `postMessage` between page and service worker) preserves
122
+ * `Error.message` reliably but strips custom `.name` and own properties,
123
+ * so we move the typed data into the message field for transport.
124
+ */
125
+ toTransportError(): Error;
126
+ /**
127
+ * Inverse of `toTransportError`. Returns a real `QuoteRejectedError` if
128
+ * `error` carries the transport prefix, else `null`.
129
+ */
130
+ static fromTransportError(error: unknown): QuoteRejectedError | null;
131
+ }
89
132
  /**
90
133
  * Thrown when the Boltz API rejects a refund request
91
134
  * (e.g. outpoint mismatch after an Ark round).
@@ -480,6 +523,7 @@ type RequestQuoteSwap = RequestEnvelope & {
480
523
  type: "QUOTE_SWAP";
481
524
  payload: {
482
525
  swapId: string;
526
+ options?: QuoteSwapOptions;
483
527
  };
484
528
  };
485
529
  type ResponseQuoteSwap = ResponseEnvelope & {
@@ -488,6 +532,32 @@ type ResponseQuoteSwap = ResponseEnvelope & {
488
532
  amount: number;
489
533
  };
490
534
  };
535
+ type RequestGetSwapQuote = RequestEnvelope & {
536
+ type: "GET_SWAP_QUOTE";
537
+ payload: {
538
+ swapId: string;
539
+ };
540
+ };
541
+ type ResponseGetSwapQuote = ResponseEnvelope & {
542
+ type: "SWAP_QUOTE_RETRIEVED";
543
+ payload: {
544
+ amount: number;
545
+ };
546
+ };
547
+ type RequestAcceptSwapQuote = RequestEnvelope & {
548
+ type: "ACCEPT_SWAP_QUOTE";
549
+ payload: {
550
+ swapId: string;
551
+ amount: number;
552
+ options?: QuoteSwapOptions;
553
+ };
554
+ };
555
+ type ResponseAcceptSwapQuote = ResponseEnvelope & {
556
+ type: "SWAP_QUOTE_ACCEPTED";
557
+ payload: {
558
+ amount: number;
559
+ };
560
+ };
491
561
  type RequestSwapManagerStart = RequestEnvelope & {
492
562
  type: "SM-START";
493
563
  };
@@ -573,8 +643,8 @@ type ResponseSwapManagerWaitForCompletion = ResponseEnvelope & {
573
643
  txid: string;
574
644
  };
575
645
  };
576
- type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
577
- type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
646
+ type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestRestoreSwaps | RequestEnrichReverseSwapPreimage | RequestEnrichSubmarineSwapInvoice | RequestGetFees | RequestGetLimits | RequestGetSwapStatus | RequestGetPendingSubmarineSwaps | RequestGetPendingReverseSwaps | RequestGetPendingChainSwaps | RequestGetSwapHistory | RequestRefreshSwapsStatus | RequestArkToBtc | RequestBtcToArk | RequestCreateChainSwap | RequestWaitAndClaimChain | RequestWaitAndClaimArk | RequestWaitAndClaimBtc | RequestClaimArk | RequestClaimBtc | RequestRefundArk | RequestSignServerClaim | RequestVerifyChainSwap | RequestQuoteSwap | RequestGetSwapQuote | RequestAcceptSwapQuote | RequestSwapManagerStart | RequestSwapManagerStop | RequestSwapManagerAddSwap | RequestSwapManagerRemoveSwap | RequestSwapManagerGetPending | RequestSwapManagerHasSwap | RequestSwapManagerIsProcessing | RequestSwapManagerGetStats | RequestSwapManagerWaitForCompletion;
647
+ type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseRestoreSwaps | ResponseEnrichReverseSwapPreimage | ResponseEnrichSubmarineSwapInvoice | ResponseGetFees | ResponseGetLimits | ResponseGetSwapStatus | ResponseGetPendingSubmarineSwaps | ResponseGetPendingReverseSwaps | ResponseGetPendingChainSwaps | ResponseGetSwapHistory | ResponseRefreshSwapsStatus | ResponseArkToBtc | ResponseBtcToArk | ResponseCreateChainSwap | ResponseWaitAndClaimChain | ResponseWaitAndClaimArk | ResponseWaitAndClaimBtc | ResponseClaimArk | ResponseClaimBtc | ResponseRefundArk | ResponseSignServerClaim | ResponseVerifyChainSwap | ResponseQuoteSwap | ResponseGetSwapQuote | ResponseAcceptSwapQuote | ResponseSwapManagerStart | ResponseSwapManagerStop | ResponseSwapManagerAddSwap | ResponseSwapManagerRemoveSwap | ResponseSwapManagerGetPending | ResponseSwapManagerHasSwap | ResponseSwapManagerIsProcessing | ResponseSwapManagerGetStats | ResponseSwapManagerWaitForCompletion;
578
648
  declare class ArkadeSwapsMessageHandler implements MessageHandler<ArkadeSwapsUpdaterRequest, ArkadeSwapsUpdaterResponse> {
579
649
  private readonly swapRepository;
580
650
  static messageTag: string;
@@ -687,7 +757,9 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
687
757
  swap: BoltzChainSwap;
688
758
  arkInfo: ArkInfo;
689
759
  }): Promise<boolean>;
690
- quoteSwap(swapId: string): Promise<number>;
760
+ quoteSwap(swapId: string, options?: QuoteSwapOptions): Promise<number>;
761
+ getSwapQuote(swapId: string): Promise<number>;
762
+ acceptSwapQuote(swapId: string, amount: number, options?: QuoteSwapOptions): Promise<number>;
691
763
  enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
692
764
  enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
693
765
  createVHTLCScript(_args: {
@@ -779,10 +851,8 @@ declare class IndexedDbSwapRepository implements SwapRepository {
779
851
  clear(): Promise<void>;
780
852
  private getSwapsByIndexValues;
781
853
  private getAllSwapsFromStore;
782
- private applySwapsFilter;
783
854
  private getAllSwapsByCreatedAt;
784
- private sortIfNeeded;
785
855
  [Symbol.asyncDispose](): Promise<void>;
786
856
  }
787
857
 
788
- export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
858
+ export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, QuoteRejectedError, type QuoteRejectionReason, QuoteSwapOptions, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SubmarineRecoveryInfo, SubmarineRecoveryResult, SubmarineRefundOutcome, SwapError, SwapExpiredError, SwapManagerClient, SwapNotFoundError, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };