public abstract class Service extends java.lang.Object implements Web3jService
| Modifier and Type | Field and Description |
|---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
| Constructor and Description |
|---|
Service(boolean includeRawResponses) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.io.InputStream |
performIO(java.lang.String payload) |
<T extends Response> |
send(Request request,
java.lang.Class<T> responseType)
Perform a synchronous JSON-RPC request.
|
<T extends Response> |
sendAsync(Request jsonRpc20Request,
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseprotected abstract java.io.InputStream performIO(java.lang.String payload)
throws java.io.IOException
java.io.IOExceptionpublic <T extends Response> T send(Request request, java.lang.Class<T> responseType) throws java.io.IOException
Web3jServicesend in interface Web3jServiceT - 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 requestpublic <T extends Response> java.util.concurrent.CompletableFuture<T> sendAsync(Request jsonRpc20Request, java.lang.Class<T> responseType)
Web3jServicesendAsync in interface Web3jServiceT - type of a data item returned by the requestjsonRpc20Request - request to performresponseType - class of a data item returned by the requestpublic BatchResponse sendBatch(BatchRequest batchRequest) throws java.io.IOException
Web3jServicesendBatch in interface Web3jServicebatchRequest - requests to performjava.io.IOException - thrown if failed to perform a batch requestpublic java.util.concurrent.CompletableFuture<BatchResponse> sendBatchAsync(BatchRequest batchRequest)
Web3jServicesendBatchAsync in interface Web3jServicebatchRequest - batch request to performpublic <T extends Notification<?>> io.reactivex.Flowable<T> subscribe(Request request, java.lang.String unsubscribeMethod, java.lang.Class<T> responseType)
Web3jServiceThis 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.
subscribe in interface Web3jServiceT - 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 events