@arkade-os/boltz-swap 0.3.0 → 0.3.2

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,46 +1,74 @@
1
- import { I as IArkadeSwaps } from './arkade-swaps-DnvQayY0.js';
2
- export { A as ArkadeSwaps } from './arkade-swaps-DnvQayY0.js';
3
- import { P as PendingSwap, D as DecodedInvoice, a as PendingChainSwap, b as PendingReverseSwap, c as PendingSubmarineSwap, 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 ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, h as ArkToBtcResponse, B as BtcToArkResponse, i as SwapRepository, j as SwapManagerClient, k as GetSwapsFilter } from './types-BRYTZH1Z.js';
4
- export { l as BoltzSwapProvider, m as BoltzSwapStatus, W as IncomingPaymentSubscription, V as SwapManager, _ as SwapManagerCallbacks, Y as SwapManagerConfig, Z as SwapManagerEvents, X as Vtxo, n as isChainClaimableStatus, o as isChainFailedStatus, p as isChainFinalStatus, q as isChainPendingStatus, r as isChainRefundableStatus, s as isChainSignableStatus, t as isChainSuccessStatus, u as isChainSwapClaimable, v as isChainSwapRefundable, w as isPendingChainSwap, x as isPendingReverseSwap, y as isPendingSubmarineSwap, z as isReverseClaimableStatus, E as isReverseFailedStatus, H as isReverseFinalStatus, I as isReversePendingStatus, J as isReverseSuccessStatus, K as isReverseSwapClaimable, M as isSubmarineFailedStatus, O as isSubmarineFinalStatus, Q as isSubmarinePendingStatus, T as isSubmarineRefundableStatus, R as isSubmarineSuccessStatus, U as isSubmarineSwapRefundable } from './types-BRYTZH1Z.js';
1
+ import { I as IArkadeSwaps } from './arkade-swaps-DHjneVaF.js';
2
+ export { A as ArkadeSwaps } from './arkade-swaps-DHjneVaF.js';
3
+ import { P as PendingSwap, D as DecodedInvoice, a as PendingChainSwap, b as PendingReverseSwap, c as PendingSubmarineSwap, 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 ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, h as ArkToBtcResponse, B as BtcToArkResponse, i as SwapRepository, j as SwapManagerClient, k as GetSwapsFilter } from './types-t0r41rlw.js';
4
+ export { X as ArkadeSwapsCreateConfig, l as BoltzSwapProvider, m as BoltzSwapStatus, W as IncomingPaymentSubscription, V as SwapManager, $ as SwapManagerCallbacks, Z as SwapManagerConfig, _ as SwapManagerEvents, Y as Vtxo, n as isChainClaimableStatus, o as isChainFailedStatus, p as isChainFinalStatus, q as isChainPendingStatus, r as isChainRefundableStatus, s as isChainSignableStatus, t as isChainSuccessStatus, u as isChainSwapClaimable, v as isChainSwapRefundable, w as isPendingChainSwap, x as isPendingReverseSwap, y as isPendingSubmarineSwap, z as isReverseClaimableStatus, E as isReverseFailedStatus, H as isReverseFinalStatus, I as isReversePendingStatus, J as isReverseSuccessStatus, K as isReverseSwapClaimable, M as isSubmarineFailedStatus, O as isSubmarineFinalStatus, Q as isSubmarinePendingStatus, T as isSubmarineRefundableStatus, R as isSubmarineSuccessStatus, U as isSubmarineSwapRefundable } from './types-t0r41rlw.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';
8
8
 
9
+ /** Options for constructing swap errors. */
9
10
  interface ErrorOptions {
11
+ /** Custom error message (overrides the default). */
10
12
  message?: string;
13
+ /** Whether the swap's funds can still be claimed. */
11
14
  isClaimable?: boolean;
15
+ /** Whether the swap's funds can be refunded. */
12
16
  isRefundable?: boolean;
17
+ /** The associated pending swap, if available. */
13
18
  pendingSwap?: PendingSwap;
14
19
  }
20
+ /**
21
+ * Base error class for all swap-related errors.
22
+ * Extends Error with swap-specific metadata (`isClaimable`, `isRefundable`, `pendingSwap`).
23
+ */
15
24
  declare class SwapError extends Error {
25
+ /** Whether the swap can still be claimed (default: false). */
16
26
  isClaimable: boolean;
27
+ /** Whether the swap can be refunded (default: false). */
17
28
  isRefundable: boolean;
29
+ /** The pending swap associated with this error, if available. */
18
30
  pendingSwap?: PendingSwap;
19
31
  constructor(options?: ErrorOptions);
20
32
  }
