fix token balance showing 0 on wallet info row

This commit is contained in:
julian 2024-01-13 10:00:42 -06:00
parent 9321480b8d
commit e1a2cf85f3
2 changed files with 9 additions and 11 deletions

View file

@ -12,14 +12,13 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/isar/models/ethereum/eth_contract.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/amount/amount_formatter.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/providers/eth/token_balance_provider.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/wallet/impl/ethereum_wallet.dart';
class WalletInfoRowBalance extends ConsumerWidget {
const WalletInfoRowBalance({
@ -44,12 +43,11 @@ class WalletInfoRowBalance extends ConsumerWidget {
contract = null;
} else {
final ethWallet =
ref.watch(pWallets).getWallet(walletId) as EthereumWallet;
contract = MainDB.instance.getEthContractSync(contractAddress!)!;
//TODO: [prio=high] fix this for token service/interface
// totalBalance = ethWallet.getCachedTokenBalance(contract).total;
totalBalance = Amount.zero;
totalBalance = ref
.watch(pTokenBalance(
(contractAddress: contractAddress!, walletId: walletId)))
.total;
}
return Text(