Options
All
  • Public
  • Public/Protected
  • All
Menu

Instruction builders for the Whirlpools program.

Hierarchy

  • WhirlpoolIx

Index

Constructors

Methods

  • Close a bundled position in a Whirlpool.

    Special Errors

    InvalidBundleIndex - If the provided bundle index is out of bounds. ClosePositionNotEmpty - The provided position account is not empty.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: CloseBundledPositionParams

      CloseBundledPositionParams object

    Returns Instruction

    • Instruction to perform the action.
  • Close a position in a Whirlpool. Burns the position token in the owner's wallet.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: ClosePositionParams

      ClosePositionParams object

    Returns Instruction

    • Instruction to perform the action.
  • Collect fees accrued for this position. Call updateFeesAndRewards before this to update the position to the newest accrued values.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: CollectFeesParams

      CollectFeesParams object

    Returns Instruction

    • Instruction to perform the action.
  • Collect protocol fees accrued in this Whirlpool.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: CollectProtocolFeesParams

      CollectProtocolFeesParams object

    Returns Instruction

    • Instruction to perform the action.
  • Collect rewards accrued for this reward index in a position. Call updateFeesAndRewards before this to update the position to the newest accrued values.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: CollectRewardParams

      CollectRewardParams object

    Returns Instruction

    • Instruction to perform the action.
  • Remove liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards.

    Special Errors

    • 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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: DecreaseLiquidityParams

      DecreaseLiquidityParams object

    Returns Instruction

    • Instruction to perform the action.
  • Deletes a PositionBundle account.

    Special Errors

    PositionBundleNotDeletable - The provided position bundle has open positions.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: DeletePositionBundleParams

      DeletePositionBundleParams object

    Returns Instruction

    • Instruction to perform the action.
  • Add liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards.

    Special Errors

    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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: IncreaseLiquidityParams

      IncreaseLiquidityParams object

    Returns Instruction

    • Instruction to perform the action.
  • Initializes a TickArray account.

    Special Errors

    InvalidStartTick - if the provided start tick is out of bounds or is not a multiple of TICK_ARRAY_SIZE * tick spacing.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitTickArrayParams

      InitTickArrayParams object

    Returns Instruction

    • Instruction to perform the action.
  • initializeConfigIx(program: Program<Whirlpool>, params: InitConfigParams): Instruction
  • Initializes a WhirlpoolsConfig account that hosts info & authorities required to govern a set of Whirlpools.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitConfigParams

      InitConfigParams object

    Returns Instruction

    • Instruction to perform the action.
  • initializeFeeTierIx(program: Program<Whirlpool>, params: InitFeeTierParams): Instruction
  • Initializes a fee tier account usable by Whirlpools in this WhirlpoolsConfig space.

    Special Errors FeeRateMaxExceeded - If the provided default_fee_rate exceeds MAX_FEE_RATE.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitFeeTierParams

      InitFeeTierParams object

    Returns Instruction

    • Instruction to perform the action.
  • initializePoolIx(program: Program<Whirlpool>, params: InitPoolParams): Instruction
  • Initializes 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

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitPoolParams

      InitPoolParams object

    Returns Instruction

    • Instruction to perform the action.
  • Initializes a PositionBundle account.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitializePositionBundleParams

      InitializePositionBundleParams object

    Returns Instruction

    • Instruction to perform the action.
  • initializePositionBundleWithMetadataIx(program: Program<Whirlpool>, params: InitializePositionBundleParams & { positionBundleMetadataPda: PDA }): Instruction
  • Initializes a PositionBundle account. Additional Metaplex metadata is appended to identify the token.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitializePositionBundleParams & { positionBundleMetadataPda: PDA }

      InitializePositionBundleParams object

    Returns Instruction

    • Instruction to perform the action.
  • Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards. The initial emissionsPerSecond is set to 0.

    Special Errors

    • 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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: InitializeRewardParams

      InitializeRewardParams object

    Returns Instruction

    • Instruction to perform the action.
  • Open 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.

    Special Errors

    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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: OpenBundledPositionParams

      OpenBundledPositionParams object

    Returns Instruction

    • Instruction to perform the action.
  • Open 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.

    Special Errors

    InvalidTickIndex - If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: OpenPositionParams

      OpenPositionParams object

    Returns Instruction

    • Instruction to perform the action.
  • openPositionWithMetadataIx(program: Program<Whirlpool>, params: OpenPositionParams & { metadataPda: PDA }): Instruction
  • Open 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.

    Special Errors

    InvalidTickIndex - If a provided tick is out of bounds, out of order or not a multiple of the tick-spacing in this pool.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: OpenPositionParams & { metadataPda: PDA }

      OpenPositionParams object and a derived PDA that hosts the position's metadata.

    Returns Instruction

    • Instruction to perform the action.
  • Sets the fee authority to collect protocol fees for a WhirlpoolsConfig. Only the current collect protocol fee authority has permission to invoke this instruction.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetCollectProtocolFeesAuthorityParams

      SetCollectProtocolFeesAuthorityParams object

    Returns Instruction

    • Instruction to perform the action.
  • Updates a fee tier account with a new default fee rate. The new rate will not retroactively update initialized pools.

    Special Errors

    • FeeRateMaxExceeded - If the provided default_fee_rate exceeds MAX_FEE_RATE.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetDefaultFeeRateParams

      SetDefaultFeeRateParams object

    Returns Instruction

    • Instruction to perform the action.
  • Updates a WhirlpoolsConfig with a new default protocol fee rate. The new rate will not retroactively update initialized pools.

    Special Errors

    • ProtocolFeeRateMaxExceeded - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetDefaultProtocolFeeRateParams

      SetDefaultFeeRateParams object

    Returns Instruction

    • Instruction to perform the action.
  • Sets 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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetFeeAuthorityParams

      SetFeeAuthorityParams object

    Returns Instruction

    • Instruction to perform the action.
  • setFeeRateIx(program: Program<Whirlpool>, params: SetFeeRateParams): Instruction
  • Sets the fee rate for a Whirlpool. Only the current fee authority has permission to invoke this instruction.

    Special Errors

    • FeeRateMaxExceeded - If the provided fee_rate exceeds MAX_FEE_RATE.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetFeeRateParams

      SetFeeRateParams object

    Returns Instruction

    • Instruction to perform the action.
  • Sets the protocol fee rate for a Whirlpool. Only the current fee authority has permission to invoke this instruction.

    Special Errors

    • ProtocolFeeRateMaxExceeded - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetProtocolFeeRateParams

      SetFeeRateParams object

    Returns Instruction

    • Instruction to perform the action.
  • Set the whirlpool reward authority at the provided reward_index. Only the current reward super authority has permission to invoke this instruction.

    Special Errors

    • InvalidRewardIndex - If the provided reward index doesn't match the lowest uninitialized index in this pool, or exceeds NUM_REWARDS.

    Parameters

    Returns Instruction

    • Instruction to perform the action.
  • Set the whirlpool reward authority at the provided reward_index. Only the current reward authority for this reward index has permission to invoke this instruction.

    Special Errors

    • InvalidRewardIndex - If the provided reward index doesn't match the lowest uninitialized index in this pool, or exceeds NUM_REWARDS.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetRewardAuthorityParams

      SetRewardAuthorityParams object

    Returns Instruction

    • Instruction to perform the action.
  • Set the reward emissions for a reward in a Whirlpool.

    Special Errors

    • 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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetRewardEmissionsParams

      SetRewardEmissionsParams object

    Returns Instruction

    • Instruction to perform the action.
  • Set 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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SetRewardEmissionsSuperAuthorityParams

      SetRewardEmissionsSuperAuthorityParams object

    Returns Instruction

    • Instruction to perform the action.
  • swapIx(program: Program<Whirlpool>, params: SwapParams): Instruction
  • Perform a swap in this Whirlpool

    Special Errors

    • 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.

    Parameters

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: SwapParams

    Returns Instruction

    • Instruction to perform the action.
  • twoHopSwapIx(program: Program<Whirlpool>, params: TwoHopSwapParams): Instruction
  • Perform a two-hop-swap in this Whirlpool

    Special Errors

    • 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.

    Parameters

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: TwoHopSwapParams

      TwoHopSwapParams object

    Returns Instruction

    • Instruction to perform the action.
  • Update the accrued fees and rewards for a position.

    Special Errors

    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.

    Parameters

    • program: Program<Whirlpool>

      program object containing services required to generate the instruction

    • params: UpdateFeesAndRewardsParams

      UpdateFeesAndRewardsParams object

    Returns Instruction

    • Instruction to perform the action.

Generated using TypeDoc