requestDynamicWithContext<RESULT, SERVICERESPONSE> method

Future<ResultWithContext<SERVICERESPONSE>> requestDynamicWithContext<RESULT, SERVICERESPONSE>(
  1. BaseServiceRequest<RESULT, SERVICERESPONSE, SolanaRequestDetails> request, [
  2. Duration? timeout
])

Sends a JSON-RPC request to the solana node and returns the result after processing the response.

request: The JSON-RPC request to be sent. timeout: The maximum duration for waiting for the response. return value with context if response contains context

Implementation

Future<ResultWithContext<SERVICERESPONSE>> requestDynamicWithContext<RESULT,
        SERVICERESPONSE>(
    BaseServiceRequest<RESULT, SERVICERESPONSE, SolanaRequestDetails> request,
    [Duration? timeout]) async {
  final id = ++_id;
  final params = request.buildRequest(id);
  final response =
      await rpc.doRequest<Map<String, dynamic>>(params, timeout: timeout);
  final result = _findError<Object?>(response: response, params: params);
  return ResultWithContext(
      result: _fetchRequest<RESULT, SERVICERESPONSE>(
          request: request, params: params, response: result),
      context: _fetchContext(result));
}