From 3104efed795da1acc1aea628df6ea6d3de32a9cf Mon Sep 17 00:00:00 2001 From: Ignacio Amigo Date: Fri, 17 Jul 2026 18:15:11 -0300 Subject: [PATCH] refactor: reduce full fetches --- crates/rust-client/src/account/mod.rs | 4 ++-- crates/rust-client/src/transaction/mod.rs | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/rust-client/src/account/mod.rs b/crates/rust-client/src/account/mod.rs index 6b934c59c..ce7552d85 100644 --- a/crates/rust-client/src/account/mod.rs +++ b/crates/rust-client/src/account/mod.rs @@ -286,7 +286,7 @@ impl Client { } } - let tracked_account = self.store.get_account(account.id()).await?; + let tracked_account = self.store.get_minimal_partial_account(account.id()).await?; match tracked_account { None => { @@ -467,7 +467,7 @@ impl Client { return Err(ClientError::AddressAlreadyTracked(address_bench32)); } - let tracked_account = self.store.get_account(account_id).await?; + let tracked_account = self.store.get_minimal_partial_account(account_id).await?; match tracked_account { None => Err(ClientError::AccountDataNotFound(account_id)), Some(tracked_account) => { diff --git a/crates/rust-client/src/transaction/mod.rs b/crates/rust-client/src/transaction/mod.rs index 048e7a330..d0326c895 100644 --- a/crates/rust-client/src/transaction/mod.rs +++ b/crates/rust-client/src/transaction/mod.rs @@ -367,7 +367,6 @@ where account: &Account, transaction_request: TransactionRequest, ) -> Result { - let account_id = account.id(); self.validate_recency().await?; validate_account_request(&transaction_request, account)?; @@ -400,7 +399,6 @@ where let future_notes: Vec<(NoteDetails, NoteTag)> = transaction_request.expected_future_notes().cloned().collect(); - let account = self.try_get_account(account_id).await?; let tx_script = transaction_request.build_transaction_script(&account.code_interface())?; let foreign_accounts = transaction_request.foreign_accounts().clone(); @@ -797,18 +795,16 @@ where self.get_sync_height().await? }; - let account_record = self + let account_code = self .store - .get_account(account_id) + .get_account_code(account_id) .await? .ok_or(ClientError::AccountDataNotFound(account_id))?; - let account: Account = account_record.try_into()?; - let data_store = ClientDataStore::new(self.store.clone(), self.rpc_api.clone()); // Ensure code is loaded on MAST store - data_store.mast_store().load_account_code(account.code()); + data_store.mast_store().load_account_code(&account_code); for fpi_account in &foreign_account_inputs { data_store.mast_store().load_account_code(fpi_account.code());