FromBTCLNSwap<T>
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:119
Legacy escrow (HTLC) based swap for Bitcoin Lightning -> Smart chains, requires manual settlement of the swap on the destination network once the lightning network payment is received by the LP.
Extends
IFromBTCSelfInitSwap<T,FromBTCLNDefinition<T>,FromBTCLNSwapState>
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends ChainType | ChainType |
Implements
IAddressSwapIClaimableSwap<T,FromBTCLNDefinition<T>,FromBTCLNSwapState>
Constructors
Constructor
new FromBTCLNSwap<T>(wrapper, init): FromBTCLNSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:170
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCLNWrapper<T> |
init | FromBTCLNSwapInit<T["Data"]> |
Returns
FromBTCLNSwap<T>
Overrides
IFromBTCSelfInitSwap.constructor
Constructor
new FromBTCLNSwap<T>(wrapper, obj): FromBTCLNSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:171
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCLNWrapper<T> |
obj | any |
Returns
FromBTCLNSwap<T>
Overrides
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.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
Inherited from
IFromBTCSelfInitSwap.createdAt
events
readonly events: EventEmitter<{
swapState: [FromBTCLNSwap<T>];
}>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:140
Event emitter emitting "swapState" event when swap's state changes
Implementation of
Inherited from
exactIn
readonly exactIn: boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:152
Whether a swap is an exact input swap
Implementation of
Inherited from
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
Inherited from
TYPE
protected readonly TYPE: FROM_BTCLN = SwapType.FROM_BTCLN;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:123
Swap type
Implementation of
Overrides
Methods
canCommitAndClaimInOneShot()
canCommitAndClaimInOneShot(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1116
Returns whether the underlying chain supports calling commit and claim in a single call, such that you can use the commitAndClaim function. If not you have to manually call commit first and then claim.
Returns
boolean
claim()
claim(
_signer,
abortSignal?,
onBeforeTxSent?,
secret?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:995
Settles the swap by claiming the funds on the destination chain if the swap requires manual settlement, you can check so with isClaimable
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | |
abortSignal? | AbortSignal | |
onBeforeTxSent? | (txId) => void | |
secret? | string | A 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
Overrides
commit()
commit(
_signer,
abortSignal?,
skipChecks?,
onBeforeTxSent?): Promise<string>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:888
Creates the escrow on the destination smart chain side, pre-locking the tokens from the intermediary (LP) into an escrow.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to sign the transactions with, must be the same as used in the initialization |
abortSignal? | AbortSignal | Abort signal |
skipChecks? | boolean | Skip 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
commitAndClaim()
commitAndClaim(
_signer,
abortSignal?,
skipChecks?,
onBeforeCommitTxSent?,
onBeforeClaimTxSent?,
secret?): Promise<string[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1176
Commits and claims the swap, in a way that the transactions can be signed together by the provided signer and then automatically sent sequentially by the SDK. To check if the underlying chain supports this flow check the canCommitAndClaimInOneShot function.
Parameters
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to sign the transactions with, must be the same as used in the initialization |
abortSignal? | AbortSignal | Abort signal to stop waiting for the transaction confirmation and abort |
skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled when swap is created (quoted), if you commit right after quoting, you can use skipChecks=true) |
onBeforeCommitTxSent? | (txId) => void | Optional callback called before the initialization (commit) transaction is broadcasted |
onBeforeClaimTxSent? | (txId) => void | Optional callback called before the settlement (claim) transaction is broadcasted |
secret? | string | A 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[]>
Throws
If in invalid state (must be PR_PAID or CLAIM_COMMITED)
Throws
If invalid signer is provided that doesn't match the swap data
execute()
execute(
dstSigner,
walletOrLnurlWithdraw?,
callbacks?,
options?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:537
Executes the swap with the provided bitcoin lightning network wallet or LNURL
Parameters
| Parameter | Type | Description |
|---|---|---|
dstSigner | T["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 claim the swap funds on the destination (this also means you need native token to cover gas costs) |
walletOrLnurlWithdraw? | | string | LNURLWithdraw | MinimalLightningNetworkWalletInterface | Bitcoin 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? | { onDestinationClaimSent?: (destinationClaimTxId) => void; onDestinationCommitSent?: (destinationCommitTxId) => void; onSourceTransactionReceived?: (sourceTxId) => void; onSwapSettled?: (destinationTxId) => void; } | Callbacks to track the progress of the swap |
callbacks.onDestinationClaimSent? | (destinationClaimTxId) => void | - |
callbacks.onDestinationCommitSent? | (destinationCommitTxId) => void | - |
callbacks.onSourceTransactionReceived? | (sourceTxId) => void | - |
callbacks.onSwapSettled? | (destinationTxId) => void | - |
options? | { abortSignal?: AbortSignal; delayBetweenCommitAndClaimSeconds?: number; lightningTxCheckIntervalSeconds?: number; secret?: string; } | Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals |
options.abortSignal? | AbortSignal | - |
options.delayBetweenCommitAndClaimSeconds? | number | - |
options.lightningTxCheckIntervalSeconds? | number | - |
options.secret? | string | A 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<boolean>
Implementation of
Overrides
getAddress()
getAddress(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:312
Returns the lightning network BOLT11 invoice that needs to be paid as an input to the swap.
In case the swap is recovered from on-chain data, the address returned might be just a payment hash, as it is impossible to retrieve the actual lightning network invoice paid purely from on-chain data.
Returns
string
Implementation of
Overrides
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.getClaimHash
getClaimNetworkFee()
getClaimNetworkFee(): Promise<TokenAmount<T["ChainId"], 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<T["ChainId"], SCToken<T["ChainId"]>, true>>
Inherited from
IFromBTCSelfInitSwap.getClaimNetworkFee
getCommitAndClaimNetworkFee()
getCommitAndClaimNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1085
Estimated transaction fee for commit & claim transactions combined, required to settle the swap on the smart chain destination side.
Returns
Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>
getCurrentActions()
getCurrentActions(options?): Promise<SwapExecutionAction<T>[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:679
Returns a state-dependent set of actions for the user to execute, or empty array if there is currently no action required from the user to execute.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { secret?: string; skipChecks?: boolean; } | |
options.secret? | string | A 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 |
options.skipChecks? | boolean | Skip 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<SwapExecutionAction<T>[]>
Implementation of
IClaimableSwap.getCurrentActions
Overrides
IFromBTCSelfInitSwap.getCurrentActions
getDefinitiveExpiryTime()
getDefinitiveExpiryTime(): number;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:333
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
Implementation of
Inherited from
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.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
IFromBTCSelfInitSwap.getEscrowRefundTxId
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
Implementation of
Inherited from
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
getHtlcTimeoutTime()
getHtlcTimeoutTime(): number;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:345
Returns timeout time (in UNIX milliseconds) when the swap htlc will expire
Returns
number
getHyperlink()
getHyperlink(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:325
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
Remarks
In case the swap is recovered from on-chain data, the address returned might be just a payment hash, as it is impossible to retrieve the actual lightning network invoice paid purely from on-chain data.
Implementation of
Overrides
IFromBTCSelfInitSwap.getHyperlink
getId()
getId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/IEscrowSwap.ts:130
Returns the ID of the swap, as used in the storage
Returns
string
Implementation of
Inherited from
getInput()
getInput(): TokenAmount<T["ChainId"], BtcToken<true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:451
Returns input amount of the swap, user needs to pay this much
Returns
TokenAmount<T["ChainId"], BtcToken<true>>
Implementation of
Overrides
getInputAddress()
getInputAddress(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:292
Returns source address of the swap
Returns
string
Implementation of
IClaimableSwap.getInputAddress
Overrides
IFromBTCSelfInitSwap.getInputAddress
getInputToken()
getInputToken(): BtcToken<true>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:444
Returns the input token of the swap
Returns
BtcToken<true>
Implementation of
Overrides
IFromBTCSelfInitSwap.getInputToken
getInputTxId()
getInputTxId(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:299
Returns swap input transaction ID on the source chain
Returns
string
Implementation of
Overrides
IFromBTCSelfInitSwap.getInputTxId
getInputWithoutFee()
getInputWithoutFee(): TokenAmount<T["ChainId"], 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<T["ChainId"], BtcToken>
Implementation of
IClaimableSwap.getInputWithoutFee
Inherited from
IFromBTCSelfInitSwap.getInputWithoutFee
getLNURL()
getLNURL(): string;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1220
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/IFromBTCSelfInitSwap.ts:172
Returns output amount of the swap, user receives this much
Returns
TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>
Implementation of
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
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
Inherited from
IFromBTCSelfInitSwap.getOutputTxId
getPriceInfo()
getPriceInfo(): object;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:346
Returns pricing info about the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
difference | PercentagePPM | atomiq-sdk/src/swaps/ISwap.ts:349 |
marketPrice? | number | atomiq-sdk/src/swaps/ISwap.ts:347 |
swapPrice | number | atomiq-sdk/src/swaps/ISwap.ts:348 |
Implementation of
Inherited from
IFromBTCSelfInitSwap.getPriceInfo
getQuoteExpiry()
getQuoteExpiry(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:492
Returns quote expiry in UNIX millis
Returns
number
Implementation of
Inherited from
IFromBTCSelfInitSwap.getQuoteExpiry
getSecurityDeposit()
getSecurityDeposit(): TokenAmount<T["ChainId"], 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<T["ChainId"], SCToken<T["ChainId"]>, true>
Inherited from
IFromBTCSelfInitSwap.getSecurityDeposit
getSmartChainNetworkFee()
getSmartChainNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:464
Returns the transaction fee paid on the smart chain side to initiate the escrow
Returns
Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>
Overrides
IFromBTCSelfInitSwap.getSmartChainNetworkFee
getState()
getState(): FromBTCLNSwapState;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:513
Returns the current state of the swap
Returns
Implementation of
Inherited from
getStateInfo()
getStateInfo(): SwapStateInfo<FromBTCLNSwapState>;
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<FromBTCLNSwapState>
Implementation of
Inherited from
IFromBTCSelfInitSwap.getStateInfo
getTimeoutTime()
getTimeoutTime(): number;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:353
Returns timeout time (in UNIX milliseconds) when the LN invoice will expire
Returns
number
getTotalDeposit()
getTotalDeposit(): TokenAmount<T["ChainId"], 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<T["ChainId"], SCToken<T["ChainId"]>, true>
Inherited from
IFromBTCSelfInitSwap.getTotalDeposit
getType()
getType(): SwapType;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:499
Returns the type of the swap
Returns
Implementation of
Inherited from
hasEnoughForTxFees()
hasEnoughForTxFees(): Promise<{
balance: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
enoughBalance: boolean;
required: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
}>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:471
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<T["ChainId"], SCToken<T["ChainId"]>, true>;
enoughBalance: boolean;
required: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
}>
Overrides
IFromBTCSelfInitSwap.hasEnoughForTxFees
hasSecretPreimage()
hasSecretPreimage(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:516
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
Inherited from
IFromBTCSelfInitSwap.hasValidPrice
isClaimable()
isClaimable(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:370
Checks whether a swap currently requires a manual claiming (settlement)
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isClaimable
isFailed()
isFailed(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:384
Returns whether the swap failed (e.g. was refunded)
Returns
boolean
Implementation of
Overrides
isFinished()
isFinished(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:363
Returns whether the swap is finished and in its terminal state (this can mean successful, refunded or failed)
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.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
Inherited from
IFromBTCSelfInitSwap.isInitiated
isInProgress()
isInProgress(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:391
Returns whether the swap is currently being processed
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isInProgress
isLNURL()
isLNURL(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1213
Whether this swap uses an LNURL-withdraw link
Returns
boolean
isQuoteExpired()
isQuoteExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:401
Checks whether the swap's quote has definitely expired and cannot be committed anymore, we can remove such swap
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isQuoteExpired
isQuoteSoftExpired()
isQuoteSoftExpired(): boolean;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:408
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/ln/FromBTCLNSwap.ts:377
Returns whether the swap finished successful
Returns
boolean
Implementation of
Overrides
IFromBTCSelfInitSwap.isSuccessful
refreshPriceData()
refreshPriceData(): Promise<void>;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:305
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/IFromBTCSelfInitSwap.ts:101
Checks whether there is some action required from the user for this swap - can mean either refundable or claimable
Returns
boolean
Implementation of
Inherited from
IFromBTCSelfInitSwap.requiresAction
serialize()
serialize(): any;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1267
Serializes the swap to a JSON stringifiable representation (i.e. no bigints, buffers etc.)
Returns
any
Implementation of
Overrides
IFromBTCSelfInitSwap.serialize
setSecretPreimage()
setSecretPreimage(secret): void;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:508
Sets the secret preimage for the swap, in case it is not known already
Parameters
| Parameter | Type | Description |
|---|---|---|
secret | string | Secret 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/FromBTCLNSwap.ts:1232
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
| Parameter | Type |
|---|---|
lnurl | string | LNURLWithdraw |
Returns
Promise<void>
txsClaim()
txsClaim(_signer?, secret?): Promise<T["TX"][]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:981
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
| Parameter | Type | Description |
|---|---|---|
_signer? | T["Signer"] | T["NativeSigner"] | Optional signer address to use for claiming the swap, can also be different from the initializer |
secret? | string | A 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
Overrides
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
| Parameter | Type | Description |
|---|---|---|
skipChecks? | boolean | Skip 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
txsCommitAndClaim()
txsCommitAndClaim(skipChecks?, secret?): Promise<T["TX"][]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1133
Returns transactions for both commit & claim operation together, such that they can be signed all at once by the wallet. WARNING: transactions must be sent sequentially, such that the claim (2nd) transaction is only sent after the commit (1st) transaction confirms. Failure to do so can reveal the HTLC pre-image too soon, opening a possibility for the LP to steal funds!
Parameters
| Parameter | Type | Description |
|---|---|---|
skipChecks? | boolean | Skip checks like making sure init signature is still valid and swap wasn't commited yet (this is handled when swap is created (quoted), if you commit right after quoting, you can use skipChecks=true) |
secret? | string | A 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"][]>
Throws
If in invalid state (must be PR_PAID or CLAIM_COMMITED)
txsExecute()
txsExecute(options?): Promise<
| object[]
| (
| {
chain: T["ChainId"];
description: string;
name: "Commit";
txs: T["TX"][];
}
| {
chain: T["ChainId"];
description: string;
name: "Claim";
txs: T["TX"][];
})[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:612
Returns a list of steps or transactions required to finish and settle the swap
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { secret?: string; skipChecks?: boolean; } | |
options.secret? | string | A 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 |
options.skipChecks? | boolean | Skip 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<
| object[]
| (
| {
chain: T["ChainId"];
description: string;
name: "Commit";
txs: T["TX"][];
}
| {
chain: T["ChainId"];
description: string;
name: "Claim";
txs: T["TX"][];
})[]>
Implementation of
Overrides
IFromBTCSelfInitSwap.txsExecute
waitForPayment()
waitForPayment(
onPaymentReceived?,
checkIntervalSeconds?,
abortSignal?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:799
Waits till a lightning network payment is received by the intermediary and client can continue by initiating (committing) & settling (claiming) the HTLC by calling either the commitAndClaim function (if the underlying chain allows commit and claim in a single transaction - check with canCommitAndClaimInOneShot). Or call commit and then claim separately.
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
| Parameter | Type | Description |
|---|---|---|
onPaymentReceived? | (txId) => void | Callback as for when the LP reports having received the ln payment |
checkIntervalSeconds? | number | How often to poll the intermediary for answer (default 5 seconds) |
abortSignal? | AbortSignal | Abort signal to stop waiting for payment |
Returns
Promise<boolean>
waitTillClaimed()
waitTillClaimed(maxWaitTimeSeconds?, abortSignal?): Promise<boolean>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:1019
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
| Parameter | Type | Description |
|---|---|---|
maxWaitTimeSeconds? | number | Maximum time in seconds to wait for the swap to be settled |
abortSignal? | AbortSignal | AbortSignal |
Returns
Promise<boolean>
whether the swap was claimed in time or not
Implementation of
IClaimableSwap.waitTillClaimed
Overrides
IFromBTCSelfInitSwap.waitTillClaimed
waitTillCommited()
waitTillCommited(abortSignal?): Promise<void>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts:911
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
| Parameter | Type | Description |
|---|---|---|
abortSignal? | AbortSignal | AbortSignal |
Returns
Promise<void>