dig-rpc-types
The canonical DIG-node JSON-RPC interface — the single source of truth both
DIG node implementations (the digstore dig-node crate and the standalone
dig-node binary) depend on instead of hand-rolling json!({…}) shapes and
ad-hoc error codes.
Pure types: no I/O, no async, no server logic, no crypto. The
dig-rpc server crate and the node
implementations build on these types.
What's here
| Module | Contents |
|---|---|
envelope |
JSON-RPC 2.0 request/response, RequestId, Version |
error |
the canonical ErrorCode taxonomy, the RpcError envelope ({code, message, data:{code, origin}}), and the one constructor helper |
method |
the Method enum — stable wire names, per-method Tier, the mTLS peer allowlist |
tier |
the three access tiers (PublicRead / Peer / Control) |
types |
every method's params + results, field-for-field with the canonical node |
frames |
the shape-dispatched DHT + PEX peer wires |
openrpc |
the OpenRPC 1.2.6 document generator (the single discovery source) |
The full contract is in SPEC.md.
Error taxonomy at a glance
Standard JSON-RPC codes plus the DIG protocol codes. The onion codes
-32020/-32021/-32022 are the published normative contract and keep their
numbers; the control-plane codes are -32030/-32031/-32032.
use ;
let e = of;
assert_eq!; // -32004
assert_eq!; // stable branch key
assert_eq!;
Method catalogue + discovery
use ;
assert_eq!;
assert_eq!;
assert!;
assert!; // control tier
let doc = openrpc_document; // OpenRPC 1.2.6
Features
| Flag | Default | Effect |
|---|---|---|
schema-export |
off | derive schemars::JsonSchema on every wire type (Go/TS codegen) |
Testing
cargo test --all-features # unit + conformance vectors
cargo llvm-cov --all-features # coverage (CI-gated ≥80%)
Licensed under Apache-2.0 OR MIT.