Browse Source

lightwallet tbalance

mempool
Jonathan "Duke" Leto 2 years ago
parent
commit
04eb253704
  1. 18
      lib/src/lightwallet.rs

18
lib/src/lightwallet.rs

@ -1089,16 +1089,16 @@ impl LightWallet {
.collect::<Vec<Utxo>>() .collect::<Vec<Utxo>>()
} }
pub fn tbalance(&self, addr: Option<String>) -> u64 { pub async fn tbalance(&self, addr: Option<String>) -> u64 {
self.get_utxos().iter() self.get_utxos()
.filter(|utxo| { .await
match addr.clone() { .iter()
Some(a) => utxo.address == a, .filter(|utxo| match addr.as_ref() {
None => true, Some(a) => utxo.address == *a,
} None => true,
}) })
.map(|utxo| utxo.value ) .map(|utxo| utxo.value)
.sum::<u64>() as u64 .sum::<u64>()
} }
pub fn verified_zbalance(&self, addr: Option<String>) -> u64 { pub fn verified_zbalance(&self, addr: Option<String>) -> u64 {

Loading…
Cancel
Save