@atomiqlabs/sdk 8.4.3 → 8.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/swaps/ISwap.d.ts +14 -0
  4. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +5 -1
  5. package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +10 -0
  6. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +4 -0
  7. package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +9 -0
  8. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +4 -0
  9. package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +7 -0
  10. package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +9 -0
  11. package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +13 -0
  12. package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +4 -0
  13. package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +8 -0
  14. package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +8 -0
  15. package/dist/swaps/trusted/ln/LnForGasSwap.js +12 -0
  16. package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +8 -0
  17. package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +13 -0
  18. package/dist/types/lnurl/LNURLPay.d.ts +0 -1
  19. package/dist/types/lnurl/LNURLPay.js +0 -1
  20. package/dist/types/lnurl/LNURLWithdraw.d.ts +0 -1
  21. package/dist/types/lnurl/LNURLWithdraw.js +0 -1
  22. package/package.json +1 -1
  23. package/src/index.ts +1 -0
  24. package/src/swaps/ISwap.ts +16 -0
  25. package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +13 -1
  26. package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +10 -0
  27. package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +8 -0
  28. package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +15 -0
  29. package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +9 -0
  30. package/src/swaps/trusted/ln/LnForGasSwap.ts +15 -1
  31. package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +15 -0
  32. package/src/types/lnurl/LNURLPay.ts +0 -1
  33. package/src/types/lnurl/LNURLWithdraw.ts +0 -1
package/dist/index.d.ts CHANGED
@@ -73,6 +73,7 @@ export * from "./types/lnurl/LNURLWithdraw";
73
73
  export * from "./types/wallets/MinimalBitcoinWalletInterface";
74
74
  export * from "./types/wallets/MinimalLightningNetworkWalletInterface";
75
75
  export * from "./types/wallets/LightningInvoiceCreateService";
76
+ export * from "./types/SwapStateInfo";
76
77
  export * from "./types/AmountData";
77
78
  export * from "./types/CustomPriceFunction";
78
79
  export * from "./types/SwapExecutionAction";
package/dist/index.js CHANGED
@@ -146,6 +146,7 @@ __exportStar(require("./types/lnurl/LNURLWithdraw"), exports);
146
146
  __exportStar(require("./types/wallets/MinimalBitcoinWalletInterface"), exports);
147
147
  __exportStar(require("./types/wallets/MinimalLightningNetworkWalletInterface"), exports);
148
148
  __exportStar(require("./types/wallets/LightningInvoiceCreateService"), exports);
149
+ __exportStar(require("./types/SwapStateInfo"), exports);
149
150
  __exportStar(require("./types/AmountData"), exports);
150
151
  __exportStar(require("./types/CustomPriceFunction"), exports);
151
152
  __exportStar(require("./types/SwapExecutionAction"), exports);
@@ -156,6 +156,16 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
156
156
  * @param options Additional options for executing the swap
157
157
  */
158
158
  abstract txsExecute(options?: any): Promise<SwapExecutionAction<T>[]>;
159
+ /**
160
+ * Executes the swap with the provided wallet, the exact arguments for this functions differ for various swap
161
+ * types. Check the `execute()` function signature in the respective swap class to see the required arguments.
162
+ *
163
+ * @param args Execution arguments, usually contains a source wallet object, callbacks and options, for exact
164
+ * syntax check the respective swap class.
165
+ *
166
+ * @returns Whether a swap was successfully executed or not, if it wasn't the user can refund or claim manually
167
+ */
168
+ abstract execute(...args: any[]): Promise<boolean>;
159
169
  /**
160
170
  * This attempts to populate missing fields in the pricing info based on the swap amounts
161
171
  *
@@ -257,6 +267,10 @@ export declare abstract class ISwap<T extends ChainType = ChainType, D extends S
257
267
  * Returns whether the swap failed (e.g. was refunded)
258
268
  */
259
269
  abstract isFailed(): boolean;
270
+ /**
271
+ * Returns whether the swap is currently being processed
272
+ */
273
+ abstract isInProgress(): boolean;
260
274
  /**
261
275
  * Whether a swap was initialized, a swap is considered initialized on first interaction with it, i.e.
262
276
  * calling commit() on a Smart chain -> Bitcoin swaps, calling waitForPayment() or similar on the other
@@ -208,6 +208,10 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
208
208
  * @inheritDoc
209
209
  */
210
210
  isFailed(): boolean;
