diff --git a/rpc/types/src/constants.rs b/rpc/types/src/constants.rs new file mode 100644 index 0000000..451101f --- /dev/null +++ b/rpc/types/src/constants.rs @@ -0,0 +1,56 @@ +//! TODO + +// From: +// +// ``` +// When making *any* change here, bump minor +// If the change is incompatible, then bump major and set minor to 0 +// This ensures CORE_RPC_VERSION always increases, that every change +// has its own version, and that clients can just test major to see +// whether they can talk to a given daemon without having to know in +// advance which version they will stop working with +// Don't go over 32767 for any of these +// ``` +// +// What this means for Cuprate: just follow `monerod`. + +//---------------------------------------------------------------------------------------------------- Import + +//---------------------------------------------------------------------------------------------------- Status +/// +pub const CORE_RPC_STATUS_OK: &str = "OK"; + +/// +pub const CORE_RPC_STATUS_BUSY: &str = "BUSY"; + +/// +pub const CORE_RPC_STATUS_NOT_MINING: &str = "NOT MINING"; + +/// +pub const CORE_RPC_STATUS_PAYMENT_REQUIRED: &str = "PAYMENT REQUIRED"; + +//---------------------------------------------------------------------------------------------------- Versions +/// RPC major version. +/// +/// See: . +pub const CORE_RPC_VERSION_MAJOR: u32 = 3; + +/// RPC miror version. +/// +/// See: . +pub const CORE_RPC_VERSION_MINOR: u32 = 14; + +/// RPC version. +/// +/// See: . +/// +/// ```rust +/// assert_eq!(cuprate_rpc_types::CORE_RPC_VERSION, 196_622); +/// ``` +pub const CORE_RPC_VERSION: u32 = (CORE_RPC_VERSION_MAJOR << 16) | CORE_RPC_VERSION_MINOR; + +//---------------------------------------------------------------------------------------------------- Tests +#[cfg(test)] +mod test { + // use super::*; +} diff --git a/rpc/types/src/lib.rs b/rpc/types/src/lib.rs index ec5f4c6..8cd8382 100644 --- a/rpc/types/src/lib.rs +++ b/rpc/types/src/lib.rs @@ -93,11 +93,19 @@ clippy::too_many_lines ) )] +// TODO: remove me after finishing impl +#![allow(dead_code)] //---------------------------------------------------------------------------------------------------- Use +mod constants; mod macros; mod status; +pub use constants::{ + CORE_RPC_STATUS_BUSY, CORE_RPC_STATUS_NOT_MINING, CORE_RPC_STATUS_OK, + CORE_RPC_STATUS_PAYMENT_REQUIRED, CORE_RPC_VERSION, CORE_RPC_VERSION_MAJOR, + CORE_RPC_VERSION_MINOR, +}; pub use status::Status; pub mod bin; diff --git a/rpc/types/src/status.rs b/rpc/types/src/status.rs index fc19450..6730744 100644 --- a/rpc/types/src/status.rs +++ b/rpc/types/src/status.rs @@ -11,6 +11,9 @@ use strum::{ // Do we need `strum`? Are there other types // (maybe outside of this crate) that will use it? +// TODO: +// These may be JSON-RPC 2.0 messages. + //---------------------------------------------------------------------------------------------------- Status /// RPC response status. ///