getCode method
Get code, the code at the given address.
Implementation
Future<int> getCode(BigInt address, MoacDefaultBlock block) async {
if (address == null) {
throw ArgumentError.notNull("Moac::getCode - address");
}
if (block == null) {
throw ArgumentError.notNull("Moac::getCode - block");
}
final String method = MoacRpcMethods.code;
final String blockString = block.getSelection();
final List params = [MoacUtilities.bigIntegerToHex(address), blockString];
final res = await rpcClient.request(method, params);
if (res != null && res.containsKey(moacResultKey)) {
return MoacUtilities.hexToInt(res[moacResultKey]);
}
_processError(method, res);
return null;
}