211
+ /**
212
+ * @inheritDoc
213
+ */
214
+ isInProgress(): boolean;
211
215
  /**
212
216
  * @inheritDoc
213
217
  */
@@ -282,7 +286,7 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
282
286
  secret?: string;
283
287
  lightningTxCheckIntervalSeconds?: number;
284
288
  delayBetweenCommitAndClaimSeconds?: number;
285
- }): Promise<void>;
289
+ }): Promise<boolean>;
286
290
  /**
287
291
  * @inheritDoc
288
292
  *
@@ -321,6 +321,15 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
321
321
  isFailed() {
322
322
  return this._state === FromBTCLNSwapState.FAILED || this._state === FromBTCLNSwapState.EXPIRED;
323
323
  }
324
+ /**
325
+ * @inheritDoc
326
+ */
327
+ isInProgress() {
328
+ return (this._state === FromBTCLNSwapState.PR_CREATED && this.initiated) ||
329
+ (this._state === FromBTCLNSwapState.QUOTE_SOFT_EXPIRED && this.initiated) ||
330
+ this._state === FromBTCLNSwapState.PR_PAID ||
331
+ this._state === FromBTCLNSwapState.CLAIM_COMMITED;
332
+ }
324
333
  /**
325
334
  * @inheritDoc
326
335
  */
@@ -485,6 +494,7 @@ class FromBTCLNSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
485
494
  if (callbacks?.onSwapSettled != null)
486
495
  callbacks.onSwapSettled(this.getOutputTxId());
487
496
  }
497
+ return true;
488
498
  }
489
499
  /**
490
500
  * @inheritDoc
@@ -245,6 +245,10 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
245
245
  * @inheritDoc
246
246
  */
247
247
  isFailed(): boolean;
248
+ /**
249
+ * @inheritDoc
250
+ */
251
+ isInProgress(): boolean;
248
252
  /**
249
253
  * @inheritDoc
250
254
  */
