iota_model/
input.rs

1use std::fmt;
2
3use serde::{Deserialize, Serialize};
4use serde_json;
5
6/// Represents an address associated with a seed, that can be used as
7/// an "input" when trying to meet a minimum threshold of funds for a
8/// transaction
9#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10pub struct Input {
11    /// Transaction address
12    pub address: String,
13    /// Address balance
14    pub balance: i64,
15    /// Key index of a seed
16    pub key_index: usize,
17    /// Security level
18    pub security: usize,
19}
20
21impl fmt::Display for Input {
22    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23        write!(
24            f,
25            "{}",
26            serde_json::to_string_pretty(self).unwrap_or_default()
27        )
28    }
29}