SwapperWithChain<T, ChainIdentifier>
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:42
Chain-specific wrapper around Swapper for a particular blockchain
Type Parameters
| Type Parameter |
|---|
T extends MultiChain |
ChainIdentifier extends ChainIds<T> |
Constructors
Constructor
new SwapperWithChain<T, ChainIdentifier>(swapper, chainIdentifier): SwapperWithChain<T, ChainIdentifier>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:87
Parameters
| Parameter | Type |
|---|---|
swapper | Swapper<T> |
chainIdentifier | ChainIdentifier |
Returns
SwapperWithChain<T, ChainIdentifier>
Properties
chainIdentifier
readonly chainIdentifier: ChainIdentifier;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:52
Smart chain identifier of this swapper with chain
prices
readonly prices: SwapPriceWithChain<T, ChainIdentifier>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:57
Pricing API used by the SDK
Accessors
intermediaryDiscovery
Get Signature
get intermediaryDiscovery(): IntermediaryDiscovery;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:62
Intermediary discovery instance
Returns
SwapTypeInfo
Get Signature
get SwapTypeInfo(): Record<SwapType, {
requiresInputWallet: boolean;
requiresOutputWallet: boolean;
supportsGasDrop: boolean;
}>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:83
Helper information about various swap protocol and their features:
requiresInputWallet: Whether a swap requires a connected wallet on the input chain able to sign arbitrary transactionrequiresOutputWallet: Whether a swap requires a connected wallet on the output chain able to sign arbitrary transactionssupportsGasDrop: Whether a swap supports the "gas drop" feature, allowing to user to receive a small amount of native token as part of the swap when swapping to smart chains
Uses a Record type here, use the SwapProtocolInfo import for a literal readonly type, with
pre-filled exact values in the type.
Returns
Record<SwapType, {
requiresInputWallet: boolean;
requiresOutputWallet: boolean;
supportsGasDrop: boolean;
}>
Utils
Get Signature
get Utils(): SwapperUtils<T>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:68
Miscellaneous utility functions
Returns
SwapperUtils<T>
Methods
_syncSwaps()
_syncSwaps(signer?): Promise<void>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:501
Synchronizes swaps from on-chain, this is ran automatically when SDK is initialized, hence
should only be ran manually when dontCheckPastSwaps=true is passed in the swapper options,
also deletes expired quotes
Parameters
| Parameter | Type | Description |
|---|---|---|
signer? | string | Optional signer to only run swap sync for swaps initiated by this signer |
Returns
Promise<void>
create()
create(
signer,
srcToken,
dstToken,
amount,
exactIn,
addressLnurlLightningInvoice): Promise<ToBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:367
Creates a swap from srcToken to dstToken, of a specific token amount, either specifying input amount (exactIn=true) or output amount (exactIn=false), NOTE: For regular -> BTC-LN (lightning) swaps the passed amount is ignored and invoice's pre-set amount is used instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Smartchain (Solana, Starknet, etc.) address of the user |
srcToken | SCToken<ChainIdentifier> | Source token of the swap, user pays this token |
dstToken | BtcToken<true> | Destination token of the swap, user receives this token |
amount | undefined | Amount of the swap |
exactIn | false | Whether the amount specified is an input amount (exactIn=true) or an output amount (exactIn=false) |
addressLnurlLightningInvoice | string | Bitcoin on-chain address, lightning invoice, LNURL-pay to pay or LNURL-withdrawal to withdraw money from |
Returns
Promise<ToBTCLNSwap<T[ChainIdentifier]>>
Deprecated
Use swap() instead
createFromBTCLNSwap()
createFromBTCLNSwap(
recipient,
tokenAddress,
amount,
exactOut?,
additionalParams?,
options?): Promise<FromBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:234
Creates LEGACY Bitcoin Lightning -> Smart chain (SwapType.FROM_BTCLN) swap
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
tokenAddress | string | Token address to receive |
amount | bigint | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut? | boolean | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | FromBTCLNOptions | Additional options for the swap |
Returns
Promise<FromBTCLNSwap<T[ChainIdentifier]>>
createFromBTCLNSwapNew()
createFromBTCLNSwapNew(
recipient,
tokenAddress,
amount,
exactOut?,
additionalParams?,
options?): Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:277
Creates Bitcoin Lightning -> Smart chain (SwapType.FROM_BTCLN_AUTO) swap
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
tokenAddress | string | Token address to receive |
amount | bigint | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut? | boolean | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | FromBTCLNAutoOptions | Additional options for the swap |
Returns
Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>>
createFromBTCLNSwapNewViaLNURL()
createFromBTCLNSwapNewViaLNURL(
recipient,
tokenAddress,
lnurl,
amount,
exactOut?,
additionalParams?,
options?): Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:300
Creates Bitcoin Lightning -> Smart chain (SwapType.FROM_BTCLN_AUTO) swap, withdrawing from an LNURL-withdraw link
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
tokenAddress | string | Token address to receive |
lnurl | string | LNURLWithdraw | LNURL-withdraw link to pull the funds from |
amount | bigint | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut? | boolean | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | FromBTCLNAutoOptions | Additional options for the swap |
Returns
Promise<FromBTCLNAutoSwap<T[ChainIdentifier]>>
createFromBTCLNSwapViaLNURL()
createFromBTCLNSwapViaLNURL(
recipient,
tokenAddress,
lnurl,
amount,
exactOut?,
additionalParams?): Promise<FromBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:256
Creates LEGACY Bitcoin Lightning -> Smart chain (SwapType.FROM_BTCLN) swap, withdrawing from an LNURL-withdraw link
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
tokenAddress | string | Token address to receive |
lnurl | string | LNURLWithdraw | LNURL-withdraw link to pull the funds from |
amount | bigint | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut? | boolean | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
Returns
Promise<FromBTCLNSwap<T[ChainIdentifier]>>
createFromBTCSwap()
createFromBTCSwap(
recipient,
tokenAddress,
amount,
exactOut?,
additionalParams?,
options?): Promise<FromBTCSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:213
Creates LEGACY Bitcoin -> Smart chain (SwapType.FROM_BTC) swap
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
tokenAddress | string | Token address to receive |
amount | bigint | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut? | boolean | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | FromBTCOptions | Additional options for the swap |
Returns
Promise<FromBTCSwap<T[ChainIdentifier]>>
createFromBTCSwapNew()
createFromBTCSwapNew(
recipient,
tokenAddress,
amount,
exactOut,
additionalParams?,
options?): Promise<SpvFromBTCSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:192
Creates Bitcoin -> Smart chain (SwapType.SPV_VAULT_FROM_BTC) swap
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
recipient | string | undefined | Recipient address on the destination chain |
tokenAddress | string | undefined | Token address to receive |
amount | bigint | undefined | Amount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true) |
exactOut | boolean | false | Whether to use a exact out instead of exact in |
additionalParams? | Record<string, any> | undefined | Additional parameters sent to the LP when creating the swap |
options? | SpvFromBTCOptions | undefined | Additional options for the swap |
Returns
Promise<SpvFromBTCSwap<T[ChainIdentifier]>>
createToBTCLNSwap()
createToBTCLNSwap(
signer,
tokenAddress,
paymentRequest,
additionalParams?,
options?): Promise<ToBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:126
Creates Smart chain -> Bitcoin Lightning (SwapType.TO_BTCLN) swap
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Signer's address on the source chain |
tokenAddress | string | Token address to pay with |
paymentRequest | string | BOLT11 lightning network invoice to be paid (needs to have a fixed amount), and the swap amount is taken from this fixed amount, hence only exact output swaps are supported |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | ToBTCLNOptions & object | Additional options for the swap |
Returns
Promise<ToBTCLNSwap<T[ChainIdentifier]>>
createToBTCLNSwapViaInvoiceCreateService()
createToBTCLNSwapViaInvoiceCreateService(
signer,
tokenAddress,
service,
amount,
exactIn?,
additionalParams?,
options?): Promise<ToBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:170
Creates Smart chain -> Bitcoin Lightning (SwapType.TO_BTCLN) swap via LightningInvoiceCreateService
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Signer's address on the source chain |
tokenAddress | string | Token address to pay with |
service | LightningInvoiceCreateService | Invoice create service object which facilitates the creation of fixed amount LN invoices |
amount | bigint | Amount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false) |
exactIn? | boolean | Whether to do an exact in swap instead of exact out |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | ToBTCLNOptions | Additional options for the swap |
Returns
Promise<ToBTCLNSwap<T[ChainIdentifier]>>
createToBTCLNSwapViaLNURL()
createToBTCLNSwapViaLNURL(
signer,
tokenAddress,
lnurlPay,
amount,
exactIn?,
additionalParams?,
options?): Promise<ToBTCLNSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:147
Creates Smart chain -> Bitcoin Lightning (SwapType.TO_BTCLN) swap via LNURL-pay link
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Signer's address on the source chain |
tokenAddress | string | Token address to pay with |
lnurlPay | string | LNURLPay | LNURL-pay link to use for the payment |
amount | bigint | Amount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false) |
exactIn? | boolean | Whether to do an exact in swap instead of exact out |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | ToBTCLNOptions | Additional options for the swap |
Returns
Promise<ToBTCLNSwap<T[ChainIdentifier]>>
createToBTCSwap()
createToBTCSwap(
signer,
tokenAddress,
address,
amount,
exactIn?,
additionalParams?,
options?): Promise<ToBTCSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:104
Creates Smart chain -> Bitcoin (SwapType.TO_BTC) swap
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Signer's address on the source chain |
tokenAddress | string | Token address to pay with |
address | string | Recipient's bitcoin address |
amount | bigint | Amount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false) |
exactIn? | boolean | Whether to use exact in instead of exact out |
additionalParams? | Record<string, any> | Additional parameters sent to the LP when creating the swap |
options? | ToBTCOptions | Additional options for the swap |
Returns
Promise<ToBTCSwap<T[ChainIdentifier]>>
createTrustedLNForGasSwap()
createTrustedLNForGasSwap(
recipient,
amount,
trustedIntermediaryOrUrl?): Promise<LnForGasSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:320
Creates a trusted Bitcoin Lightning -> Smart chain (SwapType.TRUSTED_FROM_BTCLN) gas swap
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
amount | bigint | Amount of native token to receive, in base units |
trustedIntermediaryOrUrl? | string | Intermediary | URL or Intermediary object of the trusted intermediary to use, otherwise uses default |
Returns
Promise<LnForGasSwap<T[ChainIdentifier]>>
Throws
If no trusted intermediary specified
createTrustedOnchainForGasSwap()
createTrustedOnchainForGasSwap(
recipient,
amount,
refundAddress?,
trustedIntermediaryOrUrl?): Promise<OnchainForGasSwap<T[ChainIdentifier]>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:333
Creates a trusted Bitcoin -> Smart chain (SwapType.TRUSTED_FROM_BTC) gas swap
Parameters
| Parameter | Type | Description |
|---|---|---|
recipient | string | Recipient address on the destination chain |
amount | bigint | Amount of native token to receive, in base units |
refundAddress? | string | Bitcoin refund address, in case the swap fails the funds are refunded here |
trustedIntermediaryOrUrl? | string | Intermediary | URL or Intermediary object of the trusted intermediary to use, otherwise uses default |
Returns
Promise<OnchainForGasSwap<T[ChainIdentifier]>>
Throws
If no trusted intermediary specified
getActionableSwaps()
getActionableSwaps(signer?): Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:457
Returns swaps that are in-progress and are claimable for the specific chain, optionally also for a specific signer's address
Parameters
| Parameter | Type |
|---|---|
signer? | string |
Returns
Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>
getAllSwaps()
getAllSwaps(signer?): Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:450
Returns swaps that are in-progress and are claimable for the specific chain, optionally also for a specific signer's address
Parameters
| Parameter | Type |
|---|---|
signer? | string |
Returns
Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>
getClaimableSwaps()
getClaimableSwaps(signer?): Promise<IClaimableSwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, IClaimableSwap<T[ChainIdentifier], any, any>>, number>[]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:472
Returns swaps that are due to be claimed/settled manually for the specific chain, optionally also for a specific signer's address
Parameters
| Parameter | Type |
|---|---|
signer? | string |
Returns
Promise<IClaimableSwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, IClaimableSwap<T[ChainIdentifier], any, any>>, number>[]>
getRefundableSwaps()
getRefundableSwaps(signer?): Promise<IToBTCSwap<T[ChainIdentifier], IToBTCDefinition<T[ChainIdentifier], IToBTCWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, IToBTCSwap<T[ChainIdentifier], any>>>[]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:464
Returns swaps that are refundable for the specific chain, optionally also for a specific signer's address
Parameters
| Parameter | Type |
|---|---|
signer? | string |
Returns
Promise<IToBTCSwap<T[ChainIdentifier], IToBTCDefinition<T[ChainIdentifier], IToBTCWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, IToBTCSwap<T[ChainIdentifier], any>>>[]>
getSwapById()
getSwapById(id, signer?): Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:479
Returns swap with a specific id (identifier) on a specific chain and optionally with a signer
Parameters
| Parameter | Type |
|---|---|
id | string |
signer? | string |
Returns
Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>>
getSwapCounterTokens()
getSwapCounterTokens(token, input): Token<ChainIdentifier>[];
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:653
Returns tokens that you can swap to (if input=true) from a given token, or tokens that you can swap from (if input=false) to a given token
Parameters
| Parameter | Type |
|---|---|
token | Token |
input | boolean |
Returns
Token<ChainIdentifier>[]
getSwapLimits()
getSwapLimits<A, B>(srcToken, dstToken): object;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:606
Returns minimum/maximum limits for inputs and outputs for a swap between given tokens
Type Parameters
| Type Parameter |
|---|
A extends Token<ChainIdentifier> |
B extends Token<ChainIdentifier> |
Parameters
| Parameter | Type | Description |
|---|---|---|
srcToken | A | Source token |
dstToken | B | Destination token |
Returns
object
| Name | Type | Defined in |
|---|---|---|
input | object | atomiq-sdk/src/swapper/SwapperWithChain.ts:607 |
input.max? | TokenAmount<string, A> | atomiq-sdk/src/swapper/SwapperWithChain.ts:607 |
input.min | TokenAmount<string, A> | atomiq-sdk/src/swapper/SwapperWithChain.ts:607 |
output | object | atomiq-sdk/src/swapper/SwapperWithChain.ts:608 |
output.max? | TokenAmount<string, B> | atomiq-sdk/src/swapper/SwapperWithChain.ts:608 |
output.min | TokenAmount<string, B> | atomiq-sdk/src/swapper/SwapperWithChain.ts:608 |
getSwapType()
getSwapType(srcToken, dstToken):
| FROM_BTC
| FROM_BTCLN
| TO_BTC
| TO_BTCLN
| SPV_VAULT_FROM_BTC
| FROM_BTCLN_AUTO;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:589
Returns type of the swap based on input and output tokens specified
Parameters
| Parameter | Type | Description |
|---|---|---|
srcToken | Token<ChainIdentifier> | Source token |
dstToken | Token<ChainIdentifier> | Destination token |
Returns
| FROM_BTC
| FROM_BTCLN
| TO_BTC
| TO_BTCLN
| SPV_VAULT_FROM_BTC
| FROM_BTCLN_AUTO
getToken()
getToken(tickerOrAddress): Token<ChainIdentifier>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:528
Returns the Token object for a given token
Parameters
| Parameter | Type | Description |
|---|---|---|
tickerOrAddress | string | Token to return the object for, can use multiple formats: - a) token ticker, such as "BTC", "SOL", etc. - b) token ticker prefixed with smart chain identifier, such as "SOLANA-SOL", "SOLANA-USDC", etc. - c) token address |
Returns
Token<ChainIdentifier>
getTypedSwapById()
getTypedSwapById<S>(
id,
swapType,
signer?): Promise<SwapTypeMapping<T[ChainIdentifier]>[S]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:490
Returns the swap with a proper return type, or undefined if not found or has wrong type
Type Parameters
| Type Parameter |
|---|
S extends SwapType |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | An ID of the swap (ISwap.getId) |
swapType | S | Type of the swap |
signer? | string | An optional required smart chain signer address to fetch the swap for |
Returns
Promise<SwapTypeMapping<T[ChainIdentifier]>[S]>
recoverSwaps()
recoverSwaps(signer, startBlockheight?): Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:516
Recovers swaps from on-chain historical data.
Please note that the recovered swaps might not be complete (i.e. missing amounts or addresses), as some of the swap data is purely off-chain and can never be recovered purely from on-chain data. This functions tries to recover as much swap data as possible.
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | Signer address to recover the swaps for |
startBlockheight? | number | Optional starting blockheight for swap data recovery, will only check swaps initiated after this blockheight |
Returns
Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>[]>
supportsSwapType()
supportsSwapType<Type>(swapType): SupportsSwapType<T[ChainIdentifier], Type>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:561
Returns whether the SDK supports a given swap type on this chain based on currently known LPs
Type Parameters
| Type Parameter |
|---|
Type extends SwapType |
Parameters
| Parameter | Type | Description |
|---|---|---|
swapType | Type | Swap protocol type |
Returns
SupportsSwapType<T[ChainIdentifier], Type>
swap()
swap(
srcToken,
dstToken,
amount,
exactIn,
src,
dst,
options?): Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:419
Creates a swap from srcToken to dstToken, of a specific token amount, either specifying input amount (exactIn=true) or output amount (exactIn=false), NOTE: For regular SmartChain -> BTC-LN (lightning) swaps the passed amount is ignored and invoice's pre-set amount is used instead, use LNURL-pay for dynamic amounts
Parameters
| Parameter | Type | Description |
|---|---|---|
srcToken | string | Token<ChainIdentifier> | Source token of the swap, user pays this token |
dstToken | string | Token<ChainIdentifier> | Destination token of the swap, user receives this token |
amount | string | bigint | Amount of the swap |
exactIn | boolean | SwapAmountType | Whether the amount specified is an input amount (exactIn=true) or an output amount (exactIn=false) |
src | string | LNURLWithdraw | Source wallet/lnurl-withdraw of the swap |
dst | | string | LNURLPay | LightningInvoiceCreateService | Destination smart chain address, bitcoin on-chain address, lightning invoice, LNURL-pay |
options? | | ToBTCOptions | SpvFromBTCOptions | FromBTCOptions | FromBTCLNOptions | FromBTCLNAutoOptions | ToBTCLNOptions & object | Options for the swap |
Returns
Promise<ISwap<T[ChainIdentifier], SwapTypeDefinition<T[ChainIdentifier], ISwapWrapper<T[ChainIdentifier], any, ISwapWrapperOptions>, ISwap<T[ChainIdentifier], any, any>>, number>>
withSigner()
withSigner(signer): SwapperWithSigner<T, ChainIdentifier>;
Defined in: atomiq-sdk/src/swapper/SwapperWithChain.ts:698
Creates a child swapper instance with a signer
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | T[ChainIdentifier]["Signer"] | Signer to use for the new swapper instance |
Returns
SwapperWithSigner<T, ChainIdentifier>