Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Method dispatch table.

Each JSON-RPC method name is mapped to a handler function. The handler receives the parsed [RpcRequest] and a reference to the daemon-owned [Confium] instance. Handlers return a JSON-serializable result value or a RpcError.

Adding a new method is a single entry in Dispatch::new: register the name and the handler. No match arm, no central switch. This is the open/closed shape the daemon aims for — extension is registration, not modification.

Structs§

Dispatch
The dispatch table. Maps method name → handler.

Functions§

params_object
Require that params is an object (or unit / missing). Returns the cloned map so handlers can pull fields with .get().
parse_params
Extract a typed parameter struct from the raw Value, producing an InvalidParams RPC error on failure.
require_bytes
Pull a byte field from the params map. Accepts a JSON string and decodes it as base64, or a JSON array of numbers.
require_str
Pull a string field from the params map, erroring if missing.

Type Aliases§

Handler
Type alias for a handler. Handlers are async so they can await slow operations (audit subscription setup, keystore I/O, etc.) without blocking other connections.