change unit_price, unit_limit to uint

This commit is contained in:
William
2025-02-21 23:13:28 +08:00
parent 12ddfe4dc0
commit ec0b4e4981
5 changed files with 19 additions and 21 deletions
+4 -6
View File
@@ -17,8 +17,8 @@ lazy_static::lazy_static! {
#[derive(Debug, Deserialize, Clone, Copy, PartialEq)]
pub struct PriorityFee {
pub unit_limit: f64,
pub unit_price: f64,
pub unit_limit: u32,
pub unit_price: u64,
pub buy_jito_fee: f64,
pub sell_jito_fee: f64,
}
@@ -67,10 +67,8 @@ pub async fn transfer_sol(rpc: &RpcClient, payer: &Keypair, receive_wallet: &Pub
#[inline]
pub fn create_priority_fee_instructions(priority_fee: PriorityFee) -> Vec<Instruction> {
let mut instructions = Vec::with_capacity(2);
let unit_limit = sol_to_lamports(priority_fee.unit_limit);
let unit_price = sol_to_lamports(priority_fee.unit_price);
instructions.push(ComputeBudgetInstruction::set_compute_unit_limit(unit_limit as u32));
instructions.push(ComputeBudgetInstruction::set_compute_unit_price(unit_price));
instructions.push(ComputeBudgetInstruction::set_compute_unit_limit(priority_fee.unit_limit));
instructions.push(ComputeBudgetInstruction::set_compute_unit_price(priority_fee.unit_price));
instructions
}