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) ); 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..1877a6020 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 @@ -956,17 +956,10 @@ 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 - } - - 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, @@ -984,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() }