diff --git a/src/bin/sys.rs b/src/bin/sys.rs index 0c43d0b..5b3a813 100644 --- a/src/bin/sys.rs +++ b/src/bin/sys.rs @@ -1024,6 +1024,7 @@ async fn process_jup_swap( ui_amount: Option, slippage_bps: u64, lot_selection_method: LotSelectionMethod, + lot_numbers: Option>, signers: T, existing_signature: Option, if_from_balance_exceeds: Option, @@ -1051,6 +1052,7 @@ async fn process_jup_swap( to_token, to_token_price, lot_selection_method, + lot_numbers, )?; } else { let amount = match ui_amount { @@ -1228,6 +1230,7 @@ async fn process_jup_swap( to_token, to_token_price, lot_selection_method, + lot_numbers, )?; if !send_transaction_until_expired(rpc_clients, &transaction, last_valid_block_height) @@ -5287,6 +5290,7 @@ async fn main() -> Result<(), Box> { price exceeds this percentage"), ) .arg(lot_selection_arg()) + .arg(lot_numbers_arg()) .arg( Arg::with_name("transaction") .long("transaction") @@ -6471,6 +6475,7 @@ async fn main() -> Result<(), Box> { let address = address.expect("address"); let lot_selection_method = value_t_or_exit!(arg_matches, "lot_selection", LotSelectionMethod); + let lot_numbers = lot_numbers_of(arg_matches, "lot_numbers"); let signature = value_t!(arg_matches, "transaction", Signature).ok(); let if_from_balance_exceeds = value_t!(arg_matches, "if_from_balance_exceeds", f64) .ok() @@ -6488,6 +6493,7 @@ async fn main() -> Result<(), Box> { ui_amount, slippage_bps, lot_selection_method, + lot_numbers, vec![signer], signature, if_from_balance_exceeds, diff --git a/src/db.rs b/src/db.rs index 1638d75..c17c97f 100644 --- a/src/db.rs +++ b/src/db.rs @@ -157,6 +157,7 @@ pub struct PendingSwap { pub to_token_price: Decimal, pub lot_selection_method: LotSelectionMethod, + pub lot_numbers: Option>, } #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] @@ -909,6 +910,7 @@ impl Db { to_token: MaybeToken, to_token_price: Decimal, lot_selection_method: LotSelectionMethod, + lot_numbers: Option>, ) -> DbResult<()> { let _ = self .get_account(address, from_token) @@ -923,6 +925,7 @@ impl Db { to_token, to_token_price, lot_selection_method, + lot_numbers, }); self.save() } @@ -940,6 +943,7 @@ impl Db { to_token, to_token_price, lot_selection_method, + lot_numbers, .. } = self .data @@ -962,7 +966,8 @@ impl Db { self.auto_save(false)?; if let Some((when, from_amount, to_amount)) = success { - let lots = from_account.extract_lots(self, from_amount, lot_selection_method, None)?; + let lots = + from_account.extract_lots(self, from_amount, lot_selection_method, lot_numbers)?; let to_amount_over_from_amount = to_amount as f64 / from_amount as f64; for lot in lots { diff --git a/src/vendor/kamino/fraction.rs b/src/vendor/kamino/fraction.rs index 96ee7da..c880d6b 100644 --- a/src/vendor/kamino/fraction.rs +++ b/src/vendor/kamino/fraction.rs @@ -294,6 +294,7 @@ impl TryFrom for U128 { } } +#[allow(dead_code)] pub struct FractionDisplay<'a>(&'a Fraction); impl Display for FractionDisplay<'_> {