mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-08 22:55:54 +01:00
Return total received amount
This commit is contained in:
@@ -921,7 +921,7 @@ impl Wallet {
|
||||
encoded_token: &str,
|
||||
signing_keys: Option<Vec<SigningKey>>,
|
||||
preimages: Option<Vec<String>>,
|
||||
) -> Result<(), Error> {
|
||||
) -> Result<Amount, Error> {
|
||||
let token_data = Token::from_str(encoded_token)?;
|
||||
|
||||
let unit = token_data.unit.unwrap_or_default();
|
||||
@@ -1050,11 +1050,13 @@ impl Wallet {
|
||||
mint_proofs.extend(p);
|
||||
}
|
||||
|
||||
let mut total_amount = Amount::ZERO;
|
||||
for (mint, proofs) in received_proofs {
|
||||
total_amount += proofs.iter().map(|p| p.amount).sum();
|
||||
self.localstore.add_proofs(mint, proofs).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(total_amount)
|
||||
}
|
||||
|
||||
#[instrument(skip(self, proofs), fields(mint_url = %mint_url))]
|
||||
|
||||
Reference in New Issue
Block a user