feat: add Raydium CLMM protocol support, bump version to 0.2.1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signer::Signer};
|
||||
use spl_associated_token_account::instruction::create_associated_token_account_idempotent;
|
||||
use spl_token::instruction::close_account;
|
||||
|
||||
use crate::{
|
||||
constants::pumpswap::{accounts, BUY_DISCRIMINATOR, SELL_DISCRIMINATOR},
|
||||
@@ -361,6 +362,24 @@ impl PumpSwapInstructionBuilder {
|
||||
data,
|
||||
});
|
||||
|
||||
let protocol_params = params
|
||||
.protocol_params
|
||||
.as_any()
|
||||
.downcast_ref::<PumpSwapParams>()
|
||||
.ok_or_else(|| anyhow!("Invalid protocol params for PumpSwap"))?;
|
||||
|
||||
if protocol_params.auto_handle_wsol {
|
||||
instructions.push(
|
||||
close_account(
|
||||
&accounts::TOKEN_PROGRAM,
|
||||
&user_quote_token_account,
|
||||
¶ms.payer.pubkey(),
|
||||
¶ms.payer.pubkey(),
|
||||
&[¶ms.payer.pubkey()],
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
Ok(instructions)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user