fix: sync all protocol structures with latest IDL definitions

This commit fixes multiple critical issues found when comparing SDK structures
with the official IDL repository (https://github.com/0xfnzero/solana-program-idls):

1. PumpSwap GlobalConfig
   - Add missing reserved_fee_recipients: [Pubkey; 7] field
   - Update GLOBAL_CONFIG_SIZE constant

2. PumpFun Global
   - Add missing reserved_fee_recipients: [Pubkey; 7] field
   - Update GLOBAL_SIZE constant

3. Raydium CPMM AmmConfig
   - Add missing creator_fee_rate: u64 field
   - Adjust padding from [u64; 16] to [u64; 15]

4. Raydium CPMM PoolState
   - Add creator_fee_on: u8 field
   - Add enable_creator_fee: bool field
   - Add padding1: [u8; 6] field
   - Add creator_fees_token_0: u64 field
   - Add creator_fees_token_1: u64 field
   - Adjust padding from [u64; 31] to [u64; 28]

5. Bonk (Raydium Launchpad) PoolState
   - Add AmmCreatorFeeOn enum with borsh discriminant support
   - Add token_program_flag: u8 field
   - Add amm_creator_fee_on: AmmCreatorFeeOn field
   - Add platform_vesting_share: u64 field
   - Fix padding from [u64; 8] to [u8; 54] with serde_big_array
   - Update POOL_STATE_SIZE constant

6. Bonk (Raydium Launchpad) PlatformConfig
   - Add BondingCurveParam and PlatformCurveParam structures
   - Fix name from Vec<u8> to [u8; 64] with serde_big_array
   - Fix web from Vec<u8> to [u8; 256] with serde_big_array
   - Fix img from Vec<u8> to [u8; 256] with serde_big_array
   - Add cpswap_config: Pubkey field
   - Add creator_fee_rate: u64 field
   - Add transfer_fee_extension_auth: Pubkey field
   - Add platform_vesting_wallet: Pubkey field
   - Add platform_vesting_scale: u64 field
   - Add platform_cp_creator: Pubkey field
   - Fix padding from Vec<u8> to [u8; 108] with serde_big_array
   - Add curve_params: Vec<PlatformCurveParam> field
   - Update PLATFORM_CONFIG_SIZE constant

7. PumpSwap buy_exact_quote_in parameter order bug
   - Create separate parse_buy_exact_quote_in_instruction function
   - Fix parameter parsing order: spendable_quote_in (SOL) first, then min_base_amount_out (token)
   - Previous bug: buy_exact_quote_in incorrectly reused parse_buy_instruction which has reversed parameter order
   - Add detailed comments explaining the parameter order difference

All changes have been verified against the official IDL files and compile successfully.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Wood
2026-01-23 15:40:26 +08:00
co-authored by Claude Sonnet 4.5
parent 6969d15f08
commit ce2931046d
5 changed files with 193 additions and 15 deletions
@@ -77,9 +77,10 @@ pub struct Global {
pub whitelist_pda: Pubkey,
pub reserved_fee_recipient: Pubkey,
pub mayhem_mode_enabled: bool,
pub reserved_fee_recipients: [Pubkey; 7],
}
pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1;
pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1 + 32 * 7;
pub fn global_decode(data: &[u8]) -> Option<Global> {
if data.len() < GLOBAL_SIZE {