LnForGasWrapper<T>
Defined in: atomiq-sdk/src/swaps/trusted/ln/LnForGasWrapper.ts:18
Trusted swap for Bitcoin Lightning -> Smart chains, to be used for minor amounts to get gas tokens on the destination chain, which is only needed for Solana, which still uses legacy swaps
Extends
ISwapWrapper<T,LnForGasSwapTypeDefinition<T>>
Type Parameters
| Type Parameter |
|---|
T extends ChainType |
Constructors
Constructor
new LnForGasWrapper<T>(
chainIdentifier,
unifiedStorage,
unifiedChainEvents,
chain,
prices,
tokens,
options,
events?): LnForGasWrapper<T>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:149
Parameters
| Parameter | Type |
|---|---|
chainIdentifier | T["ChainId"] |
unifiedStorage | UnifiedSwapStorage<T> |
unifiedChainEvents | UnifiedSwapEventListener<T> |
chain | T["ChainInterface"] |
prices | ISwapPrice |
tokens | WrapperCtorTokens |
options | ISwapWrapperOptions |
events? | EventEmitter<{ swapState: [ISwap<ChainType, SwapTypeDefinition<ChainType, ISwapWrapper<ChainType, any, ISwapWrapperOptions>, ISwap<ChainType, any, any>>, number>]; }> |
Returns
LnForGasWrapper<T>
Inherited from
Properties
chainIdentifier
readonly chainIdentifier: T["ChainId"];
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:142
Chain identifier string of this wrapper
Inherited from
events
readonly events: EventEmitter<{
swapState: [LnForGasSwap<T>];
}>;
Defined in: atomiq-sdk/src/swaps/ISwapWrapper.ts:146
Event emitter emitting "swapState" event when swap's state changes
Inherited from
TYPE
TYPE: TRUSTED_FROM_BTCLN = SwapType.TRUSTED_FROM_BTCLN;
Defined in: atomiq-sdk/src/swaps/trusted/ln/LnForGasWrapper.ts:19
Swap type
Overrides
Methods
checkPastSwaps()
checkPastSwaps(pastSwaps?, noSave?): Promise<{
changedSwaps: LnForGasSwap<T>[];
removeSwaps: LnForGasSwap<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? | LnForGasSwap<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: LnForGasSwap<T>[];
removeSwaps: LnForGasSwap<T>[];
}>
Inherited from
create()
create(
recipient,
amount,
lpOrUrl): Promise<LnForGasSwap<T>>;
Defined in: atomiq-sdk/src/swaps/trusted/ln/LnForGasWrapper.ts:46
Returns a newly created trusted Lightning network -> Smart chain swap, receiving the specified amount of native token on the destination chain.
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Address of the recipient on the smart chain destination chain |
amount | bigint | Amount of native token to receive in base units |
lpOrUrl | string | Intermediary | Intermediary (LP) to use for the swap |
Returns
Promise<LnForGasSwap<T>>
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? | LnForGasSwap<T>[] | Optional array of swaps to invoke _tick() on, otherwise all relevant swaps will be fetched from the persistent storage |
Returns
Promise<void>