cometbft_rpc/endpoint/broadcast/
tx_async.rs1use bytes::Bytes;
4use cometbft::{abci::Code, Hash};
5use serde::{Deserialize, Serialize};
6
7use crate::{dialect::Dialect, prelude::*, request::RequestMessage, serializers};
8
9#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
11pub struct Request {
12 #[serde(with = "serializers::bytes::base64string")]
14 pub tx: Vec<u8>,
15}
16
17impl Request {
18 pub fn new(tx: impl Into<Vec<u8>>) -> Request {
20 Request { tx: tx.into() }
21 }
22}
23
24impl RequestMessage for Request {
25 fn method(&self) -> crate::Method {
26 crate::Method::BroadcastTxAsync
27 }
28}
29
30impl<S: Dialect> crate::Request<S> for Request {
31 type Response = Response;
32}
33
34impl<S: Dialect> crate::SimpleRequest<S> for Request {
35 type Output = Response;
36}
37
38#[derive(Clone, Debug, Deserialize, Serialize)]
40pub struct Response {
41 pub code: Code,
43
44 #[serde(with = "serializers::bytes::base64string")]
46 pub data: Bytes,
47
48 pub log: String,
50
51 pub hash: Hash,
53}
54
55impl crate::Response for Response {}