Rpc_encodings.JSONRPC
Encodings for the JSON-RPC standard. See https://www.jsonrpc.org/specification.
Ids in the JSON-RPC specification can be either a string, a number or NULL (which is represented by the option type). Note that MetaMask uses ids that only fit in 64 bits, which is not supported by Data_encoding.
val random_id : ?seed:Stdlib.Random.State.t -> unit -> id_repr
val id_repr_encoding : id_repr Tezos_base.TzPervasives.Data_encoding.t
type id = id_repr option
type request = {
method_ : string;
parameters : Tezos_base.TzPervasives.Data_encoding.json option;
`params` is optional.
*)id : id;
`id` is optional.
*)}
JSON-RPC Request object:
{ "jsonrpc" : "2.0",
"method": <string>,
"params": <array | object>, //optional
"id": <string | number | NULL> //optional
}
val request_encoding : request Tezos_base.TzPervasives.Data_encoding.t
type error = {
code : int;
message : string;
data : Tezos_base.TzPervasives.Data_encoding.json option;
}
JSON-RPC Error representation.
{ "code" : <number>,
"message": <string>,
"data": <any value>
}
val error_encoding : error Tezos_base.TzPervasives.Data_encoding.t
type value = (Tezos_base.TzPervasives.Data_encoding.json, error) Stdlib.result
JSON-RPC Response object:
{ "jsonrpc": "2.0",
"result": <any>,
"error": <error object>,
"id": <id>
}
Note that `result` and `error` cannot appear at the same time, hence the choice of using the result type as representation.
val response_encoding : response Tezos_base.TzPervasives.Data_encoding.t