@arkade-os/boltz-swap 0.3.13 → 0.3.14

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.
@@ -51,20 +51,20 @@ declare const isChainRefundableStatus: (status: BoltzSwapStatus) => boolean;
51
51
  declare const isChainSignableStatus: (status: BoltzSwapStatus) => boolean;
52
52
  /** Returns true if the chain swap completed successfully. */
53
53
  declare const isChainSuccessStatus: (status: BoltzSwapStatus) => boolean;
54
- /** Type guard: narrows PendingSwap to PendingReverseSwap. */
55
- declare const isPendingReverseSwap: (swap: PendingSwap) => swap is PendingReverseSwap;
56
- /** Type guard: narrows PendingSwap to PendingSubmarineSwap. */
57
- declare const isPendingSubmarineSwap: (swap: PendingSwap) => swap is PendingSubmarineSwap;
58
- /** Type guard: narrows PendingSwap to PendingChainSwap. */
59
- declare const isPendingChainSwap: (swap: PendingSwap) => swap is PendingChainSwap;
54
+ /** Type guard: narrows BoltzSwap to BoltzReverseSwap. */
55
+ declare const isPendingReverseSwap: (swap: BoltzSwap) => swap is BoltzReverseSwap;
56
+ /** Type guard: narrows BoltzSwap to BoltzSubmarineSwap. */
57
+ declare const isPendingSubmarineSwap: (swap: BoltzSwap) => swap is BoltzSubmarineSwap;
58
+ /** Type guard: narrows BoltzSwap to BoltzChainSwap. */
59
+ declare const isPendingChainSwap: (swap: BoltzSwap) => swap is BoltzChainSwap;
60
60
  /** Type guard: checks if swap is a refundable submarine swap (failed + not yet refunded). */
61
- declare const isSubmarineSwapRefundable: (swap: PendingSwap) => swap is PendingSubmarineSwap;
61
+ declare const isSubmarineSwapRefundable: (swap: BoltzSwap) => swap is BoltzSubmarineSwap;
62
62
  /** Type guard: checks if swap is a refundable chain swap (expired ARK → BTC). */
63
- declare const isChainSwapRefundable: (swap: PendingSwap) => swap is PendingChainSwap;
63
+ declare const isChainSwapRefundable: (swap: BoltzSwap) => swap is BoltzChainSwap;
64
64
  /** Type guard: checks if swap is a claimable reverse swap. */
65
- declare const isReverseSwapClaimable: (swap: PendingSwap) => swap is PendingReverseSwap;
65
+ declare const isReverseSwapClaimable: (swap: BoltzSwap) => swap is BoltzReverseSwap;
66
66
  /** Type guard: checks if swap is a claimable chain swap. */
