JSON-RPC Protocol
All transports use the JSON-RPC 2.0 protocol, implemented in@cosmjs/json-rpc. The package provides:
- Type definitions —
JsonRpcRequest,JsonRpcSuccessResponse,JsonRpcErrorResponse - Parsing —
parseJsonRpcResponse()validates and type-guards responses - ID generation —
makeJsonRpcId()produces incrementing numeric IDs - Error codes — standard JSON-RPC error codes (
parseError,invalidRequest,methodNotFound, etc.)
Reactive Streams
The@cosmjs/stream package provides utilities built on
xstream for working with event streams:
These are primarily used internally by the WebSocket transport and subscription
system, but they’re available if you need to compose or transform event streams.