JsonRpcHttpClient class

JSON RPC HTTP Client

A JSON RPC Client for HTTP methods.

Inheritance

Constructors

JsonRpcHttpClient.new(Uri uri, {Duration? timeLimit, Map<String, String>? headers, JsonRpcClientEncoder encoder = const JsonToBytesEncoder(), JsonRpcClientDecoder<List<int>> decoder = const JsonToBytesDecoder()})
Creates a JSON RPC Client for HTTP methods.

Properties

decoder JsonRpcClientDecoder<List<int>>
Converts the incoming responses of type R to JSON.
finalinherited
encoder JsonRpcClientEncoder
Converts the outgoing requests to byte data.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
The default request headers applied to all methods. Headers can be provided per request using the send or sendAll method's JsonRpcClientConfig paramter.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeLimit Duration?
The default timeout duration applied to each request.
finalinherited
uri Uri
The connecting endpoint.
finalinherited

Methods

dispose() → void
Closes the client and disposes of all acquired resources.
override
handler<T>(List<int> encoded, {JsonRpcClientConfig? config, int? id}) Future<T>
Sends an encoded JSON RPC request to uri and returns the decoded JSON response (Map or List of Maps).
override
health() Future<HealthStatus>
Returns the health status of an RPC node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTimeout<T>() FutureOr<T>
Creates a TimeoutException.
inherited
send<T>(JsonRpcRequest request, JsonRpcResponseDecoder<Map<String, dynamic>, JsonRpcResponse<T>> decode, {JsonRpcClientConfig? config}) Future<JsonRpcSuccessResponse<T>>
Sends a JSON RPC request to uri and returns its response.
inherited
sendAll<T>(List<JsonRpcRequest> request, JsonRpcResponseDecoder<List<Map<String, dynamic>>, List<JsonRpcResponse<T>>> decode, {JsonRpcClientConfig? config, bool eagerError = false}) Future<List<JsonRpcResponse<T>>>
Sends a batch JSON RPC request to uri and returns its response.
inherited
timeout<T>(Future<T> request, Duration? timeLimit) Future<T>
Creates a new Future that completes with the result of request or a TimeoutException if timeLimit elapses (default: Client.timeLimit).
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited