Documentation ¶
Overview ¶
Package rpc provides a client that's able to communicate with a `monerod` daemon via its RPC interfaces.
Index ¶
- func WithHTTPClient(v *http.Client) func(o *clientOptions)
- type Client
- func (c *Client) JSONRPC(ctx context.Context, method string, params interface{}, response interface{}) error
- func (c *Client) RawBinaryRequest(ctx context.Context, endpoint string, body io.Reader) (io.ReadCloser, error)
- func (c *Client) RawRequest(ctx context.Context, endpoint string, params interface{}, response interface{}) error
- type ClientOption
- type RequestEnvelope
- type ResponseEnvelope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithHTTPClient ¶
WithHTTPClient is a functional option for providing a custom HTTP client to be used for the HTTP requests made to a monero daemon.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper over a plain HTTP client providing methods that correspond to all RPC invocations to a `monerod` daemon, including restricted and non-restricted ones.
func NewClient ¶
func NewClient(address string, opts ...ClientOption) (*Client, error)
NewClient instantiates a new Client that is able to communicate with monerod's RPC endpoints.
The `address` might be either restricted (typically <ip>:18089) or not (typically <ip>:18081).
func (*Client) JSONRPC ¶
func (c *Client) JSONRPC(ctx context.Context, method string, params interface{}, response interface{}) error
JSONRPC issues a request for a particular method under the JSONRPC endpoint with the proper envolope for its requests and unwrapping of results for responses.
type ClientOption ¶
type ClientOption func(o *clientOptions)
ClientOption defines a functional option for overriding optional client configuration parameters.
type RequestEnvelope ¶
type RequestEnvelope struct { ID string `json:"id"` JSONRPC string `json:"jsonrpc"` Method string `json:"method"` Params interface{} `json:"params,omitempty"` }
RequestEnvelope wraps all requests made to the RPC server.
type ResponseEnvelope ¶
type ResponseEnvelope struct { ID string `json:"id"` JSONRPC string `json:"jsonrpc"` Result interface{} `json:"result,omitempty"` Error struct { Code int `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` }
ResponseEnvelope wraps all responses from the RPC server.
Directories ¶
Path | Synopsis |
---|---|
Package daemon provides a client that encapsulates RPC methods and endpoints that can be hit in a daemon.
|
Package daemon provides a client that encapsulates RPC methods and endpoints that can be hit in a daemon. |
Package wallet provides a client that encapsulates RPC methods that can be hit in a wallet rpc server.
|
Package wallet provides a client that encapsulates RPC methods that can be hit in a wallet rpc server. |