Skip to main content

ToBTCLNSwap<T>

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:43

Escrow based (HTLC) swap for Smart chains -> Bitcoin lightning

Extends​

Type Parameters​

Type ParameterDefault type
T extends ChainTypeChainType

Constructors​

Constructor​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:73

Parameters​

ParameterType
wrapperToBTCLNWrapper<T>
initToBTCLNSwapInit<T["Data"]>

Returns​

ToBTCLNSwap<T>

Overrides​

IToBTCSwap.constructor

Constructor​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:74

Parameters​

ParameterType
wrapperToBTCLNWrapper<T>
objany

Returns​

ToBTCLNSwap<T>

Overrides​

IToBTCSwap.constructor

Properties​

chainIdentifier​

readonly chainIdentifier: T["ChainId"];

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

Smart chain identifier string corresponding to this swap

Inherited from​

IToBTCSwap.chainIdentifier


createdAt​

createdAt: number;

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

A UNIX milliseconds timestamps of when this swap was created

Inherited from​

IToBTCSwap.createdAt


events​

readonly events: EventEmitter<{
swapState: [ToBTCLNSwap<T>];
}>;

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

Event emitter emitting "swapState" event when swap's state changes

Inherited from​

IToBTCSwap.events


exactIn​

readonly exactIn: boolean;

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

Whether a swap is an exact input swap

Inherited from​

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

Inherited from​

IToBTCSwap.url


TYPE​

protected readonly TYPE: TO_BTCLN = SwapType.TO_BTCLN;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:44

Swap type

Overrides​

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

Inherited from​

IToBTCSwap._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>

Inherited from​

IToBTCSwap._verifyQuoteValid


commit()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:823

Initiates (commits) the escrow on the smart chain side

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) => voidCallback called before the transactions are broadcasted

Returns​

Promise<string>

Inherited from​

IToBTCSwap.commit


execute()​

execute(
signer,
callbacks?,
options?): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:505

Executes the swap with the provided smart chain wallet/signer

Parameters​

ParameterTypeDescription
signerT["Signer"] | T["NativeSigner"]Smart chain wallet/signer to use to sign the transaction on the source chain
callbacks?{ onSourceTransactionConfirmed?: (sourceTxId) => void; onSourceTransactionSent?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; }Callbacks to track the progress of the swap
callbacks.onSourceTransactionConfirmed?(sourceTxId) => void-
callbacks.onSourceTransactionSent?(sourceTxId) => void-
callbacks.onSwapSettled?(destinationTxId) => void-
options?{ abortSignal?: AbortSignal; maxWaitTillSwapProcessedSeconds?: number; paymentCheckIntervalSeconds?: number; }Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals
options.abortSignal?AbortSignal-
options.maxWaitTillSwapProcessedSeconds?number-
options.paymentCheckIntervalSeconds?number-

Returns​

Promise<boolean>

Whether the swap was successfully processed by the LP, in case false is returned the user can refund their funds back on the source chain by calling refund

Inherited from​

IToBTCSwap.execute


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​

IToBTCSwap.getClaimHash


getConfidence()​

