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
IEscrowSwap<T,FromBTCLNAutoDefinition<T>>
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends ChainType | ChainType |
Implements
IAddressSwapISwapWithGasDrop<T>IClaimableSwap<T,FromBTCLNAutoDefinition<T>,FromBTCLNAutoSwapState>
Constructors
Constructor
new FromBTCLNAutoSwap<T>(wrapper, init): FromBTCLNAutoSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:219
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCLNAutoWrapper<T> |
init | FromBTCLNAutoSwapInit<T["Data"]> |
Returns
FromBTCLNAutoSwap<T>
Overrides
Constructor
new FromBTCLNAutoSwap<T>(wrapper, obj): FromBTCLNAutoSwap<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:220
Parameters
| Parameter | Type |
|---|---|
wrapper | FromBTCLNAutoWrapper<T> |
obj | any |
Returns
FromBTCLNAutoSwap<T>
Overrides
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
createdAt
createdAt: number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:176
A UNIX milliseconds timestamps of when this swap was created
Implementation of
Inherited from
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
Inherited from
exactIn
readonly exactIn: boolean;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:172
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:164
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_AUTO = SwapType.FROM_BTCLN_AUTO;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts:156
Swap type
Implementation of
Overrides
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
| Parameter | Type | Description |
|---|---|---|
_signer | T["Signer"] | T["NativeSigner"] | Signer to sign the transactions with, can also be different to the initializer |
abortSignal? | AbortSignal | Abort signal to stop waiting for transaction confirmation |
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
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
| Parameter | Type | Description |
|---|---|---|
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? | { 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? | string | A 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
Overrides
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
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
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
Implementation of
Inherited from
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
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
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
| Parameter | Type | Description |
|---|---|---|
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? | number | Maximum time to wait for an automatic settlement after the bitcoin transaction is confirmed (defaults to 60 seconds) |
options.secret? | string | A 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
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
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
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
Overrides
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
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()
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
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
Overrides
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
Overrides
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
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
Overrides
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
Overrides
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
Overrides
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
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
Overrides
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
Overrides
getPriceInfo()
getPriceInfo(): object;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:388
Returns pricing info about the swap
Returns
object
| Name | Type | Defined in |
|---|---|---|
difference | PercentagePPM | atomiq-sdk/src/swaps/ISwap.ts:391 |
marketPrice? | number | atomiq-sdk/src/swaps/ISwap.ts:389 |
swapPrice | number | atomiq-sdk/src/swaps/ISwap.ts:390 |
Implementation of
Inherited from
getQuoteExpiry()
getQuoteExpiry(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:546
Returns quote expiry in UNIX millis
Returns
number
Implementation of
Inherited from
getState()
getState(): number;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:567
Returns the current state of the swap
Returns
number
Implementation of
Inherited from
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
Inherited from
getType()
getType(): SwapType;
Defined in: atomiq-sdk/src/swaps/ISwap.ts:553
Returns the type of the swap
Returns
Implementation of
Inherited from
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
Inherited from
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
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
Overrides
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
Overrides
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
Inherited from
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
Overrides
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
Overrides
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
Overrides
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
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
Overrides
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
Overrides
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
| Parameter | Type | Description |
|---|---|---|
secret | string | Secret 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
| 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_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
| Parameter | Type | Description |
|---|---|---|
_signer? | string | 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
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
| 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?,
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
| Parameter | Type | Description |
|---|---|---|
maxWaitTimeSeconds? | number | Maximum time in seconds to wait for the swap to be settled |
abortSignal? | AbortSignal | AbortSignal |
secret? | string | A 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? | number | How 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