balanceOf method
Gets the balanceOf of the specified address. contractAddr : The address of the token. ownerAdd : The address to query the balance of.
Implementation
Future<BigInt> balanceOf(String contractAdd, ownerAdd) async {
final EthereumAddress contractAddr = EthereumAddress.fromHex(contractAdd);
final contract = DeployedContract(
ContractAbi.fromJson(abiString, 'XRC20'), contractAddr);
final tokenBalanceOf = contract.function('balanceOf');
final EthereumAddress ownerAddress = EthereumAddress.fromHex(ownerAdd);
final balanceOf = await client.call(
contract: contract, function: tokenBalanceOf, params: [ownerAddress]);
final response = balanceOf[0].toString();
final res = BigInt.parse(response);
final x = pow(10, 18);
final u = x.toString();
final BigInt h = BigInt.parse(u);
final y = res ~/ h;
return (y);
}