Skip to main content

Module envelope

Module envelope 

Source
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§

JsonRpcRequest
A JSON-RPC 2.0 request envelope.
JsonRpcResponse
A JSON-RPC 2.0 response envelope.
Version
The JSON-RPC protocol version marker.

Enums§

JsonRpcResponseBody
The body of a response: either a successful result or an error.
RequestId
Per-request correlation id.