Skip to main content

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

ParameterType
swapperSwapper<T>
chainIdentifierChainIdentifier

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

IntermediaryDiscovery


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 transaction
  • requiresOutputWallet: Whether a swap requires a connected wallet on the output chain able to sign arbitrary transactions
  • supportsGasDrop: 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

ParameterTypeDescription
signer?stringOptional 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

ParameterTypeDescription
signerstringSmartchain (Solana, Starknet, etc.) address of the user
srcTokenSCToken<ChainIdentifier>Source token of the swap, user pays this token
dstTokenBtcToken<true>Destination token of the swap, user receives this token
amountundefinedAmount of the swap
exactInfalseWhether the amount specified is an input amount (exactIn=true) or an output amount (exactIn=false)
addressLnurlLightningInvoicestringBitcoin 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
tokenAddressstringToken address to receive
amountbigintAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOut?booleanWhether to use a exact out instead of exact in
additionalParams?Record<string, any>Additional parameters sent to the LP when creating the swap
options?FromBTCLNOptionsAdditional 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
tokenAddressstringToken address to receive
amountbigintAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOut?booleanWhether to use a exact out instead of exact in
additionalParams?Record<string, any>Additional parameters sent to the LP when creating the swap
options?FromBTCLNAutoOptionsAdditional 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
tokenAddressstringToken address to receive
lnurlstring | LNURLWithdrawLNURL-withdraw link to pull the funds from
amountbigintAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOut?booleanWhether to use a exact out instead of exact in
additionalParams?Record<string, any>Additional parameters sent to the LP when creating the swap
options?FromBTCLNAutoOptionsAdditional 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
tokenAddressstringToken address to receive
lnurlstring | LNURLWithdrawLNURL-withdraw link to pull the funds from
amountbigintAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOut?booleanWhether 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
tokenAddressstringToken address to receive
amountbigintAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOut?booleanWhether to use a exact out instead of exact in
additionalParams?Record<string, any>Additional parameters sent to the LP when creating the swap
options?FromBTCOptionsAdditional 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

ParameterTypeDefault valueDescription
recipientstringundefinedRecipient address on the destination chain
tokenAddressstringundefinedToken address to receive
amountbigintundefinedAmount to send in satoshis (if exactOut=false) or receive in token based units (if exactOut=true)
exactOutbooleanfalseWhether to use a exact out instead of exact in
additionalParams?Record<string, any>undefinedAdditional parameters sent to the LP when creating the swap
options?SpvFromBTCOptionsundefinedAdditional 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

ParameterTypeDescription
signerstringSigner's address on the source chain
tokenAddressstringToken address to pay with
paymentRequeststringBOLT11 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 & objectAdditional 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

ParameterTypeDescription
signerstringSigner's address on the source chain
tokenAddressstringToken address to pay with
serviceLightningInvoiceCreateServiceInvoice create service object which facilitates the creation of fixed amount LN invoices
amountbigintAmount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false)
exactIn?booleanWhether 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?ToBTCLNOptionsAdditional 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

ParameterTypeDescription
signerstringSigner's address on the source chain
tokenAddressstringToken address to pay with
lnurlPaystring | LNURLPayLNURL-pay link to use for the payment
amountbigintAmount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false)
exactIn?booleanWhether 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?ToBTCLNOptionsAdditional 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

ParameterTypeDescription
signerstringSigner's address on the source chain
tokenAddressstringToken address to pay with
addressstringRecipient's bitcoin address
amountbigintAmount to send in token based units (if exactIn=true) or receive in satoshis (if exactIn=false)
exactIn?booleanWhether to use exact in instead of exact out
additionalParams?Record<string, any>Additional parameters sent to the LP when creating the swap
options?ToBTCOptionsAdditional 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
amountbigintAmount of native token to receive, in base units
trustedIntermediaryOrUrl?string | IntermediaryURL 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

ParameterTypeDescription
recipientstringRecipient address on the destination chain
amountbigintAmount of native token to receive, in base units
refundAddress?stringBitcoin refund address, in case the swap fails the funds are refunded here
trustedIntermediaryOrUrl?string | IntermediaryURL 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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
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

ParameterType
idstring
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

ParameterType
tokenToken
inputboolean

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

ParameterTypeDescription
srcTokenASource token
dstTokenBDestination token

Returns

object

NameTypeDefined in
inputobjectatomiq-sdk/src/swapper/SwapperWithChain.ts:607
input.max?TokenAmount<string, A>atomiq-sdk/src/swapper/SwapperWithChain.ts:607
input.minTokenAmount<string, A>atomiq-sdk/src/swapper/SwapperWithChain.ts:607
outputobjectatomiq-sdk/src/swapper/SwapperWithChain.ts:608
output.max?TokenAmount<string, B>atomiq-sdk/src/swapper/SwapperWithChain.ts:608
output.minTokenAmount<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

ParameterTypeDescription
srcTokenToken<ChainIdentifier>Source token
dstTokenToken<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

ParameterTypeDescription
tickerOrAddressstringToken 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

ParameterTypeDescription
idstringAn ID of the swap (ISwap.getId)
swapTypeSType of the swap
signer?stringAn 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

ParameterTypeDescription
signerstringSigner address to recover the swaps for
startBlockheight?numberOptional 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

ParameterTypeDescription
swapTypeTypeSwap 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

ParameterTypeDescription
srcTokenstring | Token<ChainIdentifier>Source token of the swap, user pays this token
dstTokenstring | Token<ChainIdentifier>Destination token of the swap, user receives this token
amountstring | bigintAmount of the swap
exactInboolean | SwapAmountTypeWhether the amount specified is an input amount (exactIn=true) or an output amount (exactIn=false)
srcstring | LNURLWithdrawSource wallet/lnurl-withdraw of the swap
dst| string | LNURLPay | LightningInvoiceCreateServiceDestination smart chain address, bitcoin on-chain address, lightning invoice, LNURL-pay
options?| ToBTCOptions | SpvFromBTCOptions | FromBTCOptions | FromBTCLNOptions | FromBTCLNAutoOptions | ToBTCLNOptions & objectOptions 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

ParameterTypeDescription
signerT[ChainIdentifier]["Signer"]Signer to use for the new swapper instance

Returns

SwapperWithSigner<T, ChainIdentifier>