call method

Future<ChainHeadOperationResult> call(
  1. String blockHash,
  2. String function,
  3. String callParameters
)

Make a runtime call at a pinned block.

Parameters:

  • blockHash: The hash of the pinned block.
  • function: The runtime function name, like "Metadata_metadata".
  • callParameters: Hex-encoded SCALE parameters for the call.

Returns a ChainHeadOperationResult. If isStarted, use the operationId to track the operation's progress via the event stream.

Implementation

Future<ChainHeadOperationResult> call(
  String blockHash,
  String function,
  String callParameters,
) async {
  _ensureActive();
  final response = await _provider.send('chainHead_v1_call', [
    followSubscriptionId,
    blockHash,
    function,
    callParameters,
  ]);

  if (response.error != null) {
    throw Exception(response.error.toString());
  }

  return ChainHeadOperationResult.fromJson(Map<String, dynamic>.from(response.result as Map));
}