Skip to content

Commit

Permalink
fix: consider only LBTC when calculating wallet balance
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse committed Dec 25, 2024
1 parent 6782e8b commit cb52298
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/core/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,17 @@ impl LiquidSdk {
let transactions = self.onchain_wallet.transactions().await?;
let wallet_amount_sat = transactions
.into_iter()
.map(|tx| tx.balance.values().sum::<i64>())
.map(|tx| {
tx.balance
.into_iter()
.filter_map(|(asset_id, balance)| {
if asset_id == lwk_wollet::elements::AssetId::LIQUID_BTC {
return Some(balance);
}
None
})
.sum::<i64>()
})
.sum::<i64>();
debug!("Onchain wallet balance: {wallet_amount_sat} sats");

Expand Down

0 comments on commit cb52298

Please sign in to comment.