1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use crate::{Method, Order};
use serde::{Deserialize, Serialize};
use tendermint::{abci, block};
use tendermint_proto::types::TxProof;
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Request {
pub query: String,
pub prove: bool,
#[serde(with = "tendermint_proto::serializers::from_str")]
pub page: u32,
#[serde(with = "tendermint_proto::serializers::from_str")]
pub per_page: u8,
pub order_by: Order,
}
impl Request {
pub fn new(
query: impl ToString,
prove: bool,
page: u32,
per_page: u8,
order_by: Order,
) -> Self {
Self {
query: query.to_string(),
prove,
page,
per_page,
order_by,
}
}
}
impl crate::Request for Request {
type Response = Response;
fn method(&self) -> Method {
Method::TxSearch
}
}
impl crate::SimpleRequest for Request {}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub txs: Vec<ResultTx>,
#[serde(with = "tendermint_proto::serializers::from_str")]
pub total_count: u32,
}
impl crate::Response for Response {}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ResultTx {
pub hash: abci::transaction::Hash,
pub height: block::Height,
pub index: u32,
pub tx_result: abci::DeliverTx,
pub tx: abci::Transaction,
#[serde(skip_serializing_if = "Option::is_none")]
pub proof: Option<TxProof>,
}