use std::{fmt, fmt::Formatter};
use tari_common_types::types::HashOutput;
use tari_transaction_components::rpc::models::FeePerGramStat;
use crate::{
common::RequestKey,
mempool::{StateResponse, StatsResponse, TxStorageResponse},
};
#[derive(Clone, Debug)]
pub enum MempoolResponse {
Stats(StatsResponse),
State(StateResponse),
TxStorage(TxStorageResponse),
FeePerGramStats { response: Vec<FeePerGramStat> },
FilteredOutputs(Vec<HashOutput>),
}
impl fmt::Display for MempoolResponse {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
use MempoolResponse::{FeePerGramStats, FilteredOutputs, State, Stats, TxStorage};
match &self {
Stats(_) => write!(f, "Stats"),
State(_) => write!(f, "State"),
TxStorage(_) => write!(f, "TxStorage"),
FeePerGramStats { response } => write!(f, "FeePerGramStats({} item(s))", response.len()),
FilteredOutputs(outputs) => write!(f, "FilteredOutputs({} item(s))", outputs.len()),
}
}
}
#[derive(Clone, Debug)]
pub struct MempoolServiceResponse {
pub request_key: RequestKey,
pub response: MempoolResponse,
}