updateBalance method

Future<void> updateBalance()

Implementation

Future<void> updateBalance() async {
  RPCResponseBody<SuccessMiddleware, ErrorMiddleware> res = await this
      .messenger
      .send(RPCMethod.GetBalance, this.address.toString());
  if (res.error == null && res.result != null) {
    var balanceMap = res.result!.toMap();
    if (balanceMap != null) {
      this.balance = balanceMap['balance'];
      this.nonce = balanceMap['nonce'];
      this.isFound = true;
    }
  } else {
    this.balance = '0';
    this.nonce = 0;
    this.isFound = false;
  }
}