public interface Web3jService
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes resources used by the service.
|
<T extends Response> |
send(Request request,
java.lang.Class<T> responseType)
Perform a synchronous JSON-RPC request.
|
<T extends Response> |
sendAsync(Request request,
java.lang.Class<T> responseType)
Performs an asynchronous JSON-RPC request.
|
BatchResponse |
sendBatch(BatchRequest batchRequest)
Perform a synchronous JSON-RPC batch requests.
|
java.util.concurrent.CompletableFuture<BatchResponse> |
sendBatchAsync(BatchRequest batchRequest)
Performs an asynchronous JSON-RPC batch requests.
|
<T extends Notification<?>> |
subscribe(Request request,
java.lang.String unsubscribeMethod,
java.lang.Class<T> responseType)
Subscribe to a stream of notifications.
|
<T extends Response> T send(Request request, java.lang.Class<T> responseType) throws java.io.IOException
T
- type of a data item returned by the requestrequest
- request to performresponseType
- class of a data item returned by the requestjava.io.IOException
- thrown if failed to perform a request<T extends Response> java.util.concurrent.CompletableFuture<T> sendAsync(Request request, java.lang.Class<T> responseType)
T
- type of a data item returned by the requestrequest
- request to performresponseType
- class of a data item returned by the requestBatchResponse sendBatch(BatchRequest batchRequest) throws java.io.IOException
batchRequest
- requests to performjava.io.IOException
- thrown if failed to perform a batch requestjava.util.concurrent.CompletableFuture<BatchResponse> sendBatchAsync(BatchRequest batchRequest)
batchRequest
- batch request to perform<T extends Notification<?>> io.reactivex.Flowable<T> subscribe(Request request, java.lang.String unsubscribeMethod, java.lang.Class<T> responseType)
This method creates an Flowable that can be used to subscribe to new notifications. When a client unsubscribes from this Flowable the service unsubscribes from the underlying stream of events.
T
- type of incoming event objectsrequest
- JSON-RPC request that will be send to subscribe to a stream of eventsunsubscribeMethod
- method that will be called to unsubscribe from a stream of
notificationsresponseType
- class of incoming events objects in a streamFlowable
instance that emits incoming eventsvoid close() throws java.io.IOException
java.io.IOException
- thrown if a service failed to close all resources