Skip to main content

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

Constructors

Constructor

new SpvFromBTCSwap<T>(wrapper, init): SpvFromBTCSwap<T>;

Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:291

Parameters

ParameterType
wrapperSpvFromBTCWrapper<T>
initSpvFromBTCSwapInit

Returns

SpvFromBTCSwap<T>

Overrides

ISwap.constructor

Constructor

new SpvFromBTCSwap<T>(wrapper, obj): SpvFromBTCSwap<T>;

Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:292

Parameters

ParameterType
wrapperSpvFromBTCWrapper<T>
objany

Returns

SpvFromBTCSwap<T>

Overrides

ISwap.constructor

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

ISwap.chainIdentifier


createdAt

createdAt: number;

Defined in: atomiq-sdk/src/swaps/ISwap.ts:176

A UNIX milliseconds timestamps of when this swap was created

Implementation of

IClaimableSwap.createdAt

Inherited from

ISwap.createdAt


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

IClaimableSwap.events

Inherited from

ISwap.events


exactIn

readonly exactIn: boolean;

Defined in: atomiq-sdk/src/swaps/ISwap.ts:172

Whether a swap is an exact input swap

Implementation of

IClaimableSwap.exactIn

Inherited from

ISwap.exactIn


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

IClaimableSwap.TYPE

Overrides

ISwap.TYPE


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

IClaimableSwap.url

Inherited from

ISwap.url

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

ParameterTypeDescription
_signerT["Signer"] | T["NativeSigner"]Signer to use for signing the settlement transactions, can also be different to the recipient
abortSignal?AbortSignalAbort signal
onBeforeTxSent?(txId) => voidOptional 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

IClaimableSwap.claim


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

ParameterTypeDescription
_bitcoinWallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceSender's bitcoin wallet
feeRate?numberOptional 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

ParameterTypeDescription
wallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSignerBitcoin 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

IClaimableSwap.execute

Overrides

ISwap.execute


getDirection()

getDirection(): SwapDirection;

Defined in: atomiq-sdk/src/swaps/ISwap.ts:560

Returns the direction of the swap

Returns

SwapDirection

Implementation of

IClaimableSwap.getDirection

Inherited from

ISwap.getDirection


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

ParameterTypeDescription
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?numberOptional fee rate to use for the created Bitcoin transaction
options.bitcoinWallet?MinimalBitcoinWalletInterfaceOptional 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?numberMaximum 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

ISwap.getExecutionAction


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

ParameterTypeDescription
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

ISwap.getExecutionStatus


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

ParameterTypeDescription
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

ISwap.getExecutionSteps


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

IClaimableSwap.getFee

Overrides

ISwap.getFee


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

ISwap.getFeeBreakdown


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

ParameterTypeDescription
_bitcoinWallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceSender's bitcoin wallet
feeRate?numberOptional 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?booleanInstructs 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

IBTCWalletSwap.getFundedPsbt


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

IClaimableSwap.getId

Overrides

ISwap.getId


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

IClaimableSwap.getInput

Overrides

ISwap.getInput


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

ISwap.getInputAddress


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

IClaimableSwap.getInputToken

Overrides

ISwap.getInputToken


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

IClaimableSwap.getInputTxId

Overrides

ISwap.getInputTxId


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

ISwap.getInputWithoutFee


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

IClaimableSwap.getOutput

Overrides

ISwap.getOutput


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

ISwap.getOutputAddress


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

IClaimableSwap.getOutputToken

Overrides

ISwap.getOutputToken


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

IClaimableSwap.getOutputTxId

Overrides

ISwap.getOutputTxId


getPriceInfo()

getPriceInfo(): object;

Defined in: atomiq-sdk/src/swaps/ISwap.ts:388

Returns pricing info about the swap

Returns

object

NameTypeDefined in
differencePercentagePPMatomiq-sdk/src/swaps/ISwap.ts:391
marketPrice?numberatomiq-sdk/src/swaps/ISwap.ts:389
swapPricenumberatomiq-sdk/src/swaps/ISwap.ts:390

Implementation of

IClaimableSwap.getPriceInfo

Inherited from

ISwap.getPriceInfo


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

IClaimableSwap.getQuoteExpiry

Overrides

ISwap.getQuoteExpiry


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

NameTypeDefined in
ownerstringatomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:563
utxostringatomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:565
vaultIdbigintatomiq-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

IClaimableSwap.getState

Inherited from

ISwap.getState


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

IClaimableSwap.getStateInfo

Inherited from

ISwap.getStateInfo


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

SwapType

Implementation of

IClaimableSwap.getType

Inherited from

ISwap.getType


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

IClaimableSwap.hasValidPrice

Inherited from

ISwap.hasValidPrice


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

IClaimableSwap.isClaimable


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

IClaimableSwap.isFailed

Overrides

ISwap.isFailed


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

IClaimableSwap.isFinished

Overrides

ISwap.isFinished


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

IClaimableSwap.isInitiated

Inherited from

ISwap.isInitiated


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

IClaimableSwap.isInProgress

Overrides

ISwap.isInProgress


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

IClaimableSwap.isQuoteExpired

Overrides

ISwap.isQuoteExpired


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

ISwap.isQuoteSoftExpired


isSuccessful()

isSuccessful(): boolean;

Defined in: atomiq-sdk/src/swaps/spv_swaps/SpvFromBTCSwap.ts:525

Returns whether the swap finished successful

Returns

boolean

Implementation of

IClaimableSwap.isSuccessful

Overrides

ISwap.isSuccessful


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

ISwap.refreshPriceData


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

IClaimableSwap.requiresAction

Overrides

ISwap.requiresAction


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

ParameterTypeDescription
wallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSignerSender's bitcoin wallet
feeRate?numberOptional 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

IClaimableSwap.serialize

Overrides

ISwap.serialize


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

ParameterTypeDescription
_psbtanyA PSBT, either a Transaction object or a hex or base64 encoded PSBT string

Returns

Promise<string>

Implementation of

IBTCWalletSwap.submitPsbt


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

ParameterTypeDescription
_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

IClaimableSwap.txsClaim


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

ParameterTypeDescription
updateCallback?(txId?, confirmations?, targetConfirmations?, txEtaMs?) => voidCallback called when txId is found, and also called with subsequent confirmations
checkIntervalSeconds?numberHow often to check the bitcoin transaction
abortSignal?AbortSignalAbort 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

ParameterTypeDescription
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

ParameterTypeDescription
maxWaitTimeSeconds?numberMaximum time in seconds to wait for the swap to be settled (by default it waits indefinitely)
abortSignal?AbortSignalAbort signal
pollIntervalSeconds?numberHow 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

ParameterTypeDescription
updateCallback?(txId?, confirmations?, targetConfirmations?, txEtaMs?) => voidCallback called when txId is found, and also called with subsequent confirmations
checkIntervalSeconds?numberHow often to check the bitcoin transaction (5 seconds by default)
abortSignal?AbortSignalAbort signal

Returns

Promise<void>

Throws

if in invalid state (must be SpvFromBTCSwapState.POSTED or SpvFromBTCSwapState.BROADCASTED states)