requestWithContext<RESULT, SERVICERESPONSE> method
Future<ResultWithContext<RESULT> >
requestWithContext<RESULT, SERVICERESPONSE>(
- BaseServiceRequest<
RESULT, SERVICERESPONSE, SolanaRequestDetails> request, [ - 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<RESULT>> requestWithContext<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: request.onResonse(_fetchRequest<RESULT, SERVICERESPONSE>(
request: request, params: params, response: result)),
context: _fetchContext(result));
}