-
Notifications
You must be signed in to change notification settings - Fork 49
rpc-types: add traits and enum
requests/responses
#241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/// JSON-RPC requests. | ||
/// | ||
/// This enum contains all [`crate::json`] requests. | ||
/// | ||
/// See also: [`JsonRpcResponse`]. | ||
/// | ||
/// TODO: document and test (de)serialization behavior after figuring out `method/params`. | ||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] | ||
#[cfg_attr( | ||
feature = "serde", | ||
serde(rename_all = "snake_case", tag = "method", content = "params") | ||
)] | ||
#[allow(missing_docs)] | ||
pub enum JsonRpcRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: this is the problematic method/params
enum btw. Will fix in another PR.
enum
requests/responsesenum
requests/responses
GetTxIdsLoose, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be an annoying endpoint to support, it may require DB changes, depending on what guarantees we need to make
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably be ok dropping support for this end point.
What
This adds some types/traits to
cuprate_rpc_types
.This adds 6 enums for encapsulating RPC requests/responses:
crate::json::JsonRpcRequest
&crate::json::JsonRpcResponse
crate::bin::BinRequest
&crate::bin::BinResponse
crate::other::OtherRequest
&crate::other::OtherResponse
2 traits that contains some metadata about RPC request/responses:
RpcCall
RpcCallValue
and changes to the type generator macro to auto implement the traits.
Why
Both enum types and metadata is needed for actual RPC usage: #233.
How
See below review.