Skip to content

Commit

Permalink
tabs/ethereum: show loader when creating account
Browse files Browse the repository at this point in the history
  • Loading branch information
octobocto committed Nov 13, 2023
1 parent b348e9f commit 0492f1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/pages/tabs/ethereum/ethereum_rpc_tab_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class EthereumRPCTabPage extends StatelessWidget {
);
}
},
loading: viewModel.isBusy,
size: ButtonSize.small,
),
if (viewModel.account == null)
Expand Down Expand Up @@ -88,11 +89,14 @@ class EthereumRPCTabPageViewModel extends BaseViewModel {
bool running = false;

Future<void> createAccount() async {
setBusy(true);
if (account != null) {
throw Exception('you can only make one account using the GUI');
}

await _rpc.newAccount();
setBusy(false);
notifyListeners();
}

@override
Expand Down
3 changes: 3 additions & 0 deletions lib/rpc/rpc_ethereum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class EthereumRPCLive extends EthereumRPC {
Future<(double, double)> getBalance() async {
final account = await _setAndGetAccount();
final balance = await _client.getBalance(account);

notifyListeners();
return (balance.getInEther.toDouble(), 0.0);
}

Expand Down Expand Up @@ -100,6 +102,7 @@ class EthereumRPCLive extends EthereumRPC {
}

account = EthereumAddress.fromHex(accountStr);
notifyListeners();
}

// ignore: unused_element
Expand Down

0 comments on commit 0492f1e

Please sign in to comment.