Static
calculateThe amount of tokens the user wanted to swap from.
The estimated amount of input tokens expected in a SwapQuote
The estimated amount of output tokens expected from a SwapQuote
The amount of slippage to adjust for.
Specifies the token the parameter amount
represents in the swap quote. If true, the amount represents
the input token of the swap.
A Partial SwapInput
object containing the slippage adjusted 'amount' & 'otherAmountThreshold' parameters.
Static
getFetch a batch of tick-arrays for a set of TA requests.
The Whirlpool programId which the Whirlpool lives on.
An array of TickArrayRequest of tick-arrays to request for.
Optional
opts: SimpleAccountFetchOptionsan WhirlpoolAccountFetchOptions object to define fetch and cache options when accessing on-chain accounts
A array of request indicies mapped to an array of resulting PublicKeys.
Static
getStatic
getStatic
getGiven the intended token mint to swap, return the swap direction of a swap for a Whirlpool
The Whirlpool to evaluate the mint against
The token mint PublicKey the user bases their swap against
Whether the swap token is the input token. (similar to amountSpecifiedIsInput from swap Ix)
The direction of the swap given the swapTokenMint. undefined if the token mint is not part of the trade pair of the pool.
Static
getConvert a quote object and WhirlpoolClient's Whirlpool object into a SwapParams type to be plugged into WhirlpoolIx.swapIx.
A SwapQuote type generated from swapQuoteWithParams
A Whirlpool object from WhirlpoolClient
The public key for the ATA of the input token in the swap
The public key for the ATA of the input token in the swap
The token authority for this swap
A converted SwapParams generated from the input
Static
getStatic
interpolateGiven a set of tickArrays, interpolate the tickArrays with zeroed tick data if they are not initialized.
PublicKey of the whirlpool to swap on.
Fetched tickArrays to interpolate.
An array of TickArray objects with zeroed tick data if they are not initialized.
Static
getGiven the tickArrays, return the fallback tickArray account that this swap may traverse across.
An array of tickArrays to be used in the swap.
The tickSpacing for the Whirlpool.
The direction of the trade.
The Whirlpool programId which the Whirlpool lives on.
PublicKey of the whirlpool to swap on.
A PublicKey for the fallback tickArray account that this swap may traverse across. If the fallback tickArray does not exist, return undefined.
Static
getGiven the current tick-index, returns the dervied PDA and fetched data for the tick-arrays that this swap may traverse across.
The current tickIndex for the Whirlpool to swap on.
The tickSpacing for the Whirlpool.
The direction of the trade.
The Whirlpool programId which the Whirlpool lives on.
PublicKey of the whirlpool to swap on.
An array of PublicKey[] for the tickArray accounts that this swap may traverse across.
Static
getGiven the current tick-index, returns TickArray objects that this swap may traverse across.
The current tickIndex for the Whirlpool to swap on.
The tickSpacing for the Whirlpool.
The direction of the trade.
The Whirlpool programId which the Whirlpool lives on.
PublicKey of the whirlpool to swap on.
Optional
opts: SimpleAccountFetchOptionsan WhirlpoolAccountFetchOptions object to define fetch and cache options when accessing on-chain accounts
An array of PublicKey[] for the tickArray accounts that this swap may traverse across.
Calculate the SwapInput parameters
amount
&otherAmountThreshold
based on the amountIn & amountOut estimates from a quote.