@atomiqlabs/sdk 8.7.7 → 8.9.0
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/api/index.d.ts +1 -0
- package/api/index.js +3 -0
- package/dist/ApiList.d.ts +37 -0
- package/dist/ApiList.js +30 -0
- package/dist/api/ApiEndpoints.d.ts +393 -0
- package/dist/api/ApiEndpoints.js +2 -0
- package/dist/api/ApiParser.d.ts +10 -0
- package/dist/api/ApiParser.js +134 -0
- package/dist/api/ApiTypes.d.ts +157 -0
- package/dist/api/ApiTypes.js +75 -0
- package/dist/api/SerializedAction.d.ts +40 -0
- package/dist/api/SerializedAction.js +59 -0
- package/dist/api/SwapperApi.d.ts +50 -0
- package/dist/api/SwapperApi.js +431 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.js +24 -0
- package/dist/bitcoin/coinselect2/accumulative.d.ts +1 -0
- package/dist/bitcoin/coinselect2/accumulative.js +1 -1
- package/dist/bitcoin/coinselect2/blackjack.d.ts +1 -0
- package/dist/bitcoin/coinselect2/blackjack.js +1 -1
- package/dist/bitcoin/coinselect2/index.d.ts +3 -2
- package/dist/bitcoin/coinselect2/index.js +2 -2
- package/dist/bitcoin/coinselect2/utils.d.ts +7 -2
- package/dist/bitcoin/coinselect2/utils.js +45 -10
- package/dist/bitcoin/wallet/BitcoinWallet.d.ts +8 -25
- package/dist/bitcoin/wallet/BitcoinWallet.js +31 -18
- package/dist/bitcoin/wallet/IBitcoinWallet.d.ts +40 -2
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.d.ts +7 -2
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.js +10 -4
- package/dist/events/UnifiedSwapEventListener.d.ts +4 -3
- package/dist/events/UnifiedSwapEventListener.js +8 -2
- package/dist/http/HttpUtils.d.ts +4 -2
- package/dist/http/HttpUtils.js +10 -4
- package/dist/http/paramcoders/client/StreamingFetchPromise.d.ts +2 -1
- package/dist/http/paramcoders/client/StreamingFetchPromise.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +7 -2
- package/dist/intermediaries/IntermediaryDiscovery.js +4 -4
- package/dist/intermediaries/apis/IntermediaryAPI.d.ts +182 -15
- package/dist/intermediaries/apis/IntermediaryAPI.js +192 -31
- package/dist/intermediaries/auth/SignedKeyBasedAuth.d.ts +14 -0
- package/dist/intermediaries/auth/SignedKeyBasedAuth.js +68 -0
- package/dist/storage/IUnifiedStorage.d.ts +45 -3
- package/dist/storage/UnifiedSwapStorage.d.ts +8 -2
- package/dist/storage/UnifiedSwapStorage.js +46 -8
- package/dist/swapper/Swapper.d.ts +77 -4
- package/dist/swapper/Swapper.js +117 -25
- package/dist/swapper/SwapperUtils.d.ts +18 -2
- package/dist/swapper/SwapperUtils.js +39 -1
- package/dist/swaps/ISwap.d.ts +70 -9
- package/dist/swaps/ISwap.js +28 -6
- package/dist/swaps/ISwapWrapper.d.ts +11 -1
- package/dist/swaps/ISwapWrapper.js +23 -3
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +4 -2
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +2 -2
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +3 -2
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +47 -31
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +201 -67
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +82 -15
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +304 -98
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +75 -42
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +424 -87
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +7 -7
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +54 -11
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +214 -41
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +7 -8
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +5 -5
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +85 -22
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +299 -56
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +41 -7
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +183 -58
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +53 -12
- package/dist/swaps/trusted/ln/LnForGasSwap.js +163 -49
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +1 -2
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +14 -13
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +30 -47
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +3 -1
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +4 -4
- package/dist/types/SwapExecutionAction.d.ts +141 -34
- package/dist/types/SwapExecutionAction.js +104 -0
- package/dist/types/SwapExecutionStep.d.ts +144 -0
- package/dist/types/SwapExecutionStep.js +87 -0
- package/dist/types/TokenAmount.d.ts +6 -0
- package/dist/types/TokenAmount.js +26 -1
- package/dist/utils/BitcoinUtils.d.ts +4 -0
- package/dist/utils/BitcoinUtils.js +73 -1
- package/dist/utils/BitcoinWalletUtils.d.ts +2 -2
- package/dist/utils/Utils.d.ts +3 -1
- package/dist/utils/Utils.js +7 -1
- package/package.json +7 -4
- package/src/api/ApiEndpoints.ts +427 -0
- package/src/api/ApiParser.ts +138 -0
- package/src/api/ApiTypes.ts +229 -0
- package/src/api/SerializedAction.ts +97 -0
- package/src/api/SwapperApi.ts +545 -0
- package/src/api/index.ts +5 -0
- package/src/bitcoin/coinselect2/accumulative.ts +2 -1
- package/src/bitcoin/coinselect2/blackjack.ts +2 -1
- package/src/bitcoin/coinselect2/index.ts +5 -4
- package/src/bitcoin/coinselect2/utils.ts +55 -14
- package/src/bitcoin/wallet/BitcoinWallet.ts +69 -57
- package/src/bitcoin/wallet/IBitcoinWallet.ts +44 -3
- package/src/bitcoin/wallet/SingleAddressBitcoinWallet.ts +12 -4
- package/src/events/UnifiedSwapEventListener.ts +11 -3
- package/src/http/HttpUtils.ts +10 -4
- package/src/http/paramcoders/client/StreamingFetchPromise.ts +4 -2
- package/src/index.ts +1 -0
- package/src/intermediaries/IntermediaryDiscovery.ts +9 -2
- package/src/intermediaries/apis/IntermediaryAPI.ts +335 -35
- package/src/intermediaries/auth/SignedKeyBasedAuth.ts +69 -0
- package/src/storage/IUnifiedStorage.ts +45 -4
- package/src/storage/UnifiedSwapStorage.ts +42 -8
- package/src/swapper/Swapper.ts +165 -24
- package/src/swapper/SwapperUtils.ts +42 -2
- package/src/swaps/ISwap.ts +88 -16
- package/src/swaps/ISwapWrapper.ts +28 -3
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +5 -3
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +3 -1
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +4 -1
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +264 -67
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +390 -89
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +548 -94
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +7 -5
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +276 -45
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +7 -6
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +5 -3
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +413 -64
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +239 -61
- package/src/swaps/trusted/ln/LnForGasSwap.ts +211 -47
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +1 -2
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +32 -51
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +5 -3
- package/src/types/SwapExecutionAction.ts +266 -43
- package/src/types/SwapExecutionStep.ts +224 -0
- package/src/types/TokenAmount.ts +36 -2
- package/src/utils/BitcoinUtils.ts +73 -0
- package/src/utils/BitcoinWalletUtils.ts +2 -2
- package/src/utils/Utils.ts +10 -1
- package/src/intermediaries/apis/TrustedIntermediaryAPI.ts +0 -258
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ISwap, ISwapInit } from "../ISwap";
|
|
2
|
-
import { ChainType, SpvWithdrawalClaimedState, SpvWithdrawalClosedState, SpvWithdrawalFrontedState } from "@atomiqlabs/base";
|
|
2
|
+
import { BtcTx, ChainType, SpvWithdrawalClaimedState, SpvWithdrawalClosedState, SpvWithdrawalFrontedState } from "@atomiqlabs/base";
|
|
3
3
|
import { SwapType } from "../../enums/SwapType";
|
|
4
4
|
import { SpvFromBTCTypeDefinition, SpvFromBTCWrapper } from "./SpvFromBTCWrapper";
|
|
5
5
|
import { Transaction } from "@scure/btc-signer";
|
|
6
6
|
import { Fee } from "../../types/fees/Fee";
|
|
7
|
-
import { IBitcoinWallet } from "../../bitcoin/wallet/IBitcoinWallet";
|
|
7
|
+
import { BitcoinWalletUtxo, IBitcoinWallet } from "../../bitcoin/wallet/IBitcoinWallet";
|
|
8
8
|
import { IBTCWalletSwap } from "../IBTCWalletSwap";
|
|
9
9
|
import { ISwapWithGasDrop } from "../ISwapWithGasDrop";
|
|
10
10
|
import { MinimalBitcoinWalletInterface, MinimalBitcoinWalletInterfaceWithSigner } from "../../types/wallets/MinimalBitcoinWalletInterface";
|
|
@@ -14,7 +14,9 @@ import { TokenAmount } from "../../types/TokenAmount";
|
|
|
14
14
|
import { BtcToken, SCToken } from "../../types/Token";
|
|
15
15
|
import { LoggerType } from "../../utils/Logger";
|
|
16
16
|
import { PriceInfoType } from "../../types/PriceInfoType";
|
|
17
|
-
import {
|
|
17
|
+
import { SwapExecutionActionSignPSBT, SwapExecutionActionSignSmartChainTx, SwapExecutionActionWait } from "../../types/SwapExecutionAction";
|
|
18
|
+
import { SwapExecutionStepPayment, SwapExecutionStepSettlement } from "../../types/SwapExecutionStep";
|
|
19
|
+
import { SwapStateInfo } from "../../types/SwapStateInfo";
|
|
18
20
|
/**
|
|
19
21
|
* State enum for SPV vault (UTXO-controlled vault) based swaps
|
|
20
22
|
* @category Swaps/Bitcoin → Smart chain
|
|
@@ -404,13 +406,15 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
404
406
|
/**
|
|
405
407
|
* Returns the raw PSBT (not funded), the wallet should fund the PSBT (add its inputs) and importantly **set the nSequence field of the
|
|
406
408
|
* 2nd input** (input 1 - indexing from 0) to the value returned in `in1sequence`, sign the PSBT and then pass
|
|
407
|
-
* it back to the swap with {@link submitPsbt} function.
|
|
409
|
+
* it back to the swap with {@link submitPsbt} function. The transaction should use at least the returned `feeRate`
|
|
410
|
+
* sats/vB as the transaction fee.
|
|
408
411
|
*/
|
|
409
412
|
getPsbt(): Promise<{
|
|
410
413
|
psbt: Transaction;
|
|
411
414
|
psbtHex: string;
|
|
412
415
|
psbtBase64: string;
|
|
413
416
|
in1sequence: number;
|
|
417
|
+
feeRate: number;
|
|
414
418
|
}>;
|
|
415
419
|
/**
|
|
416
420
|
* Returns the PSBT that is already funded with wallet's UTXOs (runs a coin-selection algorithm to choose UTXOs to use),
|
|
@@ -423,6 +427,10 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
423
427
|
* @param _bitcoinWallet Sender's bitcoin wallet
|
|
424
428
|
* @param feeRate Optional fee rate in sats/vB for the transaction
|
|
425
429
|
* @param additionalOutputs additional outputs to add to the PSBT - can be used to collect fees from users
|
|
430
|
+
* @param utxos Pre-fetched list of UTXOs to spend from
|
|
431
|
+
* @param spendFully Instructs the wallet to spend all the passed UTXOs in the transaction without creating any
|
|
432
|
+
* change output, if the `feeRate` is passed, it will also enforce that the feeRate in sats/vB for the resulting
|
|
433
|
+
* transaction is not more than 50% and 10 sats/vB larger (considering also the CPFP adjustments)
|
|
426
434
|
*/
|
|
427
435
|
getFundedPsbt(_bitcoinWallet: IBitcoinWallet | MinimalBitcoinWalletInterface, feeRate?: number, additionalOutputs?: ({
|
|
428
436
|
amount: bigint;
|
|
@@ -430,11 +438,12 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
430
438
|
} | {
|
|
431
439
|
amount: bigint;
|
|
432
440
|
address: string;
|
|
433
|
-
})[]): Promise<{
|
|
441
|
+
})[], utxos?: BitcoinWalletUtxo[], spendFully?: boolean): Promise<{
|
|
434
442
|
psbt: Transaction;
|
|
435
443
|
psbtHex: string;
|
|
436
444
|
psbtBase64: string;
|
|
437
445
|
signInputs: number[];
|
|
446
|
+
feeRate: number;
|
|
438
447
|
}>;
|
|
439
448
|
/**
|
|
440
449
|
* @inheritDoc
|
|
@@ -447,7 +456,7 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
447
456
|
/**
|
|
448
457
|
* @inheritDoc
|
|
449
458
|
*/
|
|
450
|
-
sendBitcoinTransaction(wallet: IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner, feeRate?: number): Promise<string>;
|
|
459
|
+
sendBitcoinTransaction(wallet: IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner, feeRate?: number, utxos?: BitcoinWalletUtxo[], spendFully?: boolean): Promise<string>;
|
|
451
460
|
/**
|
|
452
461
|
* Executes the swap with the provided bitcoin wallet
|
|
453
462
|
*
|
|
@@ -469,22 +478,48 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
469
478
|
abortSignal?: AbortSignal;
|
|
470
479
|
btcTxCheckIntervalSeconds?: number;
|
|
471
480
|
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
481
|
+
utxos?: BitcoinWalletUtxo[];
|
|
482
|
+
spendFully?: boolean;
|
|
472
483
|
}): Promise<boolean>;
|
|
473
484
|
/**
|
|
474
|
-
* @
|
|
475
|
-
*
|
|
476
|
-
* @param options.bitcoinFeeRate Optional fee rate to use for the created Bitcoin transaction
|
|
477
|
-
* @param options.bitcoinWallet Optional bitcoin wallet address specification to return a funded PSBT,
|
|
478
|
-
* if not provided a raw PSBT is returned instead which necessitates the implementor to manually add
|
|
479
|
-
* inputs to the bitcoin transaction and **set the nSequence field of the 2nd input** (input 1 -
|
|
480
|
-
* indexing from 0) to the value returned in `in1sequence`
|
|
485
|
+
* @internal
|
|
481
486
|
*/
|
|
482
|
-
|
|
487
|
+
protected _getExecutionStatus(options?: {
|
|
483
488
|
bitcoinFeeRate?: number;
|
|
484
489
|
bitcoinWallet?: MinimalBitcoinWalletInterface;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
490
|
+
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
491
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
492
|
+
}): Promise<{
|
|
493
|
+
steps: [SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
|
|
494
|
+
buildCurrentAction: (actionOptions?: {
|
|
495
|
+
bitcoinFeeRate?: number;
|
|
496
|
+
bitcoinWallet?: MinimalBitcoinWalletInterface;
|
|
497
|
+
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
498
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
499
|
+
}) => Promise<SwapExecutionActionSignPSBT | SwapExecutionActionWait<"BITCOIN_CONFS" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined>;
|
|
500
|
+
state: number;
|
|
501
|
+
}>;
|
|
502
|
+
/**
|
|
503
|
+
* @inheritDoc
|
|
504
|
+
* @internal
|
|
505
|
+
*/
|
|
506
|
+
_submitExecutionTransactions(txs: (T["SignedTXType"] | Transaction | string)[], abortSignal?: AbortSignal, requiredStates?: SpvFromBTCSwapState[], idempotent?: boolean): Promise<string[]>;
|
|
507
|
+
/**
|
|
508
|
+
* @internal
|
|
509
|
+
*/
|
|
510
|
+
private _buildDepositPsbtAction;
|
|
511
|
+
/**
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
private _buildWaitBitcoinConfirmationsAction;
|
|
515
|
+
/**
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
private _buildWaitSettlementAction;
|
|
519
|
+
/**
|
|
520
|
+
* @internal
|
|
521
|
+
*/
|
|
522
|
+
private _buildClaimSmartChainTxAction;
|
|
488
523
|
/**
|
|
489
524
|
* @inheritDoc
|
|
490
525
|
*
|
|
@@ -497,12 +532,38 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
497
532
|
* @param options.maxWaitTillAutomaticSettlementSeconds Maximum time to wait for an automatic settlement after
|
|
498
533
|
* the bitcoin transaction is confirmed (defaults to 60 seconds)
|
|
499
534
|
*/
|
|
500
|
-
|
|
535
|
+
getExecutionAction(options?: {
|
|
536
|
+
bitcoinFeeRate?: number;
|
|
537
|
+
bitcoinWallet?: MinimalBitcoinWalletInterface;
|
|
538
|
+
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
539
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
540
|
+
}): Promise<SwapExecutionActionSignPSBT | SwapExecutionActionWait<"BITCOIN_CONFS" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined>;
|
|
541
|
+
/**
|
|
542
|
+
* @inheritDoc
|
|
543
|
+
*/
|
|
544
|
+
getExecutionStatus(options?: {
|
|
545
|
+
skipBuildingAction?: boolean;
|
|
501
546
|
bitcoinFeeRate?: number;
|
|
502
547
|
bitcoinWallet?: MinimalBitcoinWalletInterface;
|
|
503
548
|
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
504
549
|
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
505
|
-
}): Promise<
|
|
550
|
+
}): Promise<{
|
|
551
|
+
steps: [
|
|
552
|
+
SwapExecutionStepPayment<"BITCOIN">,
|
|
553
|
+
SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">
|
|
554
|
+
];
|
|
555
|
+
currentAction: SwapExecutionActionSignPSBT | SwapExecutionActionWait<"BITCOIN_CONFS" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined;
|
|
556
|
+
stateInfo: SwapStateInfo<SpvFromBTCSwapState>;
|
|
557
|
+
}>;
|
|
558
|
+
/**
|
|
559
|
+
* @inheritDoc
|
|
560
|
+
*/
|
|
561
|
+
getExecutionSteps(options?: {
|
|
562
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
563
|
+
}): Promise<[
|
|
564
|
+
SwapExecutionStepPayment<"BITCOIN">,
|
|
565
|
+
SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">
|
|
566
|
+
]>;
|
|
506
567
|
/**
|
|
507
568
|
* Checks whether a bitcoin payment was already made, returns the payment or null when no payment has been made.
|
|
508
569
|
* @internal
|
|
@@ -511,6 +572,7 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
511
572
|
txId: string;
|
|
512
573
|
confirmations: number;
|
|
513
574
|
targetConfirmations: number;
|
|
575
|
+
btcTx: BtcTx;
|
|
514
576
|
inputAddresses?: string[];
|
|
515
577
|
} | null>;
|
|
516
578
|
/**
|
|
@@ -550,11 +612,11 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
550
612
|
/**
|
|
551
613
|
* Periodically checks the chain to see whether the swap was finished (claimed or refunded)
|
|
552
614
|
*
|
|
553
|
-
* @param abortSignal
|
|
554
615
|
* @param interval How often to check (in seconds), default to 5s
|
|
616
|
+
* @param abortSignal
|
|
555
617
|
* @internal
|
|
556
618
|
*/
|
|
557
|
-
protected watchdogWaitTillResult(
|
|
619
|
+
protected watchdogWaitTillResult(interval?: number, abortSignal?: AbortSignal): Promise<SpvWithdrawalClaimedState | SpvWithdrawalFrontedState | SpvWithdrawalClosedState>;
|
|
558
620
|
/**
|
|
559
621
|
* Waits till the swap is successfully settled (claimed), should be called after sending the claim (settlement)
|
|
560
622
|
* transactions manually to wait till the SDK processes the settlement and updates the swap state accordingly.
|
|
@@ -575,11 +637,12 @@ export declare class SpvFromBTCSwap<T extends ChainType> extends ISwap<T, SpvFro
|
|
|
575
637
|
* @param maxWaitTimeSeconds Maximum time in seconds to wait for the swap to be settled (by default
|
|
576
638
|
* it waits indefinitely)
|
|
577
639
|
* @param abortSignal Abort signal
|
|
640
|
+
* @param pollIntervalSeconds How often to poll via the watchdog
|
|
578
641
|
*
|
|
579
642
|
* @returns {boolean} whether the swap was claimed or fronted automatically or not, if the swap was not claimed
|
|
580
643
|
* the user can claim manually through the {@link claim} function
|
|
581
644
|
*/
|
|
582
|
-
waitTillClaimedOrFronted(maxWaitTimeSeconds?: number, abortSignal?: AbortSignal): Promise<boolean>;
|
|
645
|
+
waitTillClaimedOrFronted(maxWaitTimeSeconds?: number, abortSignal?: AbortSignal, pollIntervalSeconds?: number): Promise<boolean>;
|
|
583
646
|
/**
|
|
584
647
|
* Waits till the bitcoin transaction confirms and swap settled on the destination chain
|
|
585
648
|
*
|