diff --git a/Cargo.toml b/Cargo.toml index f26d9db..7fada4e 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "0.5.2" +version = "0.5.3" edition = "2021" authors = [ "William ", diff --git a/README.md b/README.md index 167b404..752c5f4 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.2" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.3" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "0.5.2" +sol-trade-sdk = "0.5.3" ``` ## Usage Examples diff --git a/README_CN.md b/README_CN.md index 8f6f941..2ae032a 100755 --- a/README_CN.md +++ b/README_CN.md @@ -33,14 +33,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.2" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.5.3" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "0.5.2" +sol-trade-sdk = "0.5.3" ``` ## 使用示例 diff --git a/src/constants/pumpfun.rs b/src/constants/pumpfun.rs index 79677bb..057ae9c 100755 --- a/src/constants/pumpfun.rs +++ b/src/constants/pumpfun.rs @@ -32,6 +32,8 @@ pub mod seeds { /// Seed for global volume accumulator PDAs pub const GLOBAL_VOLUME_ACCUMULATOR_SEED: &[u8] = b"global_volume_accumulator"; + + pub const FEE_CONFIG_SEED: &[u8] = b"fee_config"; } pub mod global_constants { @@ -108,6 +110,8 @@ pub mod accounts { pub const RENT: Pubkey = pubkey!("SysvarRent111111111111111111111111111111111"); pub const AMM_PROGRAM: Pubkey = pubkey!("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"); + + pub const FEE_PROGRAM: Pubkey = pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"); } pub struct Symbol; diff --git a/src/instruction/pumpfun.rs b/src/instruction/pumpfun.rs index 498e993..23f31ee 100755 --- a/src/instruction/pumpfun.rs +++ b/src/instruction/pumpfun.rs @@ -8,7 +8,7 @@ use spl_token::instruction::close_account; use crate::{ constants, trading::pumpfun::common::{ - get_bonding_curve_pda, get_global_volume_accumulator_pda, get_user_volume_accumulator_pda, + get_bonding_curve_pda, get_fee_config_pda, get_global_volume_accumulator_pda, get_user_volume_accumulator_pda }, utils::calc::{ common::{calculate_with_slippage_buy, calculate_with_slippage_sell}, @@ -209,6 +209,8 @@ pub fn buy( AccountMeta::new_readonly(constants::pumpfun::accounts::PUMPFUN, false), AccountMeta::new(get_global_volume_accumulator_pda().unwrap(), false), AccountMeta::new(get_user_volume_accumulator_pda(&payer.pubkey()).unwrap(), false), + AccountMeta::new_readonly(get_fee_config_pda().unwrap(), false), + AccountMeta::new_readonly(constants::pumpfun::accounts::FEE_PROGRAM, false), ], ) } @@ -237,8 +239,8 @@ pub fn sell( AccountMeta::new_readonly(constants::pumpfun::accounts::TOKEN_PROGRAM, false), AccountMeta::new_readonly(constants::pumpfun::accounts::EVENT_AUTHORITY, false), AccountMeta::new_readonly(constants::pumpfun::accounts::PUMPFUN, false), - AccountMeta::new(get_global_volume_accumulator_pda().unwrap(), false), - AccountMeta::new(get_user_volume_accumulator_pda(&payer.pubkey()).unwrap(), false), + AccountMeta::new_readonly(get_fee_config_pda().unwrap(), false), + AccountMeta::new_readonly(constants::pumpfun::accounts::FEE_PROGRAM, false), ], ) } diff --git a/src/trading/pumpfun/common.rs b/src/trading/pumpfun/common.rs index 429816a..19c723a 100755 --- a/src/trading/pumpfun/common.rs +++ b/src/trading/pumpfun/common.rs @@ -73,6 +73,17 @@ pub fn get_global_volume_accumulator_pda() -> Option { pda.map(|pubkey| pubkey.0) } +#[inline] +pub fn get_fee_config_pda() -> Option { + let seeds: &[&[u8]; 2] = &[ + constants::pumpfun::seeds::FEE_CONFIG_SEED, + constants::pumpfun::accounts::PUMPFUN.as_ref(), + ]; + let program_id: &Pubkey = &constants::pumpfun::accounts::FEE_PROGRAM; + let pda: Option<(Pubkey, u8)> = Pubkey::try_find_program_address(seeds, program_id); + pda.map(|pubkey| pubkey.0) +} + #[inline] pub fn get_metadata_pda(mint: &Pubkey) -> Pubkey { Pubkey::find_program_address(