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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
use crate::client::client_types::{terra_f64_format, terra_u64_format};
use crate::core_types::Coin;
use crate::messages::Message;
use serde::{Deserialize, Serialize};
#[allow(clippy::upper_case_acronyms)]
#[derive(Deserialize, Serialize, Debug)]
pub struct TXResultAsync {
#[serde(with = "terra_u64_format")]
pub height: u64,
pub txhash: String,
}
#[allow(clippy::upper_case_acronyms)]
#[derive(Deserialize, Serialize, Debug)]
pub struct TXResultSync {
#[serde(with = "terra_u64_format")]
pub height: u64,
pub txhash: String,
pub code: Option<usize>,
pub raw_log: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TxResultBlockAttribute {
pub key: String,
pub value: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TxResultBlockEvent {
#[serde(rename = "type")]
pub sytpe: String,
pub attributes: Vec<TxResultBlockAttribute>,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TxResultBlockMsg {
pub msg_index: usize,
pub log: String,
pub events: Vec<TxResultBlockEvent>,
}
#[allow(clippy::upper_case_acronyms)]
#[derive(Deserialize, Serialize, Debug)]
pub struct TXResultBlock {
#[serde(with = "terra_u64_format")]
pub height: u64,
pub txhash: String,
pub codespace: Option<String>,
pub code: Option<usize>,
pub raw_log: String,
pub logs: Option<Vec<TxResultBlockMsg>>,
}
#[derive(Serialize)]
pub struct TxEstimate2<'a> {
pub msg: &'a [Message],
}
#[derive(Serialize)]
pub struct TxEstimate<'a> {
pub tx: TxEstimate2<'a>,
#[serde(with = "terra_f64_format")]
pub gas_adjustment: f64,
pub gas_prices: &'a [&'a Coin],
}
impl<'a> TxEstimate<'a> {
pub fn create(
msg: &'a [Message],
gas_adjustment: f64,
gas_prices: &'a [&'a Coin],
) -> TxEstimate<'a> {
TxEstimate {
tx: TxEstimate2 { msg },
gas_adjustment,
gas_prices,
}
}
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TxFeeBlock {
pub fees: Vec<Coin>,
#[serde(with = "terra_u64_format")]
pub gas: u64,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TxFeeResult {
#[serde(with = "terra_u64_format")]
pub height: u64,
pub result: TxFeeBlock,
}