Expand description
Remote chain protocol methods (tags 76-103).
Translates between SCALE-encoded binary messages from the product-SDK and JSON-RPC for smoldot. Each function either:
- Parses a smoldot JSON-RPC notification and encodes the result as SCALE, or
- Encodes a SCALE response for a given chain request tag.
All response messages follow the envelope:
request_id (SCALE str) + response_tag (u8) + v1 (0x00) + payload
Structs§
- Runtime
Spec - Parsed runtime specification fields.
- Storage
Result Item - A single storage result item returned in OperationStorageItems.
Enums§
- Chain
Head Event - Strongly-typed representation of every
chainHead_v1_followEventvariant. - Runtime
Info - Runtime information attached to Initialized / NewBlock events.
Constants§
- TAG_
CHAIN_ HEAD_ BODY_ REQ - TAG_
CHAIN_ HEAD_ BODY_ RESP - TAG_
CHAIN_ HEAD_ CALL_ REQ - TAG_
CHAIN_ HEAD_ CALL_ RESP - TAG_
CHAIN_ HEAD_ CONTINUE_ REQ - TAG_
CHAIN_ HEAD_ CONTINUE_ RESP - TAG_
CHAIN_ HEAD_ FOLLOW_ INTERRUPT - TAG_
CHAIN_ HEAD_ FOLLOW_ RECEIVE - TAG_
CHAIN_ HEAD_ FOLLOW_ START - TAG_
CHAIN_ HEAD_ FOLLOW_ STOP - TAG_
CHAIN_ HEAD_ HEADER_ REQ - TAG_
CHAIN_ HEAD_ HEADER_ RESP - TAG_
CHAIN_ HEAD_ STOP_ OP_ REQ - TAG_
CHAIN_ HEAD_ STOP_ OP_ RESP - TAG_
CHAIN_ HEAD_ STORAGE_ REQ - TAG_
CHAIN_ HEAD_ STORAGE_ RESP - TAG_
CHAIN_ HEAD_ UNPIN_ REQ - TAG_
CHAIN_ HEAD_ UNPIN_ RESP - TAG_
CHAIN_ SPEC_ CHAIN_ NAME_ REQ - TAG_
CHAIN_ SPEC_ CHAIN_ NAME_ RESP - TAG_
CHAIN_ SPEC_ GENESIS_ HASH_ REQ - TAG_
CHAIN_ SPEC_ GENESIS_ HASH_ RESP - TAG_
CHAIN_ SPEC_ PROPERTIES_ REQ - TAG_
CHAIN_ SPEC_ PROPERTIES_ RESP - TAG_
CHAIN_ TX_ BROADCAST_ REQ - TAG_
CHAIN_ TX_ BROADCAST_ RESP - TAG_
CHAIN_ TX_ STOP_ REQ - TAG_
CHAIN_ TX_ STOP_ RESP
Functions§
- bytes_
to_ hex - Convert raw bytes
[0xab, 0xcd]to"0xabcd". - encode_
chain_ follow_ json_ event - Encode a chain-head follow event notification from raw JSON-RPC text.
- encode_
chain_ follow_ stop - Encode a synthetic follow stop event for unsupported/disconnected chains.
- encode_
chain_ head_ event - Encode a
chainHead_v1_followEventreceive message (tag 79). - encode_
chain_ response_ hex - Encode a
Result(Hex(), GenericError)response. - encode_
chain_ response_ nullable_ hex - Encode a
Result(Nullable(Hex()), GenericError)response. - encode_
chain_ response_ nullable_ string - Encode a
Result(Nullable(str), GenericError)response. - encode_
chain_ response_ operation_ started - Encode a
Result(OperationStartedResult, GenericError)response. - encode_
chain_ response_ string - Encode a
Result(str, GenericError)response. - encode_
chain_ response_ void - Encode a
Result(void, GenericError)response. - encode_
chain_ rpc_ error - Encode a chain RPC error using the correct response tag for
request_tag. - encode_
chain_ rpc_ json_ response - Encode a chain RPC response from raw JSON-RPC text using the correct
chain protocol envelope for
request_tag. - hex_
to_ bytes - Convert a
"0xabcd"hex string to raw bytes[0xab, 0xcd]. - parse_
chain_ head_ json_ rpc - Parse a smoldot
chainHead_v1_followEventnotification into aChainHeadEvent.