Skip to main content

FromBTCLNAutoSwap<T>

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:152

New escrow based (HTLC) swaps for Bitcoin Lightning -> Smart chain swaps not requiring manual settlement on the destination by the user, and instead letting the LP initiate the escrow. Permissionless watchtower network handles the claiming of HTLC, with the swap secret broadcasted over Nostr. Also adds a possibility for the user to receive a native token on the destination chain as part of the swap (a "gas drop" feature).

Extends

Type Parameters

Type ParameterDefault type
T extends ChainTypeChainType

Implements

Constructors

Constructor

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:219

Parameters

ParameterType
wrapperFromBTCLNAutoWrapper<T>
initFromBTCLNAutoSwapInit<T["Data"]>

Returns

FromBTCLNAutoSwap<T>

Overrides

IEscrowSwap.constructor

Constructor

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:220

Parameters

ParameterType
wrapperFromBTCLNAutoWrapper<T>
objany

Returns

FromBTCLNAutoSwap<T>

Overrides

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

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

IEscrowSwap.createdAt


events

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

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

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

IEscrowSwap.url


TYPE

protected readonly TYPE: FROM_BTCLN_AUTO = SwapType.FROM_BTCLN_AUTO;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:156

Swap type

Implementation of

IClaimableSwap.TYPE

Overrides

IEscrowSwap.TYPE

Methods

_verifyQuoteDefinitelyExpired()

_verifyQuoteDefinitelyExpired(): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:512

Returns

Promise<boolean>

Inherit Doc

Implementation of

IClaimableSwap._verifyQuoteDefinitelyExpired

Overrides

IEscrowSwap._verifyQuoteDefinitelyExpired

_verifyQuoteValid()

_verifyQuoteValid(): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:519

Returns

Promise<boolean>

Inherit Doc

Implementation of

IClaimableSwap._verifyQuoteValid

Overrides

IEscrowSwap._verifyQuoteValid

claim()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1470

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 sign the transactions with, can also be different to the initializer
abortSignal?AbortSignalAbort signal to stop waiting for transaction confirmation
onBeforeTxSent?(txId) => void
secret?stringA swap secret to use for the claim transaction, generally only needed if the swap was recovered from on-chain data, or the pre-image was generated outside the SDK

Returns

Promise<string>

Implementation of

IClaimableSwap.claim


execute()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:784

Executes the swap with the provided bitcoin lightning network wallet or LNURL

Parameters

ParameterTypeDescription
walletOrLnurlWithdraw?| string | LNURLWithdraw | MinimalLightningNetworkWalletInterfaceBitcoin lightning wallet to use to pay the lightning network invoice, or an LNURL-withdraw link, wallet is not required and the LN invoice can be paid externally as well (just pass null or undefined here)
callbacks?{ onSourceTransactionReceived?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; }Callbacks to track the progress of the swap
callbacks.onSourceTransactionReceived?(sourceTxId) => void-
callbacks.onSwapSettled?(destinationTxId) => void-
options?{ abortSignal?: AbortSignal; lightningTxCheckIntervalSeconds?: number; maxWaitTillAutomaticSettlementSeconds?: number; secret?: string; }Optional options for the swap like AbortSignal, and timeouts/intervals
options.abortSignal?AbortSignal-
options.lightningTxCheckIntervalSeconds?number-
options.maxWaitTillAutomaticSettlementSeconds?number-
options.secret?stringA swap secret to broadcast to watchtowers, generally only needed if the swap was recovered from on-chain data, or the pre-image was generated outside the SDK

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

IEscrowSwap.execute


getAddress()

getAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:425

Returns the lightning network BOLT11 invoice that needs to be paid as an input to the swap

Returns

string

Implementation of

IAddressSwap.getAddress


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

IEscrowSwap.getClaimHash


getDefinitiveExpiryTime()

