SpvFromBTCSwap<T>
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:202
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:291
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:292
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:168
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:176
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:160
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:172
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:281
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:208
Swap type
Implementation of
Overrides
url?
readonly optional url: string;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:164
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:1672
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<BtcToken<false>, true>>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1038
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<BtcToken<false>, true>>
Implementation of
IBTCWalletSwap.estimateBitcoinFee
execute()
execute(
wallet,
callbacks?,
options?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1077
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; spendFully?: boolean; utxos?: BitcoinWalletUtxo[]; } | Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals |
options.abortSignal? | AbortSignal | - |
options.btcTxCheckIntervalSeconds? | number | - |
options.feeRate? | number | - |
options.maxWaitTillAutomaticSettlementSeconds? | number | - |
options.spendFully? | boolean | - |
options.utxos? | BitcoinWalletUtxo[] | - |
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
getDirection()
getDirection(): SwapDirection;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:560
Returns the direction of the swap
Returns
Implementation of
Inherited from
getExecutionAction()
getExecutionAction(options?): Promise<
| SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignPSBT
| SwapExecutionActionSignSmartChainTx<T>>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1456
Returns a current state-dependent action for the user to execute, or undefined if there is no more action
required for this swap - this means that the swap is probably finished (either expired, failed or settled).
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; } | Optional options argument for the additional action context (i.e. passing bitcoin wallet info to get funded PSBTs or passing the externally-generated swap secret), see the actual type in the respective swap classes |
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<
| SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignPSBT
| SwapExecutionActionSignSmartChainTx<T>>
Implementation of
IClaimableSwap.getExecutionAction
Overrides
getExecutionStatus()
getExecutionStatus(options?): Promise<{
currentAction: | SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignPSBT
| SwapExecutionActionSignSmartChainTx<T>;
stateInfo: SwapStateInfo<SpvFromBTCSwapState>;
steps: [SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1474
Returns the current action and the full execution steps for a given swap. Prefer this to calling getExecutionSteps and getExecutionAction separately - if called sequentially they might return the respective steps/actions in different states if you hit the state transition boundary.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; skipBuildingAction?: boolean; } | Optional options argument for the additional execution status context, see the actual type in the respective swap classes |
options.bitcoinFeeRate? | number | - |
options.bitcoinWallet? | MinimalBitcoinWalletInterface | - |
options.manualSettlementSmartChainSigner? | string | T["Signer"] | T["NativeSigner"] | - |
options.maxWaitTillAutomaticSettlementSeconds? | number | - |
options.skipBuildingAction? | boolean | - |
Returns
Promise<{
currentAction: | SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignPSBT
| SwapExecutionActionSignSmartChainTx<T>;
stateInfo: SwapStateInfo<SpvFromBTCSwapState>;
steps: [SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
}>
Implementation of
IClaimableSwap.getExecutionStatus
Overrides
getExecutionSteps()
getExecutionSteps(options?): Promise<[SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1503
Returns a list of execution steps the user has to go through for a given swap, to see the possible execution steps check out SwapExecutionStep.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { maxWaitTillAutomaticSettlementSeconds?: number; } | Optional options argument for the additional steps context (i.e. automatic settlement timeout), see the actual type in the respective swap classes |
options.maxWaitTillAutomaticSettlementSeconds? | number | - |
Returns
Promise<[SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]>
Implementation of
IClaimableSwap.getExecutionSteps
Overrides
getFee()
getFee(): Fee<T["ChainId"], BtcToken<false>, SCToken<T["ChainId"]>>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:685
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:708
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?,
utxos?,
spendFully?): Promise<{
feeRate: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:898
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 |
utxos? | BitcoinWalletUtxo[] | Pre-fetched list of UTXOs to spend from |
spendFully? | boolean | Instructs the wallet to spend all the passed UTXOs in the transaction without creating any change output, if the feeRate is passed, it will also enforce that the feeRate in sats/vB for the resulting transaction is not more than 50% and 10 sats/vB larger (considering also the CPFP adjustments) |
Returns
Promise<{
feeRate: number;
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<SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:741
Returns the output of the "gas drop", additional native token received by the user on the destination chain
Returns
TokenAmount<SCToken<T["ChainId"]>, true>
Implementation of
ISwapWithGasDrop.getGasDropOutput
getId()
getId(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:446
Returns the ID of the swap, as used in the storage
Returns
string
Implementation of
Overrides
getInput()
getInput(): TokenAmount<BtcToken<false>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:762
Returns input amount of the swap, user needs to pay this much
Returns
TokenAmount<BtcToken<false>, true>
Implementation of
Overrides
getInputAddress()
getInputAddress(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:490
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:755
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:497
Returns swap input transaction ID on the source chain
Returns
string
Implementation of
Overrides
getInputWithoutFee()
getInputWithoutFee(): TokenAmount<BtcToken<false>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:748
Returns input amount of the swap without the fees (swap fee, network fee)
Returns
TokenAmount<BtcToken<false>, true>
Implementation of
IClaimableSwap.getInputWithoutFee
Overrides
getOutput()
getOutput(): TokenAmount<SCToken<T["ChainId"]>, true>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:734
Returns output amount of the swap, user receives this much
Returns
TokenAmount<SCToken<T["ChainId"]>, true>
Implementation of
Overrides
getOutputAddress()
getOutputAddress(): string;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:476
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:727
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:483
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:388
Returns pricing info about the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
difference | PercentagePPM | atomiq-sdk/src/swaps/ISwap.ts:391 |
marketPrice? | number | atomiq-sdk/src/swaps/ISwap.ts:389 |
swapPrice | number | atomiq-sdk/src/swaps/ISwap.ts:390 |
Implementation of
Inherited from
getPsbt()
getPsbt(): Promise<{
feeRate: number;
in1sequence: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
}>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:838
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. The transaction should use at least the returned feeRate
sats/vB as the transaction fee.
Returns
Promise<{
feeRate: number;
in1sequence: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
}>
getQuoteExpiry()
getQuoteExpiry(): number;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:453
Returns quote expiry in UNIX millis
Returns
number
Implementation of
Overrides
getRequiredConfirmationsCount()
getRequiredConfirmationsCount(): number;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:773
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:562
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:563 |
utxo | string | atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:565 |
vaultId | bigint | atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:564 |
getState()
getState(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:567
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:574
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:781
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:553
Returns the type of the swap
Returns
Implementation of
Inherited from
hasValidPrice()
hasValidPrice(): boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:380
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:518
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:532
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:511
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:539
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:539
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:548
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:555
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:525
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:406
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:504
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?,
utxos?,
spendFully?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1048
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 |
utxos? | BitcoinWalletUtxo[] | - |
spendFully? | boolean | - |
Returns
Promise<string>
Implementation of
IBTCWalletSwap.sendBitcoinTransaction
serialize()
serialize(): any;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1871
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:944
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:1616
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
waitForBitcoinTransaction()
waitForBitcoinTransaction(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1547
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:1757
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?,
pollIntervalSeconds?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:1772
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 |
pollIntervalSeconds? | number | How often to poll via the watchdog |
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:1855
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)