Static
closeClose a position in a Whirlpool. Burns the position token in the owner's wallet. Mint and TokenAccount are based on Token-2022. And Mint accout will be also closed.
ClosePositionWithTokenExtensionsParams object
Static
closeClose a bundled position in a Whirlpool.
InvalidBundleIndex
- If the provided bundle index is out of bounds.
ClosePositionNotEmpty
- The provided position account is not empty.
program object containing services required to generate the instruction
CloseBundledPositionParams object
Static
closeClose a position in a Whirlpool. Burns the position token in the owner's wallet.
program object containing services required to generate the instruction
ClosePositionParams object
Static
collectCollect fees accrued for this position. Call updateFeesAndRewards before this to update the position to the newest accrued values.
program object containing services required to generate the instruction
CollectFeesParams object
Static
collectStatic
collectCollect protocol fees accrued in this Whirlpool.
program object containing services required to generate the instruction
CollectProtocolFeesParams object
Static
collectStatic
collectCollect rewards accrued for this reward index in a position. Call updateFeesAndRewards before this to update the position to the newest accrued values.
program object containing services required to generate the instruction
CollectRewardParams object
Static
collectStatic
decreaseRemove liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards.
LiquidityZero
- Provided liquidity amount is zero.LiquidityTooHigh
- Provided liquidity exceeds u128::max.TokenMinSubceeded
- The required token to perform this operation subceeds the user defined amount.program object containing services required to generate the instruction
DecreaseLiquidityParams object
Static
decreaseStatic
deleteDeletes a PositionBundle account.
PositionBundleNotDeletable
- The provided position bundle has open positions.
program object containing services required to generate the instruction
DeletePositionBundleParams object
Static
deleteStatic
increaseAdd liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards.
LiquidityZero
- Provided liquidity amount is zero.
LiquidityTooHigh
- Provided liquidity exceeds u128::max.
TokenMaxExceeded
- The required token to perform this operation exceeds the user defined amount.
program object containing services required to generate the instruction
IncreaseLiquidityParams object
Static
increaseStatic
initializeStatic
initializeInitializes a WhirlpoolsConfig account that hosts info & authorities required to govern a set of Whirlpools.
program object containing services required to generate the instruction
InitConfigParams object
Static
initializeInitializes a fee tier account usable by Whirlpools in this WhirlpoolsConfig space.
Special Errors
FeeRateMaxExceeded
- If the provided default_fee_rate exceeds MAX_FEE_RATE.
program object containing services required to generate the instruction
InitFeeTierParams object
Static
initializeInitializes a tick_array account to represent a tick-range in a Whirlpool.
Special Errors
InvalidTokenMintOrder
- The order of mints have to be ordered by
SqrtPriceOutOfBounds
- provided initial_sqrt_price is not between 2^-64 to 2^64
program object containing services required to generate the instruction
InitPoolParams object
Static
initializeStatic
initializeInitializes a PositionBundle account.
program object containing services required to generate the instruction
InitializePositionBundleParams object
Static
initializeInitializes a PositionBundle account. Additional Metaplex metadata is appended to identify the token.
program object containing services required to generate the instruction
InitializePositionBundleParams object
Static
initializeInitialize reward for a Whirlpool. A pool can only support up to a set number of rewards. The initial emissionsPerSecond is set to 0.
InvalidRewardIndex
- If the provided reward index doesn't match the lowest uninitialized index in this pool,
or exceeds NUM_REWARDS, or all reward slots for this pool has been initialized.program object containing services required to generate the instruction
InitializeRewardParams object
Static
initializeStatic
initializeStatic
initInitializes a TickArray account.
InvalidStartTick
- if the provided start tick is out of bounds or is not a multiple of TICK_ARRAY_SIZE * tick spacing.
program object containing services required to generate the instruction
InitTickArrayParams object
Static
openOpen a bundled position in a Whirlpool. No new tokens are issued because the owner of the position bundle becomes the owner of the position. The position will start off with 0 liquidity.
InvalidBundleIndex
- If the provided bundle index is out of bounds.
InvalidTickIndex
- If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.
program object containing services required to generate the instruction
OpenBundledPositionParams object
Static
openOpen a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. The position will start off with 0 liquidity.
InvalidTickIndex
- If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.
program object containing services required to generate the instruction
OpenPositionParams object
Static
openOpen a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. Additional Metaplex metadata is appended to identify the token. The position will start off with 0 liquidity.
InvalidTickIndex
- If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.
program object containing services required to generate the instruction
OpenPositionParams object and a derived PDA that hosts the position's metadata.
Static
openOpen a position in a Whirlpool. A unique token will be minted to represent the position in the users wallet. Additional TokenMetadata extension is initialized to identify the token if requested. Mint and Token account are based on Token-2022. The position will start off with 0 liquidity.
InvalidTickIndex
- If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.
OpenPositionWithTokenExtensionsParams object and a derived PDA that hosts the position's metadata.
Static
setSets the fee authority to collect protocol fees for a WhirlpoolsConfig. Only the current collect protocol fee authority has permission to invoke this instruction.
program object containing services required to generate the instruction
SetCollectProtocolFeesAuthorityParams object
Static
setStatic
setUpdates a fee tier account with a new default fee rate. The new rate will not retroactively update initialized pools.
FeeRateMaxExceeded
- If the provided default_fee_rate exceeds MAX_FEE_RATE.program object containing services required to generate the instruction
SetDefaultFeeRateParams object
Static
setUpdates a WhirlpoolsConfig with a new default protocol fee rate. The new rate will not retroactively update initialized pools.
ProtocolFeeRateMaxExceeded
- If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE.program object containing services required to generate the instruction
SetDefaultFeeRateParams object
Static
setSets the fee authority for a WhirlpoolsConfig. The fee authority can set the fee & protocol fee rate for individual pools or set the default fee rate for newly minted pools. Only the current fee authority has permission to invoke this instruction.
program object containing services required to generate the instruction
SetFeeAuthorityParams object
Static
setSets the fee rate for a Whirlpool. Only the current fee authority has permission to invoke this instruction.
FeeRateMaxExceeded
- If the provided fee_rate exceeds MAX_FEE_RATE.program object containing services required to generate the instruction
SetFeeRateParams object
Static
setSets the protocol fee rate for a Whirlpool. Only the current fee authority has permission to invoke this instruction.
ProtocolFeeRateMaxExceeded
- If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE.program object containing services required to generate the instruction
SetFeeRateParams object
Static
setSet the whirlpool reward authority at the provided reward_index
.
Only the current reward super authority has permission to invoke this instruction.
InvalidRewardIndex
- If the provided reward index doesn't match the lowest uninitialized index in this pool,
or exceeds NUM_REWARDS.program object containing services required to generate the instruction
SetRewardAuthorityParams object
Static
setSet the whirlpool reward authority at the provided reward_index
.
Only the current reward authority for this reward index has permission to invoke this instruction.
InvalidRewardIndex
- If the provided reward index doesn't match the lowest uninitialized index in this pool,
or exceeds NUM_REWARDS.program object containing services required to generate the instruction
SetRewardAuthorityParams object
Static
setSet the reward emissions for a reward in a Whirlpool.
RewardVaultAmountInsufficient
- The amount of rewards in the reward vault cannot emit more than a day of desired emissions.InvalidTimestamp
- Provided timestamp is not in order with the previous timestamp.InvalidRewardIndex
- If the provided reward index doesn't match the lowest uninitialized index in this pool,
or exceeds NUM_REWARDS.program object containing services required to generate the instruction
SetRewardEmissionsParams object
Static
setSet the whirlpool reward super authority for a WhirlpoolsConfig
Only the current reward super authority has permission to invoke this instruction.
This instruction will not change the authority on any WhirlpoolRewardInfo
whirlpool rewards.
program object containing services required to generate the instruction
SetRewardEmissionsSuperAuthorityParams object
Static
setStatic
setStatic
swapPerform a swap in this Whirlpool
ZeroTradableAmount
- User provided parameter amount
is 0.InvalidSqrtPriceLimitDirection
- User provided parameter sqrt_price_limit
does not match the direction of the trade.SqrtPriceOutOfBounds
- User provided parameter sqrt_price_limit
is over Whirlppool's max/min bounds for sqrt-price.InvalidTickArraySequence
- User provided tick-arrays are not in sequential order required to proceed in this trade direction.TickArraySequenceInvalidIndex
- The swap loop attempted to access an invalid array index during the query of the next initialized tick.TickArrayIndexOutofBounds
- The swap loop attempted to access an invalid array index during tick crossing.LiquidityOverflow
- Liquidity value overflowed 128bits during tick crossing.InvalidTickSpacing
- The swap pool was initialized with tick-spacing of 0.AmountCalcOverflow
- The required token amount exceeds the u64 range.AmountRemainingOverflow
- Result does not match the specified amount.DifferentWhirlpoolTickArrayAccount
- The provided tick array account does not belong to the whirlpool.PartialFillError
- Partially filled when sqrtPriceLimit = 0 and amountSpecifiedIsInput = false.program object containing services required to generate the instruction
Static
swapStatic
twoPerform a two-hop-swap in this Whirlpool
ZeroTradableAmount
- User provided parameter amount
is 0.InvalidSqrtPriceLimitDirection
- User provided parameter sqrt_price_limit
does not match the direction of the trade.SqrtPriceOutOfBounds
- User provided parameter sqrt_price_limit
is over Whirlppool's max/min bounds for sqrt-price.InvalidTickArraySequence
- User provided tick-arrays are not in sequential order required to proceed in this trade direction.TickArraySequenceInvalidIndex
- The swap loop attempted to access an invalid array index during the query of the next initialized tick.TickArrayIndexOutofBounds
- The swap loop attempted to access an invalid array index during tick crossing.LiquidityOverflow
- Liquidity value overflowed 128bits during tick crossing.InvalidTickSpacing
- The swap pool was initialized with tick-spacing of 0.DuplicateTwoHopPool
- Swaps on the same pool are not allowed.InvalidIntermediaryMint
- The first and second leg of the hops do not share a common token.AmountCalcOverflow
- The required token amount exceeds the u64 range.AmountRemainingOverflow
- Result does not match the specified amount.DifferentWhirlpoolTickArrayAccount
- The provided tick array account does not belong to the whirlpool.PartialFillError
- Partially filled when sqrtPriceLimit = 0 and amountSpecifiedIsInput = false.IntermediateTokenAmountMismatch
- The amount of tokens received from the first hop does not match the amount sent to the second hop.program object containing services required to generate the instruction
TwoHopSwapParams object
Static
twoStatic
updateUpdate the accrued fees and rewards for a position.
TickNotFound
- Provided tick array account does not contain the tick for this position.
LiquidityZero
- Position has zero liquidity and therefore already has the most updated fees and reward values.
program object containing services required to generate the instruction
UpdateFeesAndRewardsParams object
Instruction builders for the Whirlpools program.