33
+ /** Thrown when a Lightning invoice expires before being paid. The swap may be refundable. */
21
34
  declare class InvoiceExpiredError extends SwapError {
22
35
  constructor(options?: ErrorOptions);
23
36
  }
37
+ /** Thrown when Boltz fails to route the Lightning payment to the destination. Typically refundable. */
24
38
  declare class InvoiceFailedToPayError extends SwapError {
25
39
  constructor(options?: ErrorOptions);
26
40
  }
41
+ /** Thrown when the wallet does not have enough funds to complete the swap. */
27
42
  declare class InsufficientFundsError extends SwapError {
28
43
  constructor(options?: ErrorOptions);
29
44
  }
45
+ /**
46
+ * Thrown for HTTP/network failures when communicating with the Boltz API.
47
+ * Not a SwapError — does not carry swap metadata.
48
+ */
30
49
  declare class NetworkError extends Error {
50
+ /** HTTP status code from the failed request, if available. */
31
51
  statusCode?: number;
52
+ /** Raw error payload from the Boltz API, if available. */
32
53
  errorData?: any;
33
54
  constructor(message: string, statusCode?: number, errorData?: any);
34
55
  }
56
+ /** Thrown when the Boltz API returns a response that doesn't match the expected schema. */
35
57
  declare class SchemaError extends SwapError {
36
58
  constructor(options?: ErrorOptions);
37
59
  }
60
+ /** Thrown when a swap exceeds its time limit. May be refundable depending on swap type. */
38
61
  declare class SwapExpiredError extends SwapError {
39
62
  constructor(options?: ErrorOptions);
40
63
  }
64
+ /** Thrown when an on-chain or off-chain transaction fails. */
41
65
  declare class TransactionFailedError extends SwapError {
42
66
  constructor(options?: ErrorOptions);
43
67
  }
68
+ /**
69
+ * Thrown when a submarine swap's Lightning payment settles but retrieving the
70
+ * preimage from Boltz fails. The payment was made but proof-of-payment is unavailable.
71
+ */
44
72
  declare class PreimageFetchError extends SwapError {
45
73
  constructor(options?: ErrorOptions);
46
74
  }
@@ -177,6 +205,7 @@ type RequestRestoreSwaps = RequestEnvelope & {
177
205
  type ResponseRestoreSwaps = ResponseEnvelope & {
178
206
  type: "SWAPS_RESTORED";
179
207
  payload: {
208
+ chainSwaps: PendingChainSwap[];
180
209
  reverseSwaps: PendingReverseSwap[];
181
210
  submarineSwaps: PendingSubmarineSwap[];
182
211
  };
@@ -541,6 +570,7 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
541
570
  preimage: string;
542
571
  }>;
543
572
  restoreSwaps(boltzFees?: FeesResponse): Promise<{
573
+ chainSwaps: PendingChainSwap[];
544
574
  reverseSwaps: PendingReverseSwap[];
545
575
  submarineSwaps: PendingSubmarineSwap[];
546
576
  }>;
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  updateReverseSwapStatus,
50
50
  updateSubmarineSwapStatus,
51
51
  verifySignatures
52
- } from "./chunk-XVJ47GNJ.js";
52
+ } from "./chunk-Y7C7NJ5D.js";
53
53
  import "./chunk-3RG5ZIWI.js";
54
54
 
55
55
  // src/serviceWorker/arkade-swaps-message-handler.ts
@@ -1,4 +1,4 @@
1
- import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-BRYTZH1Z.cjs';
1
+ import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-t0r41rlw.cjs';
2
2
  import '@arkade-os/sdk';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-BRYTZH1Z.js';
1
+ import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-t0r41rlw.js';
2
2
  import '@arkade-os/sdk';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
2
- import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-BRYTZH1Z.cjs';
2
+ import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-t0r41rlw.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 { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-BRYTZH1Z.js';
2
+ import { i as SwapRepository, P as PendingSwap, k as GetSwapsFilter } from '../../types-t0r41rlw.js';
3
3
  import '@arkade-os/sdk';
4
4
 
5
5
  /**