Skip to main content

FromBTCLNAutoSwap<T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


getCurrentActions()

getCurrentActions(options?): Promise<SwapExecutionAction<T>[]>;

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

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<SwapExecutionAction<T>[]>

Implementation of

IClaimableSwap.getCurrentActions

Overrides

IEscrowSwap.getCurrentActions


getDefinitiveExpiryTime()

getDefinitiveExpiryTime(): number;

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

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

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

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

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

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

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

Returns

string

Inherited from

IEscrowSwap.getEscrowRefundTxId


getFee()

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

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

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

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

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

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


getHtlcTimeoutTime()

getHtlcTimeoutTime(): number;

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

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

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

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

Returns

string

Implementation of

IClaimableSwap.getId

Overrides

IEscrowSwap.getId


getInput()

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

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

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

Returns

TokenAmount<T["ChainId"], 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:397

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

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

Returns swap input transaction ID on the source chain

Returns

string

Implementation of

IClaimableSwap.getInputTxId

Overrides

IEscrowSwap.getInputTxId


getInputWithoutFee()

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

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

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

Returns

TokenAmount<T["ChainId"], 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:1283

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

Returns

string


getOutput()

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

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

Returns output amount of the swap, user receives this much

Returns

TokenAmount<T["ChainId"], 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:348

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

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

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

IEscrowSwap.getPriceInfo


getQuoteExpiry()

getQuoteExpiry(): number;

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

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

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

IEscrowSwap.getStateInfo


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

IEscrowSwap.getType


hasSecretPreimage()

hasSecretPreimage(): boolean;

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

Returns whether the secret preimage for this swap is known

Returns

boolean


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

IEscrowSwap.hasValidPrice


isClaimable()

isClaimable(): boolean;

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

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

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

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

IEscrowSwap.isInitiated


isInProgress()

isInProgress(): boolean;

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

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

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

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

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

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

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

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

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): void;

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

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

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

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

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


txsExecute()

txsExecute(): Promise<object[]>;

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

Returns a list of steps or transactions required to finish and settle the swap

Returns

Promise<object[]>

Implementation of

IClaimableSwap.txsExecute

Overrides

IEscrowSwap.txsExecute


waitForPayment()

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

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

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

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

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

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

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