getBalance method
- EthereumAddress? address,
- {BlockNum atBlock = const BlockNum.current()}
Gets the amount of Ether held by a contract.
address
: The address to get the balance of.
Returns a Future
Implementation
Future<EtherAmount> getBalance(EthereumAddress? address,
{BlockNum atBlock = const BlockNum.current()}) {
if (address == null) {
return Future.value(EtherAmount.zero());
}
return _provider
.send<String>('eth_getBalance', [address.hex, atBlock.toBlockParam()])
.then(BigInt.parse)
.then((value) => EtherAmount.fromBigInt(EtherUnit.wei, value));
}