@@ -352,6 +352,15 @@ class FromBTCLNAutoSwap extends IEscrowSwap_1.IEscrowSwap {
352
352
  isFailed() {
353
353
  return this._state === FromBTCLNAutoSwapState.FAILED || this._state === FromBTCLNAutoSwapState.EXPIRED;
354
354
  }
355
+ /**
356
+ * @inheritDoc
357
+ */
358
+ isInProgress() {
359
+ return (this._state === FromBTCLNAutoSwapState.PR_CREATED && this.initiated) ||
360
+ (this._state === FromBTCLNAutoSwapState.QUOTE_SOFT_EXPIRED && this.initiated) ||
361
+ this._state === FromBTCLNAutoSwapState.PR_PAID ||
362
+ this._state === FromBTCLNAutoSwapState.CLAIM_COMMITED;
363
+ }
355
364
  /**
356
365
  * @inheritDoc
357
366
  */
@@ -175,6 +175,10 @@ export declare class FromBTCSwap<T extends ChainType = ChainType> extends IFromB
175
175
  * @inheritDoc
176
176
  */
177
177
  isFailed(): boolean;
178
+ /**
179
+ * @inheritDoc
180
+ */
181
+ isInProgress(): boolean;
178
182
  /**
179
183
  * @inheritDoc
180
184
  */
@@ -237,6 +237,13 @@ class FromBTCSwap extends IFromBTCSelfInitSwap_1.IFromBTCSelfInitSwap {
237
237
  isFailed() {
238
238
  return this._state === FromBTCSwapState.FAILED || this._state === FromBTCSwapState.EXPIRED;
239
239
  }
240
+ /**
241
+ * @inheritDoc
242
+ */
243
+ isInProgress() {
244
+ return this._state === FromBTCSwapState.CLAIM_COMMITED ||
245
+ this._state === FromBTCSwapState.BTC_TX_CONFIRMED;
246
+ }
240
247
  /**
241
248
  * @inheritDoc
242
249
  */
@@ -172,6 +172,15 @@ export declare abstract class IToBTCSwap<T extends ChainType = ChainType, D exte
172
172
  * @inheritDoc
173
173
  */
174
174
  isFailed(): boolean;
175
+ /**
176
+ * @inheritDoc
177
+ */
178
+ isInProgress(): boolean;
179
+ /**
180
+ * Returns the time (in UNIX milliseconds) at which the swap expires and the user is able to unilaterally
181
+ * refund it with the {@link refund} or {@link txsRefund} function.
182
+ */
183
+ getExpiry(): number;
175
184
  /**
176
185
  * @inheritDoc
177
186
  * @internal
@@ -221,6 +221,19 @@ class IToBTCSwap extends IEscrowSelfInitSwap_1.IEscrowSelfInitSwap {
221
221
  isFailed() {
222
222
  return this._state === ToBTCSwapState.REFUNDED;
223
223
  }
224
+ /**
225
+ * @inheritDoc
226
+ */
227
+ isInProgress() {
228
+ return this._state === ToBTCSwapState.COMMITED || this._state === ToBTCSwapState.SOFT_CLAIMED;
229
+ }
230
+ /**
231
+ * Returns the time (in UNIX milliseconds) at which the swap expires and the user is able to unilaterally
232
+ * refund it with the {@link refund} or {@link txsRefund} function.
233
+ */
234
+ getExpiry() {
235
+ return Number(this._data.getExpiry()) * 1000;
236
+ }
224
237
  /**
225
238
  * @inheritDoc
226
239
  * @internal
@@ -278,6 +278,10 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
278
278
  * @inheritDoc
279
279
  */
280
280
  isFailed(): boolean;
281
+ /**
282
+ * @inheritDoc
283
+ */
284
+ isInProgress(): boolean;
281
285
  /**
282
286
  * @inheritDoc
283
287
  */
@@ -346,6 +346,14 @@ class SpvFromBTCSwap extends ISwap_1.ISwap {
346
346
  isFailed() {
347
347
  return this._state === SpvFromBTCSwapState.FAILED || this._state === SpvFromBTCSwapState.DECLINED || this._state === SpvFromBTCSwapState.CLOSED;
348
348
  }
349
+ /**
350
+ * @inheritDoc
351
+ */
352
+ isInProgress() {
353
+ return this._state === SpvFromBTCSwapState.POSTED ||
354
+ this._state === SpvFromBTCSwapState.BROADCASTED ||
355
+ this._state === SpvFromBTCSwapState.BTC_TX_CONFIRMED;
356
+ }
349
357
  /**
350
358
  * @inheritDoc
351
359
  */
@@ -151,6 +151,10 @@ export declare class LnForGasSwap<T extends ChainType = ChainType> extends ISwap
151
151
  * @inheritDoc
152
152
  */
153
153
  isSuccessful(): boolean;
154
+ /**
155
+ * @inheritDoc
156
+ */
157
+ isInProgress(): boolean;
154
158
  /**
155
159
  * @inheritDoc
156
160
  * @internal
@@ -209,6 +213,10 @@ export declare class LnForGasSwap<T extends ChainType = ChainType> extends ISwap
209
213
  * @inheritDoc
210
214
  */
211
215
  txsExecute(): Promise<[SwapExecutionActionLightning]>;
216
+ /**
217
+ * @remark Not supported
218
+ */
219
+ execute(): Promise<boolean>;
212
220
  /**
213
221
  * @inheritDoc
214
222
  */
@@ -218,6 +218,12 @@ class LnForGasSwap extends ISwap_1.ISwap {
218
218
  isSuccessful() {
219
219
  return this._state === LnForGasSwapState.FINISHED;
220
220
  }
221
+ /**
222
+ * @inheritDoc
223
+ */
224
+ isInProgress() {
225
+ return (this._state === LnForGasSwapState.PR_CREATED && this.initiated) || this._state === LnForGasSwapState.PR_PAID;
226
+ }
221
227
  /**
222
228
  * @inheritDoc
223
229
  * @internal
@@ -347,6 +353,12 @@ class LnForGasSwap extends ISwap_1.ISwap {
347
353
  }
348
354
  throw new Error("Invalid swap state to obtain execution txns, required PR_CREATED");
349
355
  }
356
+ /**
357
+ * @remark Not supported
358
+ */
359
+ async execute() {
360
+ throw new Error("Not supported");
361
+ }
350
362
  /**
351
363
  * @inheritDoc
352
364
  */
@@ -171,6 +171,10 @@ export declare class OnchainForGasSwap<T extends ChainType = ChainType> extends
171
171
  * @inheritDoc
172
172
  */
173
173
  isSuccessful(): boolean;
174
+ /**
175
+ * @inheritDoc
176
+ */
177
+ isInProgress(): boolean;
174
178
  /**
175
179
  * @inheritDoc
176
180
  * @internal
@@ -267,6 +271,10 @@ export declare class OnchainForGasSwap<T extends ChainType = ChainType> extends
267
271
  }): Promise<[
268
272
  SwapExecutionActionBitcoin<"ADDRESS" | "FUNDED_PSBT">
269
273
  ]>;
274
+ /**
275
+ * @remark Not supported
276
+ */
277
+ execute(): Promise<boolean>;
270
278
  /**
271
279
  * @inheritDoc
272
280
  *
@@ -225,6 +225,13 @@ class OnchainForGasSwap extends ISwap_1.ISwap {
225
225
  isSuccessful() {
226
226
  return this._state === OnchainForGasSwapState.FINISHED;
227
227
  }
228
+ /**
229
+ * @inheritDoc
230
+ */
231
+ isInProgress() {
232
+ return (this._state === OnchainForGasSwapState.PR_CREATED && this.txId != null) ||
233
+ (this._state === OnchainForGasSwapState.REFUNDABLE && this.refundAddress != null);
234
+ }
228
235
  /**
229
236
  * @inheritDoc
230
237
  * @internal
@@ -453,6 +460,12 @@ class OnchainForGasSwap extends ISwap_1.ISwap {
453
460
  }
454
461
  throw new Error("Invalid swap state to obtain execution txns, required PR_CREATED or CLAIM_COMMITED");
455
462
  }
463
+ /**
464
+ * @remark Not supported
465
+ */
466
+ async execute() {
467
+ throw new Error("Not supported");
468
+ }
456
469
  /**
457
470
  * @inheritDoc
458
471
  *
@@ -47,7 +47,6 @@ export declare function isLNURLPayParams(obj: any): obj is LNURLPayParams;
47
47
  * Type guard for {@link LNURLPay}
48
48
  *
49
49
  * @category Lightning
50
- * @internal
51
50
  */
52
51
  export declare function isLNURLPay(value: any): value is LNURLPay;
53
52
  /**
@@ -15,7 +15,6 @@ exports.isLNURLPayParams = isLNURLPayParams;
15
15
  * Type guard for {@link LNURLPay}
16
16
  *
17
17
  * @category Lightning
18
- * @internal
19
18
  */
20
19
  function isLNURLPay(value) {
21
20
  return (typeof value === "object" &&
@@ -37,7 +37,6 @@ export type LNURLWithdraw = {
37
37
  * Type guard for {@link LNURLWithdraw}
38
38
  *
39
39
  * @category Lightning
40
- * @internal
41
40
  */
42
41
  export declare function isLNURLWithdraw(value: any): value is LNURLWithdraw;
43
42
  /**
@@ -5,7 +5,6 @@ exports.isLNURLWithdrawParams = exports.isLNURLWithdraw = void 0;
5
5
  * Type guard for {@link LNURLWithdraw}
6
6
  *
7
7
  * @category Lightning
8
- * @internal
9
8
  */
10
9
  function isLNURLWithdraw(value) {
11
10
  return (typeof value === "object" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/sdk",
3
- "version": "8.4.3",
3
+ "version": "8.4.4",
4
4
  "description": "atomiq labs SDK for cross-chain swaps between smart chains and bitcoin",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -127,6 +127,7 @@ export * from "./types/wallets/MinimalBitcoinWalletInterface";
127
127
  export * from "./types/wallets/MinimalLightningNetworkWalletInterface";
128
128
  export * from "./types/wallets/LightningInvoiceCreateService";
129
129
 
130
+ export * from "./types/SwapStateInfo";
130
131
  export * from "./types/AmountData";
131
132
  export * from "./types/CustomPriceFunction";
132
133
  export * from "./types/SwapExecutionAction";
@@ -249,6 +249,17 @@ export abstract class ISwap<
249
249
  */
250
250
  public abstract txsExecute(options?: any): Promise<SwapExecutionAction<T>[]>;
251
251
 
252
+ /**
253
+ * Executes the swap with the provided wallet, the exact arguments for this functions differ for various swap
254
+ * types. Check the `execute()` function signature in the respective swap class to see the required arguments.
255
+ *
256
+ * @param args Execution arguments, usually contains a source wallet object, callbacks and options, for exact
257
+ * syntax check the respective swap class.
258
+ *
259
+ * @returns Whether a swap was successfully executed or not, if it wasn't the user can refund or claim manually
260
+ */
261
+ public abstract execute(...args: any[]): Promise<boolean>;
262
+
252
263
  //////////////////////////////
253
264
  //// Pricing
254
265
 
@@ -460,6 +471,11 @@ export abstract class ISwap<
460
471
  */
461
472
  public abstract isFailed(): boolean;
462
473
 
474
+ /**
475
+ * Returns whether the swap is currently being processed
476
+ */
477
+ public abstract isInProgress(): boolean;
478
+
463
479
  /**
464
480
  * Whether a swap was initialized, a swap is considered initialized on first interaction with it, i.e.
465
481
  * calling commit() on a Smart chain -> Bitcoin swaps, calling waitForPayment() or similar on the other
@@ -385,6 +385,16 @@ export class FromBTCLNSwap<T extends ChainType = ChainType>
385
385
  return this._state===FromBTCLNSwapState.FAILED || this._state===FromBTCLNSwapState.EXPIRED;
386
386
  }
387
387
 
388
+ /**
389
+ * @inheritDoc
390
+ */
391
+ isInProgress(): boolean {
392
+ return (this._state===FromBTCLNSwapState.PR_CREATED && this.initiated) ||
393
+ (this._state===FromBTCLNSwapState.QUOTE_SOFT_EXPIRED && this.initiated) ||
394
+ this._state===FromBTCLNSwapState.PR_PAID ||
395
+ this._state===FromBTCLNSwapState.CLAIM_COMMITED;
396
+ }
397
+
388
398
  /**
389
399
  * @inheritDoc
390
400
  */
@@ -539,7 +549,7 @@ export class FromBTCLNSwap<T extends ChainType = ChainType>
539
549
  lightningTxCheckIntervalSeconds?: number,
540
550
  delayBetweenCommitAndClaimSeconds?: number
541
551
  }
542
- ): Promise<void> {
552
+ ): Promise<boolean> {
543
553
  if(this._state===FromBTCLNSwapState.FAILED) throw new Error("Swap failed!");
544
554
  if(this._state===FromBTCLNSwapState.EXPIRED) throw new Error("Swap HTLC expired!");
545
555
  if(this._state===FromBTCLNSwapState.QUOTE_EXPIRED || this._state===FromBTCLNSwapState.QUOTE_SOFT_EXPIRED) throw new Error("Swap quote expired!");
@@ -585,6 +595,8 @@ export class FromBTCLNSwap<T extends ChainType = ChainType>
585
595
  if(this._state===FromBTCLNSwapState.CLAIM_CLAIMED) {
586
596
  if(callbacks?.onSwapSettled!=null) callbacks.onSwapSettled(this.getOutputTxId()!);
587
597
  }
598
+
599
+ return true;
588
600
  }
589
601
 
590
602
  /**
@@ -470,6 +470,16 @@ export class FromBTCLNAutoSwap<T extends ChainType = ChainType>
470
470
  return this._state===FromBTCLNAutoSwapState.FAILED || this._state===FromBTCLNAutoSwapState.EXPIRED;
471
471
  }
472
472
 
473
+ /**
474
+ * @inheritDoc
475
+ */
476
+ isInProgress(): boolean {
477
+ return (this._state===FromBTCLNAutoSwapState.PR_CREATED && this.initiated) ||
478
+ (this._state===FromBTCLNAutoSwapState.QUOTE_SOFT_EXPIRED && this.initiated) ||
479
+ this._state===FromBTCLNAutoSwapState.PR_PAID ||
480
+ this._state===FromBTCLNAutoSwapState.CLAIM_COMMITED;
481
+ }
482
+
473
483
  /**
474
484
  * @inheritDoc
475
485
  */
@@ -307,6 +307,14 @@ export class FromBTCSwap<T extends ChainType = ChainType>
307
307
  return this._state===FromBTCSwapState.FAILED || this._state===FromBTCSwapState.EXPIRED;
308
308
  }
309
309
 
310
+ /**
311
+ * @inheritDoc
312
+ */
313
+ isInProgress(): boolean {
314
+ return this._state===FromBTCSwapState.CLAIM_COMMITED ||
315
+ this._state===FromBTCSwapState.BTC_TX_CONFIRMED;
316
+ }
317
+
310
318
  /**
311
319
  * @inheritDoc
312
320
  */
@@ -300,6 +300,21 @@ export abstract class IToBTCSwap<
300
300
  return this._state===ToBTCSwapState.REFUNDED;
301
301
  }
302
302
 
303
+ /**
304
+ * @inheritDoc
305
+ */
306
+ isInProgress(): boolean {
307
+ return this._state===ToBTCSwapState.COMMITED || this._state===ToBTCSwapState.SOFT_CLAIMED;
308
+ }
309
+
310
+ /**
311
+ * Returns the time (in UNIX milliseconds) at which the swap expires and the user is able to unilaterally
312
+ * refund it with the {@link refund} or {@link txsRefund} function.
313
+ */
314
+ getExpiry(): number {
315
+ return Number(this._data.getExpiry())*1000;
316
+ }
317
+
303
318
  /**
304
319
  * @inheritDoc
305
320
  * @internal
@@ -506,6 +506,15 @@ export class SpvFromBTCSwap<T extends ChainType>
506
506
  return this._state===SpvFromBTCSwapState.FAILED || this._state===SpvFromBTCSwapState.DECLINED || this._state===SpvFromBTCSwapState.CLOSED;
507
507
  }
508
508
 
509
+ /**
510
+ * @inheritDoc
511
+ */
512
+ isInProgress(): boolean {
513
+ return this._state===SpvFromBTCSwapState.POSTED ||
514
+ this._state===SpvFromBTCSwapState.BROADCASTED ||
515
+ this._state===SpvFromBTCSwapState.BTC_TX_CONFIRMED;
516
+ }
517
+
509
518
  /**
510
519
  * @inheritDoc
511
520
  */
@@ -272,6 +272,13 @@ export class LnForGasSwap<T extends ChainType = ChainType> extends ISwap<T, LnFo
272
272
  return this._state===LnForGasSwapState.FINISHED;
273
273
  }
274
274
 
275
+ /**
276
+ * @inheritDoc
277
+ */
278
+ isInProgress(): boolean {
279
+ return (this._state===LnForGasSwapState.PR_CREATED && this.initiated) || this._state===LnForGasSwapState.PR_PAID;
280
+ }
281
+
275
282
  /**
276
283
  * @inheritDoc
277
284
  * @internal
@@ -420,6 +427,13 @@ export class LnForGasSwap<T extends ChainType = ChainType> extends ISwap<T, LnFo
420
427
  throw new Error("Invalid swap state to obtain execution txns, required PR_CREATED");
421
428
  }
422
429
 
430
+ /**
431
+ * @remark Not supported
432
+ */
433
+ async execute(): Promise<boolean> {
434
+ throw new Error("Not supported");
435
+ }
436
+
423
437
  /**
424
438
  * @inheritDoc
425
439
  */
@@ -572,4 +586,4 @@ export class LnForGasSwap<T extends ChainType = ChainType> extends ISwap<T, LnFo
572
586
  return Promise.resolve(false);
573
587
  }
574
588
 
575
- }
589
+ }
@@ -314,6 +314,14 @@ export class OnchainForGasSwap<T extends ChainType = ChainType> extends ISwap<T,
314
314
  return this._state===OnchainForGasSwapState.FINISHED;
315
315
  }
