dubp_block/
lib.rs

1//  Copyright (C) 2017-2019  The AXIOM TEAM Association.
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU Affero General Public License as
5// published by the Free Software Foundation, either version 3 of the
6// License, or (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16//! Wrappers around Block document.
17
18#![deny(
19    clippy::expect_used,
20    clippy::unwrap_used,
21    missing_debug_implementations,
22    missing_copy_implementations,
23    trivial_casts,
24    trivial_numeric_casts,
25    unsafe_code,
26    unstable_features,
27    unused_import_braces
28)]
29
30mod block;
31pub mod parser;
32
33// Prelude
34pub mod prelude {
35    pub use crate::block::{
36        DubpBlock, DubpBlockTrait, DubpBlockV10, DubpBlockV10Stringified, VerifyBlockHashError,
37    };
38}
39
40// Crate imports
41pub(crate) use crate::prelude::*;
42pub(crate) use dubp_documents::dubp_common::crypto::bases::BaseConversionError;
43pub(crate) use dubp_documents::dubp_common::crypto::hashs::Hash;
44pub(crate) use dubp_documents::dubp_common::crypto::keys::*;
45pub(crate) use dubp_documents::dubp_common::currency_params::*;
46pub(crate) use dubp_documents::dubp_common::prelude::*;
47pub(crate) use dubp_documents::membership::v10::MembershipType;
48pub(crate) use dubp_documents::prelude::*;
49pub(crate) use dubp_documents_parser::prelude::*;
50pub(crate) use log::{error, warn};
51pub(crate) use serde::{Deserialize, Serialize};
52pub(crate) use serde_json::Value;
53pub(crate) use std::{collections::HashMap, convert::TryFrom, str::FromStr};
54pub(crate) use thiserror::Error;
55
56pub use block::{
57    DubpBlock, DubpBlockStringified, DubpBlockV10, DubpBlockV10AfterPowData, DubpBlockV10Builder,
58    DubpBlockV10Content, DubpBlockV10Stringified,
59};
60
61#[cfg(test)]
62pub(crate) mod tests {
63    use super::*;
64    use unwrap::unwrap;
65
66    pub(crate) fn pk(pk_b58: &str) -> ed25519::PublicKey {
67        unwrap!(ed25519::PublicKey::from_base58(pk_b58))
68    }
69}