Skip to main content

FromBTCSwap<T>

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:132

Legacy escrow (PrTLC) based swap for Bitcoin -> Smart chains, requires manual initiation of the swap escrow on the destination chain.

Extends​

Type Parameters​

Type ParameterDefault type
T extends ChainTypeChainType

Implements​

Constructors​

Constructor​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:173

Parameters​

ParameterType
wrapperFromBTCWrapper<T>
initFromBTCSwapInit<T["Data"]>

Returns​

FromBTCSwap<T>

Overrides​

IFromBTCSelfInitSwap.constructor

Constructor​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:174

Parameters​

ParameterType
wrapperFromBTCWrapper<T>
objany

Returns​

FromBTCSwap<T>

Overrides​

IFromBTCSelfInitSwap.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​

IFromBTCSelfInitSwap.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​

IFromBTCSelfInitSwap.createdAt


events​

readonly events: EventEmitter<{
swapState: [FromBTCSwap<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​

IFromBTCSelfInitSwap.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​

IFromBTCSelfInitSwap.exactIn


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​

IFromBTCSelfInitSwap.url


TYPE​

protected readonly TYPE: FROM_BTC = SwapType.FROM_BTC;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:136

Swap type

Implementation of​

IClaimableSwap.TYPE

Overrides​

IFromBTCSelfInitSwap.TYPE

Methods​

_verifyQuoteDefinitelyExpired()​

_verifyQuoteDefinitelyExpired(): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:178

Checks if the swap's quote is expired for good (i.e. the swap strictly cannot be committed on-chain anymore)

Returns​

Promise<boolean>

Implementation of​

IClaimableSwap._verifyQuoteDefinitelyExpired

Inherited from​

IFromBTCSelfInitSwap._verifyQuoteDefinitelyExpired


_verifyQuoteValid()​

_verifyQuoteValid(): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:189

Checks if the swap's quote is still valid

Returns​

Promise<boolean>

Implementation of​

IClaimableSwap._verifyQuoteValid

Inherited from​

IFromBTCSelfInitSwap._verifyQuoteValid


claim()​

claim(
_signer,
abortSignal?,
onBeforeTxSent?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1441

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>

Transaction ID of the settlement (claim) transaction on the destination smart chain

Remarks​

Might also sync the bitcoin light client during the process.

Implementation of​

IClaimableSwap.claim

Overrides​

IFromBTCSelfInitSwap.claim


commit()​

commit(
_signer,
abortSignal?,
skipChecks?,
onBeforeTxSent?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1323

Creates the escrow on the destination smart chain side, pre-locking the tokens from the intermediary (LP) into an escrow.

Parameters​

ParameterTypeDescription
_signerT["Signer"] | T["NativeSigner"]Signer to sign the transactions with, must be the same as used in the initialization
abortSignal?AbortSignalAbort signal
skipChecks?booleanSkip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true)
onBeforeTxSent?(txId) => void-

Returns​

Promise<string>

Throws​

If invalid signer is provided that doesn't match the swap data

Overrides​

IFromBTCSelfInitSwap.commit


estimateBitcoinFee()​

estimateBitcoinFee(_bitcoinWallet, feeRate?): Promise<TokenAmount<BtcToken<false>, true>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:714

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(
dstSigner,
wallet?,
callbacks?,
options?): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:770

Executes the swap with the provided bitcoin wallet,

Parameters​

ParameterTypeDescription
dstSignerT["Signer"] | T["NativeSigner"]Signer on the destination network, needs to have the same address as the one specified when quote was created, this is required for legacy swaps because the destination wallet needs to actively open a bitcoin swap address to which the BTC is then sent, this means that the address also needs to have enough native tokens to pay for gas on the destination network
wallet?| IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSignerBitcoin wallet to use to sign the bitcoin transaction, can also be null - then the execution waits till a transaction is received from an external wallet
callbacks?{ onDestinationCommitSent?: (destinationCommitTxId) => void; onSourceTransactionConfirmationStatus?: (sourceTxId?, confirmations?, targetConfirations?, etaMs?) => void; onSourceTransactionConfirmed?: (sourceTxId) => void; onSourceTransactionSent?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; }Callbacks to track the progress of the swap
callbacks.onDestinationCommitSent?(destinationCommitTxId) => void-
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 swap.claim() to settle the swap on the destination manually

Implementation of​

IClaimableSwap.execute

Overrides​

IFromBTCSelfInitSwap.execute


getAddress()​

getAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:243

Returns bitcoin address where the on-chain BTC should be sent to

Returns​

string

Implementation of​

IAddressSwap.getAddress

Overrides​

IFromBTCSelfInitSwap.getAddress


getClaimerBounty()​

getClaimerBounty(): TokenAmount<SCToken<T["ChainId"]>, true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:406

Returns claimer bounty, acting as a reward for watchtowers to claim the swap automatically, this amount is pre-funded by the user on the destination chain when the swap escrow is initiated. For total pre-funded deposit amount see getTotalDeposit.

Returns​

TokenAmount<SCToken<T["ChainId"]>, true>


getClaimHash()​

getClaimHash(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:130

Returns the claim data hash specifying the claim path of the escrow - i.e. hash passed to the claim handler

Returns​

string

Inherited from​

IFromBTCSelfInitSwap.getClaimHash


getClaimNetworkFee()​

getClaimNetworkFee(): Promise<TokenAmount<SCToken<T["ChainId"]>, true>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:276

Returns the transaction fee required for the claim transaction to settle the escrow on the destination smart chain

Returns​

Promise<TokenAmount<SCToken<T["ChainId"]>, true>>

Inherited from​

IFromBTCSelfInitSwap.getClaimNetworkFee


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​

IFromBTCSelfInitSwap.getDirection


getEscrowClaimTxId()​

getEscrowClaimTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:151

Returns the smart chain transaction ID of the tx that claimed (settled) the escrow

Returns​

string

Inherited from​

IFromBTCSelfInitSwap.getEscrowClaimTxId


getEscrowHash()​

getEscrowHash(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:123

Returns the escrow hash - i.e. hash of the escrow data

Returns​

string

Inherited from​

IFromBTCSelfInitSwap.getEscrowHash


getEscrowInitTxId()​

getEscrowInitTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:144

Returns the smart chain transaction ID of the tx that initiated the escrow

Returns​

string

Inherited from​

IFromBTCSelfInitSwap.getEscrowInitTxId


getEscrowRefundTxId()​

getEscrowRefundTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:158

Returns the smart chain transaction ID of the tx that refunded the escrow

Returns​

string

Inherited from​

IFromBTCSelfInitSwap.getEscrowRefundTxId


getExecutionAction()​

getExecutionAction(options?): Promise<
| SwapExecutionActionSendToAddress<false>
| SwapExecutionActionSignPSBT<"FUNDED_PSBT">
| SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignSmartChainTx<T>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1253

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; skipChecks?: boolean; }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?MinimalBitcoinWalletInterfaceBitcoin wallet to use, when provided the function returns a funded psbt ("FUNDED_PSBT"), if not passed just a bitcoin receive address is returned ("ADDRESS")
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)
options.skipChecks?booleanSkip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true)

Returns​

Promise< | SwapExecutionActionSendToAddress<false> | SwapExecutionActionSignPSBT<"FUNDED_PSBT"> | SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS"> | SwapExecutionActionSignSmartChainTx<T>>

Implementation of​

IClaimableSwap.getExecutionAction

Overrides​

IFromBTCSelfInitSwap.getExecutionAction


getExecutionStatus()​

getExecutionStatus(options?): Promise<{
currentAction: | SwapExecutionActionSendToAddress<false>
| SwapExecutionActionSignPSBT<"FUNDED_PSBT">
| SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS">
| SwapExecutionActionSignSmartChainTx<T>;
stateInfo: SwapStateInfo<FromBTCSwapState>;
steps: [SwapExecutionStepSetup<T["ChainId"]>, SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
}>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1273

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; skipChecks?: 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-
options.skipChecks?boolean-

Returns​

Promise<{ currentAction: | SwapExecutionActionSendToAddress<false> | SwapExecutionActionSignPSBT<"FUNDED_PSBT"> | SwapExecutionActionWait<"SETTLEMENT" | "BITCOIN_CONFS"> | SwapExecutionActionSignSmartChainTx<T>; stateInfo: SwapStateInfo<FromBTCSwapState>; steps: [SwapExecutionStepSetup<T["ChainId"]>, SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]; }>

Implementation of​

IClaimableSwap.getExecutionStatus

Overrides​

IFromBTCSelfInitSwap.getExecutionStatus


getExecutionSteps()​

getExecutionSteps(options?): Promise<[SwapExecutionStepSetup<T["ChainId"]>, SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1305

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<[SwapExecutionStepSetup<T["ChainId"]>, SwapExecutionStepPayment<"BITCOIN">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]>

Implementation of​

IClaimableSwap.getExecutionSteps

Overrides​

IFromBTCSelfInitSwap.getExecutionSteps


getFee()​

getFee(): Fee;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:148

Returns total fee for the swap, the fee is represented in source currency & destination currency, but is paid only once

Returns​

Fee

Implementation of​

IClaimableSwap.getFee

Inherited from​

IFromBTCSelfInitSwap.getFee


getFeeBreakdown()​

getFeeBreakdown(): [{
fee: Fee<T["ChainId"], BtcToken, SCToken<T["ChainId"]>>;
type: SWAP;
}];

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:155

Returns the breakdown of all the fees paid

Returns​

[{ fee: Fee<T["ChainId"], BtcToken, SCToken<T["ChainId"]>>; type: SWAP; }]

Implementation of​

IClaimableSwap.getFeeBreakdown

Inherited from​

IFromBTCSelfInitSwap.getFeeBreakdown


getFundedPsbt()​

getFundedPsbt(
_bitcoinWallet,
feeRate?,
additionalOutputs?): Promise<{
feeRate: number;
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:665

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<{ feeRate: number; psbt: Transaction; psbtBase64: string; psbtHex: string; signInputs: number[]; }>

Implementation of​

IBTCWalletSwap.getFundedPsbt


getHyperlink(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:260

A hyperlink representation of the address + amount that the user needs to sends on the source chain. This is suitable to be displayed in a form of QR code.

Returns​

string

Implementation of​

IAddressSwap.getHyperlink

Overrides​

IFromBTCSelfInitSwap.getHyperlink


getId()​

getId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:137

Returns the ID of the swap, as used in the storage

Returns​

string

Implementation of​

IClaimableSwap.getId

Inherited from​

IFromBTCSelfInitSwap.getId


getInput()​

getInput(): TokenAmount<BtcToken<false>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:397

Returns input amount of the swap, user needs to pay this much

Returns​

TokenAmount<BtcToken<false>>

Implementation of​

IClaimableSwap.getInput

Overrides​

IFromBTCSelfInitSwap.getInput


getInputAddress()​

getInputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:268

Returns source address of the swap

Returns​

string

Implementation of​

IClaimableSwap.getInputAddress

Overrides​

IFromBTCSelfInitSwap.getInputAddress


getInputToken()​

getInputToken(): BtcToken<false>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:390

Returns the input token of the swap

Returns​

BtcToken<false>

Implementation of​

IClaimableSwap.getInputToken

Overrides​

IFromBTCSelfInitSwap.getInputToken


getInputTxId()​

getInputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:275

Returns swap input transaction ID on the source chain

Returns​

string

Implementation of​

IClaimableSwap.getInputTxId

Overrides​

IFromBTCSelfInitSwap.getInputTxId


getInputWithoutFee()​

getInputWithoutFee(): TokenAmount<BtcToken>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:184

Returns input amount of the swap without the fees (swap fee, network fee)

Returns​

TokenAmount<BtcToken>

Implementation of​

IClaimableSwap.getInputWithoutFee

Inherited from​

IFromBTCSelfInitSwap.getInputWithoutFee


getOutput()​

getOutput(): TokenAmount<SCToken<T["ChainId"]>, true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:172

Returns output amount of the swap, user receives this much

Returns​

TokenAmount<SCToken<T["ChainId"]>, true>

Implementation of​

IClaimableSwap.getOutput

Inherited from​

IFromBTCSelfInitSwap.getOutput


getOutputAddress()​

getOutputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:94

Returns destination address of the swap

Returns​

string

Implementation of​

IClaimableSwap.getOutputAddress

Inherited from​

IFromBTCSelfInitSwap.getOutputAddress


getOutputToken()​

getOutputToken(): SCToken<T["ChainId"]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:165

Returns the output token of the swap

Returns​

SCToken<T["ChainId"]>

Implementation of​

IClaimableSwap.getOutputToken

Inherited from​

IFromBTCSelfInitSwap.getOutputToken


getOutputTxId()​

getOutputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:87

Returns swap output transaction ID on the destination chain

Returns​

string

Implementation of​

IClaimableSwap.getOutputTxId

Inherited from​

IFromBTCSelfInitSwap.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​

IFromBTCSelfInitSwap.getPriceInfo


getQuoteExpiry()​

getQuoteExpiry(): number;

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

Returns quote expiry in UNIX millis

Returns​

number

Implementation of​

IClaimableSwap.getQuoteExpiry

Inherited from​

IFromBTCSelfInitSwap.getQuoteExpiry


getRequiredConfirmationsCount()​

getRequiredConfirmationsCount(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:440

Returns the number of confirmations required for the bitcoin transaction for this swap to complete and settle

Returns​

number

Implementation of​

IBTCWalletSwap.getRequiredConfirmationsCount


getSecurityDeposit()​

getSecurityDeposit(): TokenAmount<SCToken<T["ChainId"]>, true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:215

Returns the amount of native token of the destination chain locked up during initialization of the escrow to act as a security deposit that can be taken by the intermediary (LP) if the user doesn't go through with the swap

Returns​

TokenAmount<SCToken<T["ChainId"]>, true>

Inherited from​

IFromBTCSelfInitSwap.getSecurityDeposit


getSmartChainNetworkFee()​

getSmartChainNetworkFee(): Promise<TokenAmount<SCToken<T["ChainId"]>, true>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts:115

Returns the transaction fee paid on the smart chain side to initiate the escrow

Returns​

Promise<TokenAmount<SCToken<T["ChainId"]>, true>>

Inherited from​

IFromBTCSelfInitSwap.getSmartChainNetworkFee


getState()​

getState(): FromBTCSwapState;

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

Returns the current state of the swap

Returns​

FromBTCSwapState

Implementation of​

IClaimableSwap.getState

Inherited from​

IFromBTCSelfInitSwap.getState


getStateInfo()​

getStateInfo(): SwapStateInfo<FromBTCSwapState>;

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

Implementation of​

IClaimableSwap.getStateInfo

Inherited from​

IFromBTCSelfInitSwap.getStateInfo


getTimeoutTime()​

getTimeoutTime(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:309

Returns timeout time (in UNIX milliseconds) when the on-chain address will expire and no funds should be sent to that address anymore

Returns​

number


getTotalDeposit()​

getTotalDeposit(): TokenAmount<SCToken<T["ChainId"]>, true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:224

Returns the total amount of native token of the destination chain locked up during initialization of the escrow. This covers the security deposit and the watchtower fee (if applicable), it is calculated a maximum of those two values.

Returns​

TokenAmount<SCToken<T["ChainId"]>, true>

Inherited from​

IFromBTCSelfInitSwap.getTotalDeposit


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​

IFromBTCSelfInitSwap.getType


hasEnoughForTxFees()​

hasEnoughForTxFees(): Promise<{
balance: TokenAmount<SCToken<T["ChainId"]>, true>;
enoughBalance: boolean;
required: TokenAmount<SCToken<T["ChainId"]>, true>;
}>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:193

Checks if the initiator/sender has enough balance on the smart chain side to cover the transaction fee for processing the swap

Returns​

Promise<{ balance: TokenAmount<SCToken<T["ChainId"]>, true>; enoughBalance: boolean; required: TokenAmount<SCToken<T["ChainId"]>, true>; }>

Inherited from​

IFromBTCSelfInitSwap.hasEnoughForTxFees


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​

IFromBTCSelfInitSwap.hasValidPrice


isClaimable()​

isClaimable(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:330

Checks whether a swap currently requires a manual claiming (settlement)

Returns​

boolean

Implementation of​

IClaimableSwap.isClaimable

Overrides​

IFromBTCSelfInitSwap.isClaimable


isFailed()​

isFailed(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:344

Returns whether the swap failed (e.g. was refunded)

Returns​

boolean

Implementation of​

IClaimableSwap.isFailed

Overrides​

IFromBTCSelfInitSwap.isFailed


isFinished()​

isFinished(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:323

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​

IFromBTCSelfInitSwap.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​

IFromBTCSelfInitSwap.isInitiated


isInProgress()​

isInProgress(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:351

Returns whether the swap is currently being processed

Returns​

boolean

Implementation of​

IClaimableSwap.isInProgress

Overrides​

IFromBTCSelfInitSwap.isInProgress


isQuoteExpired()​

isQuoteExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:359

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​

IFromBTCSelfInitSwap.isQuoteExpired


isQuoteSoftExpired()​

isQuoteSoftExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:366

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​

IFromBTCSelfInitSwap.isQuoteSoftExpired


isSuccessful()​

isSuccessful(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:337

Returns whether the swap finished successful

Returns​

boolean

Implementation of​

IClaimableSwap.isSuccessful

Overrides​

IFromBTCSelfInitSwap.isSuccessful


refreshPriceData()​

refreshPriceData(): Promise<void>;

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

Re-fetches & revalidates the price data based on the current market prices

Returns​

Promise<void>

Implementation of​

IClaimableSwap.refreshPriceData

Inherited from​

IFromBTCSelfInitSwap.refreshPriceData


requiresAction()​

requiresAction(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:316

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​

IFromBTCSelfInitSwap.requiresAction


sendBitcoinTransaction()​

sendBitcoinTransaction(wallet, feeRate?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:725

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/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1556

Serializes the swap to a JSON stringifiable representation (i.e. no bigints, buffers etc.)

Returns​

any

Implementation of​

IClaimableSwap.serialize

Overrides​

IFromBTCSelfInitSwap.serialize


submitPsbt()​

submitPsbt(_psbt): Promise<string>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:683

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/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1394

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

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 FromBTCSwapState.BTC_TX_CONFIRMED)

Implementation of​

IClaimableSwap.txsClaim

Overrides​

IFromBTCSelfInitSwap.txsClaim


txsCommit()​

txsCommit(skipChecks?): Promise<T["TX"][]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts:241

Returns transactions for initiating (committing) the escrow on the destination smart chain side, pre-locking the tokens from the intermediary (LP) into an escrow.

Parameters​

ParameterTypeDescription
skipChecks?booleanSkip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you can use skipChecks=true)

Returns​

Promise<T["TX"][]>

Throws​

When in invalid state to commit the swap

Inherited from​

IFromBTCSelfInitSwap.txsCommit


waitForBitcoinTransaction()​

waitForBitcoinTransaction(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:522

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?,
pollIntervalSeconds?): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1488

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?numberMaximum time in seconds to wait for the swap to be settled
abortSignal?AbortSignalAbortSignal
pollIntervalSeconds?number-

Returns​

Promise<boolean>

whether the swap was claimed in time or not

Implementation of​

IClaimableSwap.waitTillClaimed

Overrides​

IFromBTCSelfInitSwap.waitTillClaimed


waitTillCommited()​

waitTillCommited(abortSignal?): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts:1346

Waits till a swap is initiated (committed) on-chain, should be called after sending the commit transactions (txsCommit) manually to wait till the SDK processes the escrow initialization and updates the swap state accordingly

Parameters​

ParameterTypeDescription
abortSignal?AbortSignalAbortSignal

Returns​

Promise<void>

Overrides​

IFromBTCSelfInitSwap.waitTillCommited