Skip to main content

dpp/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2// Coding conventions .
3#![forbid(unsafe_code)]
4//#![deny(missing_docs)]
5#![allow(dead_code)]
6// `ProtocolError` is the Err type of hundreds of fns here; boxing it
7// would add indirection to every return. Removing the allow needs a
8// crate-wide error refactor.
9#![allow(clippy::result_large_err)]
10// Covers static-dispatch async trait methods; dyn-safe traits like
11// `Signer` still use `#[async_trait]` at their own declaration.
12#![allow(async_fn_in_trait)]
13
14extern crate core;
15
16pub use dashcore;
17
18#[cfg(feature = "core_key_wallet")]
19pub use key_wallet;
20
21#[cfg(feature = "core_key_wallet_manager")]
22pub use key_wallet_manager;
23
24#[cfg(feature = "core_spv")]
25pub use dash_spv;
26
27#[cfg(feature = "core_rpc_client")]
28pub use dashcore_rpc;
29
30#[cfg(feature = "client")]
31pub use dash_platform_protocol::DashPlatformProtocol;
32pub use errors::*;
33
34pub mod data_contract;
35pub mod document;
36pub mod identifier;
37pub mod identity;
38pub mod metadata;
39#[cfg(feature = "state-transitions")]
40pub mod state_transition;
41pub mod util;
42pub mod version;
43
44pub mod errors;
45
46pub mod validation;
47
48#[cfg(feature = "client")]
49pub mod dash_platform_protocol;
50
51mod bls;
52
53#[cfg(feature = "fixtures-and-mocks")]
54pub mod tests;
55
56pub mod asset_lock;
57pub mod balances;
58pub mod block;
59/// Core subsidy
60pub mod core_subsidy;
61pub mod fee;
62pub mod nft;
63pub mod prefunded_specialized_balance;
64pub mod serialization;
65#[cfg(any(
66    feature = "message-signing",
67    feature = "message-signature-verification"
68))]
69pub mod signing;
70#[cfg(feature = "system_contracts")]
71pub mod system_data_contracts;
72
73pub mod tokens;
74
75pub mod voting;
76
77#[cfg(feature = "core-types")]
78pub mod core_types;
79
80pub mod address_funds;
81pub mod contract_group;
82pub mod group;
83pub mod shielded;
84pub mod withdrawal;
85
86pub use async_trait;
87
88pub use bls::*;
89
90pub mod prelude {
91
92    pub use crate::data_contract::DataContract;
93    #[cfg(feature = "extended-document")]
94    pub use crate::document::ExtendedDocument;
95    pub use crate::errors::ProtocolError;
96    pub use crate::identifier::Identifier;
97    pub use crate::identity::state_transition::asset_lock_proof::AssetLockProof;
98    pub use crate::identity::Identity;
99    pub use crate::identity::IdentityPublicKey;
100    #[cfg(feature = "validation")]
101    pub use crate::validation::ConsensusValidationResult;
102
103    pub type EpochInterval = u16;
104
105    pub type BlockHeight = u64;
106
107    pub type FeeMultiplier = u64;
108
109    pub type BlockHeightInterval = u64;
110
111    pub type CoreBlockHeight = u32;
112    pub type TimestampMillis = u64;
113
114    pub type TimestampMillisInterval = u64;
115
116    pub type StartAtIncluded = bool;
117
118    pub type TimestampIncluded = bool;
119    pub type Revision = u64;
120
121    /// Identity nonces are split 24 bits are for the recent documents, 40 bits are for the identity.
122    pub type IdentityNonce = u64;
123
124    /// The Key of type none is only 32 bits, which means an address can be used up to 4 billion times.
125    pub type AddressNonce = u32;
126
127    pub type SenderKeyIndex = u32;
128    pub type RecipientKeyIndex = u32;
129
130    /// The index of the user's key that is used to derive keys that will be used to encrypt the contact's user id in encToUserId and the private data.
131    pub type RootEncryptionKeyIndex = u32;
132
133    /// The index at which to derive the root encryption key.
134    pub type DerivationEncryptionKeyIndex = u32;
135
136    /// UserFeeIncrease is the additional percentage of the processing fee.
137    /// A 1 here means we pay 1% more in processing fees. A 100 means we pay 100% more.
138    pub type UserFeeIncrease = u16;
139}
140
141pub use bincode;
142pub use bincode::enc::Encode;
143#[cfg(feature = "bls-signatures")]
144pub use dashcore::blsful as bls_signatures;
145#[cfg(feature = "ed25519-dalek")]
146pub use dashcore::ed25519_dalek;
147#[cfg(feature = "data-contracts")]
148pub use data_contracts;
149#[cfg(feature = "jsonschema")]
150pub use jsonschema;
151pub use platform_serialization;
152pub use platform_serialization::de::{BorrowDecode, Decode, DefaultBorrowDecode, DefaultDecode};
153pub use platform_value;