mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-02-01 07:15:56 +00:00
add misc.rs
for root misc types
This commit is contained in:
parent
e1dcd8e724
commit
72bd1673d6
4 changed files with 101 additions and 20 deletions
|
@ -18,28 +18,13 @@ use serde::{Deserialize, Serialize};
|
|||
#[cfg(feature = "epee")]
|
||||
use cuprate_epee_encoding::epee_object;
|
||||
|
||||
use crate::Status;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Macro
|
||||
/// Link the original `monerod` definition for RPC base types.
|
||||
macro_rules! monero_rpc_base_link {
|
||||
($start:literal..=$end:literal) => {
|
||||
concat!(
|
||||
"[Definition](https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server_commands_defs.h#L",
|
||||
stringify!($start),
|
||||
"-L",
|
||||
stringify!($end),
|
||||
")."
|
||||
)
|
||||
};
|
||||
}
|
||||
use crate::{macros::monero_definition_link, Status};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Requests
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Responses
|
||||
#[doc = monero_definition_link!(cc73fe71162d564ffda8e549b79a350bca53c454 => core_rpc_server_commands_defs.h => 101..=112)]
|
||||
/// The most common base for responses.
|
||||
///
|
||||
#[doc = monero_rpc_base_link!(101..=112)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct ResponseBase {
|
||||
|
@ -58,9 +43,8 @@ epee_object! {
|
|||
untrusted: bool,
|
||||
}
|
||||
|
||||
#[doc = monero_definition_link!(cc73fe71162d564ffda8e549b79a350bca53c454 => core_rpc_server_commands_defs.h => 124..=136)]
|
||||
/// A base for RPC response types that support RPC payment.
|
||||
///
|
||||
#[doc = monero_rpc_base_link!(124..=136)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct AccessResponseBase {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
unused_allocation,
|
||||
coherence_leak_check,
|
||||
while_true,
|
||||
clippy::missing_docs_in_private_items,
|
||||
|
||||
// Maybe can be put into `#[deny]`.
|
||||
unconditional_recursion,
|
||||
|
@ -121,3 +120,6 @@ pub mod json;
|
|||
#[cfg(feature = "other")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "other")))]
|
||||
pub mod other;
|
||||
|
||||
mod misc;
|
||||
pub use misc::BlockHeader;
|
||||
|
|
|
@ -288,3 +288,24 @@ macro_rules! define_request_and_response_doc {
|
|||
};
|
||||
}
|
||||
pub(crate) use define_request_and_response_doc;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Macro
|
||||
/// Link the original `monerod` definition for RPC base types.
|
||||
macro_rules! monero_definition_link {
|
||||
($commit:ident => $file:ident.$file_extension:ident => $start:literal..=$end:literal) => {
|
||||
concat!(
|
||||
"[Definition](https://github.com/monero-project/monero/blob/",
|
||||
stringify!($commit),
|
||||
"/src/rpc/",
|
||||
stringify!($file),
|
||||
".",
|
||||
stringify!($file_extension),
|
||||
"#L",
|
||||
stringify!($start),
|
||||
"-L",
|
||||
stringify!($end),
|
||||
")."
|
||||
)
|
||||
};
|
||||
}
|
||||
pub(crate) use monero_definition_link;
|
||||
|
|
74
rpc/types/src/misc.rs
Normal file
74
rpc/types/src/misc.rs
Normal file
|
@ -0,0 +1,74 @@
|
|||
//! TODO
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Import
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "epee")]
|
||||
use cuprate_epee_encoding::epee_object;
|
||||
|
||||
use crate::macros::monero_definition_link;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- BlockHeader
|
||||
#[doc = monero_definition_link!(cc73fe71162d564ffda8e549b79a350bca53c454 => core_rpc_server_commands_defs.h => 1163..=1212)]
|
||||
/// TODO.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[allow(missing_docs)]
|
||||
pub struct BlockHeader {
|
||||
pub major_version: u8,
|
||||
pub minor_version: u8,
|
||||
pub timestamp: u64,
|
||||
pub prev_hash: String,
|
||||
pub nonce: u32,
|
||||
pub orphan_status: bool,
|
||||
pub height: u64,
|
||||
pub depth: u64,
|
||||
pub hash: String,
|
||||
pub difficulty: u64,
|
||||
pub wide_difficulty: String,
|
||||
pub difficulty_top64: u64,
|
||||
pub cumulative_difficulty: u64,
|
||||
pub wide_cumulative_difficulty: String,
|
||||
pub cumulative_difficulty_top64: u64,
|
||||
pub reward: u64,
|
||||
pub block_size: u64,
|
||||
pub block_weight: u64,
|
||||
pub num_txes: u64,
|
||||
pub pow_hash: String,
|
||||
pub long_term_weight: u64,
|
||||
pub miner_tx_hash: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "epee")]
|
||||
epee_object! {
|
||||
BlockHeader,
|
||||
major_version: u8,
|
||||
minor_version: u8,
|
||||
timestamp: u64,
|
||||
prev_hash: String,
|
||||
nonce: u32,
|
||||
orphan_status: bool,
|
||||
height: u64,
|
||||
depth: u64,
|
||||
hash: String,
|
||||
difficulty: u64,
|
||||
wide_difficulty: String,
|
||||
difficulty_top64: u64,
|
||||
cumulative_difficulty: u64,
|
||||
wide_cumulative_difficulty: String,
|
||||
cumulative_difficulty_top64: u64,
|
||||
reward: u64,
|
||||
block_size: u64,
|
||||
block_weight: u64,
|
||||
num_txes: u64,
|
||||
pow_hash: String,
|
||||
long_term_weight: u64,
|
||||
miner_tx_hash: String,
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Tests
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
// use super::*;
|
||||
}
|
Loading…
Reference in a new issue