From e23b6e49b813f937454642c7133c34474f5ac52c Mon Sep 17 00:00:00 2001 From: thrishank Date: Wed, 25 Jun 2025 00:26:46 +0530 Subject: [PATCH 1/3] fix typo --- jup-ag-sdk/src/types/swap_transaction.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jup-ag-sdk/src/types/swap_transaction.rs b/jup-ag-sdk/src/types/swap_transaction.rs index fc5f0d5..48cf989 100644 --- a/jup-ag-sdk/src/types/swap_transaction.rs +++ b/jup-ag-sdk/src/types/swap_transaction.rs @@ -68,7 +68,7 @@ pub struct SwapRequest { /// When enabled, it estimates slippage and apply it in the swap transaction directly, overwriting the slippageBps parameter in the quote response. /// Used together with dynamicSlippage in /quote, otherwise the slippage used will be the one in the /quote's slippageBps #[serde(skip_serializing_if = "Option::is_none")] - pub dyanmic_slippage: Option, + pub dynamic_slippage: Option, /// To use an exact compute unit price to calculate priority fee /// computeUnitLimit (1400000) * computeUnitPriceMicroLamports @@ -143,7 +143,7 @@ impl SwapRequest { destination_token_account: None, dynamic_compute_unit_limit: None, skip_user_account_rpc_calls: None, - dyanmic_slippage: None, + dynamic_slippage: None, compute_unit_price_micro_lamports: None, blockhash_slots_to_expiry: None, quote_response: quote, @@ -245,8 +245,8 @@ impl SwapRequest { /// Enables dynamic slippage estimation. /// /// If enabled, slippage will be recalculated at swap-time instead of using a fixed value. - pub fn dyanmic_slippage(mut self, dynamic: bool) -> Self { - self.dyanmic_slippage = Some(dynamic); + pub fn dynamic_slippage(mut self, dynamic: bool) -> Self { + self.dynamic_slippage = Some(dynamic); self } From a31a7a6da875bfcea88f512563f7e986df71bf98 Mon Sep 17 00:00:00 2001 From: thrishank Date: Wed, 25 Jun 2025 00:52:46 +0530 Subject: [PATCH 2/3] fix: priority fee lamports struct --- jup-ag-sdk/src/types/swap_transaction.rs | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/jup-ag-sdk/src/types/swap_transaction.rs b/jup-ag-sdk/src/types/swap_transaction.rs index 48cf989..aaa9e1a 100644 --- a/jup-ag-sdk/src/types/swap_transaction.rs +++ b/jup-ag-sdk/src/types/swap_transaction.rs @@ -84,8 +84,11 @@ pub struct SwapRequest { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PrioritizationFeeLamports { + #[serde(skip_serializing_if = "Option::is_none")] pub jito_tip_lamports: Option, - pub priority_level_with_max_lamports: PriorityLevelWithMaxLamports, + + #[serde(skip_serializing_if = "Option::is_none")] + pub priority_level_with_max_lamports: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -184,30 +187,36 @@ impl SwapRequest { } /// Set prioritization fee lamports + /// + /// Note: + /// - Cannot be combined with `priority_level_with_max_lamports`. pub fn prioritization_fee_jito_tip(mut self, fee: u64) -> Self { self.prioritization_fee_lamports = Some(PrioritizationFeeLamports { jito_tip_lamports: Some(fee), - priority_level_with_max_lamports: PriorityLevelWithMaxLamports { - max_lamports: 0, - priority_level: PriorityLevel::Medium, - }, + priority_level_with_max_lamports: None, }); self } - /// set prioritization config + /// Sets a priority fee configuration based on estimated network congestion + /// + /// Allows specifying both: + /// - Priority level (e.g., `medium`, `high`) + /// - Maximum cap on lamports paid + /// + /// Note: + /// - Cannot be combined with `jito_tip_lamports`. pub fn prioritization_fee_config( mut self, - jito_tip: Option, max_lamports: u32, priority_level: PriorityLevel, ) -> Self { self.prioritization_fee_lamports = Some(PrioritizationFeeLamports { - jito_tip_lamports: jito_tip, - priority_level_with_max_lamports: PriorityLevelWithMaxLamports { + jito_tip_lamports: None, + priority_level_with_max_lamports: Some(PriorityLevelWithMaxLamports { max_lamports, priority_level, - }, + }), }); self } From d1ad3ba72ee672c4a9b72be8c07e192f829e0d92 Mon Sep 17 00:00:00 2001 From: thrishank Date: Wed, 25 Jun 2025 01:04:12 +0530 Subject: [PATCH 3/3] update doc --- jup-ag-sdk/src/types/swap_transaction.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jup-ag-sdk/src/types/swap_transaction.rs b/jup-ag-sdk/src/types/swap_transaction.rs index aaa9e1a..211d7c3 100644 --- a/jup-ag-sdk/src/types/swap_transaction.rs +++ b/jup-ag-sdk/src/types/swap_transaction.rs @@ -81,6 +81,8 @@ pub struct SwapRequest { pub quote_response: QuoteResponse, } +/// Only one of these fields should be set at a time. +/// Use either `jito_tip_lamports` or `priority_level_with_max_lamports`, not both. #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PrioritizationFeeLamports { @@ -187,9 +189,6 @@ impl SwapRequest { } /// Set prioritization fee lamports - /// - /// Note: - /// - Cannot be combined with `priority_level_with_max_lamports`. pub fn prioritization_fee_jito_tip(mut self, fee: u64) -> Self { self.prioritization_fee_lamports = Some(PrioritizationFeeLamports { jito_tip_lamports: Some(fee), @@ -203,9 +202,6 @@ impl SwapRequest { /// Allows specifying both: /// - Priority level (e.g., `medium`, `high`) /// - Maximum cap on lamports paid - /// - /// Note: - /// - Cannot be combined with `jito_tip_lamports`. pub fn prioritization_fee_config( mut self, max_lamports: u32,