@arkade-os/boltz-swap 0.3.0 → 0.3.1
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/README.md +139 -480
- package/dist/{arkade-swaps-Brpa88Fg.d.cts → arkade-swaps-DHjneVaF.d.ts} +86 -26
- package/dist/{arkade-swaps-DnvQayY0.d.ts → arkade-swaps-w-cm-cPg.d.cts} +86 -26
- package/dist/{background-OI6ONB3C.js → background-2UJPEKEU.js} +2 -2
- package/dist/{chunk-WNTQXNGX.js → chunk-LKAPZQDE.js} +1 -1
- package/dist/{chunk-XVJ47GNJ.js → chunk-Y7C7NJ5D.js} +163 -33
- package/dist/expo/index.cjs +164 -34
- package/dist/expo/index.d.cts +3 -2
- package/dist/expo/index.d.ts +3 -2
- package/dist/expo/index.js +4 -4
- package/dist/index.cjs +163 -33
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +1 -1
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{types-BRYTZH1Z.d.cts → types-t0r41rlw.d.cts} +267 -10
- package/dist/{types-BRYTZH1Z.d.ts → types-t0r41rlw.d.ts} +267 -10
- package/package.json +2 -2
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
2
|
-
import { l as BoltzSwapProvider, V as SwapManager, i as SwapRepository, A as ArkadeSwapsConfig, j as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as PendingReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as PendingSubmarineSwap, h as ArkToBtcResponse, a as PendingChainSwap, B as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, P as PendingSwap } from './types-
|
|
2
|
+
import { l as BoltzSwapProvider, V as SwapManager, i as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, j as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as PendingReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as PendingSubmarineSwap, h as ArkToBtcResponse, a as PendingChainSwap, B as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, P as PendingSwap } from './types-t0r41rlw.js';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Unified entry point for Lightning and chain swaps between Arkade, Lightning Network, and Bitcoin.
|
|
7
|
+
*
|
|
8
|
+
* Orchestrates submarine swaps (Arkade → Lightning), reverse swaps (Lightning → Arkade),
|
|
9
|
+
* and chain swaps (ARK ↔ BTC) through the Boltz swap protocol.
|
|
10
|
+
*
|
|
11
|
+
* Optionally integrates SwapManager for autonomous background monitoring, auto-claiming,
|
|
12
|
+
* and auto-refunding of swaps.
|
|
13
|
+
*/
|
|
5
14
|
declare class ArkadeSwaps {
|
|
15
|
+
/** The Arkade wallet instance used for signing and address generation. */
|
|
6
16
|
readonly wallet: IWallet;
|
|
17
|
+
/** Provider for Ark protocol operations (VTXO management, batch joining). */
|
|
7
18
|
readonly arkProvider: ArkProvider;
|
|
19
|
+
/** Boltz API client for creating and monitoring swaps. */
|
|
8
20
|
readonly swapProvider: BoltzSwapProvider;
|
|
21
|
+
/** Provider for querying VTXO state on the Ark indexer. */
|
|
9
22
|
readonly indexerProvider: IndexerProvider;
|
|
23
|
+
/** Background swap monitor, or null if not enabled. */
|
|
10
24
|
readonly swapManager: SwapManager | null;
|
|
25
|
+
/** Storage backend for persisting swap data. */
|
|
11
26
|
readonly swapRepository: SwapRepository;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an ArkadeSwaps instance, auto-detecting the network from the wallet's Ark server.
|
|
29
|
+
* If no `swapProvider` is given, one is created automatically using the detected network.
|
|
30
|
+
*
|
|
31
|
+
* This is the recommended way to initialize ArkadeSwaps.
|
|
32
|
+
*
|
|
33
|
+
* @param config - Configuration options. swapProvider is auto-created from the wallet's network if omitted.
|
|
34
|
+
* @returns A fully initialized ArkadeSwaps instance.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const swaps = await ArkadeSwaps.create({
|
|
39
|
+
* wallet,
|
|
40
|
+
* swapManager: true,
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
static create(config: ArkadeSwapsCreateConfig): Promise<ArkadeSwaps>;
|
|
12
45
|
constructor(config: ArkadeSwapsConfig);
|
|
13
46
|
private savePendingReverseSwap;
|
|
14
47
|
private savePendingSubmarineSwap;
|
|
@@ -41,59 +74,80 @@ declare class ArkadeSwaps {
|
|
|
41
74
|
*/
|
|
42
75
|
[Symbol.asyncDispose](): Promise<void>;
|
|
43
76
|
/**
|
|
44
|
-
* Creates a Lightning invoice.
|
|
45
|
-
* @param args -
|
|
46
|
-
* @
|
|
77
|
+
* Creates a Lightning invoice via a reverse swap (Lightning → Arkade).
|
|
78
|
+
* @param args.amount - Invoice amount in satoshis.
|
|
79
|
+
* @param args.description - Optional description for the BOLT11 invoice.
|
|
80
|
+
* @returns Object containing the BOLT11 invoice, payment hash, preimage, and pending swap for monitoring.
|
|
81
|
+
* @throws {SwapError} If amount is <= 0 or wallet key retrieval fails.
|
|
47
82
|
*/
|
|
48
83
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
49
84
|
/**
|
|
50
|
-
* Creates a reverse swap.
|
|
51
|
-
* @param args -
|
|
52
|
-
* @
|
|
85
|
+
* Creates a reverse swap (Lightning → Arkade) and saves it to storage.
|
|
86
|
+
* @param args.amount - Amount in satoshis for the reverse swap.
|
|
87
|
+
* @param args.description - Optional invoice description.
|
|
88
|
+
* @returns The pending reverse swap, added to SwapManager if enabled.
|
|
89
|
+
* @throws {SwapError} If amount is <= 0 or key retrieval fails.
|
|
53
90
|
*/
|
|
54
91
|
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<PendingReverseSwap>;
|
|
55
92
|
/**
|
|
56
|
-
* Claims the VHTLC for a pending reverse swap.
|
|
57
|
-
* @param pendingSwap - The
|
|
93
|
+
* Claims the VHTLC for a pending reverse swap, transferring locked funds to the wallet.
|
|
94
|
+
* @param pendingSwap - The reverse swap whose VHTLC should be claimed.
|
|
95
|
+
* @throws {Error} If preimage is missing, VHTLC script creation fails, or no spendable VTXOs found.
|
|
58
96
|
*/
|
|
59
97
|
claimVHTLC(pendingSwap: PendingReverseSwap): Promise<void>;
|
|
60
98
|
/**
|
|
61
|
-
* Waits for
|
|
62
|
-
*
|
|
99
|
+
* Waits for a reverse swap to be confirmed and claims the VHTLC.
|
|
100
|
+
* Delegates to SwapManager if enabled, otherwise monitors via WebSocket.
|
|
101
|
+
* @param pendingSwap - The reverse swap to monitor and claim.
|
|
63
102
|
* @returns The transaction ID of the claimed VHTLC.
|
|
103
|
+
* @throws {InvoiceExpiredError} If the Lightning invoice expires.
|
|
104
|
+
* @throws {SwapExpiredError} If the swap exceeds its time limit.
|
|
105
|
+
* @throws {TransactionFailedError} If the on-chain transaction fails.
|
|
64
106
|
*/
|
|
65
107
|
waitAndClaim(pendingSwap: PendingReverseSwap): Promise<{
|
|
66
108
|
txid: string;
|
|
67
109
|
}>;
|
|
68
110
|
/**
|
|
69
|
-
* Sends a Lightning payment.
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
111
|
+
* Sends a Lightning payment via a submarine swap (Arkade → Lightning).
|
|
112
|
+
* Creates the swap, sends funds, and waits for settlement. Auto-refunds on failure.
|
|
113
|
+
* @param args.invoice - BOLT11 Lightning invoice to pay.
|
|
114
|
+
* @returns The amount paid, preimage (proof of payment), and transaction ID.
|
|
115
|
+
* @throws {TransactionFailedError} If the payment fails (auto-refunds if possible).
|
|
72
116
|
*/
|
|
73
117
|
sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
|
|
74
118
|
/**
|
|
75
|
-
* Creates a submarine swap.
|
|
76
|
-
* @param args -
|
|
77
|
-
* @returns The
|
|
119
|
+
* Creates a submarine swap (Arkade → Lightning) and saves it to storage.
|
|
120
|
+
* @param args.invoice - BOLT11 Lightning invoice to pay.
|
|
121
|
+
* @returns The pending submarine swap, added to SwapManager if enabled.
|
|
122
|
+
* @throws {SwapError} If invoice is missing or key retrieval fails.
|
|
78
123
|
*/
|
|
79
124
|
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<PendingSubmarineSwap>;
|
|
80
125
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
126
|
+
* Refunds the VHTLC for a failed submarine swap, returning locked funds to the wallet.
|
|
127
|
+
* Uses multi-party signatures (user + Boltz + server) for non-recoverable VTXOs.
|
|
128
|
+
* @param pendingSwap - The submarine swap to refund.
|
|
129
|
+
* @throws {Error} If preimage hash is unavailable, VHTLC not found, or already spent.
|
|
83
130
|
*/
|
|
84
131
|
refundVHTLC(pendingSwap: PendingSubmarineSwap): Promise<void>;
|
|
85
132
|
/**
|
|
86
|
-
* Waits for
|
|
87
|
-
* @param pendingSwap - The
|
|
88
|
-
* @returns The
|
|
133
|
+
* Waits for a submarine swap's Lightning payment to settle.
|
|
134
|
+
* @param pendingSwap - The submarine swap to monitor.
|
|
135
|
+
* @returns The preimage from the settled Lightning payment (proof of payment).
|
|
136
|
+
* @throws {SwapExpiredError} If the swap expires.
|
|
137
|
+
* @throws {InvoiceFailedToPayError} If Boltz fails to route the payment.
|
|
138
|
+
* @throws {TransactionLockupFailedError} If the lockup transaction fails.
|
|
89
139
|
*/
|
|
90
140
|
waitForSwapSettlement(pendingSwap: PendingSubmarineSwap): Promise<{
|
|
91
141
|
preimage: string;
|
|
92
142
|
}>;
|
|
93
143
|
/**
|
|
94
144
|
* Creates a chain swap from ARK to BTC.
|
|
95
|
-
* @param args -
|
|
96
|
-
* @
|
|
145
|
+
* @param args.btcAddress - Destination Bitcoin address.
|
|
146
|
+
* @param args.senderLockAmount - Exact amount sender locks (receiver gets less after fees). Specify this OR receiverLockAmount.
|
|
147
|
+
* @param args.receiverLockAmount - Exact amount receiver gets (sender pays more). Specify this OR senderLockAmount.
|
|
148
|
+
* @param args.feeSatsPerByte - Fee rate for the BTC claim transaction (default: 1).
|
|
149
|
+
* @returns The ARK lockup address, amount to pay, and pending swap.
|
|
150
|
+
* @throws {SwapError} If chain swap verification fails.
|
|
97
151
|
*/
|
|
98
152
|
arkToBtc(args: {
|
|
99
153
|
btcAddress: string;
|
|
@@ -121,8 +175,11 @@ declare class ArkadeSwaps {
|
|
|
121
175
|
refundArk(pendingSwap: PendingChainSwap): Promise<void>;
|
|
122
176
|
/**
|
|
123
177
|
* Creates a chain swap from BTC to ARK.
|
|
124
|
-
* @param args -
|
|
125
|
-
* @
|
|
178
|
+
* @param args.feeSatsPerByte - Fee rate for BTC transactions (default: 1).
|
|
179
|
+
* @param args.senderLockAmount - Exact BTC amount to lock. Specify this OR receiverLockAmount.
|
|
180
|
+
* @param args.receiverLockAmount - Exact ARK amount to receive. Specify this OR senderLockAmount.
|
|
181
|
+
* @returns The BTC lockup address, amount to pay, and pending swap.
|
|
182
|
+
* @throws {SwapError} If chain swap verification fails.
|
|
126
183
|
*/
|
|
127
184
|
btcToArk(args: {
|
|
128
185
|
feeSatsPerByte?: number;
|
|
@@ -266,6 +323,7 @@ declare class ArkadeSwaps {
|
|
|
266
323
|
* display/monitoring and are not automatically wired into the SwapManager.
|
|
267
324
|
*/
|
|
268
325
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
326
|
+
chainSwaps: PendingChainSwap[];
|
|
269
327
|
reverseSwaps: PendingReverseSwap[];
|
|
270
328
|
submarineSwaps: PendingSubmarineSwap[];
|
|
271
329
|
}>;
|
|
@@ -278,6 +336,7 @@ declare class ArkadeSwaps {
|
|
|
278
336
|
*/
|
|
279
337
|
enrichSubmarineSwapInvoice(swap: PendingSubmarineSwap, invoice: string): PendingSubmarineSwap;
|
|
280
338
|
}
|
|
339
|
+
/** Public interface for ArkadeSwaps, defining all swap operations available to consumers. */
|
|
281
340
|
interface IArkadeSwaps extends AsyncDisposable {
|
|
282
341
|
startSwapManager(): Promise<void>;
|
|
283
342
|
stopSwapManager(): Promise<void>;
|
|
@@ -295,6 +354,7 @@ interface IArkadeSwaps extends AsyncDisposable {
|
|
|
295
354
|
preimage: string;
|
|
296
355
|
}>;
|
|
297
356
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
357
|
+
chainSwaps: PendingChainSwap[];
|
|
298
358
|
reverseSwaps: PendingReverseSwap[];
|
|
299
359
|
submarineSwaps: PendingSubmarineSwap[];
|
|
300
360
|
}>;
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
2
|
-
import { l as BoltzSwapProvider, V as SwapManager, i as SwapRepository, A as ArkadeSwapsConfig, j as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as PendingReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as PendingSubmarineSwap, h as ArkToBtcResponse, a as PendingChainSwap, B as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, P as PendingSwap } from './types-
|
|
2
|
+
import { l as BoltzSwapProvider, V as SwapManager, i as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, j as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as PendingReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as PendingSubmarineSwap, h as ArkToBtcResponse, a as PendingChainSwap, B as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, P as PendingSwap } from './types-t0r41rlw.cjs';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Unified entry point for Lightning and chain swaps between Arkade, Lightning Network, and Bitcoin.
|
|
7
|
+
*
|
|
8
|
+
* Orchestrates submarine swaps (Arkade → Lightning), reverse swaps (Lightning → Arkade),
|
|
9
|
+
* and chain swaps (ARK ↔ BTC) through the Boltz swap protocol.
|
|
10
|
+
*
|
|
11
|
+
* Optionally integrates SwapManager for autonomous background monitoring, auto-claiming,
|
|
12
|
+
* and auto-refunding of swaps.
|
|
13
|
+
*/
|
|
5
14
|
declare class ArkadeSwaps {
|
|
15
|
+
/** The Arkade wallet instance used for signing and address generation. */
|
|
6
16
|
readonly wallet: IWallet;
|
|
17
|
+
/** Provider for Ark protocol operations (VTXO management, batch joining). */
|
|
7
18
|
readonly arkProvider: ArkProvider;
|
|
19
|
+
/** Boltz API client for creating and monitoring swaps. */
|
|
8
20
|
readonly swapProvider: BoltzSwapProvider;
|
|
21
|
+
/** Provider for querying VTXO state on the Ark indexer. */
|
|
9
22
|
readonly indexerProvider: IndexerProvider;
|
|
23
|
+
/** Background swap monitor, or null if not enabled. */
|
|
10
24
|
readonly swapManager: SwapManager | null;
|
|
25
|
+
/** Storage backend for persisting swap data. */
|
|
11
26
|
readonly swapRepository: SwapRepository;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an ArkadeSwaps instance, auto-detecting the network from the wallet's Ark server.
|
|
29
|
+
* If no `swapProvider` is given, one is created automatically using the detected network.
|
|
30
|
+
*
|
|
31
|
+
* This is the recommended way to initialize ArkadeSwaps.
|
|
32
|
+
*
|
|
33
|
+
* @param config - Configuration options. swapProvider is auto-created from the wallet's network if omitted.
|
|
34
|
+
* @returns A fully initialized ArkadeSwaps instance.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const swaps = await ArkadeSwaps.create({
|
|
39
|
+
* wallet,
|
|
40
|
+
* swapManager: true,
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
static create(config: ArkadeSwapsCreateConfig): Promise<ArkadeSwaps>;
|
|
12
45
|
constructor(config: ArkadeSwapsConfig);
|
|
13
46
|
private savePendingReverseSwap;
|
|
14
47
|
private savePendingSubmarineSwap;
|
|
@@ -41,59 +74,80 @@ declare class ArkadeSwaps {
|
|
|
41
74
|
*/
|
|
42
75
|
[Symbol.asyncDispose](): Promise<void>;
|
|
43
76
|
/**
|
|
44
|
-
* Creates a Lightning invoice.
|
|
45
|
-
* @param args -
|
|
46
|
-
* @
|
|
77
|
+
* Creates a Lightning invoice via a reverse swap (Lightning → Arkade).
|
|
78
|
+
* @param args.amount - Invoice amount in satoshis.
|
|
79
|
+
* @param args.description - Optional description for the BOLT11 invoice.
|
|
80
|
+
* @returns Object containing the BOLT11 invoice, payment hash, preimage, and pending swap for monitoring.
|
|
81
|
+
* @throws {SwapError} If amount is <= 0 or wallet key retrieval fails.
|
|
47
82
|
*/
|
|
48
83
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
49
84
|
/**
|
|
50
|
-
* Creates a reverse swap.
|
|
51
|
-
* @param args -
|
|
52
|
-
* @
|
|
85
|
+
* Creates a reverse swap (Lightning → Arkade) and saves it to storage.
|
|
86
|
+
* @param args.amount - Amount in satoshis for the reverse swap.
|
|
87
|
+
* @param args.description - Optional invoice description.
|
|
88
|
+
* @returns The pending reverse swap, added to SwapManager if enabled.
|
|
89
|
+
* @throws {SwapError} If amount is <= 0 or key retrieval fails.
|
|
53
90
|
*/
|
|
54
91
|
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<PendingReverseSwap>;
|
|
55
92
|
/**
|
|
56
|
-
* Claims the VHTLC for a pending reverse swap.
|
|
57
|
-
* @param pendingSwap - The
|
|
93
|
+
* Claims the VHTLC for a pending reverse swap, transferring locked funds to the wallet.
|
|
94
|
+
* @param pendingSwap - The reverse swap whose VHTLC should be claimed.
|
|
95
|
+
* @throws {Error} If preimage is missing, VHTLC script creation fails, or no spendable VTXOs found.
|
|
58
96
|
*/
|
|
59
97
|
claimVHTLC(pendingSwap: PendingReverseSwap): Promise<void>;
|
|
60
98
|
/**
|
|
61
|
-
* Waits for
|
|
62
|
-
*
|
|
99
|
+
* Waits for a reverse swap to be confirmed and claims the VHTLC.
|
|
100
|
+
* Delegates to SwapManager if enabled, otherwise monitors via WebSocket.
|
|
101
|
+
* @param pendingSwap - The reverse swap to monitor and claim.
|
|
63
102
|
* @returns The transaction ID of the claimed VHTLC.
|
|
103
|
+
* @throws {InvoiceExpiredError} If the Lightning invoice expires.
|
|
104
|
+
* @throws {SwapExpiredError} If the swap exceeds its time limit.
|
|
105
|
+
* @throws {TransactionFailedError} If the on-chain transaction fails.
|
|
64
106
|
*/
|
|
65
107
|
waitAndClaim(pendingSwap: PendingReverseSwap): Promise<{
|
|
66
108
|
txid: string;
|
|
67
109
|
}>;
|
|
68
110
|
/**
|
|
69
|
-
* Sends a Lightning payment.
|
|
70
|
-
*
|
|
71
|
-
* @
|
|
111
|
+
* Sends a Lightning payment via a submarine swap (Arkade → Lightning).
|
|
112
|
+
* Creates the swap, sends funds, and waits for settlement. Auto-refunds on failure.
|
|
113
|
+
* @param args.invoice - BOLT11 Lightning invoice to pay.
|
|
114
|
+
* @returns The amount paid, preimage (proof of payment), and transaction ID.
|
|
115
|
+
* @throws {TransactionFailedError} If the payment fails (auto-refunds if possible).
|
|
72
116
|
*/
|
|
73
117
|
sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
|
|
74
118
|
/**
|
|
75
|
-
* Creates a submarine swap.
|
|
76
|
-
* @param args -
|
|
77
|
-
* @returns The
|
|
119
|
+
* Creates a submarine swap (Arkade → Lightning) and saves it to storage.
|
|
120
|
+
* @param args.invoice - BOLT11 Lightning invoice to pay.
|
|
121
|
+
* @returns The pending submarine swap, added to SwapManager if enabled.
|
|
122
|
+
* @throws {SwapError} If invoice is missing or key retrieval fails.
|
|
78
123
|
*/
|
|
79
124
|
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<PendingSubmarineSwap>;
|
|
80
125
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
126
|
+
* Refunds the VHTLC for a failed submarine swap, returning locked funds to the wallet.
|
|
127
|
+
* Uses multi-party signatures (user + Boltz + server) for non-recoverable VTXOs.
|
|
128
|
+
* @param pendingSwap - The submarine swap to refund.
|
|
129
|
+
* @throws {Error} If preimage hash is unavailable, VHTLC not found, or already spent.
|
|
83
130
|
*/
|
|
84
131
|
refundVHTLC(pendingSwap: PendingSubmarineSwap): Promise<void>;
|
|
85
132
|
/**
|
|
86
|
-
* Waits for
|
|
87
|
-
* @param pendingSwap - The
|
|
88
|
-
* @returns The
|
|
133
|
+
* Waits for a submarine swap's Lightning payment to settle.
|
|
134
|
+
* @param pendingSwap - The submarine swap to monitor.
|
|
135
|
+
* @returns The preimage from the settled Lightning payment (proof of payment).
|
|
136
|
+
* @throws {SwapExpiredError} If the swap expires.
|
|
137
|
+
* @throws {InvoiceFailedToPayError} If Boltz fails to route the payment.
|
|
138
|
+
* @throws {TransactionLockupFailedError} If the lockup transaction fails.
|
|
89
139
|
*/
|
|
90
140
|
waitForSwapSettlement(pendingSwap: PendingSubmarineSwap): Promise<{
|
|
91
141
|
preimage: string;
|
|
92
142
|
}>;
|
|
93
143
|
/**
|
|
94
144
|
* Creates a chain swap from ARK to BTC.
|
|
95
|
-
* @param args -
|
|
96
|
-
* @
|
|
145
|
+
* @param args.btcAddress - Destination Bitcoin address.
|
|
146
|
+
* @param args.senderLockAmount - Exact amount sender locks (receiver gets less after fees). Specify this OR receiverLockAmount.
|
|
147
|
+
* @param args.receiverLockAmount - Exact amount receiver gets (sender pays more). Specify this OR senderLockAmount.
|
|
148
|
+
* @param args.feeSatsPerByte - Fee rate for the BTC claim transaction (default: 1).
|
|
149
|
+
* @returns The ARK lockup address, amount to pay, and pending swap.
|
|
150
|
+
* @throws {SwapError} If chain swap verification fails.
|
|
97
151
|
*/
|
|
98
152
|
arkToBtc(args: {
|
|
99
153
|
btcAddress: string;
|
|
@@ -121,8 +175,11 @@ declare class ArkadeSwaps {
|
|
|
121
175
|
refundArk(pendingSwap: PendingChainSwap): Promise<void>;
|
|
122
176
|
/**
|
|
123
177
|
* Creates a chain swap from BTC to ARK.
|
|
124
|
-
* @param args -
|
|
125
|
-
* @
|
|
178
|
+
* @param args.feeSatsPerByte - Fee rate for BTC transactions (default: 1).
|
|
179
|
+
* @param args.senderLockAmount - Exact BTC amount to lock. Specify this OR receiverLockAmount.
|
|
180
|
+
* @param args.receiverLockAmount - Exact ARK amount to receive. Specify this OR senderLockAmount.
|
|
181
|
+
* @returns The BTC lockup address, amount to pay, and pending swap.
|
|
182
|
+
* @throws {SwapError} If chain swap verification fails.
|
|
126
183
|
*/
|
|
127
184
|
btcToArk(args: {
|
|
128
185
|
feeSatsPerByte?: number;
|
|
@@ -266,6 +323,7 @@ declare class ArkadeSwaps {
|
|
|
266
323
|
* display/monitoring and are not automatically wired into the SwapManager.
|
|
267
324
|
*/
|
|
268
325
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
326
|
+
chainSwaps: PendingChainSwap[];
|
|
269
327
|
reverseSwaps: PendingReverseSwap[];
|
|
270
328
|
submarineSwaps: PendingSubmarineSwap[];
|
|
271
329
|
}>;
|
|
@@ -278,6 +336,7 @@ declare class ArkadeSwaps {
|
|
|
278
336
|
*/
|
|
279
337
|
enrichSubmarineSwapInvoice(swap: PendingSubmarineSwap, invoice: string): PendingSubmarineSwap;
|
|
280
338
|
}
|
|
339
|
+
/** Public interface for ArkadeSwaps, defining all swap operations available to consumers. */
|
|
281
340
|
interface IArkadeSwaps extends AsyncDisposable {
|
|
282
341
|
startSwapManager(): Promise<void>;
|
|
283
342
|
stopSwapManager(): Promise<void>;
|
|
@@ -295,6 +354,7 @@ interface IArkadeSwaps extends AsyncDisposable {
|
|
|
295
354
|
preimage: string;
|
|
296
355
|
}>;
|
|
297
356
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
357
|
+
chainSwaps: PendingChainSwap[];
|
|
298
358
|
reverseSwaps: PendingReverseSwap[];
|
|
299
359
|
submarineSwaps: PendingSubmarineSwap[];
|
|
300
360
|
}>;
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
defineExpoSwapBackgroundTask,
|
|
3
3
|
registerExpoSwapBackgroundTask,
|
|
4
4
|
unregisterExpoSwapBackgroundTask
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-LKAPZQDE.js";
|
|
6
|
+
import "./chunk-Y7C7NJ5D.js";
|
|
7
7
|
import "./chunk-3RG5ZIWI.js";
|
|
8
8
|
export {
|
|
9
9
|
defineExpoSwapBackgroundTask,
|