Skip to content

Commit

Permalink
fix(wallet): swap for proofs with conditons in send
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed May 13, 2024
1 parent 2671c92 commit 91e1823
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions crates/cdk/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,14 +730,16 @@ impl Wallet {
) -> Result<String, Error> {
let input_proofs = self.select_proofs(mint_url.clone(), unit, amount).await?;

let send_proofs = match input_proofs
.iter()
.map(|p| p.amount)
.sum::<Amount>()
.eq(&amount)
{
true => Some(input_proofs),
false => {
let send_proofs = match (
input_proofs
.iter()
.map(|p| p.amount)
.sum::<Amount>()
.eq(&amount),
&conditions,
) {
(true, None) => Some(input_proofs),
_ => {
self.swap(mint_url, unit, Some(amount), input_proofs, conditions)
.await?
}
Expand Down

0 comments on commit 91e1823

Please sign in to comment.