@arkade-os/boltz-swap 0.3.39 → 0.3.41

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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-Uet3tgN6.js';
2
- export { A as ArkadeSwaps } from './arkade-swaps-Uet3tgN6.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 ChainArkRefundOutcome, n as SwapRepository, o as SwapManagerClient, p as GetSwapsFilter } from './types-D97i1LFu.js';
4
- export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineRecoveryStatus, x as SwapManager, y as SwapManagerCallbacks, z as SwapManagerConfig, E as SwapManagerEvents, V as Vtxo, H as isChainClaimableStatus, J as isChainFailedStatus, K as isChainFinalStatus, M as isChainPendingStatus, O as isChainRefundableStatus, Q as isChainSignableStatus, R as isChainSuccessStatus, T as isChainSwapClaimable, U as isChainSwapRefundable, W as isPendingChainSwap, X as isPendingReverseSwap, Y as isPendingSubmarineSwap, Z as isReverseClaimableStatus, _ as isReverseFailedStatus, $ as isReverseFinalStatus, a0 as isReversePendingStatus, a1 as isReverseSuccessStatus, a2 as isReverseSwapClaimable, a3 as isSubmarineFailedStatus, a4 as isSubmarineFinalStatus, a5 as isSubmarinePendingStatus, a6 as isSubmarineRefundableStatus, a7 as isSubmarineSuccessStatus, a8 as isSubmarineSwapRefundable } from './types-D97i1LFu.js';
1
+ import { Q as QuoteSwapOptions, I as IArkadeSwaps, V as VhtlcTimeouts } from './arkade-swaps-LvsGHtre.js';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-LvsGHtre.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, O as OptimisticSendLightningPaymentResponse, f as SubmarineRefundOutcome, g as SubmarineRecoveryInfo, h as SubmarineRecoveryResult, i as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, j as ArkToBtcResponse, k as BtcToArkResponse, l as ChainArkRefundOutcome, m as SwapRepository, n as SwapManagerClient, o as SendLightningPaymentResponse, p as GetSwapsFilter } from './types-8NrCdOpS.js';
4
+ export { q as ArkadeSwapsCreateConfig, r as BoltzSwapProvider, s as BoltzSwapStatus, I as IncomingPaymentSubscription, P as PendingChainSwap, t as PendingReverseSwap, u as PendingSubmarineSwap, v as PendingSwap, w as SubmarineProgressionStatus, x as SubmarineRecoveryStatus, y as SwapManager, z as SwapManagerCallbacks, E as SwapManagerConfig, H as SwapManagerEvents, V as Vtxo, J as hasSubmarineStatusReached, K as isChainClaimableStatus, M as isChainFailedStatus, Q as isChainFinalStatus, R as isChainPendingStatus, T as isChainRefundableStatus, U as isChainSignableStatus, W as isChainSuccessStatus, X as isChainSwapClaimable, Y as isChainSwapRefundable, Z as isPendingChainSwap, _ as isPendingReverseSwap, $ as isPendingSubmarineSwap, a0 as isReverseClaimableStatus, a1 as isReverseFailedStatus, a2 as isReverseFinalStatus, a3 as isReversePendingStatus, a4 as isReverseSuccessStatus, a5 as isReverseSwapClaimable, a6 as isSubmarineFailedStatus, a7 as isSubmarineFinalStatus, a8 as isSubmarinePendingStatus, a9 as isSubmarineRefundableStatus, aa as isSubmarineSuccessStatus, ab as isSubmarineSwapRefundable } from './types-8NrCdOpS.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';
@@ -225,7 +225,8 @@ type RequestSendLightningPayment = RequestEnvelope & {
225
225
  };
226
226
  type ResponseSendLightningPayment = ResponseEnvelope & {
227
227
  type: "LIGHTNING_PAYMENT_SENT";
228
- payload: SendLightningPaymentResponse;
228
+ /** Strict SendLightningPaymentResponse unless the request used waitFor: "funded". */
229
+ payload: OptimisticSendLightningPaymentResponse;
229
230
  };