67
- declare const isChainSwapClaimable: (swap: PendingSwap) => swap is PendingChainSwap;
67
+ declare const isChainSwapClaimable: (swap: BoltzSwap) => swap is BoltzChainSwap;
68
68
  type TimeoutBlockHeights = {
69
69
  refund: number;
70
70
  unilateralClaim: number;
@@ -392,39 +392,39 @@ interface SwapManagerConfig {
392
392
  }
393
393
  /** Event callbacks for swap lifecycle events. Can be provided in config or registered via on/off methods. */
394
394
  interface SwapManagerEvents {
395
- onSwapUpdate?: (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
396
- onSwapCompleted?: (swap: PendingSwap) => void;
397
- onSwapFailed?: (swap: PendingSwap, error: Error) => void;
398
- onActionExecuted?: (swap: PendingSwap, action: Actions) => void;
395
+ onSwapUpdate?: (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
396
+ onSwapCompleted?: (swap: BoltzSwap) => void;
397
+ onSwapFailed?: (swap: BoltzSwap, error: Error) => void;
398
+ onActionExecuted?: (swap: BoltzSwap, action: Actions) => void;
399
399
  onWebSocketConnected?: () => void;
400
400
  onWebSocketDisconnected?: (error?: Error) => void;
401
401
  }
402
402
  /** Callback for swap status changes. Receives the updated swap and its previous status. */
403
- type SwapUpdateListener = (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
403
+ type SwapUpdateListener = (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
404
404
  /** Callback for swap completions (final success state reached). */
405
- type SwapCompletedListener = (swap: PendingSwap) => void;
405
+ type SwapCompletedListener = (swap: BoltzSwap) => void;
406
406
  /** Callback for swap failures. Includes the error that caused the failure. */
407
- type SwapFailedListener = (swap: PendingSwap, error: Error) => void;
407
+ type SwapFailedListener = (swap: BoltzSwap, error: Error) => void;
408
408
  /** Callback after a swap action (claim/refund) has been executed. */
409
- type ActionExecutedListener = (swap: PendingSwap, action: Actions) => void;
409
+ type ActionExecutedListener = (swap: BoltzSwap, action: Actions) => void;
410
410
  /** Callback when the WebSocket connection is established. */
411
411
  type WebSocketConnectedListener = () => void;
412
412
  /** Callback when the WebSocket disconnects. Includes the error if disconnection was not clean. */
413
413
  type WebSocketDisconnectedListener = (error?: Error) => void;
414
414
  /** Per-swap update callback used with subscribeToSwapUpdates. */
415
- type SwapUpdateCallback = (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
415
+ type SwapUpdateCallback = (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
416
416
  /** Public interface for SwapManager consumers. Provides swap monitoring, event subscription, and lifecycle control. */
417
417
  interface SwapManagerClient {
418
418
  /** Starts the manager, loading initial swaps and connecting WebSocket. */
419
- start(pendingSwaps: PendingSwap[]): Promise<void>;
419
+ start(pendingSwaps: BoltzSwap[]): Promise<void>;
420
420
  /** Stops the manager, closes WebSocket, and clears all timers. */
421
421
  stop(): Promise<void>;
422
422
  /** Adds a new swap to be monitored. Immediately subscribes via WebSocket. */
423
- addSwap(swap: PendingSwap): Promise<void>;
423
+ addSwap(swap: BoltzSwap): Promise<void>;
424
424
  /** Removes a swap from monitoring. */
425
425
  removeSwap(swapId: string): Promise<void>;
426
426
  /** Returns all currently monitored (non-final) swaps. */
427
- getPendingSwaps(): Promise<PendingSwap[]>;
427
+ getPendingSwaps(): Promise<BoltzSwap[]>;
428
428
  /** Subscribes to status updates for a specific swap. @returns Unsubscribe function. */
429
429
  subscribeToSwapUpdates(swapId: string, callback: SwapUpdateCallback): Promise<() => void>;
430
430
  /** Returns a promise that resolves with { txid } when the swap completes, or rejects on failure. */
@@ -459,13 +459,13 @@ interface SwapManagerClient {
459
459
  }
460
460
  /** Internal callbacks wired by ArkadeSwaps to perform claim/refund/save operations. */
461
461
  interface SwapManagerCallbacks {
462
- claim: (swap: PendingReverseSwap) => Promise<void>;
463
- refund: (swap: PendingSubmarineSwap) => Promise<void>;
464
- claimArk: (swap: PendingChainSwap) => Promise<void>;
465
- claimBtc: (swap: PendingChainSwap) => Promise<void>;
466
- refundArk: (swap: PendingChainSwap) => Promise<void>;
467
- signServerClaim?: (swap: PendingChainSwap) => Promise<void>;
468
- saveSwap: (swap: PendingSwap) => Promise<void>;
462
+ claim: (swap: BoltzReverseSwap) => Promise<void>;
463
+ refund: (swap: BoltzSubmarineSwap) => Promise<void>;
464
+ claimArk: (swap: BoltzChainSwap) => Promise<void>;
465
+ claimBtc: (swap: BoltzChainSwap) => Promise<void>;
466
+ refundArk: (swap: BoltzChainSwap) => Promise<void>;
467
+ signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
468
+ saveSwap: (swap: BoltzSwap) => Promise<void>;
469
469
  }
470
470
  /**
471
471
  * Background swap monitor with WebSocket + polling fallback.
@@ -564,7 +564,7 @@ declare class SwapManager implements SwapManagerClient {
564
564
  * 3. Poll all swaps after connection
565
565
  * 4. Resume any actionable swaps
566
566
  */
567
- start(pendingSwaps: PendingSwap[]): Promise<void>;
567
+ start(pendingSwaps: BoltzSwap[]): Promise<void>;
568
568
  /**
569
569
  * Stop the swap manager
570
570
  * Cleanup: close WebSocket, stop all timers
@@ -580,7 +580,7 @@ declare class SwapManager implements SwapManagerClient {
580
580
  * If fallback polling is active, this triggers an immediate poll and resets
581
581
  * fallback delay so newly-added swaps are checked without waiting.
582
582
  */
583
- addSwap(swap: PendingSwap): Promise<void>;
583
+ addSwap(swap: BoltzSwap): Promise<void>;
584
584
  /**
585
585
  * Remove a swap from monitoring
586
586
  */
@@ -588,7 +588,7 @@ declare class SwapManager implements SwapManagerClient {
588
588
  /**
589
589
  * Get all currently monitored swaps
590
590
  */
591
- getPendingSwaps(): Promise<PendingSwap[]>;
591
+ getPendingSwaps(): Promise<BoltzSwap[]>;
592
592
  /**
593
593
  * Subscribe to updates for a specific swap
594
594
  * Returns an unsubscribe function
@@ -727,15 +727,15 @@ declare class SwapManager implements SwapManagerClient {
727
727
  type GetSwapsFilter = {
728
728
  id?: string | string[];
729
729
  status?: BoltzSwapStatus | BoltzSwapStatus[];
730
- type?: PendingSwap["type"] | PendingSwap["type"][];
730
+ type?: BoltzSwap["type"] | BoltzSwap["type"][];
731
731
  orderBy?: "createdAt";
732
732
  orderDirection?: "asc" | "desc";
733
733
  };
734
734
  interface SwapRepository extends AsyncDisposable {
735
735
  readonly version: 1;
736
- saveSwap<T extends PendingSwap>(swap: T): Promise<void>;
736
+ saveSwap<T extends BoltzSwap>(swap: T): Promise<void>;
737
737
  deleteSwap(id: string): Promise<void>;
738
- getAllSwaps<T extends PendingSwap>(filter?: GetSwapsFilter): Promise<T[]>;
738
+ getAllSwaps<T extends BoltzSwap>(filter?: GetSwapsFilter): Promise<T[]>;
739
739
  clear(): Promise<void>;
740
740
  }
741
741
 
@@ -770,7 +770,7 @@ interface ArkToBtcResponse {
770
770
  /** Amount in satoshis to send to the lockup address. */
771
771
  amountToPay: number;
772
772
  /** The pending chain swap object for monitoring. */
773
- pendingSwap: PendingChainSwap;
773
+ pendingSwap: BoltzChainSwap;
774
774
  }
775
775
  /** Response from creating a BTC → ARK chain swap. */
776
776
  interface BtcToArkResponse {
@@ -779,7 +779,7 @@ interface BtcToArkResponse {
779
779
  /** Amount in satoshis to send to the lockup address. */
780
780
  amountToPay: number;
781
781
  /** The pending chain swap object for monitoring. */
782
- pendingSwap: PendingChainSwap;
782
+ pendingSwap: BoltzChainSwap;
783
783
  }
784
784
  /** Request to create a Lightning invoice (reverse swap: Lightning → Arkade). */
785
785
  interface CreateLightningInvoiceRequest {
@@ -799,7 +799,7 @@ interface CreateLightningInvoiceResponse {
799
799
  /** The payment hash (hex-encoded). */
800
800
  paymentHash: string;
801
801
  /** The pending reverse swap for monitoring. */
802
- pendingSwap: PendingReverseSwap;
802
+ pendingSwap: BoltzReverseSwap;
803
803
  /** The preimage (hex-encoded). Keep secret until claiming. */
804
804
  preimage: string;
805
805
  }
@@ -818,7 +818,7 @@ interface SendLightningPaymentResponse {
818
818
  txid: string;
819
819
  }
820
820
  /** Tracks an in-progress reverse swap (Lightning → Arkade). */
821
- interface PendingReverseSwap {
821
+ interface BoltzReverseSwap {
822
822
  /** Unique swap ID from Boltz. */
823
823
  id: string;
824
824
  /** Discriminator — always "reverse". */
@@ -835,7 +835,7 @@ interface PendingReverseSwap {
835
835
  response: CreateReverseSwapResponse;
836
836
  }
837
837
  /** Tracks an in-progress submarine swap (Arkade → Lightning). */
838
- interface PendingSubmarineSwap {
838
+ interface BoltzSubmarineSwap {
839
839
  /** Unique swap ID from Boltz. */
840
840
  id: string;
841
841
  /** Discriminator — always "submarine". */
@@ -858,7 +858,7 @@ interface PendingSubmarineSwap {
858
858
  response: CreateSubmarineSwapResponse;
859
859
  }
860
860
  /** Tracks an in-progress chain swap (ARK ↔ BTC). */
861
- interface PendingChainSwap {
861
+ interface BoltzChainSwap {
862
862
  /** Unique swap ID from Boltz. */
863
863
  id: string;
864
864
  /** Discriminator — always "chain". */
@@ -883,7 +883,7 @@ interface PendingChainSwap {
883
883
  amount: number;
884
884
  }
885
885
  /** Union type of all pending swap types. */
886
- type PendingSwap = PendingReverseSwap | PendingSubmarineSwap | PendingChainSwap;
886
+ type BoltzSwap = BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap;
887
887
  /** Configuration for initializing ArkadeSwaps via the constructor (swapProvider is required). */
888
888
  interface ArkadeSwapsConfig {
889
889
  /** An IWallet instance from @arkade-os/sdk (must expose arkProvider and indexerProvider). */
@@ -992,4 +992,4 @@ interface ChainFeesResponse {
992
992
  };
993
993
  }
994
994
 
995
- export { type SwapManagerCallbacks as $, type ArkadeSwapsConfig as A, type BtcToArkResponse as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, isReverseFailedStatus as E, type FeesResponse as F, type GetSwapStatusResponse as G, isReverseFinalStatus as H, isReversePendingStatus as I, isReverseSuccessStatus as J, isReverseSwapClaimable as K, type LimitsResponse as L, isSubmarineFailedStatus as M, type Network as N, isSubmarineFinalStatus as O, type PendingSwap as P, isSubmarinePendingStatus as Q, isSubmarineSuccessStatus as R, type SendLightningPaymentRequest as S, isSubmarineRefundableStatus as T, isSubmarineSwapRefundable as U, SwapManager as V, type IncomingPaymentSubscription as W, type ArkadeSwapsCreateConfig as X, type Vtxo as Y, type SwapManagerConfig as Z, type SwapManagerEvents as _, type PendingChainSwap as a, type PendingReverseSwap as b, type PendingSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type ChainFeesResponse as g, type ArkToBtcResponse as h, type SwapRepository as i, type SwapManagerClient as j, type GetSwapsFilter as k, BoltzSwapProvider as l, type BoltzSwapStatus as m, isChainClaimableStatus as n, isChainFailedStatus as o, isChainFinalStatus as p, isChainPendingStatus as q, isChainRefundableStatus as r, isChainSignableStatus as s, isChainSuccessStatus as t, isChainSwapClaimable as u, isChainSwapRefundable as v, isPendingChainSwap as w, isPendingReverseSwap as x, isPendingSubmarineSwap as y, isReverseClaimableStatus as z };
995
+ export { type SwapManagerCallbacks as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, isReverseClaimableStatus as E, type FeesResponse as F, type GetSwapStatusResponse as G, isReverseFailedStatus as H, isReverseFinalStatus as I, isReversePendingStatus as J, isReverseSuccessStatus as K, type LimitsResponse as L, isReverseSwapClaimable as M, type Network as N, isSubmarineFailedStatus as O, isSubmarineFinalStatus as P, isSubmarinePendingStatus as Q, isSubmarineSuccessStatus as R, type SendLightningPaymentRequest as S, isSubmarineRefundableStatus as T, isSubmarineSwapRefundable as U, SwapManager as V, type IncomingPaymentSubscription as W, type ArkadeSwapsCreateConfig as X, type Vtxo as Y, type SwapManagerConfig as Z, type SwapManagerEvents as _, type BoltzChainSwap as a, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type ChainFeesResponse as g, type ArkToBtcResponse as h, type BtcToArkResponse as i, type SwapRepository as j, type SwapManagerClient as k, type GetSwapsFilter as l, BoltzSwapProvider as m, type BoltzSwapStatus as n, isChainClaimableStatus as o, isChainFailedStatus as p, isChainFinalStatus as q, isChainPendingStatus as r, isChainRefundableStatus as s, isChainSignableStatus as t, isChainSuccessStatus as u, isChainSwapClaimable as v, isChainSwapRefundable as w, isPendingChainSwap as x, isPendingReverseSwap as y, isPendingSubmarineSwap as z };
@@ -51,20 +51,20 @@ declare const isChainRefundableStatus: (status: BoltzSwapStatus) => boolean;
51
51
  declare const isChainSignableStatus: (status: BoltzSwapStatus) => boolean;
52
52
  /** Returns true if the chain swap completed successfully. */
53
53
  declare const isChainSuccessStatus: (status: BoltzSwapStatus) => boolean;
54
- /** Type guard: narrows PendingSwap to PendingReverseSwap. */
55
- declare const isPendingReverseSwap: (swap: PendingSwap) => swap is PendingReverseSwap;
56
- /** Type guard: narrows PendingSwap to PendingSubmarineSwap. */
57
- declare const isPendingSubmarineSwap: (swap: PendingSwap) => swap is PendingSubmarineSwap;
58
- /** Type guard: narrows PendingSwap to PendingChainSwap. */
59
- declare const isPendingChainSwap: (swap: PendingSwap) => swap is PendingChainSwap;
54
+ /** Type guard: narrows BoltzSwap to BoltzReverseSwap. */
55
+ declare const isPendingReverseSwap: (swap: BoltzSwap) => swap is BoltzReverseSwap;
56
+ /** Type guard: narrows BoltzSwap to BoltzSubmarineSwap. */
57
+ declare const isPendingSubmarineSwap: (swap: BoltzSwap) => swap is BoltzSubmarineSwap;
58
+ /** Type guard: narrows BoltzSwap to BoltzChainSwap. */
59
+ declare const isPendingChainSwap: (swap: BoltzSwap) => swap is BoltzChainSwap;
60
60
  /** Type guard: checks if swap is a refundable submarine swap (failed + not yet refunded). */
61
- declare const isSubmarineSwapRefundable: (swap: PendingSwap) => swap is PendingSubmarineSwap;
61
+ declare const isSubmarineSwapRefundable: (swap: BoltzSwap) => swap is BoltzSubmarineSwap;
62
62
  /** Type guard: checks if swap is a refundable chain swap (expired ARK → BTC). */
63
- declare const isChainSwapRefundable: (swap: PendingSwap) => swap is PendingChainSwap;
63
+ declare const isChainSwapRefundable: (swap: BoltzSwap) => swap is BoltzChainSwap;
64
64
  /** Type guard: checks if swap is a claimable reverse swap. */
65
- declare const isReverseSwapClaimable: (swap: PendingSwap) => swap is PendingReverseSwap;
65
+ declare const isReverseSwapClaimable: (swap: BoltzSwap) => swap is BoltzReverseSwap;
66
66
  /** Type guard: checks if swap is a claimable chain swap. */
67
- declare const isChainSwapClaimable: (swap: PendingSwap) => swap is PendingChainSwap;
67
+ declare const isChainSwapClaimable: (swap: BoltzSwap) => swap is BoltzChainSwap;
68
68
  type TimeoutBlockHeights = {
69
69
  refund: number;
70
70
  unilateralClaim: number;
@@ -392,39 +392,39 @@ interface SwapManagerConfig {
392
392
  }
393
393
  /** Event callbacks for swap lifecycle events. Can be provided in config or registered via on/off methods. */
394
394
  interface SwapManagerEvents {
395
- onSwapUpdate?: (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
396
- onSwapCompleted?: (swap: PendingSwap) => void;
397
- onSwapFailed?: (swap: PendingSwap, error: Error) => void;
398
- onActionExecuted?: (swap: PendingSwap, action: Actions) => void;
395
+ onSwapUpdate?: (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
396
+ onSwapCompleted?: (swap: BoltzSwap) => void;
397
+ onSwapFailed?: (swap: BoltzSwap, error: Error) => void;
398
+ onActionExecuted?: (swap: BoltzSwap, action: Actions) => void;
399
399
  onWebSocketConnected?: () => void;
400
400
  onWebSocketDisconnected?: (error?: Error) => void;
401
401
  }
402
402
  /** Callback for swap status changes. Receives the updated swap and its previous status. */
403
- type SwapUpdateListener = (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
403
+ type SwapUpdateListener = (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
404
404
  /** Callback for swap completions (final success state reached). */
405
- type SwapCompletedListener = (swap: PendingSwap) => void;
405
+ type SwapCompletedListener = (swap: BoltzSwap) => void;
406
406
  /** Callback for swap failures. Includes the error that caused the failure. */
407
- type SwapFailedListener = (swap: PendingSwap, error: Error) => void;
407
+ type SwapFailedListener = (swap: BoltzSwap, error: Error) => void;
408
408
  /** Callback after a swap action (claim/refund) has been executed. */
409
- type ActionExecutedListener = (swap: PendingSwap, action: Actions) => void;
409
+ type ActionExecutedListener = (swap: BoltzSwap, action: Actions) => void;
410
410
  /** Callback when the WebSocket connection is established. */
411
411
  type WebSocketConnectedListener = () => void;
412
412
  /** Callback when the WebSocket disconnects. Includes the error if disconnection was not clean. */
413
413
  type WebSocketDisconnectedListener = (error?: Error) => void;
414
414
  /** Per-swap update callback used with subscribeToSwapUpdates. */
415
- type SwapUpdateCallback = (swap: PendingSwap, oldStatus: BoltzSwapStatus) => void;
415
+ type SwapUpdateCallback = (swap: BoltzSwap, oldStatus: BoltzSwapStatus) => void;
416
416
  /** Public interface for SwapManager consumers. Provides swap monitoring, event subscription, and lifecycle control. */
417
417
  interface SwapManagerClient {
418
418
  /** Starts the manager, loading initial swaps and connecting WebSocket. */
419
- start(pendingSwaps: PendingSwap[]): Promise<void>;
419
+ start(pendingSwaps: BoltzSwap[]): Promise<void>;
420
420
  /** Stops the manager, closes WebSocket, and clears all timers. */
421
421
  stop(): Promise<void>;
422
422
  /** Adds a new swap to be monitored. Immediately subscribes via WebSocket. */
423
- addSwap(swap: PendingSwap): Promise<void>;
423
+ addSwap(swap: BoltzSwap): Promise<void>;
424
424
  /** Removes a swap from monitoring. */
425
425
  removeSwap(swapId: string): Promise<void>;
426
426
  /** Returns all currently monitored (non-final) swaps. */
427
- getPendingSwaps(): Promise<PendingSwap[]>;
427
+ getPendingSwaps(): Promise<BoltzSwap[]>;
428
428
  /** Subscribes to status updates for a specific swap. @returns Unsubscribe function. */
429
429
  subscribeToSwapUpdates(swapId: string, callback: SwapUpdateCallback): Promise<() => void>;
430
430
  /** Returns a promise that resolves with { txid } when the swap completes, or rejects on failure. */
@@ -459,13 +459,13 @@ interface SwapManagerClient {
459
459
  }
460
460
  /** Internal callbacks wired by ArkadeSwaps to perform claim/refund/save operations. */
461
461
  interface SwapManagerCallbacks {
462
- claim: (swap: PendingReverseSwap) => Promise<void>;
463
- refund: (swap: PendingSubmarineSwap) => Promise<void>;
464
- claimArk: (swap: PendingChainSwap) => Promise<void>;
465
- claimBtc: (swap: PendingChainSwap) => Promise<void>;
466
- refundArk: (swap: PendingChainSwap) => Promise<void>;
467
- signServerClaim?: (swap: PendingChainSwap) => Promise<void>;
468
- saveSwap: (swap: PendingSwap) => Promise<void>;
462
+ claim: (swap: BoltzReverseSwap) => Promise<void>;
463
+ refund: (swap: BoltzSubmarineSwap) => Promise<void>;
464
+ claimArk: (swap: BoltzChainSwap) => Promise<void>;
465
+ claimBtc: (swap: BoltzChainSwap) => Promise<void>;
466
+ refundArk: (swap: BoltzChainSwap) => Promise<void>;
467
+ signServerClaim?: (swap: BoltzChainSwap) => Promise<void>;
468
+ saveSwap: (swap: BoltzSwap) => Promise<void>;
469
469
  }
470
470
  /**
471
471
  * Background swap monitor with WebSocket + polling fallback.
@@ -564,7 +564,7 @@ declare class SwapManager implements SwapManagerClient {
564
564
  * 3. Poll all swaps after connection
565
565
  * 4. Resume any actionable swaps
566
566
  */
567
- start(pendingSwaps: PendingSwap[]): Promise<void>;
567
+ start(pendingSwaps: BoltzSwap[]): Promise<void>;
568
568
  /**
569
569
  * Stop the swap manager
570
570
  * Cleanup: close WebSocket, stop all timers
@@ -580,7 +580,7 @@ declare class SwapManager implements SwapManagerClient {
580
580
  * If fallback polling is active, this triggers an immediate poll and resets
581
581
  * fallback delay so newly-added swaps are checked without waiting.
582
582
  */
583
- addSwap(swap: PendingSwap): Promise<void>;
583
+ addSwap(swap: BoltzSwap): Promise<void>;
584
584
  /**
585
585
  * Remove a swap from monitoring
586
586
  */
@@ -588,7 +588,7 @@ declare class SwapManager implements SwapManagerClient {
588
588
  /**
589
589
  * Get all currently monitored swaps
590
590
  */
591
- getPendingSwaps(): Promise<PendingSwap[]>;
591
+ getPendingSwaps(): Promise<BoltzSwap[]>;
592
592
  /**
593
593
  * Subscribe to updates for a specific swap
594
594
  * Returns an unsubscribe function
@@ -727,15 +727,15 @@ declare class SwapManager implements SwapManagerClient {
727
727
  type GetSwapsFilter = {
728
728
  id?: string | string[];
729
729
  status?: BoltzSwapStatus | BoltzSwapStatus[];
730
- type?: PendingSwap["type"] | PendingSwap["type"][];
730
+ type?: BoltzSwap["type"] | BoltzSwap["type"][];
731
731
  orderBy?: "createdAt";
732
732
  orderDirection?: "asc" | "desc";
733
733
  };
734
734
  interface SwapRepository extends AsyncDisposable {
735
735
  readonly version: 1;
736
- saveSwap<T extends PendingSwap>(swap: T): Promise<void>;
736
+ saveSwap<T extends BoltzSwap>(swap: T): Promise<void>;
737
737
  deleteSwap(id: string): Promise<void>;
738
- getAllSwaps<T extends PendingSwap>(filter?: GetSwapsFilter): Promise<T[]>;
738
+ getAllSwaps<T extends BoltzSwap>(filter?: GetSwapsFilter): Promise<T[]>;
739
739
  clear(): Promise<void>;
740
740
  }
741
741
 
@@ -770,7 +770,7 @@ interface ArkToBtcResponse {
770
770
  /** Amount in satoshis to send to the lockup address. */
771
771
  amountToPay: number;
772
772
  /** The pending chain swap object for monitoring. */
773
- pendingSwap: PendingChainSwap;
773
+ pendingSwap: BoltzChainSwap;
774
774
  }
775
775
  /** Response from creating a BTC → ARK chain swap. */
776
776
  interface BtcToArkResponse {
@@ -779,7 +779,7 @@ interface BtcToArkResponse {
779
779
  /** Amount in satoshis to send to the lockup address. */
780
780
  amountToPay: number;
781
781
  /** The pending chain swap object for monitoring. */
782
- pendingSwap: PendingChainSwap;
782
+ pendingSwap: BoltzChainSwap;
783
783
  }
784
784
  /** Request to create a Lightning invoice (reverse swap: Lightning → Arkade). */
785
785
  interface CreateLightningInvoiceRequest {
@@ -799,7 +799,7 @@ interface CreateLightningInvoiceResponse {
799
799
  /** The payment hash (hex-encoded). */
800
800
  paymentHash: string;
801
801
  /** The pending reverse swap for monitoring. */
802
- pendingSwap: PendingReverseSwap;
802
+ pendingSwap: BoltzReverseSwap;
803
803
  /** The preimage (hex-encoded). Keep secret until claiming. */
804
804
  preimage: string;
805
805
  }
@@ -818,7 +818,7 @@ interface SendLightningPaymentResponse {
818
818
  txid: string;
819
819
  }
820
820
  /** Tracks an in-progress reverse swap (Lightning → Arkade). */
821
- interface PendingReverseSwap {
821
+ interface BoltzReverseSwap {
822
822
  /** Unique swap ID from Boltz. */
823
823
  id: string;
824
824
  /** Discriminator — always "reverse". */
@@ -835,7 +835,7 @@ interface PendingReverseSwap {
835
835
  response: CreateReverseSwapResponse;
836
836
  }
837
837
  /** Tracks an in-progress submarine swap (Arkade → Lightning). */
838
- interface PendingSubmarineSwap {
838
+ interface BoltzSubmarineSwap {
839
839
  /** Unique swap ID from Boltz. */
840
840
  id: string;
841
841
  /** Discriminator — always "submarine". */
@@ -858,7 +858,7 @@ interface PendingSubmarineSwap {
858
858
  response: CreateSubmarineSwapResponse;
859
859
  }
860
860
  /** Tracks an in-progress chain swap (ARK ↔ BTC). */
861
- interface PendingChainSwap {
861
+ interface BoltzChainSwap {
862
862
  /** Unique swap ID from Boltz. */
863
863
  id: string;
864
864
  /** Discriminator — always "chain". */
@@ -883,7 +883,7 @@ interface PendingChainSwap {
883
883
  amount: number;
884
884
  }
885
885
  /** Union type of all pending swap types. */
886
- type PendingSwap = PendingReverseSwap | PendingSubmarineSwap | PendingChainSwap;
886
+ type BoltzSwap = BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap;
887
887
  /** Configuration for initializing ArkadeSwaps via the constructor (swapProvider is required). */
888
888
  interface ArkadeSwapsConfig {
889
889
  /** An IWallet instance from @arkade-os/sdk (must expose arkProvider and indexerProvider). */
@@ -992,4 +992,4 @@ interface ChainFeesResponse {
992
992
  };
993
993
  }
994
994
 
995
- export { type SwapManagerCallbacks as $, type ArkadeSwapsConfig as A, type BtcToArkResponse as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, isReverseFailedStatus as E, type FeesResponse as F, type GetSwapStatusResponse as G, isReverseFinalStatus as H, isReversePendingStatus as I, isReverseSuccessStatus as J, isReverseSwapClaimable as K, type LimitsResponse as L, isSubmarineFailedStatus as M, type Network as N, isSubmarineFinalStatus as O, type PendingSwap as P, isSubmarinePendingStatus as Q, isSubmarineSuccessStatus as R, type SendLightningPaymentRequest as S, isSubmarineRefundableStatus as T, isSubmarineSwapRefundable as U, SwapManager as V, type IncomingPaymentSubscription as W, type ArkadeSwapsCreateConfig as X, type Vtxo as Y, type SwapManagerConfig as Z, type SwapManagerEvents as _, type PendingChainSwap as a, type PendingReverseSwap as b, type PendingSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type ChainFeesResponse as g, type ArkToBtcResponse as h, type SwapRepository as i, type SwapManagerClient as j, type GetSwapsFilter as k, BoltzSwapProvider as l, type BoltzSwapStatus as m, isChainClaimableStatus as n, isChainFailedStatus as o, isChainFinalStatus as p, isChainPendingStatus as q, isChainRefundableStatus as r, isChainSignableStatus as s, isChainSuccessStatus as t, isChainSwapClaimable as u, isChainSwapRefundable as v, isPendingChainSwap as w, isPendingReverseSwap as x, isPendingSubmarineSwap as y, isReverseClaimableStatus as z };
995
+ export { type SwapManagerCallbacks as $, type ArkadeSwapsConfig as A, type BoltzSwap as B, type CreateLightningInvoiceRequest as C, type DecodedInvoice as D, isReverseClaimableStatus as E, type FeesResponse as F, type GetSwapStatusResponse as G, isReverseFailedStatus as H, isReverseFinalStatus as I, isReversePendingStatus as J, isReverseSuccessStatus as K, type LimitsResponse as L, isReverseSwapClaimable as M, type Network as N, isSubmarineFailedStatus as O, isSubmarineFinalStatus as P, isSubmarinePendingStatus as Q, isSubmarineSuccessStatus as R, type SendLightningPaymentRequest as S, isSubmarineRefundableStatus as T, isSubmarineSwapRefundable as U, SwapManager as V, type IncomingPaymentSubscription as W, type ArkadeSwapsCreateConfig as X, type Vtxo as Y, type SwapManagerConfig as Z, type SwapManagerEvents as _, type BoltzChainSwap as a, type BoltzReverseSwap as b, type BoltzSubmarineSwap as c, type Chain as d, type CreateLightningInvoiceResponse as e, type SendLightningPaymentResponse as f, type ChainFeesResponse as g, type ArkToBtcResponse as h, type BtcToArkResponse as i, type SwapRepository as j, type SwapManagerClient as k, type GetSwapsFilter as l, BoltzSwapProvider as m, type BoltzSwapStatus as n, isChainClaimableStatus as o, isChainFailedStatus as p, isChainFinalStatus as q, isChainPendingStatus as r, isChainRefundableStatus as s, isChainSignableStatus as t, isChainSuccessStatus as u, isChainSwapClaimable as v, isChainSwapRefundable as w, isPendingChainSwap as x, isPendingReverseSwap as y, isPendingSubmarineSwap as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/boltz-swap",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
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",
@@ -60,7 +60,7 @@
60
60
  "author": "Arkade-OS",
61
61
  "license": "MIT",
62
62
  "dependencies": {
63
- "@arkade-os/sdk": "0.4.14",
63
+ "@arkade-os/sdk": "0.4.15",
64
64
  "@noble/hashes": "2.0.1",
65
65
  "@scure/base": "2.0.0",
66
66
  "@scure/btc-signer": "2.0.1",
@@ -96,21 +96,15 @@
96
96
  "lint": "prettier --check src test",
97
97
  "test": "vitest run",
98
98
  "test:unit": "vitest run --exclude test/e2e",
99
- "test:setup": "test/setupRegtestEnv.sh",
100
99
  "test:integration": "vitest run test/e2e/**",
101
- "test:down": "test/setupRegtestEnv.sh down",
102
- "test:build-docker": "docker compose -f test.docker-compose.yml build --no-cache",
103
- "test:up-docker": "docker compose -f test.docker-compose.yml up arkd arkd-wallet nbxplorer pgnbxplorer -d",
104
100
  "test:setup-docker": "node test/e2e/setup.mjs",
105
101
  "test:integration-docker": "vitest run test/e2e/**",
106
- "test:down-docker": "docker compose -f test.docker-compose.yml down -v",
107
102
  "release": "pnpm run build && bash scripts/release.sh",
108
103
  "release:dry-run": "bash scripts/release.sh --dry-run",
109
104
  "release:cleanup": "bash scripts/release.sh --cleanup",
110
- "regtest": "pnpm regtest:down && pnpm regtest:build && pnpm regtest:up && pnpm regtest:setup",
111
- "regtest:build": "docker compose -f test.docker-compose.yml build",
112
- "regtest:up": "docker compose -f test.docker-compose.yml up arkd arkd-wallet nbxplorer pgnbxplorer -d",
113
- "regtest:down": "docker compose -f test.docker-compose.yml down -v",
114
- "regtest:setup": "node test/e2e/setup.mjs"
105
+ "regtest:start": "./regtest/start-env.sh",
106
+ "regtest:stop": "./regtest/stop-env.sh",
107
+ "regtest:clean": "./regtest/clean-env.sh",
108
+ "regtest": "pnpm regtest:clean && pnpm regtest:start && pnpm test:setup-docker"
115
109
  }
116
110
  }