SpvFromBTCSwap<T>
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:192
New spv vault (UTXO-controlled vault) based swaps for Bitcoin -> Smart chain swaps not requiring any initiation on the destination chain, and with the added possibility for the user to receive a native token on the destination chain as part of the swap (a "gas drop" feature).
Extends
ISwap<T,SpvFromBTCTypeDefinition<T>>
Type Parameters
| Type Parameter |
|---|
T extends ChainType |
Implements
IBTCWalletSwapISwapWithGasDrop<T>IClaimableSwap<T,SpvFromBTCTypeDefinition<T>,SpvFromBTCSwapState>
Constructors
Constructor
new SpvFromBTCSwap<T>(wrapper, init): SpvFromBTCSwap<T>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:275
Parameters
| Parameter | Type |
|---|---|
wrapper | SpvFromBTCWrapper<T> |
init | SpvFromBTCSwapInit |
Returns
SpvFromBTCSwap<T>
Overrides
Constructor
new SpvFromBTCSwap<T>(wrapper, obj): SpvFromBTCSwap<T>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:276
Parameters
| Parameter | Type |
|---|---|
wrapper | SpvFromBTCWrapper<T> |
obj | any |
Returns
SpvFromBTCSwap<T>
Overrides
Properties
chainIdentifier
readonly chainIdentifier: T["ChainId"];
Defined in: atomiq-sdk/src/swaps/ISwap.ts:148
Smart chain identifier string corresponding to this swap
Implementation of
IClaimableSwap.chainIdentifier
Inherited from
createdAt
createdAt: number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:156
A UNIX milliseconds timestamps of when this swap was created
Implementation of
Inherited from
events
readonly events: EventEmitter<{
swapState: [SpvFromBTCSwap<T>];
}>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:140
Event emitter emitting "swapState" event when swap's state changes
Implementation of
Inherited from
exactIn
readonly exactIn: boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:152
Whether a swap is an exact input swap
Implementation of
Inherited from
minimumBtcFeeRate
readonly minimumBtcFeeRate: number;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:267
Minimum fee rate in sats/vB that the input bitcoin transaction needs to pay
TYPE
readonly TYPE: SPV_VAULT_FROM_BTC = SwapType.SPV_VAULT_FROM_BTC;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:196
Swap type
Implementation of
Overrides
url?
readonly optional url: string;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:144
URL of the intermediary (LP) used for this swap, already has the swap service specific path appended
Implementation of
Inherited from
Methods
claim()
claim(
_signer,
abortSignal?,
onBeforeTxSent?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1306
Settles the swap by claiming the funds on the destination chain if the swap requires manual settlement, you can check so with isClaimable.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to use for signing the settlement transactions, can also be different to the recipient |
abortSignal? | AbortSignal | Abort signal |
onBeforeTxSent? | (txId) => void | Optional callback triggered before the claim transaction is broadcasted |
Returns
Promise<string>
Remarks
Might also sync the bitcoin light client during the process.
Throws
If the swap is in invalid state (must be SpvFromBTCSwapState.BTC_TX_CONFIRMED)
Implementation of
estimateBitcoinFee()
estimateBitcoinFee(_bitcoinWallet, feeRate?): Promise<TokenAmount<any, BtcToken<false>, true>>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:999
Estimates a bitcoin on-chain fee paid for the bitcoin swap transaction
Parameters
| Parameter | Type | Description |
|---|---|---|
_bitcoinWallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
Returns
Promise<TokenAmount<any, BtcToken<false>, true>>
Implementation of
IBTCWalletSwap.estimateBitcoinFee
execute()
execute(
wallet,
callbacks?,
options?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1033
Executes the swap with the provided bitcoin wallet
Parameters
| Parameter | Type | Description |
|---|---|---|
wallet | | IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner | Bitcoin wallet to use to sign the bitcoin transaction |
callbacks? | { onSourceTransactionConfirmationStatus?: (sourceTxId?, confirmations?, targetConfirations?, etaMs?) => void; onSourceTransactionConfirmed?: (sourceTxId) => void; onSourceTransactionSent?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; } | Callbacks to track the progress of the swap |
callbacks.onSourceTransactionConfirmationStatus? | (sourceTxId?, confirmations?, targetConfirations?, etaMs?) => void | - |
callbacks.onSourceTransactionConfirmed? | (sourceTxId) => void | - |
callbacks.onSourceTransactionSent? | (sourceTxId) => void | - |
callbacks.onSwapSettled? | (destinationTxId) => void | - |
options? | { abortSignal?: AbortSignal; btcTxCheckIntervalSeconds?: number; feeRate?: number; maxWaitTillAutomaticSettlementSeconds?: number; } | Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals |
options.abortSignal? | AbortSignal | - |
options.btcTxCheckIntervalSeconds? | number | - |
options.feeRate? | number | - |
options.maxWaitTillAutomaticSettlementSeconds? | number | - |
Returns
Promise<boolean>
Whether a swap was settled automatically by swap watchtowers or requires manual claim by the
user, in case false is returned the user should call the claim function to settle the swap on the
destination manually
Implementation of
Overrides
getCurrentActions()
getCurrentActions(options?): Promise<SwapExecutionAction<T>[]>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1120
Returns a state-dependent set of actions for the user to execute, or empty array if there is currently no action required from the user to execute.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; } | - |
options.bitcoinFeeRate? | number | Optional fee rate to use for the created Bitcoin transaction |
options.bitcoinWallet? | MinimalBitcoinWalletInterface | Optional bitcoin wallet address specification to return a funded PSBT, if not provided a raw PSBT is returned instead which necessitates the implementor to manually add inputs to the bitcoin transaction and set the nSequence field of the 2nd input (input 1 - indexing from 0) to the value returned in in1sequence |
options.manualSettlementSmartChainSigner? | string | T["Signer"] | T["NativeSigner"] | Optional smart chain signer to create a manual claim (settlement) transaction |
options.maxWaitTillAutomaticSettlementSeconds? | number | Maximum time to wait for an automatic settlement after the bitcoin transaction is confirmed (defaults to 60 seconds) |
Returns
Promise<SwapExecutionAction<T>[]>
Implementation of
IClaimableSwap.getCurrentActions
Overrides
getDirection()
getDirection(): SwapDirection;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:506
Returns the direction of the swap
Returns
Implementation of
Inherited from
getFee()
getFee(): Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:658
Returns total fee for the swap, the fee is represented in source currency & destination currency, but is paid only once
Returns
Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>
Implementation of
Overrides
getFeeBreakdown()
getFeeBreakdown(): [{
fee: Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
type: SWAP;
}, {
fee: Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
type: NETWORK_OUTPUT;
}];
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:681
Returns the breakdown of all the fees paid
Returns
[{
fee: Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
type: SWAP;
}, {
fee: Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
type: NETWORK_OUTPUT;
}]
Implementation of
IClaimableSwap.getFeeBreakdown
Overrides
getFundedPsbt()
getFundedPsbt(
_bitcoinWallet,
feeRate?,
additionalOutputs?): Promise<{
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:864
Returns the PSBT that is already funded with wallet's UTXOs (runs a coin-selection algorithm to choose UTXOs to use), also returns inputs indices that need to be signed by the wallet before submitting the PSBT back to the SDK with submitPsbt
Parameters
| Parameter | Type | Description |
|---|---|---|
_bitcoinWallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
additionalOutputs? | ( | { amount: bigint; outputScript: Uint8Array; } | { address: string; amount: bigint; })[] | additional outputs to add to the PSBT - can be used to collect fees from users |
Returns
Promise<{
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>
Remarks
Note that when passing the feeRate argument, the fee must be at least minimumBtcFeeRate sats/vB.
Implementation of
getGasDropOutput()
getGasDropOutput(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:714
Returns the output of the "gas drop", additional native token received by the user on the destination chain
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Implementation of
ISwapWithGasDrop.getGasDropOutput
getId()
getId(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:419
Returns the ID of the swap, as used in the storage
Returns
string
Implementation of
Overrides
getInput()
getInput(): TokenAmount<T["ChainId"], BtcToken<false>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:735
Returns input amount of the swap, user needs to pay this much
Returns
TokenAmount<T["ChainId"], BtcToken<false>, true>
Implementation of
Overrides
getInputAddress()
getInputAddress(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:463
Returns source address of the swap
Returns
string
Implementation of
IClaimableSwap.getInputAddress
Overrides
getInputToken()
getInputToken(): BtcToken<false>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:728
Returns the input token of the swap
Returns
BtcToken<false>
Implementation of
Overrides
getInputTxId()
getInputTxId(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:470
Returns swap input transaction ID on the source chain
Returns
string
Implementation of
Overrides
getInputWithoutFee()
getInputWithoutFee(): TokenAmount<T["ChainId"], BtcToken<false>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:721
Returns input amount of the swap without the fees (swap fee, network fee)
Returns
TokenAmount<T["ChainId"], BtcToken<false>, true>
Implementation of
IClaimableSwap.getInputWithoutFee
Overrides
getOutput()
getOutput(): TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:707
Returns output amount of the swap, user receives this much
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Implementation of
Overrides
getOutputAddress()
getOutputAddress(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:449
Returns destination address of the swap
Returns
string
Implementation of
IClaimableSwap.getOutputAddress
Overrides
getOutputToken()
getOutputToken(): SCToken<T["ChainId"]>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:700
Returns the output token of the swap
Returns
SCToken<T["ChainId"]>
Implementation of
Overrides
getOutputTxId()
getOutputTxId(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:456
Returns swap output transaction ID on the destination chain
Returns
string
Implementation of
Overrides
getPriceInfo()
getPriceInfo(): object;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:346
Returns pricing info about the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
difference | PercentagePPM | atomiq-sdk/src/swaps/ISwap.ts:349 |
marketPrice? | number | atomiq-sdk/src/swaps/ISwap.ts:347 |
swapPrice | number | atomiq-sdk/src/swaps/ISwap.ts:348 |
Implementation of
Inherited from
getPsbt()
getPsbt(): Promise<{
in1sequence: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:810
Returns the raw PSBT (not funded), the wallet should fund the PSBT (add its inputs) and importantly set the nSequence field of the
2nd input (input 1 - indexing from 0) to the value returned in in1sequence, sign the PSBT and then pass
it back to the swap with submitPsbt function.
Returns
Promise<{
in1sequence: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
}>
getQuoteExpiry()
getQuoteExpiry(): number;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:426
Returns quote expiry in UNIX millis
Returns
number
Implementation of
Overrides
getRequiredConfirmationsCount()
getRequiredConfirmationsCount(): number;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:746
Returns the number of confirmations required for the bitcoin transaction for this swap to complete and settle
Returns
number
Implementation of
IBTCWalletSwap.getRequiredConfirmationsCount
getSpvVaultData()
getSpvVaultData(): object;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:535
Returns the data about used spv vault (UTXO-controlled vault) to perform the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
owner | string | atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:536 |
utxo | string | atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:538 |
vaultId | bigint | atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:537 |
getState()
getState(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:513
Returns the current state of the swap
Returns
number
Implementation of
Inherited from
getStateInfo()
getStateInfo(): SwapStateInfo<number>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:520
Returns the current state of the swap along with the human-readable description of the state
Returns
SwapStateInfo<number>
Implementation of
Inherited from
getTransactionDetails()
getTransactionDetails(): Promise<{
in0sequence: number;
in0txid: string;
in0vout: number;
in1sequence: number;
locktime: number;
out1script: Uint8Array;
out2amount: bigint;
out2script: Uint8Array;
vaultAmount: bigint;
vaultScript: Uint8Array;
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:754
Returns raw transaction details that can be used to manually create a swap PSBT. It is better to use the getPsbt or getFundedPsbt function retrieve an already prepared PSBT.
Returns
Promise<{
in0sequence: number;
in0txid: string;
in0vout: number;
in1sequence: number;
locktime: number;
out1script: Uint8Array;
out2amount: bigint;
out2script: Uint8Array;
vaultAmount: bigint;
vaultScript: Uint8Array;
}>
getType()
getType(): SwapType;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:499
Returns the type of the swap
Returns
Implementation of
Inherited from
hasValidPrice()
hasValidPrice(): boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:338
Checks if the pricing for the swap is valid, according to max allowed price difference set in the ISwapPrice
Returns
boolean
Implementation of
Inherited from
isClaimable()
isClaimable(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:491
Checks whether a swap currently requires a manual claiming (settlement)
Returns
boolean
Implementation of
isFailed()
isFailed(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:505
Returns whether the swap failed (e.g. was refunded)
Returns
boolean
Implementation of
Overrides
isFinished()
isFinished(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:484
Returns whether the swap is finished and in its terminal state (this can mean successful, refunded or failed)
Returns
boolean
Implementation of
Overrides
isInitiated()
isInitiated(): boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:485
Whether a swap was initialized, a swap is considered initialized on first interaction with it, i.e. calling commit() on a Smart chain -> Bitcoin swaps, calling waitForPayment() or similar on the other direction. Not initiated swaps are not saved to the persistent storage by default (see SwapperOptions.saveUninitializedSwaps)
Returns
boolean
Implementation of
Inherited from
isInProgress()
isInProgress(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:512
Returns whether the swap is currently being processed
Returns
boolean
Implementation of
Overrides
isQuoteExpired()
isQuoteExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:521
Checks whether the swap's quote has definitely expired and cannot be committed anymore, we can remove such swap
Returns
boolean
Implementation of
Overrides
isQuoteSoftExpired()
isQuoteSoftExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:528
Checks whether the swap's quote is soft expired (this means there is not enough time buffer for it to commit, but it still can happen)
Returns
boolean
Implementation of
IClaimableSwap.isQuoteSoftExpired
Overrides
isSuccessful()
isSuccessful(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:498
Returns whether the swap finished successful
Returns
boolean
Implementation of
Overrides
refreshPriceData()
refreshPriceData(): Promise<void>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:382
Re-fetches & revalidates the price data based on the current market prices
Returns
Promise<void>
Implementation of
IClaimableSwap.refreshPriceData
Overrides
requiresAction()
requiresAction(): boolean;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:477
Checks whether there is some action required from the user for this swap - can mean either refundable or claimable
Returns
boolean
Implementation of
Overrides
sendBitcoinTransaction()
sendBitcoinTransaction(wallet, feeRate?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1009
Sends a swap bitcoin transaction via the passed bitcoin wallet
Parameters
| Parameter | Type | Description |
|---|---|---|
wallet | | IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
Returns
Promise<string>
Implementation of
IBTCWalletSwap.sendBitcoinTransaction
serialize()
serialize(): any;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1504
Serializes the swap to a JSON stringifiable representation (i.e. no bigints, buffers etc.)
Returns
any
Implementation of
Overrides
submitPsbt()
submitPsbt(_psbt): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:906
Submits a PSBT signed by the wallet back to the SDK
Parameters
| Parameter | Type | Description |
|---|---|---|
_psbt | any | A PSBT, either a Transaction object or a hex or base64 encoded PSBT string |
Returns
Promise<string>
Implementation of
txsClaim()
txsClaim(_signer?): Promise<T["TX"][]>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1250
Returns transactions for settling (claiming) the swap if the swap requires manual settlement, you can check so with isClaimable. After sending the transaction manually be sure to call the waitTillClaimed function to wait till the claim transaction is observed, processed by the SDK and state of the swap properly updated.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer? | string | T["Signer"] | T["NativeSigner"] | Address of the signer to create the claim transactions for, can also be different to the recipient |
Returns
Promise<T["TX"][]>
Remarks
Might also return transactions necessary to sync the bitcoin light client.
Throws
If the swap is in invalid state (must be SpvFromBTCSwapState.BTC_TX_CONFIRMED)
Implementation of
txsExecute()
txsExecute(options?): Promise<[SwapExecutionActionBitcoin<"FUNDED_PSBT" | "RAW_PSBT">]>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1082
Returns a list of steps or transactions required to finish and settle the swap
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; } | Additional options for executing the swap |
options.bitcoinFeeRate? | number | Optional fee rate to use for the created Bitcoin transaction |
options.bitcoinWallet? | MinimalBitcoinWalletInterface | Optional bitcoin wallet address specification to return a funded PSBT, if not provided a raw PSBT is returned instead which necessitates the implementor to manually add inputs to the bitcoin transaction and set the nSequence field of the 2nd input (input 1 - indexing from 0) to the value returned in in1sequence |
Returns
Promise<[SwapExecutionActionBitcoin<"FUNDED_PSBT" | "RAW_PSBT">]>
Implementation of
Overrides
waitForBitcoinTransaction()
waitForBitcoinTransaction(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1181
Waits till the bitcoin transaction gets the required number of confirmations
Parameters
| Parameter | Type | Description |
|---|---|---|
updateCallback? | (txId?, confirmations?, targetConfirmations?, txEtaMs?) => void | Callback called when txId is found, and also called with subsequent confirmations |
checkIntervalSeconds? | number | How often to check the bitcoin transaction |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<string>
Throws
if in invalid state
Implementation of
IBTCWalletSwap.waitForBitcoinTransaction
waitTillClaimed()
waitTillClaimed(maxWaitTimeSeconds?, abortSignal?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1391
Waits till the swap is successfully settled (claimed), should be called after sending the claim (settlement) transactions manually to wait till the SDK processes the settlement and updates the swap state accordingly.
Parameters
| Parameter | Type | Description |
|---|---|---|
maxWaitTimeSeconds? | number | – Maximum time in seconds to wait for the swap to be settled |
abortSignal? | AbortSignal | – AbortSignal |
Returns
Promise<boolean>
Whether the swap was claimed in time or not
Remarks
This is an alias for the waitTillClaimedOrFronted function and will also resolve if the swap has been fronted (not necessarily claimed)
Implementation of
IClaimableSwap.waitTillClaimed
waitTillClaimedOrFronted()
waitTillClaimedOrFronted(maxWaitTimeSeconds?, abortSignal?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1405
Waits till the swap is successfully fronted or settled on the destination chain
Parameters
| Parameter | Type | Description |
|---|---|---|
maxWaitTimeSeconds? | number | Maximum time in seconds to wait for the swap to be settled (by default it waits indefinitely) |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<boolean>
whether the swap was claimed or fronted automatically or not, if the swap was not claimed the user can claim manually through the claim function
waitTillExecuted()
waitTillExecuted(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<void>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1488
Waits till the bitcoin transaction confirms and swap settled on the destination chain
Parameters
| Parameter | Type | Description |
|---|---|---|
updateCallback? | (txId?, confirmations?, targetConfirmations?, txEtaMs?) => void | Callback called when txId is found, and also called with subsequent confirmations |
checkIntervalSeconds? | number | How often to check the bitcoin transaction (5 seconds by default) |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<void>
Throws
if in invalid state (must be SpvFromBTCSwapState.POSTED or SpvFromBTCSwapState.BROADCASTED states)