Documentation ¶
Overview ¶
Package providerwrapper wraps a web3 provider in order to implement the RPCClient interface.
Index ¶
- type RPCClient
- func (c *RPCClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *RPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *RPCClient) Close()
- func (c *RPCClient) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func NewRPCClient ¶
func (*RPCClient) BatchCallContext ¶
BatchCall sends all given requests as a single batch and waits for the server to return a response for all of them. The wait duration is bounded by the context's deadline.
In contrast to CallContext, BatchCallContext only returns errors that have occurred while sending the request. Any error specific to a request is reported through the Error field of the corresponding BatchElem.
Note that batch calls may not be executed atomically on the server side.
func (*RPCClient) CallContext ¶
func (c *RPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
CallContext performs a JSON-RPC call with the given arguments. If the context is canceled before the call has successfully returned, CallContext returns immediately.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
func (*RPCClient) EthSubscribe ¶
func (c *RPCClient) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
EthSubscribe registers a subscripion under the "eth" namespace.