casper_client/rpcs/v1_4_5/
list_rpcs.rs1use schemars::{schema::Schema, Map};
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4
5use casper_types::ProtocolVersion;
6
7pub(crate) const LIST_RPCS_METHOD: &str = "rpc.discover";
8
9#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
11pub struct OpenRpcContactField {
12 pub name: String,
14 pub url: String,
16}
17
18#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
20pub struct OpenRpcLicenseField {
21 pub name: String,
23 pub url: String,
25}
26
27#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
29pub struct OpenRpcInfoField {
30 pub version: String,
32 pub title: String,
34 pub description: String,
36 pub contact: OpenRpcContactField,
38 pub license: OpenRpcLicenseField,
40}
41
42#[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize, Debug)]
44pub struct OpenRpcServerEntry {
45 pub name: String,
47 pub url: String,
49}
50
51#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
53pub struct SchemaParam {
54 pub name: String,
56 pub schema: Schema,
58 pub required: bool,
60}
61
62#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
64pub struct ResponseResult {
65 pub name: String,
67 pub schema: Schema,
69}
70
71#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
73pub struct ExampleParam {
74 pub name: String,
76 pub value: Value,
78}
79
80#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
82pub struct ExampleResult {
83 pub name: String,
85 pub value: Value,
87}
88
89#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
91pub struct Example {
92 pub name: String,
94 pub params: Vec<ExampleParam>,
96 pub result: ExampleResult,
98}
99
100#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
103pub struct Method {
104 pub name: String,
106 pub summary: String,
108 pub params: Vec<SchemaParam>,
110 pub result: ResponseResult,
112 pub examples: Vec<Example>,
114}
115
116#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
118pub struct Components {
119 pub schemas: Map<String, Schema>,
121}
122
123#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
126pub struct OpenRpcSchema {
127 pub openrpc: String,
129 pub info: OpenRpcInfoField,
131 pub servers: Vec<OpenRpcServerEntry>,
133 pub methods: Vec<Method>,
135 pub components: Components,
137}
138
139#[derive(Serialize, Deserialize, Debug)]
141#[serde(deny_unknown_fields)]
142pub struct ListRpcsResult {
143 pub api_version: ProtocolVersion,
145 pub name: String,
147 pub schema: OpenRpcSchema,
149}