Skip to content

Commit

Permalink
apply nit changes
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jan 2, 2025
1 parent ee20b9a commit 4c63f6e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mm2src/coins/rpc_command/tendermint/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ use mm2_err_handle::prelude::MmError;

use crate::{lp_coinfind_or_err, tendermint::TendermintCoinRpcError, MmCoinEnum};

pub type ValidatorsRPCResult = Result<ValidatorsRPCResponse, MmError<ValidatorsRPCError>>;

#[derive(Default, Deserialize)]
pub enum ValidatorStatus {
pub(crate) enum ValidatorStatus {
All,
#[default]
Bonded,
Expand All @@ -32,12 +30,12 @@ pub struct ValidatorsRPC {
#[serde(flatten)]
paging: PagingOptions,
#[serde(default)]
pub(crate) filter_by_status: ValidatorStatus,
filter_by_status: ValidatorStatus,
}

#[derive(Clone, Serialize)]
pub struct ValidatorsRPCResponse {
pub(crate) validators: Vec<serde_json::Value>,
validators: Vec<serde_json::Value>,
}

#[derive(Clone, Debug, Display, Serialize, SerializeErrorType, PartialEq)]
Expand Down Expand Up @@ -79,7 +77,10 @@ impl From<TendermintCoinRpcError> for ValidatorsRPCError {
}
}

pub async fn validators_rpc(ctx: MmArc, req: ValidatorsRPC) -> ValidatorsRPCResult {
pub async fn validators_rpc(
ctx: MmArc,
req: ValidatorsRPC,
) -> Result<ValidatorsRPCResponse, MmError<ValidatorsRPCError>> {
fn maybe_jsonize_description(description: Option<Description>) -> Option<serde_json::Value> {
description.map(|d| {
json!({
Expand Down

0 comments on commit 4c63f6e

Please sign in to comment.