230
231
  type RequestCreateSubmarineSwap = RequestEnvelope & {
231
232
  type: "CREATE_SUBMARINE_SWAP";
@@ -309,6 +310,13 @@ type ResponseWaitForSwapSettlement = ResponseEnvelope & {
309
310
  preimage: string;
310
311
  };
311
312
  };
313
+ type RequestWaitForSwapFunded = RequestEnvelope & {
314
+ type: "WAIT_FOR_SWAP_FUNDED";
315
+ payload: BoltzSubmarineSwap;
316
+ };
317
+ type ResponseWaitForSwapFunded = ResponseEnvelope & {
318
+ type: "SWAP_FUNDED";
319
+ };
312
320
  type RequestRestoreSwaps = RequestEnvelope & {
313
321
  type: "RESTORE_SWAPS";
314
322
  payload?: FeesResponse;
@@ -653,8 +661,8 @@ type ResponseSwapManagerWaitForCompletion = ResponseEnvelope & {
653
661
  txid: string;
654
662
  };
655
663
  };
656
- 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;
657
- 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;
664
+ type ArkadeSwapsUpdaterRequest = RequestInitArkSwaps | RequestCreateLightningInvoice | RequestSendLightningPayment | RequestCreateSubmarineSwap | RequestCreateReverseSwap | RequestClaimVhtlc | RequestRefundVhtlc | RequestInspectSubmarineRecovery | RequestScanRecoverableSubmarineSwaps | RequestRecoverSubmarineFunds | RequestRecoverAllSubmarineFunds | RequestWaitAndClaim | RequestWaitForSwapSettlement | RequestWaitForSwapFunded | 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;
665
+ type ArkadeSwapsUpdaterResponse = ResponseInitArkSwaps | ResponseCreateLightningInvoice | ResponseSendLightningPayment | ResponseCreateSubmarineSwap | ResponseCreateReverseSwap | ResponseClaimVhtlc | ResponseRefundVhtlc | ResponseInspectSubmarineRecovery | ResponseScanRecoverableSubmarineSwaps | ResponseRecoverSubmarineFunds | ResponseRecoverAllSubmarineFunds | ResponseWaitAndClaim | ResponseWaitForSwapSettlement | ResponseWaitForSwapFunded | 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;
658
666
  declare class ArkadeSwapsMessageHandler implements MessageHandler<ArkadeSwapsUpdaterRequest, ArkadeSwapsUpdaterResponse> {
659
667
  private readonly swapRepository;
660
668
  static messageTag: string;
@@ -709,7 +717,10 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
709
717
  stopSwapManager(): Promise<void>;
710
718
  getSwapManager(): SwapManagerClient | null;
711
719
  createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
712
- sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
720
+ sendLightningPayment(args: SendLightningPaymentRequest & {
721
+ waitFor?: "settled";
722
+ }): Promise<SendLightningPaymentResponse>;
723
+ sendLightningPayment(args: SendLightningPaymentRequest): Promise<OptimisticSendLightningPaymentResponse>;
713
724
  createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
714
725
  createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
715
726
  claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
@@ -724,6 +735,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
724
735
  waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
725
736
  preimage: string;
726
737
  }>;
738
+ waitForSwapFunded(pendingSwap: BoltzSubmarineSwap): Promise<void>;
727
739
  restoreSwaps(boltzFees?: FeesResponse): Promise<{
728
740
  chainSwaps: BoltzChainSwap[];
729
741
  reverseSwaps: BoltzReverseSwap[];
@@ -879,4 +891,4 @@ declare class InMemorySwapRepository implements SwapRepository {
879
891
  [Symbol.asyncDispose](): Promise<void>;
880
892
  }
881
893
 
882
- export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, InMemorySwapRepository, 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 };
894
+ export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzRefundError, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, InMemorySwapRepository, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, OptimisticSendLightningPaymentResponse, 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.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  enrichSubmarineSwapInvoice,
21
21
  getInvoicePaymentHash,
22
22
  getInvoiceSatoshis,
23
+ hasSubmarineStatusReached,
23
24
  isChainClaimableStatus,
24
25
  isChainFailedStatus,
