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 group;
82pub mod shielded;
83pub mod withdrawal;
84
85pub use async_trait;
86
87pub use bls::*;
88
89pub mod prelude {
90
91    pub use crate::data_contract::DataContract;
92    #[cfg(feature = "extended-document")]
93    pub use crate::document::ExtendedDocument;
94    pub use crate::errors::ProtocolError;
95    pub use crate::identifier::Identifier;
96    pub use crate::identity::state_transition::asset_lock_proof::AssetLockProof;
97    pub use crate::identity::Identity;
98    pub use crate::identity::IdentityPublicKey;
99    #[cfg(feature = "validation")]
100    pub use crate::validation::ConsensusValidationResult;
101
102    pub type EpochInterval = u16;
103
104    pub type BlockHeight = u64;
105
106    pub type FeeMultiplier = u64;
107
108    pub type BlockHeightInterval = u64;
109
110    pub type CoreBlockHeight = u32;
111    pub type TimestampMillis = u64;
112
113    pub type TimestampMillisInterval = u64;
114
115    pub type StartAtIncluded = bool;
116
117    pub type TimestampIncluded = bool;
118    pub type Revision = u64;
119
120    /// Identity nonces are split 24 bits are for the recent documents, 40 bits are for the identity.
121    pub type IdentityNonce = u64;
122
123    /// The Key of type none is only 32 bits, which means an address can be used up to 4 billion times.
124    pub type AddressNonce = u32;
125
126    pub type SenderKeyIndex = u32;
127    pub type RecipientKeyIndex = u32;
128
129    /// 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.
130    pub type RootEncryptionKeyIndex = u32;
131
132    /// The index at which to derive the root encryption key.
133    pub type DerivationEncryptionKeyIndex = u32;
134
135    /// UserFeeIncrease is the additional percentage of the processing fee.
136    /// A 1 here means we pay 1% more in processing fees. A 100 means we pay 100% more.
137    pub type UserFeeIncrease = u16;
138}
139
140pub use bincode;
141pub use bincode::enc::Encode;
142#[cfg(feature = "bls-signatures")]
143pub use dashcore::blsful as bls_signatures;
144#[cfg(feature = "ed25519-dalek")]
145pub use dashcore::ed25519_dalek;
146#[cfg(feature = "data-contracts")]
147pub use data_contracts;
148#[cfg(feature = "jsonschema")]
149pub use jsonschema;
150pub use platform_serialization;
151pub use platform_serialization::de::{BorrowDecode, Decode, DefaultBorrowDecode, DefaultDecode};
152pub use platform_value;