Skip to main content

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

Constructors

Constructor

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

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

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:276

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:148

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:156

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:140

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:152

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: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

IClaimableSwap.TYPE

Overrides

ISwap.TYPE


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

IClaimableSwap.url

Inherited from

ISwap.url

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

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

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

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; }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

IClaimableSwap.execute

Overrides

ISwap.execute


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

ParameterTypeDescription
options?{ bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; }-
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<SwapExecutionAction<T>[]>

Implementation of

IClaimableSwap.getCurrentActions

Overrides

ISwap.getCurrentActions


getDirection()

getDirection(): SwapDirection;

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

Returns the direction of the swap

Returns

SwapDirection

Implementation of

IClaimableSwap.getDirection

Inherited from

ISwap.getDirection


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

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: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

ISwap.getFeeBreakdown


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

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

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

IBTCWalletSwap.getFundedPsbt


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

IClaimableSwap.getId

Overrides

ISwap.getId


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

IClaimableSwap.getInput

Overrides

ISwap.getInput


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

ISwap.getInputAddress


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

IClaimableSwap.getInputToken

Overrides

ISwap.getInputToken


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

IClaimableSwap.getInputTxId

Overrides

ISwap.getInputTxId


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

ISwap.getInputWithoutFee


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

IClaimableSwap.getOutput

Overrides

ISwap.getOutput


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

ISwap.getOutputAddress


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

IClaimableSwap.getOutputToken

Overrides

ISwap.getOutputToken


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

IClaimableSwap.getOutputTxId

Overrides

ISwap.getOutputTxId


getPriceInfo()

getPriceInfo(): object;

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

Returns pricing info about the swap

Returns

object

NameTypeDefined in
differencePercentagePPMatomiq-sdk/src/swaps/ISwap.ts:349
marketPrice?numberatomiq-sdk/src/swaps/ISwap.ts:347
swapPricenumberatomiq-sdk/src/swaps/ISwap.ts:348

Implementation of

IClaimableSwap.getPriceInfo

Inherited from

ISwap.getPriceInfo


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

IClaimableSwap.getQuoteExpiry

Overrides

ISwap.getQuoteExpiry


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

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

IClaimableSwap.getState

Inherited from

ISwap.getState


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

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: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

SwapType

Implementation of

IClaimableSwap.getType

Inherited from

ISwap.getType


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

IClaimableSwap.hasValidPrice

Inherited from

ISwap.hasValidPrice


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

IClaimableSwap.isClaimable


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

IClaimableSwap.isFailed

Overrides

ISwap.isFailed


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

IClaimableSwap.isFinished

Overrides

ISwap.isFinished


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

IClaimableSwap.isInitiated

Inherited from

ISwap.isInitiated


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

IClaimableSwap.isInProgress

Overrides

ISwap.isInProgress


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

IClaimableSwap.isQuoteExpired

Overrides

ISwap.isQuoteExpired


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

ISwap.isQuoteSoftExpired


isSuccessful()

isSuccessful(): boolean;

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

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:382

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:477

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?): Promise<string>;

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

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

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

IClaimableSwap.serialize

Overrides

ISwap.serialize


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

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: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

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


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

ParameterTypeDescription
options?{ bitcoinFeeRate?: number; bitcoinWallet?: MinimalBitcoinWalletInterface; }Additional options for executing the swap
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

Returns

Promise<[SwapExecutionActionBitcoin<"FUNDED_PSBT" | "RAW_PSBT">]>

Implementation of

IClaimableSwap.txsExecute

Overrides

ISwap.txsExecute


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

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: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

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?): 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

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

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)