Withdraw all tokens from a position, close the account and burn the position token.
Users have to collect all fees and rewards from this position prior to closing the account.
If positionWallet
, payer
is provided, the wallet owner has to sign this transaction.
The address of the position account.
The amount of slippage the caller is willing to accept when withdrawing liquidity.
Optional
destinationWallet: AddressThe wallet that the tokens withdrawn and rent lamports will be sent to. If null, the WhirlpoolContext wallet is used.
Optional
positionWallet: AddressThe wallet that houses the position token that corresponds to this position address. If null, the WhirlpoolContext wallet is used.
Optional
payer: Addressthe wallet that will fund the cost needed to initialize the token ATA accounts. If null, the WhirlpoolContext wallet is used.
Optional
usePriceSlippage: booleanif true, use the price slippage to calculate the minimum tokens to receive. If false, use the token slippage.
transactions that will close the position. The transactions must be executed serially.
Return the address for this Whirlpool instance.
the PublicKey for this Whirlpool instance.
Return the most recently fetched Whirlpool account data.
most recently fetched WhirlpoolData for this address.
Get the WhirlpoolRewardInfos for this pool.
Array of 3 WhirlpoolRewardInfos. However, not all of them may be initialized. Use the initialized field on WhirlpoolRewardInfo to check if the reward is active.
Get the TokenInfo for token A of this pool.
Get the TokenInfo for token B of this pool.
Get the TokenAccountInfo for token vault A of this pool.
TokenAccountInfo for token vault A
Get the TokenAccountInfo for token vault B of this pool.
TokenAccountInfo for token vault B
Initialize a set of tick-arrays that encompasses the provided ticks.
If funder
is provided, the funder wallet has to sign this transaction.
A group of ticks that define the desired tick-arrays to initialize. If the tick's array has been initialized, it will be ignored.
Optional
funder: Addressthe wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
Optional
opts: SimpleAccountFetchOptionsan WhirlpoolAccountFetchOptions object to define fetch and cache options when accessing on-chain accounts
a transaction that will initialize the defined tick-arrays if executed. Return null if all of the tick's arrays are initialized.
Open and fund a position on this Whirlpool.
User has to ensure the TickArray for tickLower and tickUpper has been initialized prior to calling this function.
If wallet
or funder
is provided, those wallets have to sign this transaction.
the tick index for the lower bound of this position
the tick index for the upper bound of this position
an InputLiquidityInput type to define the desired liquidity amount to deposit
Optional
wallet: Addressthe wallet to withdraw tokens to deposit into the position and house the position token. If null, the WhirlpoolContext wallet is used.
Optional
funder: Addressthe wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
Optional
positionMint: PublicKeythe mint address of the position token to be created. If null, a new mint address will be created.
Optional
tokenProgramId: PublicKeythe token program id to use for the position token. The default is TOKEN_PROGRAM_ID.
positionMint
- the position to be created. tx
- The transaction containing the instructions to perform the operation on chain.
Open and fund a position with meta-data on this Whirlpool.
User has to ensure the TickArray for tickLower and tickUpper has been initialized prior to calling this function.
If wallet
or funder
is provided, the wallet owners have to sign this transaction.
the tick index for the lower bound of this position
the tick index for the upper bound of this position
input that defines the desired liquidity amount and maximum tokens willing to be to deposited.
Optional
wallet: Addressthe wallet to withdraw tokens to deposit into the position and house the position token. If null, the WhirlpoolContext wallet is used.
Optional
funder: Addressthe wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
Optional
positionMint: PublicKeythe mint address of the position token to be created. If null, a new mint address will be created.
Optional
tokenProgramId: PublicKeythe token program id to use for the position token. The default is TOKEN_PROGRAM_ID.
positionMint
- the position to be created. tx
- The transaction containing the instructions to perform the operation on chain.
Fetch and return the most recently fetched Whirlpool account data.
the most up to date WhirlpoolData for this address.
Perform a swap between tokenA and tokenB on this pool.
A quote on the desired tokenIn and tokenOut for this swap. Use swapQuoteWithParams or other swap quote functions to generate this object.
Optional
wallet: PublicKeyThe wallet that tokens will be withdrawn and deposit into. If null, the WhirlpoolContext wallet is used.
a transaction that will perform the swap once executed.
Collect a developer fee and perform a swap between tokenA and tokenB on this pool.
A quote on the desired tokenIn and tokenOut for this swap. Use swapQuoteByInputTokenWithDevFees to generate this object.
The wallet that developer fees will be deposited into.
Optional
wallet: PublicKeyThe wallet that swap tokens will be withdrawn and deposit into. If null, the WhirlpoolContext wallet is used.
Optional
payer: PublicKeyThe wallet that will fund the cost needed to initialize the dev wallet token ATA accounts. If null, the WhirlpoolContext wallet is used.
a transaction that will perform the swap once executed.
Helper class to interact with a Whirlpool account and build complex transactions.