getDefinitiveExpiryTime(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:440

Returns the timeout time (in UNIX milliseconds) when the swap will definitelly be considered as expired if the LP doesn't make it expired sooner

Returns

number


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

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

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

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

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

IEscrowSwap.getEscrowRefundTxId


getExecutionAction()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1089

Parameters

ParameterTypeDescription
options?{ manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"]; maxWaitTillAutomaticSettlementSeconds?: number; secret?: string; }-
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.secret?stringA swap secret to broadcast to watchtowers, generally only needed if the swap was recovered from on-chain data, or the pre-image was generated outside the SDK

Returns

Promise< | SwapExecutionActionSendToAddress<true> | SwapExecutionActionWait<"LP" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T>>

Implementation of

IClaimableSwap.getExecutionAction

Overrides

IEscrowSwap.getExecutionAction


getExecutionStatus()

getExecutionStatus(options?): Promise<{
currentAction: | SwapExecutionActionSendToAddress<true>
| SwapExecutionActionWait<"LP" | "SETTLEMENT">
| SwapExecutionActionSignSmartChainTx<T>;
stateInfo: SwapStateInfo<FromBTCLNAutoSwapState>;
steps: [SwapExecutionStepPayment<"LIGHTNING">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
}>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1107

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

Returns

Promise<{ currentAction: | SwapExecutionActionSendToAddress<true> | SwapExecutionActionWait<"LP" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T>; stateInfo: SwapStateInfo<FromBTCLNAutoSwapState>; steps: [SwapExecutionStepPayment<"LIGHTNING">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">]; }>

Implementation of

IClaimableSwap.getExecutionStatus

Overrides

IEscrowSwap.getExecutionStatus


getExecutionSteps()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1135

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

Implementation of

IClaimableSwap.getExecutionSteps

Overrides

IEscrowSwap.getExecutionSteps


getFee()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:702

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<true>, SCToken<T["ChainId"]>>

Implementation of

IClaimableSwap.getFee

Overrides

IEscrowSwap.getFee


getFeeBreakdown()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:725

Returns the breakdown of all the fees paid

Returns

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

Implementation of

IClaimableSwap.getFeeBreakdown

Overrides

IEscrowSwap.getFeeBreakdown


getGasDropOutput()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:632

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


getHtlcTimeoutTime()

getHtlcTimeoutTime(): number;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:453

Returns timeout time (in UNIX milliseconds) when the swap htlc will expire

Returns

number


getHyperlink(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:432

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


getId()

getId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:353

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

Returns

string

Implementation of

IClaimableSwap.getId

Overrides

IEscrowSwap.getId


getInput()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:604

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

Returns

TokenAmount<BtcToken<true>>

Implementation of

IClaimableSwap.getInput

Overrides

IEscrowSwap.getInput


getInputAddress()

getInputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:409

Returns source address of the swap

Returns

string

Implementation of

IClaimableSwap.getInputAddress

Overrides

IEscrowSwap.getInputAddress


getInputToken()

getInputToken(): BtcToken<true>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:597

Returns the input token of the swap

Returns

BtcToken<true>

Implementation of

IClaimableSwap.getInputToken

Overrides

IEscrowSwap.getInputToken


getInputTxId()

getInputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:416

Returns swap input transaction ID on the source chain

Returns

string

Implementation of

IClaimableSwap.getInputTxId

Overrides

IEscrowSwap.getInputTxId


getInputWithoutFee()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:611

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

Returns

TokenAmount<BtcToken<true>>

Implementation of

IClaimableSwap.getInputWithoutFee

Overrides

IEscrowSwap.getInputWithoutFee


getLNURL()

getLNURL(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1580

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

Returns

string


getOutput()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:625

Returns output amount of the swap, user receives this much

Returns

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

Implementation of

IClaimableSwap.getOutput

Overrides

IEscrowSwap.getOutput


getOutputAddress()

getOutputAddress(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:360

Returns destination address of the swap

Returns

string

Implementation of

IClaimableSwap.getOutputAddress

Overrides

IEscrowSwap.getOutputAddress


getOutputToken()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:618

Returns the output token of the swap

Returns

SCToken<T["ChainId"]>

Implementation of

IClaimableSwap.getOutputToken

Overrides

IEscrowSwap.getOutputToken


getOutputTxId()

getOutputTxId(): string;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:367

Returns swap output transaction ID on the destination chain

Returns

string

Implementation of

IClaimableSwap.getOutputTxId

Overrides

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

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

IEscrowSwap.getQuoteExpiry


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

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

IEscrowSwap.getStateInfo


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

IEscrowSwap.getType


hasSecretPreimage()

hasSecretPreimage(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:763

Returns whether the secret preimage for this swap is known

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

Implementation of

IClaimableSwap.hasValidPrice

Inherited from

IEscrowSwap.hasValidPrice


isClaimable()

isClaimable(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:467

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/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:481

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

Returns

boolean

Implementation of

IClaimableSwap.isFailed

Overrides

IEscrowSwap.isFailed


isFinished()

isFinished(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:460

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

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

IEscrowSwap.isInitiated


isInProgress()

isInProgress(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:488

Returns whether the swap is currently being processed

Returns

boolean

Implementation of

IClaimableSwap.isInProgress

Overrides

IEscrowSwap.isInProgress


isLNURL()

isLNURL(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1573

Whether this swap uses an LNURL-withdraw link

Returns

boolean


isQuoteExpired()

isQuoteExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:498

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

IEscrowSwap.isQuoteExpired


isQuoteSoftExpired()

isQuoteSoftExpired(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:505

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

IEscrowSwap.isQuoteSoftExpired


isSuccessful()

isSuccessful(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:474

Returns whether the swap finished successful

Returns

boolean

Implementation of

IClaimableSwap.isSuccessful

Overrides

IEscrowSwap.isSuccessful


refreshPriceData()

refreshPriceData(): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:312

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

Returns

Promise<void>

Implementation of

IClaimableSwap.refreshPriceData

Overrides

IEscrowSwap.refreshPriceData


requiresAction()

requiresAction(): boolean;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:374

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

IEscrowSwap.requiresAction


serialize()

serialize(): any;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1627

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

Returns

any

Implementation of

IClaimableSwap.serialize

Overrides

IEscrowSwap.serialize


setSecretPreimage()

setSecretPreimage(secret): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:754

Sets the secret preimage for the swap, in case it is not known already

Parameters

ParameterTypeDescription
secretstringSecret preimage that matches the expected payment hash

Returns

Promise<void>

Throws

If an invalid secret preimage is provided


settleWithLNURLWithdraw()

settleWithLNURLWithdraw(lnurl): Promise<void>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1592

Pay the generated lightning network invoice with an LNURL-withdraw link, this is useful when you want to display a lightning payment QR code and also want to allow payments using LNURL-withdraw NFC cards.

Note that the swap needs to be created without an LNURL to begin with for this function to work. If this swap is already using an LNURL-withdraw link, this function throws.

Parameters

ParameterType
lnurlstring | LNURLWithdraw

Returns

Promise<void>


txsClaim()

txsClaim(_signer?, secret?): Promise<T["TX"][]>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1435

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"]Optional signer address to use for claiming the swap, can also be different from the initializer
secret?stringA swap secret to use for the claim transaction, generally only needed if the swap was recovered from on-chain data, or the pre-image was generated outside the SDK

Returns

Promise<T["TX"][]>

Implementation of

IClaimableSwap.txsClaim


waitForPayment()

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

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1345

Waits till a lightning network payment is received by the intermediary, and the intermediary initiates the swap HTLC on the smart chain side. After the HTLC is initiated you can wait for an automatic settlement by the watchtowers with the waitTillClaimed function, or settle manually using the claim or txsClaim functions.

If this swap is using an LNURL-withdraw link as input, it automatically posts the generated invoice to the LNURL service to pay it.

Parameters

ParameterTypeDescription
onPaymentReceived?(txId) => voidCallback as for when the LP reports having received the ln payment
checkIntervalSeconds?numberHow often to poll the intermediary for answer (default 5 seconds)
abortSignal?AbortSignalAbort signal to stop waiting for payment

Returns

Promise<boolean>


waitTillClaimed()

waitTillClaimed(
maxWaitTimeSeconds?,
abortSignal?,
secret?,
pollIntervalSeconds?): Promise<boolean>;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:1503

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
secret?stringA swap secret to broadcast to watchtowers, generally only needed if the swap was recovered from on-chain data, or the pre-image was generated outside the SDK
pollIntervalSeconds?numberHow often to poll via the watchdog

Returns

Promise<boolean>

whether the swap was claimed in time or not

Throws

If swap is in invalid state (must be FromBTCLNAutoSwapState.CLAIM_COMMITED)

Throws

If the LP refunded sooner than we were able to claim

Implementation of

IClaimableSwap.waitTillClaimed


getWatchtowerFeeAmountBtc()

protected getWatchtowerFeeAmountBtc(): bigint;

Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:548

Returns the watchtower fee paid in BTC satoshis, or null if known (i.e. if the swap was recovered from on-chain data)

Returns

bigint