feat(pumpswap): enhance PumpSwap trading functionality and logs parsing system
- Expand buy/sell trading logic with optimized execution flow - Improve logs data structures and parser performance - Enhance common utilities and pool management features - Refactor main program architecture for better maintainability - Update library export interfaces with improved API design
This commit is contained in:
@@ -64,3 +64,22 @@ pub async fn get_sell_sol_amount(
|
||||
let pool_data = crate::pumpswap::pool::Pool::fetch(rpc, pool).await?;
|
||||
pool_data.calculate_sell_amount(rpc, token_amount).await
|
||||
}
|
||||
|
||||
pub(crate) fn coin_creator_vault_authority(coin_creator: Pubkey) -> Pubkey {
|
||||
let (pump_pool_authority, _) = Pubkey::find_program_address(
|
||||
&[b"creator_vault", &coin_creator.to_bytes()],
|
||||
&crate::constants::pumpswap::accounts::AMM_PROGRAM,
|
||||
);
|
||||
pump_pool_authority
|
||||
}
|
||||
|
||||
pub(crate) fn coin_creator_vault_ata(coin_creator: Pubkey) -> Pubkey {
|
||||
let creator_vault_authority = coin_creator_vault_authority(coin_creator);
|
||||
let associated_token_creator_vault_authority =
|
||||
spl_associated_token_account::get_associated_token_address_with_program_id(
|
||||
&creator_vault_authority,
|
||||
&crate::constants::pumpswap::accounts::WSOL_TOKEN_ACCOUNT,
|
||||
&crate::constants::pumpswap::accounts::TOKEN_PROGRAM,
|
||||
);
|
||||
associated_token_creator_vault_authority
|
||||
}
|
||||
Reference in New Issue
Block a user