diff --git a/src/common/mod.rs b/src/common/mod.rs old mode 100644 new mode 100755 diff --git a/src/lib.rs b/src/lib.rs index db5bbcc..157ac8b 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,12 +20,13 @@ use solana_sdk::{ }; use spl_associated_token_account::{ get_associated_token_address, - create_associated_token_account, + instruction::create_associated_token_account, }; use common::logs_subscribe; use common::logs_subscribe::SubscriptionHandle; use common::logs_events::DexEvent; +use spl_token::instruction::close_account; use std::sync::Arc; use std::time::Instant; @@ -167,6 +168,7 @@ impl PumpFun { &self.payer.pubkey(), &self.payer.pubkey(), &mint.pubkey(), + &constants::accounts::TOKEN_PROGRAM, )); } @@ -217,6 +219,7 @@ impl PumpFun { &self.payer.pubkey(), &self.payer.pubkey(), mint, + &constants::accounts::TOKEN_PROGRAM, )); } @@ -271,6 +274,7 @@ impl PumpFun { &self.payer.pubkey(), &self.payer.pubkey(), mint, + &constants::accounts::TOKEN_PROGRAM, )); } @@ -346,6 +350,14 @@ impl PumpFun { }, )); + instructions.push(close_account( + &spl_token::ID, + &ata, + &self.payer.pubkey(), + &self.payer.pubkey(), + &[&self.payer.pubkey()], + ).unwrap()); + let recent_blockhash = self.rpc.get_latest_blockhash()?; let transaction = Transaction::new_signed_with_payer( &instructions, @@ -451,6 +463,14 @@ impl PumpFun { }, )); + instructions.push(close_account( + &spl_token::ID, + &ata, + &self.payer.pubkey(), + &self.payer.pubkey(), + &[&self.payer.pubkey()], + ).unwrap()); + instructions.push( system_instruction::transfer( &self.payer.pubkey(),