getStorageAt method

Future<BigInt> getStorageAt (BigInt address, int pos, MoacDefaultBlock block)

Get Storage at, the value from a storage position at a given address. Parameters are the address of the storage, the integer position of the storage and

Implementation

// the default block parameter.
Future<BigInt> getStorageAt(
    BigInt address, int pos, MoacDefaultBlock block) async {
  if (address == null) {
    throw ArgumentError.notNull("Moac::getStorageAt - address");
  }
  if (pos == null) {
    throw ArgumentError.notNull("Moac::getStorageAt - pos");
  }
  if (block == null) {
    throw ArgumentError.notNull("Moac::getStorageAt - block");
  }
  final String method = MoacRpcMethods.storageAt;
  final String blockString = block.getSelection();
  final List params = [
    MoacUtilities.bigIntegerToHex(address),
    MoacUtilities.intToHex(pos),
    blockString
  ];
  final res = await rpcClient.request(method, params);
  if (res != null && res.containsKey(moacResultKey)) {
    return MoacUtilities.safeParse(res[moacResultKey]);
  }
  _processError(method, res);
  return null;
}