FromBTCLNWrapper<T>
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts:56
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
IFromBTCLNWrapper<T,FromBTCLNDefinition<T>,FromBTCLNWrapperOptions>
Type Parameters
| Type Parameter |
|---|
T extends ChainType |
Implements
IClaimableSwapWrapper<FromBTCLNSwap<T>>
Constructors
Constructor
new FromBTCLNWrapper<T>(
chainIdentifier,
unifiedStorage,
unifiedChainEvents,
chain,
contract,
prices,
tokens,
swapDataDeserializer,
lnApi,
options?,
events?): FromBTCLNWrapper<T>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts:103
Parameters
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | string | |
unifiedStorage | UnifiedSwapStorage<T> | Storage interface for the current environment |
unifiedChainEvents | UnifiedSwapEventListener<T> | On-chain event listener |
chain | T["ChainInterface"] | |
contract | T["Contract"] | Underlying contract handling the swaps |
prices | ISwapPrice | Swap pricing handler |
tokens | WrapperCtorTokens | |
swapDataDeserializer | (data) => T["Data"] | Deserializer for SwapData |
lnApi | LightningNetworkApi | |
options? | AllOptional<FromBTCLNWrapperOptions> | |
events? | EventEmitter<{ swapState: [ISwap<ChainType, SwapTypeDefinition<ChainType, ISwapWrapper<ChainType, any, ISwapWrapperOptions>, ISwap<ChainType, any, any>>, number>]; }> | Instance to use for emitting events |
Returns
FromBTCLNWrapper<T>
Overrides
Properties
chainIdentifier
readonly chainIdentifier: T["ChainId"];
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:142
Chain identifier string of this wrapper
Inherited from
IFromBTCLNWrapper.chainIdentifier
events
readonly events: EventEmitter<{
swapState: [FromBTCLNSwap<T>];
}>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:146
Event emitter emitting "swapState" event when swap's state changes
Inherited from
TYPE
readonly TYPE: FROM_BTCLN = SwapType.FROM_BTCLN;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts:60
Swap type
Overrides
Methods
checkPastSwaps()
checkPastSwaps(pastSwaps?, noSave?): Promise<{
changedSwaps: FromBTCLNSwap<T>[];
removeSwaps: FromBTCLNSwap<T>[];
}>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:369
Runs checks on all the known pending swaps, syncing their state from on-chain data
Parameters
| Parameter | Type | Description |
|---|---|---|
pastSwaps? | FromBTCLNSwap<T>[] | Optional array of past swaps to check, otherwise all relevant swaps will be fetched from the persistent storage |
noSave? | boolean | Whether to skip saving the swap changes in the persistent storage |
Returns
Promise<{
changedSwaps: FromBTCLNSwap<T>[];
removeSwaps: FromBTCLNSwap<T>[];
}>
Inherited from
IFromBTCLNWrapper.checkPastSwaps
create()
create(
recipient,
amountData,
lps,
options?,
additionalParams?,
abortSignal?,
preFetches?): object[];
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts:223
Returns a newly created legacy Lightning -> Smart chain swap using the HTLC based escrow swap protocol, where the user needs to manually settle swap on the destination smart chain. The user has to pay a bolt11 invoice on the input lightning network side.
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Smart chain signer's address on the destination chain, that will have to manually settle the swap. |
amountData | AmountData | Amount, token and exact input/output data for to swap |
lps | Intermediary[] | An array of intermediaries (LPs) to get the quotes from |
options? | FromBTCLNOptions | Optional additional quote options |
additionalParams? | Record<string, any> | Optional additional parameters sent to the LP when creating the swap |
abortSignal? | AbortSignal | Abort signal |
preFetches? | { feeRatePromise?: Promise<string>; pricePrefetchPromise?: Promise<bigint>; usdPricePrefetchPromise: Promise<number>; } | Optional pre-fetches for speeding up the quoting process (mainly used internally) |
preFetches.feeRatePromise? | Promise<string> | - |
preFetches.pricePrefetchPromise? | Promise<bigint> | - |
preFetches.usdPricePrefetchPromise? | Promise<number> | - |
Returns
object[]
createViaLNURL()
createViaLNURL(
recipient,
lnurl,
amountData,
lps,
options?,
additionalParams?,
abortSignal?): Promise<object[]>;
Defined in: atomiq-sdk/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts:363
Returns a newly created legacy Lightning -> Smart chain swap using the HTLC based escrow swap protocol, where the user needs to manually settle swap on the destination smart chain. The swap is created with an LNURL-withdraw link which will be used to pay the generated bolt11 invoice automatically when FromBTCLNSwap.waitForPayment is called on the swap.
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Smart chain signer's address on the destination chain, that will have to manually settle the swap. |
lnurl | | string | LNURLWithdrawParamsWithUrl | LNURL-withdraw link to pull the funds from |
amountData | AmountData | Amount, token and exact input/output data for to swap |
lps | Intermediary[] | An array of intermediaries (LPs) to get the quotes from |
options? | FromBTCLNOptions | Optional additional quote options |
additionalParams? | Record<string, any> | Optional additional parameters sent to the LP when creating the swap |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<object[]>
init()
init(noTimers, noCheckPastSwaps): Promise<void>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:314
Initializes the swap wrapper, needs to be called before any other action can be taken
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
noTimers | boolean | false | Whether to skip scheduling a tick timer for the swaps, if the tick timer is not initiated the swap states depending on e.g. expiry can be out of sync with the actual expiration of the swap |
noCheckPastSwaps | boolean | false | Whether to skip checking past swaps on initialization (by default all pending swaps are re-checked on init, and their state is synchronized from the on-chain data) |
Returns
Promise<void>
Inherited from
stop()
stop(): Promise<void>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:355
Un-subscribes from event listeners on the smart chain, terminates the tick interval and stops this wrapper
Returns
Promise<void>
Inherited from
tick()
tick(swaps?): Promise<void>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:396
Invokes ISwap._tick on all the known swaps
Parameters
| Parameter | Type | Description |
|---|---|---|
swaps? | FromBTCLNSwap<T>[] | Optional array of swaps to invoke _tick() on, otherwise all relevant swaps will be fetched from the persistent storage |
Returns
Promise<void>