Base RPC types
There exists a few "base" types that many types are built on-top of in monerod
.
These are also implemented in cuprate-rpc-types
.
For example, many requests include these 2 fields:
{
"status": "OK",
"untrusted": false,
}
This is rpc_response_base
in monerod
, and ResponseBase
in Cuprate.
These types are flattened into other types, i.e. the fields
from these base types are injected into the given type. For example, get_block_count
's response type is defined like such in Cuprate:
#![allow(unused)] fn main() { struct GetBlockCountResponse { // The fields of this `base` type are directly // injected into `GetBlockCountResponse` during // (de)serialization. // // I.e. it is as if this `base` field were actually these 2 fields: // status: Status, // untrusted: bool, base: ResponseBase, count: u64, } }
The JSON output of this type would look something like:
{
"status": "OK",
"untrusted": "false",
"count": 993163
}
RPC payment
monerod
also contains RPC base types for the RPC payment system. Although the RPC payment system is pseudo deprecated, monerod
still generates these fields in responses, and thus, so does Cuprate.