check if node is connected before check balances

This commit is contained in:
poka 2022-08-14 16:34:24 +02:00
parent c603d2b201
commit 7b778a74b1
1 changed files with 9 additions and 0 deletions

View File

@ -152,6 +152,15 @@ class SubstrateSdk with ChangeNotifier {
// }
Future<Map<String, double>> getBalance(String address) async {
if (!nodeConnected) {
return {
'transferableBalance': 0,
'free': 0,
'unclaimedUds': 0,
'reserved': 0,
};
}
// Get onchain storage values
final Map balanceGlobal = await getStorage('system.account("$address")');
final int? idtyIndex =