Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/bloc/coins_bloc/coins_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ class CoinsBloc extends Bloc<CoinsEvent, CoinsState> {
await emit.forEach(
coinUpdateStream,
onData: (Coin coin) {
if (!state.walletCoins.containsKey(coin.abbr)) {
final key = coin.id.id;
if (!state.walletCoins.containsKey(key)) {
_log.warning(
'Coin ${coin.abbr} not found in wallet coins, skipping update',
);
return state;
}
return state.copyWith(
walletCoins: {...state.walletCoins, coin.id.id: coin},
coins: {...state.coins, coin.id.id: coin},
walletCoins: {...state.walletCoins, key: coin},
coins: {...state.coins, key: coin},
);
},
);
Expand Down
8 changes: 7 additions & 1 deletion lib/bloc/coins_bloc/coins_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,16 @@ class CoinsRepo {
spendable: newSpendable,
);

final updatedCoin = coin.copyWith(sendableBalance: newSpendable);

// Broadcast the updated balance so non-streaming assets still emit
// real-time change events through the same path as streaming assets.
_broadcastBalanceChange(updatedCoin);

// Yield updated coin with new balance
// We still set both the deprecated fields and rely on the SDK
// for future access to maintain backward compatibility
yield coin.copyWith(sendableBalance: newSpendable);
yield updatedCoin;
}
} catch (e, s) {
_log.warning('Failed to update balance for ${coin.id}', e, s);
Expand Down
2 changes: 1 addition & 1 deletion sdk
Submodule sdk updated from 2da6d2 to b4750c
Loading