25
26
  isChainFinalStatus,
@@ -52,7 +53,7 @@ import {
52
53
  updateReverseSwapStatus,
53
54
  updateSubmarineSwapStatus,
54
55
  verifySignatures
55
- } from "./chunk-CFB2NNGT.js";
56
+ } from "./chunk-UXYHW7KV.js";
56
57
  import {
57
58
  applyCreatedAtOrder,
58
59
  applySwapsFilter
@@ -84,6 +85,7 @@ var LONG_RUNNING_ARKADE_SWAPS_REQUEST_TYPES = /* @__PURE__ */ new Set([
84
85
  "RECOVER_ALL_SUBMARINE_FUNDS",
85
86
  "WAIT_AND_CLAIM",
86
87
  "WAIT_FOR_SWAP_SETTLEMENT",
88
+ "WAIT_FOR_SWAP_FUNDED",
87
89
  "RESTORE_SWAPS",
88
90
  "WAIT_AND_CLAIM_CHAIN",
89
91
  "WAIT_AND_CLAIM_ARK",
@@ -271,6 +273,10 @@ var ArkadeSwapsMessageHandler = class _ArkadeSwapsMessageHandler {
271
273
  payload: res
272
274
  });
273
275
  }
276
+ case "WAIT_FOR_SWAP_FUNDED": {
277
+ await this.handler.waitForSwapFunded(message.payload);
278
+ return this.tagged({ id, type: "SWAP_FUNDED" });
279
+ }
274
280
  case "RESTORE_SWAPS": {
275
281
  const res = await this.handler.restoreSwaps(message.payload);
276
282
  return this.tagged({
@@ -976,6 +982,18 @@ var ServiceWorkerArkadeSwaps = class _ServiceWorkerArkadeSwaps {
976
982
  throw new Error("Cannot wait for swap settlement", { cause: e });
977
983
  }
978
984
  }
985
+ async waitForSwapFunded(pendingSwap) {
986
+ try {
987
+ await this.sendMessage({
988
+ id: getRandomId(),
989
+ tag: this.messageTag,
990
+ type: "WAIT_FOR_SWAP_FUNDED",
991
+ payload: pendingSwap
992
+ });
993
+ } catch (e) {
994
+ throw new Error("Cannot wait for swap funding", { cause: e });
995
+ }
996
+ }
979
997
  async restoreSwaps(boltzFees) {
980
998
  try {
981
999
  const res = await this.sendMessage({
@@ -1563,6 +1581,7 @@ export {
1563
1581
  enrichSubmarineSwapInvoice,
1564
1582
  getInvoicePaymentHash,
1565
1583
  getInvoiceSatoshis,
1584
+ hasSubmarineStatusReached,
1566
1585
  isChainClaimableStatus,
1567
1586
  isChainFailedStatus,
1568
1587
  isChainFinalStatus,
@@ -1,5 +1,5 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-D97i1LFu.cjs';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.cjs';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { RealmLike } from '@arkade-os/sdk/repositories/realm';
2
- import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-D97i1LFu.js';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.js';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-D97i1LFu.cjs';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.cjs';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { n as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-D97i1LFu.js';
2
+ import { m as SwapRepository, B as BoltzSwap, p as GetSwapsFilter } from '../../types-8NrCdOpS.js';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
2
2
  import { Identity, ArkProvider, IndexerProvider, IWallet } from '@arkade-os/sdk';
3
- import { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-D97i1LFu.cjs';
3
+ import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-8NrCdOpS.cjs';
4
4
 
5
5
  /**
6
6
  * Dependencies injected into every swap processor at runtime.
@@ -1,6 +1,6 @@
1
1
  import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
2
2
  import { Identity, ArkProvider, IndexerProvider, IWallet } from '@arkade-os/sdk';
3
- import { n as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-D97i1LFu.js';
3
+ import { m as SwapRepository, N as Network, r as BoltzSwapProvider, A as ArkadeSwapsConfig } from './types-8NrCdOpS.js';
4
4
 
5
5
  /**
6
6
  * Dependencies injected into every swap processor at runtime.
@@ -25,6 +25,27 @@ declare const isSubmarineFinalStatus: (status: BoltzSwapStatus) => boolean;
25
25
  declare const isSubmarinePendingStatus: (status: BoltzSwapStatus) => boolean;
26
26
  /** Returns true if the submarine swap is eligible for refund. */
27
27
  declare const isSubmarineRefundableStatus: (status: BoltzSwapStatus) => boolean;
28
+ /**
29
+ * Canonical progression of a successful submarine swap, in order. Failure
30
+ * statuses are intentionally absent. This defines relative ordering, NOT a
31
+ * guaranteed sequence: statuses can be skipped (e.g. "transaction.mempool"
32
+ * jumps straight to "invoice.pending" when Boltz accepts 0-conf, and a
33
+ * subscription only ever reports the current status). Consumers must treat
34
+ * any later status as implying the earlier ones — which is exactly what
35
+ * hasSubmarineStatusReached does.
36
+ */
37
+ declare const SUBMARINE_STATUS_PROGRESSION: readonly ["swap.created", "invoice.set", "transaction.mempool", "transaction.confirmed", "invoice.pending", "invoice.paid", "transaction.claim.pending", "transaction.claimed"];
38
+ /**
39
+ * A status in the successful submarine swap progression — the only valid
40
+ * targets for optimistic settlement resolution.
41
+ */
42
+ type SubmarineProgressionStatus = (typeof SUBMARINE_STATUS_PROGRESSION)[number];
43
+ /**
44
+ * Returns true if `status` is at or beyond `target` in the successful
45
+ * submarine swap progression. Returns false when the observed status is not
46
+ * part of the progression (e.g. failure statuses like "swap.expired").
47
+ */
48
+ declare const hasSubmarineStatusReached: (status: BoltzSwapStatus, target: SubmarineProgressionStatus) => boolean;
28
49
  /** Returns true if the submarine swap completed successfully. */
29
50
  declare const isSubmarineSuccessStatus: (status: BoltzSwapStatus) => boolean;
30
51
  /** Returns true if the reverse swap failed. */
@@ -914,6 +935,22 @@ interface CreateLightningInvoiceResponse {
914
935
  interface SendLightningPaymentRequest {
915
936
  /** BOLT11-encoded Lightning invoice to pay. */
916
937
  invoice: string;
938
+ /**
939
+ * When the returned promise resolves (default "settled").
940
+ *
941
+ * - "settled": at the terminal "transaction.claimed" status, once Boltz
942
+ * has swept the HTLC. The preimage is included in the response.
943
+ * - "funded": optimistically, as soon as the lockup transaction is
944
+ * observed ("transaction.mempool" or any later status — statuses can be
945
+ * skipped since subscriptions report only the current one). The sender's
946
+ * funds are committed and the swap is refundable from this point, so
947
+ * most wallets show the payment as "sent" here. No preimage is available
948
+ * yet; monitoring continues in the background and keeps persisting
949
+ * status updates until a terminal status, but a late failure no longer
950
+ * rejects — keep the SwapManager enabled so refunds are handled
951
+ * automatically.
952
+ */
953
+ waitFor?: "settled" | "funded";
917
954
  }
918
955
  /** Response after a successful Lightning payment. */
919
956
  interface SendLightningPaymentResponse {
@@ -924,6 +961,19 @@ interface SendLightningPaymentResponse {
924
961
  /** Transaction ID of the Arkade payment. */
925
962
  txid: string;
926
963
  }
964
+ /**
965
+ * Response after a Lightning payment sent with `waitFor: "funded"` — the
966
+ * payment is in flight but may not be settled yet, so the preimage may not
967
+ * be available.
968
+ */
969
+ interface OptimisticSendLightningPaymentResponse {
970
+ /** Amount paid in satoshis. */
971
+ amount: number;
972
+ /** Payment preimage (hex-encoded). Undefined when the call resolved before the swap settled. */
973
+ preimage?: string;
974
+ /** Transaction ID of the Arkade payment. */
975
+ txid: string;
976
+ }
927
977
  /** Tracks an in-progress reverse swap (Lightning → Arkade). */
928
978
  interface BoltzReverseSwap {
929
979
  /** Unique swap ID from Boltz. */
@@ -1180,4 +1230,4 @@ interface ChainFeesResponse {
1180
1230
  };
1181
1231
  }
1182
1232
 
1183
- export { isReverseFinalStatus as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerEvents as E, type FeesResponse as F, type GetSwapStatusResponse as G, isChainClaimableStatus as H, type IncomingPaymentSubscription as I, isChainFailedStatus as J, isChainFinalStatus as K, type LimitsResponse as L, isChainPendingStatus as M, type Network as N, isChainRefundableStatus as O, type PendingChainSwap as P, isChainSignableStatus as Q, isChainSuccessStatus as R, type SendLightningPaymentRequest as S, isChainSwapClaimable as T, isChainSwapRefundable as U, type Vtxo as V, isPendingChainSwap as W, isPendingReverseSwap as X, isPendingSubmarineSwap as Y, isReverseClaimableStatus as Z, isReverseFailedStatus as _, type BoltzChainSwap as a, isReversePendingStatus as a0, isReverseSuccessStatus as a1, isReverseSwapClaimable as a2, isSubmarineFailedStatus as a3, isSubmarineFinalStatus as a4, isSubmarinePendingStatus as a5, isSubmarineRefundableStatus as a6, isSubmarineSuccessStatus as a7, isSubmarineSwapRefundable as a8, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type SubmarineRefundOutcome as g, type SubmarineRecoveryInfo as h, type SubmarineRecoveryResult as i, type ChainFeesResponse as j, type ArkToBtcResponse as k, type BtcToArkResponse as l, type ChainArkRefundOutcome as m, type SwapRepository as n, type SwapManagerClient as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineRecoveryStatus as w, SwapManager as x, type SwapManagerCallbacks as y, type SwapManagerConfig as z };
1233
+ export { isPendingSubmarineSwap as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerConfig as E, type FeesResponse as F, type GetSwapStatusResponse as G, type SwapManagerEvents as H, type IncomingPaymentSubscription as I, hasSubmarineStatusReached as J, isChainClaimableStatus as K, type LimitsResponse as L, isChainFailedStatus as M, type Network as N, type OptimisticSendLightningPaymentResponse as O, type PendingChainSwap as P, isChainFinalStatus as Q, isChainPendingStatus as R, type SendLightningPaymentRequest as S, isChainRefundableStatus as T, isChainSignableStatus as U, type Vtxo as V, isChainSuccessStatus as W, isChainSwapClaimable as X, isChainSwapRefundable as Y, isPendingChainSwap as Z, isPendingReverseSwap as _, type BoltzChainSwap as a, isReverseClaimableStatus as a0, isReverseFailedStatus as a1, isReverseFinalStatus as a2, isReversePendingStatus as a3, isReverseSuccessStatus as a4, isReverseSwapClaimable as a5, isSubmarineFailedStatus as a6, isSubmarineFinalStatus as a7, isSubmarinePendingStatus as a8, isSubmarineRefundableStatus as a9, isSubmarineSuccessStatus as aa, isSubmarineSwapRefundable as ab, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SubmarineRefundOutcome as f, type SubmarineRecoveryInfo as g, type SubmarineRecoveryResult as h, type ChainFeesResponse as i, type ArkToBtcResponse as j, type BtcToArkResponse as k, type ChainArkRefundOutcome as l, type SwapRepository as m, type SwapManagerClient as n, type SendLightningPaymentResponse as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineProgressionStatus as w, type SubmarineRecoveryStatus as x, SwapManager as y, type SwapManagerCallbacks as z };
@@ -25,6 +25,27 @@ declare const isSubmarineFinalStatus: (status: BoltzSwapStatus) => boolean;
25
25
  declare const isSubmarinePendingStatus: (status: BoltzSwapStatus) => boolean;
26
26
  /** Returns true if the submarine swap is eligible for refund. */
27
27
  declare const isSubmarineRefundableStatus: (status: BoltzSwapStatus) => boolean;
28
+ /**
29
+ * Canonical progression of a successful submarine swap, in order. Failure
30
+ * statuses are intentionally absent. This defines relative ordering, NOT a
31
+ * guaranteed sequence: statuses can be skipped (e.g. "transaction.mempool"
32
+ * jumps straight to "invoice.pending" when Boltz accepts 0-conf, and a
33
+ * subscription only ever reports the current status). Consumers must treat
34
+ * any later status as implying the earlier ones — which is exactly what
35
+ * hasSubmarineStatusReached does.
36
+ */
37
+ declare const SUBMARINE_STATUS_PROGRESSION: readonly ["swap.created", "invoice.set", "transaction.mempool", "transaction.confirmed", "invoice.pending", "invoice.paid", "transaction.claim.pending", "transaction.claimed"];
38
+ /**
39
+ * A status in the successful submarine swap progression — the only valid
40
+ * targets for optimistic settlement resolution.
41
+ */
42
+ type SubmarineProgressionStatus = (typeof SUBMARINE_STATUS_PROGRESSION)[number];
43
+ /**
44
+ * Returns true if `status` is at or beyond `target` in the successful
45
+ * submarine swap progression. Returns false when the observed status is not
46
+ * part of the progression (e.g. failure statuses like "swap.expired").
47
+ */
48
+ declare const hasSubmarineStatusReached: (status: BoltzSwapStatus, target: SubmarineProgressionStatus) => boolean;
28
49
  /** Returns true if the submarine swap completed successfully. */
29
50
  declare const isSubmarineSuccessStatus: (status: BoltzSwapStatus) => boolean;
30
51
  /** Returns true if the reverse swap failed. */
@@ -914,6 +935,22 @@ interface CreateLightningInvoiceResponse {
914
935
  interface SendLightningPaymentRequest {
915
936
  /** BOLT11-encoded Lightning invoice to pay. */
916
937
  invoice: string;
938
+ /**
939
+ * When the returned promise resolves (default "settled").
940
+ *
941
+ * - "settled": at the terminal "transaction.claimed" status, once Boltz
942
+ * has swept the HTLC. The preimage is included in the response.
943
+ * - "funded": optimistically, as soon as the lockup transaction is
944
+ * observed ("transaction.mempool" or any later status — statuses can be
945
+ * skipped since subscriptions report only the current one). The sender's
946
+ * funds are committed and the swap is refundable from this point, so
947
+ * most wallets show the payment as "sent" here. No preimage is available
948
+ * yet; monitoring continues in the background and keeps persisting
949
+ * status updates until a terminal status, but a late failure no longer
950
+ * rejects — keep the SwapManager enabled so refunds are handled
951
+ * automatically.
952
+ */
953
+ waitFor?: "settled" | "funded";
917
954
  }
918
955
  /** Response after a successful Lightning payment. */
919
956
  interface SendLightningPaymentResponse {
@@ -924,6 +961,19 @@ interface SendLightningPaymentResponse {
924
961
  /** Transaction ID of the Arkade payment. */
925
962
  txid: string;
926
963
  }
964
+ /**
965
+ * Response after a Lightning payment sent with `waitFor: "funded"` — the
966
+ * payment is in flight but may not be settled yet, so the preimage may not
967
+ * be available.
968
+ */
969
+ interface OptimisticSendLightningPaymentResponse {
970
+ /** Amount paid in satoshis. */
971
+ amount: number;
972
+ /** Payment preimage (hex-encoded). Undefined when the call resolved before the swap settled. */
973
+ preimage?: string;
974
+ /** Transaction ID of the Arkade payment. */
975
+ txid: string;
976
+ }
927
977
  /** Tracks an in-progress reverse swap (Lightning → Arkade). */
928
978
  interface BoltzReverseSwap {
929
979
  /** Unique swap ID from Boltz. */
@@ -1180,4 +1230,4 @@ interface ChainFeesResponse {
1180
1230
  };
1181
1231
  }
1182
1232
 
1183
- export { isReverseFinalStatus as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerEvents as E, type FeesResponse as F, type GetSwapStatusResponse as G, isChainClaimableStatus as H, type IncomingPaymentSubscription as I, isChainFailedStatus as J, isChainFinalStatus as K, type LimitsResponse as L, isChainPendingStatus as M, type Network as N, isChainRefundableStatus as O, type PendingChainSwap as P, isChainSignableStatus as Q, isChainSuccessStatus as R, type SendLightningPaymentRequest as S, isChainSwapClaimable as T, isChainSwapRefundable as U, type Vtxo as V, isPendingChainSwap as W, isPendingReverseSwap as X, isPendingSubmarineSwap as Y, isReverseClaimableStatus as Z, isReverseFailedStatus as _, type BoltzChainSwap as a, isReversePendingStatus as a0, isReverseSuccessStatus as a1, isReverseSwapClaimable as a2, isSubmarineFailedStatus as a3, isSubmarineFinalStatus as a4, isSubmarinePendingStatus as a5, isSubmarineRefundableStatus as a6, isSubmarineSuccessStatus as a7, isSubmarineSwapRefundable as a8, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type SubmarineRefundOutcome as g, type SubmarineRecoveryInfo as h, type SubmarineRecoveryResult as i, type ChainFeesResponse as j, type ArkToBtcResponse as k, type BtcToArkResponse as l, type ChainArkRefundOutcome as m, type SwapRepository as n, type SwapManagerClient as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineRecoveryStatus as w, SwapManager as x, type SwapManagerCallbacks as y, type SwapManagerConfig as z };
1233
+ export { isPendingSubmarineSwap as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, type SwapManagerConfig as E, type FeesResponse as F, type GetSwapStatusResponse as G, type SwapManagerEvents as H, type IncomingPaymentSubscription as I, hasSubmarineStatusReached as J, isChainClaimableStatus as K, type LimitsResponse as L, isChainFailedStatus as M, type Network as N, type OptimisticSendLightningPaymentResponse as O, type PendingChainSwap as P, isChainFinalStatus as Q, isChainPendingStatus as R, type SendLightningPaymentRequest as S, isChainRefundableStatus as T, isChainSignableStatus as U, type Vtxo as V, isChainSuccessStatus as W, isChainSwapClaimable as X, isChainSwapRefundable as Y, isPendingChainSwap as Z, isPendingReverseSwap as _, type BoltzChainSwap as a, isReverseClaimableStatus as a0, isReverseFailedStatus as a1, isReverseFinalStatus as a2, isReversePendingStatus as a3, isReverseSuccessStatus as a4, isReverseSwapClaimable as a5, isSubmarineFailedStatus as a6, isSubmarineFinalStatus as a7, isSubmarinePendingStatus as a8, isSubmarineRefundableStatus as a9, isSubmarineSuccessStatus as aa, isSubmarineSwapRefundable as ab, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SubmarineRefundOutcome as f, type SubmarineRecoveryInfo as g, type SubmarineRecoveryResult as h, type ChainFeesResponse as i, type ArkToBtcResponse as j, type BtcToArkResponse as k, type ChainArkRefundOutcome as l, type SwapRepository as m, type SwapManagerClient as n, type SendLightningPaymentResponse as o, type GetSwapsFilter as p, type ArkadeSwapsCreateConfig as q, BoltzSwapProvider as r, type BoltzSwapStatus as s, type PendingReverseSwap as t, type PendingSubmarineSwap as u, type PendingSwap as v, type SubmarineProgressionStatus as w, type SubmarineRecoveryStatus as x, SwapManager as y, type SwapManagerCallbacks as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/boltz-swap",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "type": "module",
5
5
  "description": "A production-ready TypeScript package that brings Boltz submarine-swaps to Arkade.",
6
6
  "main": "./dist/index.js",
@@ -76,7 +76,7 @@
76
76
  "@scure/btc-signer": "2.0.1",
77
77
  "bip68": "1.0.4",
78
78
  "light-bolt11-decoder": "3.2.0",
79
- "@arkade-os/sdk": "0.4.34"
79
+ "@arkade-os/sdk": "0.4.36"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "expo-task-manager": ">=3.0.0",