Fixed #86 - shuffling domain zones list.

This commit is contained in:
Revertron
2021-04-27 17:10:05 +02:00
parent daf6c23967
commit f60e42eb2e
5 changed files with 45 additions and 5 deletions
+23
View File
@@ -63,6 +63,22 @@ impl Transaction {
}
None
}
/// Gets a type of transaction
pub fn get_type(what: &Option<Transaction>) -> TransactionType {
match what {
None => { TransactionType::Signing }
Some(transaction) => {
if let Some(_) = transaction.get_domain_data() {
return TransactionType::Domain;
}
if let Ok(_) = serde_json::from_str::<ZoneData>(&transaction.data) {
return TransactionType::Zone;
}
TransactionType::Unknown
}
}
}
}
impl fmt::Debug for Transaction {
@@ -89,6 +105,13 @@ impl Serialize for Transaction {
}
}
pub enum TransactionType {
Unknown,
Signing,
Domain,
Zone,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct DomainData {
pub domain: Bytes,