call method

Future<Uint8List> call(
  1. String method,
  2. Uint8List bytes, {
  3. BlockHash? at,
})

Call a contract at a block's state.

Implementation

Future<Uint8List> call(String method, Uint8List bytes,
    {BlockHash? at}) async {
  final List<String> params = [method, '0x${hex.encode(bytes)}'];
  if (at != null) {
    params.add('0x${hex.encode(at)}');
  }
  final response = await _provider.send('state_call', params);
  final data = response.result as String;
  return Uint8List.fromList(hex.decode(data.substring(2)));
}