Expand description
JSON-RPC 2.0 envelope types.
The DIG-node RPC wire is strict JSON-RPC 2.0:
every request carries jsonrpc: "2.0", an id, a method, and optional
params; every response carries jsonrpc, the echoed id, and exactly one
of result or error.
§The Version marker
Version is zero-sized and (de)serializes as the literal string "2.0".
A response whose jsonrpc field is anything else fails to deserialize into
JsonRpcResponse with no hand-written check — the version guard is
structural.
§The error envelope
Errors follow the canonical DIG envelope
{"code": <int>, "message": <str>, "data": {"code": <UPPER_SNAKE>, "origin": <origin>}}.
See crate::error for the RpcError type and the single constructor
helper that mints it.
Structs§
- Json
RpcRequest - A JSON-RPC 2.0 request envelope.
- Json
RpcResponse - A JSON-RPC 2.0 response envelope.
- Version
- The JSON-RPC protocol version marker.
Enums§
- Json
RpcResponse Body - The body of a response: either a successful result or an error.
- Request
Id - Per-request correlation id.