use bytes::Bytes;
use serde::{Deserialize, Serialize};
use tendermint::{abci::Code, Hash};
use crate::{dialect::Dialect, prelude::*, request::RequestMessage, serializers};
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Request {
#[serde(with = "serializers::bytes::base64string")]
pub tx: Vec<u8>,
}
impl Request {
pub fn new(tx: impl Into<Vec<u8>>) -> Request {
Request { tx: tx.into() }
}
}
impl RequestMessage for Request {
fn method(&self) -> crate::Method {
crate::Method::BroadcastTxSync
}
}
impl<S: Dialect> crate::Request<S> for Request {
type Response = Response;
}
impl<S: Dialect> crate::SimpleRequest<S> for Request {
type Output = Response;
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub codespace: String,
pub code: Code,
#[serde(with = "serializers::bytes::base64string")]
pub data: Bytes,
pub log: String,
pub hash: Hash,
}
impl crate::Response for Response {}