getConfidence(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:179

Returns the confidence of the intermediary that this payment will succeed.

Returns​

number

Decimal value between 0 and 1, where 0 is not likely and 1 is very likely


getDirection()​

getDirection(): SwapDirection;

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

Returns the direction of the swap

Returns​

SwapDirection

Inherited from​

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

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

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

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

IToBTCSwap.getEscrowRefundTxId


getExecutionAction()​

getExecutionAction(options?): Promise<
| SwapExecutionActionWait<"LP">
| SwapExecutionActionSignSmartChainTx<T>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:746

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?{ refundSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; 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.refundSmartChainSigner?string | T["Signer"] | T["NativeSigner"]Optional smart chain signer to use when creating refunds transactions
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< | SwapExecutionActionWait<"LP"> | SwapExecutionActionSignSmartChainTx<T>>

Inherited from​

IToBTCSwap.getExecutionAction


getExecutionStatus()​

getExecutionStatus(options?): Promise<{
currentAction: | SwapExecutionActionWait<"LP">
| SwapExecutionActionSignSmartChainTx<T>;
stateInfo: SwapStateInfo<ToBTCSwapState>;
steps: [SwapExecutionStepPayment<T["ChainId"]>, SwapExecutionStepSettlement<"BITCOIN" | "LIGHTNING", "soft_settled">, SwapExecutionStepRefund<T["ChainId"]>];
}>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:761

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?{ refundSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; skipBuildingAction?: boolean; skipChecks?: boolean; }Optional options argument for the additional execution status context, see the actual type in the respective swap classes
options.refundSmartChainSigner?string | T["Signer"] | T["NativeSigner"]-
options.skipBuildingAction?boolean-
options.skipChecks?boolean-

Returns​

Promise<{ currentAction: | SwapExecutionActionWait<"LP"> | SwapExecutionActionSignSmartChainTx<T>; stateInfo: SwapStateInfo<ToBTCSwapState>; steps: [SwapExecutionStepPayment<T["ChainId"]>, SwapExecutionStepSettlement<"BITCOIN" | "LIGHTNING", "soft_settled">, SwapExecutionStepRefund<T["ChainId"]>]; }>

Inherited from​

IToBTCSwap.getExecutionStatus


getExecutionSteps()​

getExecutionSteps(): Promise<[SwapExecutionStepPayment<T["ChainId"]>, SwapExecutionStepSettlement<"BITCOIN" | "LIGHTNING", "soft_settled">, SwapExecutionStepRefund<T["ChainId"]>]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:788

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.

Returns​

Promise<[SwapExecutionStepPayment<T["ChainId"]>, SwapExecutionStepSettlement<"BITCOIN" | "LIGHTNING", "soft_settled">, SwapExecutionStepRefund<T["ChainId"]>]>

Inherited from​

IToBTCSwap.getExecutionSteps


getExpiry()​

getExpiry(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:321

Returns the time (in UNIX milliseconds) at which the swap expires and the user is able to unilaterally refund it with the refund or txsRefund function.

Returns​

number

Inherited from​

IToBTCSwap.getExpiry


getFee()​

getFee(): Fee<T["ChainId"], SCToken<T["ChainId"]>, BtcToken>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:388

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

Returns​

Fee<T["ChainId"], SCToken<T["ChainId"]>, BtcToken>

Inherited from​

IToBTCSwap.getFee


getFeeBreakdown()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:407

Returns the breakdown of all the fees paid

Returns​

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

Inherited from​

IToBTCSwap.getFeeBreakdown


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

Inherited from​

IToBTCSwap.getId


getInput()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:433

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

Returns​

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

Inherited from​

IToBTCSwap.getInput


getInputAddress()​

getInputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:250

Returns source address of the swap

Returns​

string

Inherited from​

IToBTCSwap.getInputAddress


getInputToken()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:426

Returns the input token of the swap

Returns​

SCToken<T["ChainId"]>

Inherited from​

IToBTCSwap.getInputToken


getInputTxId()​

getInputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:257

Returns swap input transaction ID on the source chain

Returns​

string

Inherited from​

IToBTCSwap.getInputTxId


getInputWithoutFee()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:443

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

Returns​

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

Inherited from​

IToBTCSwap.getInputWithoutFee


getLNURL()​

getLNURL(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:281

Gets the used LNURL-pay link or null if this is not an LNURL-pay swap

Returns​

string


getOutput()​

getOutput(): TokenAmount<BtcToken<true>>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:138

Returns output amount of the swap, user receives this much

Returns​

TokenAmount<BtcToken<true>>

Overrides​

IToBTCSwap.getOutput


getOutputAddress()​

getOutputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:163

Returns destination address of the swap

Returns​

string

Overrides​

IToBTCSwap.getOutputAddress


getOutputToken()​

getOutputToken(): BtcToken<true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:131

Returns the output token of the swap

Returns​

BtcToken<true>

Overrides​

IToBTCSwap.getOutputToken


getOutputTxId()​

getOutputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:154

Returns swap output transaction ID on the destination chain

Returns​

string

Overrides​

IToBTCSwap.getOutputTxId


getPaymentHash()​

getPaymentHash(): Buffer<ArrayBufferLike>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:257

Returns the payment hash of the swap, i.e. a payment hash of the lightning network invoice that is about to be paid

Returns​

Buffer<ArrayBufferLike>


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

Inherited from​

IToBTCSwap.getPriceInfo


getQuoteExpiry()​

getQuoteExpiry(): number;

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

Returns quote expiry in UNIX millis

Returns​

number

Inherited from​

IToBTCSwap.getQuoteExpiry


getRefundNetworkFee()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:1041

Get the estimated smart chain transaction fee of the refund transaction

Returns​

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

Inherited from​

IToBTCSwap.getRefundNetworkFee


getSecret()​

getSecret(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:170

Returns payment secret (pre-image) as a proof of payment

Returns​

string


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​

IToBTCSwap.getSmartChainNetworkFee


getState()​

getState(): ToBTCSwapState;

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

Returns the current state of the swap

Returns​

ToBTCSwapState

Inherited from​

IToBTCSwap.getState


getStateInfo()​

getStateInfo(): SwapStateInfo<ToBTCSwapState>;

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

Inherited from​

IToBTCSwap.getStateInfo


getSuccessAction()​

getSuccessAction(): LNURLDecodedSuccessAction;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:295

Returns the success action after a successful payment, else null

Returns​

LNURLDecodedSuccessAction


getType()​

getType(): SwapType;

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

Returns the type of the swap

Returns​

SwapType

Inherited from​

IToBTCSwap.getType


hasEnoughBalance()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:453

Checks if the initiator/sender on the source chain has enough balance to go through with the swap

Returns​

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

Inherited from​

IToBTCSwap.hasEnoughBalance


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/tobtc/IToBTCSwap.ts:475

Checks if the initiator/sender on the source chain has enough native token balance to cover the transaction fee of initiating the swap

Returns​

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

Inherited from​

IToBTCSwap.hasEnoughForTxFees


hasLongExpiration()​

hasLongExpiration(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:223

Returns whether the swap requires longer than usual HTLC expiration, this means in the case that the LP is not cooperative the user will have to wait longer for the unilateral refund to become available. The longer expiration times might be required when sending lightning payments to systems with long potential settlement times (like Arkade or Bark).

Returns​

boolean


hasSuccessAction()​

hasSuccessAction(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:288

Checks whether this LNURL-pay payment contains a success action

Returns​

boolean


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

Inherited from​

IToBTCSwap.hasValidPrice


isFailed()​

isFailed(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:306

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

Returns​

boolean

Inherited from​

IToBTCSwap.isFailed


isFinished()​

isFinished(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:271

Returns whether the swap is finished and in its terminal state (this can mean successful, refunded or failed)

Returns​

boolean

Inherited from​

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

Inherited from​

IToBTCSwap.isInitiated


isInProgress()​

isInProgress(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:313

Returns whether the swap is currently being processed

Returns​

boolean

Inherited from​

IToBTCSwap.isInProgress


isLNURL()​

isLNURL(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:274

Whether this is an LNURL-pay swap

Returns​

boolean


isPayingToNonCustodialWallet()​

isPayingToNonCustodialWallet(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:206

Tries to detect if the target lightning invoice is a non-custodial mobile wallet, extract care must be taken for such a wallet to be online when attempting to make a swap sending to such a wallet

Returns​

boolean


isQuoteExpired()​

isQuoteExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:285

Checks whether the swap's quote has definitely expired and cannot be committed anymore, we can remove such swap

Returns​

boolean

Inherited from​

IToBTCSwap.isQuoteExpired


isQuoteSoftExpired()​

isQuoteSoftExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:292

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

Inherited from​

IToBTCSwap.isQuoteSoftExpired


isRefundable()​

isRefundable(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:278

Checks whether a swap is currently refundable

Returns​

boolean

Inherited from​

IToBTCSwap.isRefundable


isSuccessful()​

isSuccessful(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:299

Returns whether the swap finished successful

Returns​

boolean

Inherited from​

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

Inherited from​

IToBTCSwap.refreshPriceData


refund()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:1096

Refunds the swap if the swap is in refundable state, you can check so with isRefundable

Parameters​

ParameterTypeDescription
_signerT["Signer"] | T["NativeSigner"]Signer to sign the transactions with, must be the same as used in the initialization
abortSignal?AbortSignalAbort signal

Returns​

Promise<string>

Inherited from​

IToBTCSwap.refund


requiresAction()​

requiresAction(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:264

Checks whether there is some action required from the user for this swap - can mean either refundable or claimable

Returns​

boolean

Inherited from​

IToBTCSwap.requiresAction


serialize()​

serialize(): any;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:306

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

Returns​

any

Overrides​

IToBTCSwap.serialize


txsCommit()​

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:804

Returns transactions for initiating (committing) the escrow on the smart chain side. After sending the transactions manually be sure to call the waitTillCommited function to wait till the initiation transaction is observed, processed by the SDK and state of the swap properly updated.

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"][]>

Inherited from​

IToBTCSwap.txsCommit


txsRefund()​

txsRefund(_signer?): Promise<T["TX"][]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:1057

Returns transactions for refunding the swap if the swap is in refundable state, you can check so with isRefundable. After sending the transaction manually be sure to call the waitTillRefunded function to wait till the refund 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 refund transactions for

Returns​

Promise<T["TX"][]>

Inherited from​

IToBTCSwap.txsRefund


waitForPayment()​

waitForPayment(
maxWaitTimeSeconds?,
checkIntervalSeconds?,
abortSignal?): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:974

A blocking promise resolving when swap was concluded by the intermediary (LP), rejecting in case of failure

Parameters​

ParameterTypeDescription
maxWaitTimeSeconds?numberMaximum time in seconds to wait for the swap to be settled, an error is thrown if the swap is taking too long to claim
checkIntervalSeconds?numberHow often to poll the intermediary for answer
abortSignal?AbortSignalAbort signal

Returns​

Promise<boolean>

true if swap was successful, false if swap failed and we can refund

Throws​

If a swap is determined expired by the intermediary, but it is actually still valid

Throws​

If the swap should be cooperatively refundable but the intermediary returned invalid refund signature

Throws​

When swap expires or if the swap has invalid state (must be ToBTCSwapState.COMMITED)

Inherited from​

IToBTCSwap.waitForPayment


waitTillCommited()​

waitTillCommited(abortSignal?): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:848

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>

Inherited from​

IToBTCSwap.waitTillCommited


waitTillRefunded()​

waitTillRefunded(abortSignal?): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts:1114

Waits till a swap is refunded, should be called after sending the refund transactions manually to wait till the SDK processes the refund and updates the swap state accordingly

Parameters​

ParameterTypeDescription
abortSignal?AbortSignalAbortSignal

Returns​

Promise<void>

Inherited from​

IToBTCSwap.waitTillRefunded


willLikelyFail()​

willLikelyFail(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts:186

Checks whether a swap is likely to fail, based on the confidence as reported by the intermediary (LP)

Returns​

boolean