From 6818f234ca936080a106f2d093871b99e9c0527d Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Thu, 4 Apr 2024 22:26:41 +0000 Subject: [PATCH 1/4] remove references to extra functions --- zingolib/src/lightclient/describe.rs | 22 ++++++++++++++++------ zingolib/src/wallet.rs | 9 ++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index b8552eea4..333397575 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -1,5 +1,7 @@ /// These functions can be called by consumer to learn about the LightClient. use json::{object, JsonValue}; +use orchard::note_encryption::OrchardDomain; +use sapling_crypto::note_encryption::SaplingDomain; use std::collections::HashMap; use tokio::runtime::Runtime; @@ -50,14 +52,22 @@ impl LightClient { pub async fn do_balance(&self) -> PoolBalances { PoolBalances { - sapling_balance: self.wallet.maybe_verified_sapling_balance(None).await, - verified_sapling_balance: self.wallet.verified_sapling_balance(None).await, + sapling_balance: self + .wallet + .shielded_balance::(None, &[]) + .await, + verified_sapling_balance: self.wallet.verified_balance::(None).await, spendable_sapling_balance: self.wallet.spendable_sapling_balance(None).await, - unverified_sapling_balance: self.wallet.unverified_sapling_balance(None).await, - orchard_balance: self.wallet.maybe_verified_orchard_balance(None).await, - verified_orchard_balance: self.wallet.verified_orchard_balance(None).await, + unverified_sapling_balance: self.wallet.unverified_balance::(None).await, + + orchard_balance: self + .wallet + .shielded_balance::(None, &[]) + .await, + verified_orchard_balance: self.wallet.verified_balance::(None).await, spendable_orchard_balance: self.wallet.spendable_orchard_balance(None).await, - unverified_orchard_balance: self.wallet.unverified_orchard_balance(None).await, + unverified_orchard_balance: self.wallet.unverified_balance::(None).await, + transparent_balance: self.wallet.tbalance(None).await, } } diff --git a/zingolib/src/wallet.rs b/zingolib/src/wallet.rs index 4f6cba145..30ed437d2 100644 --- a/zingolib/src/wallet.rs +++ b/zingolib/src/wallet.rs @@ -844,7 +844,7 @@ impl LightWallet { } #[allow(clippy::type_complexity)] - async fn shielded_balance( + pub async fn shielded_balance( &self, target_addr: Option, filters: &[Box bool + '_>], @@ -936,7 +936,7 @@ impl LightWallet { self.transaction_context.transaction_metadata_set.clone() } - async fn unverified_balance( + pub async fn unverified_balance( &self, target_addr: Option, ) -> Option @@ -966,7 +966,10 @@ impl LightWallet { self.unverified_balance::(target_addr).await } - async fn verified_balance(&self, target_addr: Option) -> Option + pub async fn verified_balance( + &self, + target_addr: Option, + ) -> Option where ::Recipient: Recipient, ::Note: PartialEq + Clone, From df6a2f6ddfb1660c388899e4f4c542faebee66cb Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Fri, 5 Apr 2024 15:28:00 +0000 Subject: [PATCH 2/4] remove unused functions --- zingolib/src/wallet.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/zingolib/src/wallet.rs b/zingolib/src/wallet.rs index 30ed437d2..833a92baa 100644 --- a/zingolib/src/wallet.rs +++ b/zingolib/src/wallet.rs @@ -956,16 +956,6 @@ impl LightWallet { self.shielded_balance::(target_addr, filters).await } - pub async fn unverified_orchard_balance(&self, target_addr: Option) -> Option { - self.unverified_balance::(target_addr).await - } - - /// The following functions use a filter/map functional approach to - /// expressively unpack different kinds of transaction data. - pub async fn unverified_sapling_balance(&self, target_addr: Option) -> Option { - self.unverified_balance::(target_addr).await - } - pub async fn verified_balance( &self, target_addr: Option, From 69f108f641af3d48e1c84d57449fd82076b1d10f Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Fri, 5 Apr 2024 15:29:47 +0000 Subject: [PATCH 3/4] removed reference to extra function --- integration-tests/tests/integrations.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/integration-tests/tests/integrations.rs b/integration-tests/tests/integrations.rs index 78bbe67d4..4f68ad87f 100644 --- a/integration-tests/tests/integrations.rs +++ b/integration-tests/tests/integrations.rs @@ -642,6 +642,7 @@ mod fast { } } mod slow { + use orchard::note_encryption::OrchardDomain; use zcash_primitives::consensus::NetworkConstants; use super::*; @@ -1359,7 +1360,10 @@ mod slow { Some(expected_funds) ); assert_eq!( - recipient.wallet.verified_orchard_balance(None).await, + recipient + .wallet + .verified_balance::(None) + .await, Some(0) ); From 914749e4c41901d5b298c8bd14eb3e240b61a7ab Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Fri, 5 Apr 2024 15:31:18 +0000 Subject: [PATCH 4/4] remove unused functions --- zingolib/src/wallet.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/zingolib/src/wallet.rs b/zingolib/src/wallet.rs index 833a92baa..1877a6020 100644 --- a/zingolib/src/wallet.rs +++ b/zingolib/src/wallet.rs @@ -977,14 +977,6 @@ impl LightWallet { self.shielded_balance::(target_addr, filters).await } - pub async fn verified_orchard_balance(&self, target_addr: Option) -> Option { - self.verified_balance::(target_addr).await - } - - pub async fn verified_sapling_balance(&self, target_addr: Option) -> Option { - self.verified_balance::(target_addr).await - } - pub fn wallet_capability(&self) -> Arc { self.transaction_context.key.clone() }