316
316
 
317
+ /**
318
+ * @inheritDoc
319
+ */
320
+ isInProgress(): boolean {
321
+ return (this._state===OnchainForGasSwapState.PR_CREATED && this.txId!=null) ||
322
+ (this._state===OnchainForGasSwapState.REFUNDABLE && this.refundAddress!=null);
323
+ }
324
+
317
325
  /**
318
326
  * @inheritDoc
319
327
  * @internal
@@ -584,6 +592,13 @@ export class OnchainForGasSwap<T extends ChainType = ChainType> extends ISwap<T,
584
592
  throw new Error("Invalid swap state to obtain execution txns, required PR_CREATED or CLAIM_COMMITED");
585
593
  }
586
594
 
595
+ /**
596
+ * @remark Not supported
597
+ */
598
+ async execute(): Promise<boolean> {
599
+ throw new Error("Not supported");
600
+ }
601
+
587
602
  /**
588
603
  * @inheritDoc
589
604
  *
@@ -51,7 +51,6 @@ export function isLNURLPayParams(obj: any): obj is LNURLPayParams {
51
51
  * Type guard for {@link LNURLPay}
52
52
  *
53
53
  * @category Lightning
54
- * @internal
55
54
  */
56
55
  export function isLNURLPay(value: any): value is LNURLPay {
57
56
  return (
@@ -38,7 +38,6 @@ export type LNURLWithdraw = {
38
38
  * Type guard for {@link LNURLWithdraw}
39
39
  *
40
40
  * @category Lightning
41
- * @internal
42
41
  */
43
42
  export function isLNURLWithdraw(value: any): value is LNURLWithdraw {
44
43
  return (