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
/*
* Algod REST API.
*
* API endpoint for algod operations.
*
* The version of the OpenAPI document: 0.0.1
* Contact: contact@algorand.com
* Generated by: https://openapi-generator.tech
*/
use algonaut_crypto::{HashDigest, deserialize_hash};
use algonaut_transaction::builder::TransactionParams;
/// TransactionParams200Response : TransactionParams contains the parameters that help a client construct a new transaction.
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct TransactionParams200Response {
/// ConsensusVersion indicates the consensus protocol version as of LastRound.
#[serde(rename = "consensus-version")]
pub consensus_version: String,
/// Fee is the suggested transaction fee Fee is in units of micro-Algos per byte. Fee may fall to zero but transactions must still have a fee of at least MinTxnFee for the current network protocol.
#[serde(rename = "fee")]
pub fee: u64,
/// GenesisHash is the hash of the genesis block.
#[serde(rename = "genesis-hash", deserialize_with = "deserialize_hash")]
pub genesis_hash: HashDigest,
/// GenesisID is an ID listed in the genesis block.
#[serde(rename = "genesis-id")]
pub genesis_id: String,
/// LastRound indicates the last round seen
#[serde(rename = "last-round")]
pub last_round: u64,
/// The minimum transaction fee (not per byte) required for the txn to validate for the current network protocol.
#[serde(rename = "min-fee")]
pub min_fee: u64,
}
impl TransactionParams200Response {
/// TransactionParams contains the parameters that help a client construct a new transaction.
pub fn new(
consensus_version: String,
fee: u64,
genesis_hash: HashDigest,
genesis_id: String,
last_round: u64,
min_fee: u64,
) -> TransactionParams200Response {
TransactionParams200Response {
consensus_version,
fee,
genesis_hash,
genesis_id,
last_round,
min_fee,
}
}
}
impl TransactionParams for TransactionParams200Response {
fn last_round(&self) -> u64 {
self.last_round
}
fn min_fee(&self) -> u64 {
self.min_fee
}
fn genesis_hash(&self) -> HashDigest {
self.genesis_hash
}
fn genesis_id(&self) -> &String {
&self.genesis_id
}
}