@orca-so/whirlpools-sdk
Version:
Typescript SDK to interact with Orca's Whirlpool program.
1,394 lines • 147 kB
TypeScript
export type Whirlpool = {
"version": "0.3.5";
"name": "whirlpool";
"instructions": [
{
"name": "initializeConfig";
"docs": [
"Initializes a WhirlpoolsConfig account that hosts info & authorities",
"required to govern a set of Whirlpools.",
"",
"### Parameters",
"- `fee_authority` - Authority authorized to initialize fee-tiers and set customs fees.",
"- `collect_protocol_fees_authority` - Authority authorized to collect protocol fees.",
"- `reward_emissions_super_authority` - Authority authorized to set reward authorities in pools."
];
"accounts": [
{
"name": "config";
"isMut": true;
"isSigner": true;
},
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "feeAuthority";
"type": "publicKey";
},
{
"name": "collectProtocolFeesAuthority";
"type": "publicKey";
},
{
"name": "rewardEmissionsSuperAuthority";
"type": "publicKey";
},
{
"name": "defaultProtocolFeeRate";
"type": "u16";
}
];
},
{
"name": "initializePool";
"docs": [
"Initializes a Whirlpool account.",
"Fee rate is set to the default values on the config and supplied fee_tier.",
"",
"### Parameters",
"- `bumps` - The bump value when deriving the PDA of the Whirlpool address.",
"- `tick_spacing` - The desired tick spacing for this pool.",
"- `initial_sqrt_price` - The desired initial sqrt-price for this pool",
"",
"#### 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",
""
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenMintA";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenMintB";
"isMut": false;
"isSigner": false;
},
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": true;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": true;
},
{
"name": "feeTier";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "bumps";
"type": {
"defined": "WhirlpoolBumps";
};
},
{
"name": "tickSpacing";
"type": "u16";
},
{
"name": "initialSqrtPrice";
"type": "u128";
}
];
},
{
"name": "initializeTickArray";
"docs": [
"Initializes a tick_array account to represent a tick-range in a Whirlpool.",
"",
"### Parameters",
"- `start_tick_index` - The starting tick index for this tick-array.",
"Has to be a multiple of TickArray size & the tick spacing of this pool.",
"",
"#### Special Errors",
"- `InvalidStartTick` - if the provided start tick is out of bounds or is not a multiple of",
"TICK_ARRAY_SIZE * tick spacing."
];
"accounts": [
{
"name": "whirlpool";
"isMut": false;
"isSigner": false;
},
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "tickArray";
"isMut": true;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "startTickIndex";
"type": "i32";
}
];
},
{
"name": "initializeFeeTier";
"docs": [
"Initializes a fee_tier account usable by Whirlpools in a WhirlpoolConfig space.",
"",
"### Authority",
"- \"fee_authority\" - Set authority in the WhirlpoolConfig",
"",
"### Parameters",
"- `tick_spacing` - The tick-spacing that this fee-tier suggests the default_fee_rate for.",
"- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this",
"fee tier during initialization.",
"",
"#### Special Errors",
"- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."
];
"accounts": [
{
"name": "config";
"isMut": false;
"isSigner": false;
},
{
"name": "feeTier";
"isMut": true;
"isSigner": false;
},
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "tickSpacing";
"type": "u16";
},
{
"name": "defaultFeeRate";
"type": "u16";
}
];
},
{
"name": "initializeReward";
"docs": [
"Initialize reward for a Whirlpool. A pool can only support up to a set number of rewards.",
"",
"### Authority",
"- \"reward_authority\" - assigned authority by the reward_super_authority for the specified",
"reward-index in this Whirlpool",
"",
"### Parameters",
"- `reward_index` - The reward index that we'd like to initialize. (0 <= index <= NUM_REWARDS)",
"",
"#### 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."
];
"accounts": [
{
"name": "rewardAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardMint";
"isMut": false;
"isSigner": false;
},
{
"name": "rewardVault";
"isMut": true;
"isSigner": true;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "rewardIndex";
"type": "u8";
}
];
},
{
"name": "setRewardEmissions";
"docs": [
"Set the reward emissions for a reward in a Whirlpool.",
"",
"### Authority",
"- \"reward_authority\" - assigned authority by the reward_super_authority for the specified",
"reward-index in this Whirlpool",
"",
"### Parameters",
"- `reward_index` - The reward index (0 <= index <= NUM_REWARDS) that we'd like to modify.",
"- `emissions_per_second_x64` - The amount of rewards emitted in this pool.",
"",
"#### 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, or",
"all reward slots for this pool has been initialized."
];
"accounts": [
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "rewardVault";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "rewardIndex";
"type": "u8";
},
{
"name": "emissionsPerSecondX64";
"type": "u128";
}
];
},
{
"name": "openPosition";
"docs": [
"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.",
"",
"### Parameters",
"- `tick_lower_index` - The tick specifying the lower end of the position range.",
"- `tick_upper_index` - The tick specifying the upper end of the position range.",
"",
"#### 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."
];
"accounts": [
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "owner";
"isMut": false;
"isSigner": false;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionMint";
"isMut": true;
"isSigner": true;
},
{
"name": "positionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
},
{
"name": "associatedTokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "bumps";
"type": {
"defined": "OpenPositionBumps";
};
},
{
"name": "tickLowerIndex";
"type": "i32";
},
{
"name": "tickUpperIndex";
"type": "i32";
}
];
},
{
"name": "openPositionWithMetadata";
"docs": [
"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.",
"",
"### Parameters",
"- `tick_lower_index` - The tick specifying the lower end of the position range.",
"- `tick_upper_index` - The tick specifying the upper end of the position range.",
"",
"#### 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."
];
"accounts": [
{
"name": "funder";
"isMut": true;
"isSigner": true;
},
{
"name": "owner";
"isMut": false;
"isSigner": false;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionMint";
"isMut": true;
"isSigner": true;
},
{
"name": "positionMetadataAccount";
"isMut": true;
"isSigner": false;
"docs": [
"https://github.com/metaplex-foundation/mpl-token-metadata/blob/master/programs/token-metadata/program/src/utils/metadata.rs#L78"
];
},
{
"name": "positionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
},
{
"name": "associatedTokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "metadataProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "metadataUpdateAuth";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "bumps";
"type": {
"defined": "OpenPositionWithMetadataBumps";
};
},
{
"name": "tickLowerIndex";
"type": "i32";
},
{
"name": "tickUpperIndex";
"type": "i32";
}
];
},
{
"name": "increaseLiquidity";
"docs": [
"Add liquidity to a position in the Whirlpool. This call also updates the position's accrued fees and rewards.",
"",
"### Authority",
"- `position_authority` - authority that owns the token corresponding to this desired position.",
"",
"### Parameters",
"- `liquidity_amount` - The total amount of Liquidity the user is willing to deposit.",
"- `token_max_a` - The maximum amount of tokenA the user is willing to deposit.",
"- `token_max_b` - The maximum amount of tokenB the user is willing to deposit.",
"",
"#### 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."
];
"accounts": [
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "positionAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenOwnerAccountA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenOwnerAccountB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArrayLower";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArrayUpper";
"isMut": true;
"isSigner": false;
}
];
"args": [
{
"name": "liquidityAmount";
"type": "u128";
},
{
"name": "tokenMaxA";
"type": "u64";
},
{
"name": "tokenMaxB";
"type": "u64";
}
];
},
{
"name": "decreaseLiquidity";
"docs": [
"Withdraw liquidity from a position in the Whirlpool. This call also updates the position's accrued fees and rewards.",
"",
"### Authority",
"- `position_authority` - authority that owns the token corresponding to this desired position.",
"",
"### Parameters",
"- `liquidity_amount` - The total amount of Liquidity the user desires to withdraw.",
"- `token_min_a` - The minimum amount of tokenA the user is willing to withdraw.",
"- `token_min_b` - The minimum amount of tokenB the user is willing to withdraw.",
"",
"#### 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."
];
"accounts": [
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "positionAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenOwnerAccountA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenOwnerAccountB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArrayLower";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArrayUpper";
"isMut": true;
"isSigner": false;
}
];
"args": [
{
"name": "liquidityAmount";
"type": "u128";
},
{
"name": "tokenMinA";
"type": "u64";
},
{
"name": "tokenMinB";
"type": "u64";
}
];
},
{
"name": "updateFeesAndRewards";
"docs": [
"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."
];
"accounts": [
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArrayLower";
"isMut": false;
"isSigner": false;
},
{
"name": "tickArrayUpper";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "collectFees";
"docs": [
"Collect fees accrued for this position.",
"",
"### Authority",
"- `position_authority` - authority that owns the token corresponding to this desired position."
];
"accounts": [
{
"name": "whirlpool";
"isMut": false;
"isSigner": false;
},
{
"name": "positionAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenOwnerAccountA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenOwnerAccountB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "collectReward";
"docs": [
"Collect rewards accrued for this position.",
"",
"### Authority",
"- `position_authority` - authority that owns the token corresponding to this desired position."
];
"accounts": [
{
"name": "whirlpool";
"isMut": false;
"isSigner": false;
},
{
"name": "positionAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "rewardOwnerAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardVault";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "rewardIndex";
"type": "u8";
}
];
},
{
"name": "collectProtocolFees";
"docs": [
"Collect the protocol fees accrued in this Whirlpool",
"",
"### Authority",
"- `collect_protocol_fees_authority` - assigned authority in the WhirlpoolConfig that can collect protocol fees"
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "collectProtocolFeesAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenDestinationA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenDestinationB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "swap";
"docs": [
"Perform a swap in this Whirlpool",
"",
"### Authority",
"- \"token_authority\" - The authority to withdraw tokens from the input token account.",
"",
"### Parameters",
"- `amount` - The amount of input or output token to swap from (depending on amount_specified_is_input).",
"- `other_amount_threshold` - The maximum/minimum of input/output token to swap into (depending on amount_specified_is_input).",
"- `sqrt_price_limit` - The maximum/minimum price the swap will swap to.",
"- `amount_specified_is_input` - Specifies the token the parameter `amount`represents. If true, the amount represents the input token of the swap.",
"- `a_to_b` - The direction of the swap. True if swapping from A to B. False if swapping from B to A.",
"",
"#### 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."
];
"accounts": [
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenOwnerAccountA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultA";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenOwnerAccountB";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenVaultB";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArray0";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArray1";
"isMut": true;
"isSigner": false;
},
{
"name": "tickArray2";
"isMut": true;
"isSigner": false;
},
{
"name": "oracle";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "amount";
"type": "u64";
},
{
"name": "otherAmountThreshold";
"type": "u64";
},
{
"name": "sqrtPriceLimit";
"type": "u128";
},
{
"name": "amountSpecifiedIsInput";
"type": "bool";
},
{
"name": "aToB";
"type": "bool";
}
];
},
{
"name": "closePosition";
"docs": [
"Close a position in a Whirlpool. Burns the position token in the owner's wallet.",
"",
"### Authority",
"- \"position_authority\" - The authority that owns the position token.",
"",
"#### Special Errors",
"- `ClosePositionNotEmpty` - The provided position account is not empty."
];
"accounts": [
{
"name": "positionAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "receiver";
"isMut": true;
"isSigner": false;
},
{
"name": "position";
"isMut": true;
"isSigner": false;
},
{
"name": "positionMint";
"isMut": true;
"isSigner": false;
},
{
"name": "positionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "setDefaultFeeRate";
"docs": [
"Set the default_fee_rate for a FeeTier",
"Only the current fee authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"fee_authority\" - Set authority in the WhirlpoolConfig",
"",
"### Parameters",
"- `default_fee_rate` - The default fee rate that a pool will use if the pool uses this",
"fee tier during initialization.",
"",
"#### Special Errors",
"- `FeeRateMaxExceeded` - If the provided default_fee_rate exceeds MAX_FEE_RATE."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "feeTier";
"isMut": true;
"isSigner": false;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
}
];
"args": [
{
"name": "defaultFeeRate";
"type": "u16";
}
];
},
{
"name": "setDefaultProtocolFeeRate";
"docs": [
"Sets the default protocol fee rate for a WhirlpoolConfig",
"Protocol fee rate is represented as a basis point.",
"Only the current fee authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"fee_authority\" - Set authority that can modify pool fees in the WhirlpoolConfig",
"",
"### Parameters",
"- `default_protocol_fee_rate` - Rate that is referenced during the initialization of a Whirlpool using this config.",
"",
"#### Special Errors",
"- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": true;
"isSigner": false;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
}
];
"args": [
{
"name": "defaultProtocolFeeRate";
"type": "u16";
}
];
},
{
"name": "setFeeRate";
"docs": [
"Sets the fee rate for a Whirlpool.",
"Fee rate is represented as hundredths of a basis point.",
"Only the current fee authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"fee_authority\" - Set authority that can modify pool fees in the WhirlpoolConfig",
"",
"### Parameters",
"- `fee_rate` - The rate that the pool will use to calculate fees going onwards.",
"",
"#### Special Errors",
"- `FeeRateMaxExceeded` - If the provided fee_rate exceeds MAX_FEE_RATE."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
}
];
"args": [
{
"name": "feeRate";
"type": "u16";
}
];
},
{
"name": "setProtocolFeeRate";
"docs": [
"Sets the protocol fee rate for a Whirlpool.",
"Protocol fee rate is represented as a basis point.",
"Only the current fee authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"fee_authority\" - Set authority that can modify pool fees in the WhirlpoolConfig",
"",
"### Parameters",
"- `protocol_fee_rate` - The rate that the pool will use to calculate protocol fees going onwards.",
"",
"#### Special Errors",
"- `ProtocolFeeRateMaxExceeded` - If the provided default_protocol_fee_rate exceeds MAX_PROTOCOL_FEE_RATE."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
}
];
"args": [
{
"name": "protocolFeeRate";
"type": "u16";
}
];
},
{
"name": "setFeeAuthority";
"docs": [
"Sets the fee authority for a WhirlpoolConfig.",
"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.",
"",
"### Authority",
"- \"fee_authority\" - Set authority that can modify pool fees in the WhirlpoolConfig"
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": true;
"isSigner": false;
},
{
"name": "feeAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "newFeeAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "setCollectProtocolFeesAuthority";
"docs": [
"Sets the fee authority to collect protocol fees for a WhirlpoolConfig.",
"Only the current collect protocol fee authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"fee_authority\" - Set authority that can collect protocol fees in the WhirlpoolConfig"
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": true;
"isSigner": false;
},
{
"name": "collectProtocolFeesAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "newCollectProtocolFeesAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "setRewardAuthority";
"docs": [
"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.",
"",
"### Authority",
"- \"reward_authority\" - Set authority that can control reward emission for this particular reward.",
"",
"#### 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."
];
"accounts": [
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "newRewardAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "rewardIndex";
"type": "u8";
}
];
},
{
"name": "setRewardAuthorityBySuperAuthority";
"docs": [
"Set the whirlpool reward authority at the provided `reward_index`.",
"Only the current reward super authority has permission to invoke this instruction.",
"",
"### Authority",
"- \"reward_authority\" - Set authority that can control reward emission for this particular reward.",
"",
"#### 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."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": false;
"isSigner": false;
},
{
"name": "whirlpool";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardEmissionsSuperAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "newRewardAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "rewardIndex";
"type": "u8";
}
];
},
{
"name": "setRewardEmissionsSuperAuthority";
"docs": [
"Set the whirlpool reward super authority for a WhirlpoolConfig",
"Only the current reward super authority has permission to invoke this instruction.",
"This instruction will not change the authority on any `WhirlpoolRewardInfo` whirlpool rewards.",
"",
"### Authority",
"- \"reward_emissions_super_authority\" - Set authority that can control reward authorities for all pools in this config space."
];
"accounts": [
{
"name": "whirlpoolsConfig";
"isMut": true;
"isSigner": false;
},
{
"name": "rewardEmissionsSuperAuthority";
"isMut": false;
"isSigner": true;
},
{
"name": "newRewardEmissionsSuperAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "twoHopSwap";
"docs": [
"Perform a two-hop swap in this Whirlpool",
"",
"### Authority",
"- \"token_authority\" - The authority to withdraw tokens from the input token account.",
"",
"### Parameters",
"- `amount` - The amount of input or output token to swap from (depe