request<T> method

Future<T> request<T>(
  1. TVMRequestParam<T, Map<String, dynamic>> request, [
  2. Duration? timeout
])

Sends a request to the Tron network using the specified request parameter.

The timeout parameter, if provided, sets the maximum duration for the request.

Implementation

Future<T> request<T>(TVMRequestParam<T, Map<String, dynamic>> request,
    [Duration? timeout]) async {
  final id = ++_id;
  final params = request.toRequest(id);
  final data = request.method.isPost
      ? await rpc.post(params, timeout)
      : await rpc.get(params, timeout);

  return request.onResonse(data);
}