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
use super::constants::{GET_FROZEN_LEDGERS, LEDGERS_FREEZE};
use super::RequestType;

#[derive(Serialize, PartialEq, Debug)]
pub struct LedgersFreezeOperation {
    #[serde(rename = "type")]
    pub _type: String,
    pub ledgers_ids: Vec<u64>,
}

impl LedgersFreezeOperation {
    pub fn new(ledgers_ids: Vec<u64>) -> LedgersFreezeOperation {
        LedgersFreezeOperation {
            _type: LEDGERS_FREEZE.to_string(),
            ledgers_ids,
        }
    }
}

impl RequestType for LedgersFreezeOperation {
    fn get_txn_type<'a>() -> &'a str {
        LEDGERS_FREEZE
    }
}

#[derive(Serialize, PartialEq, Debug)]
pub struct GetFrozenLedgersOperation {
    #[serde(rename = "type")]
    pub _type: String,
}

impl GetFrozenLedgersOperation {
    pub fn new() -> GetFrozenLedgersOperation {
        GetFrozenLedgersOperation {
            _type: GET_FROZEN_LEDGERS.to_string(),
        }
    }
}

impl Default for GetFrozenLedgersOperation {
    fn default() -> Self {
        Self::new()
    }
}

impl RequestType for GetFrozenLedgersOperation {
    fn get_txn_type<'a>() -> &'a str {
        GET_FROZEN_LEDGERS
    }
}