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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#![deny(
clippy::unwrap_used,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces
)]
mod compact_text;
mod json;
mod raw_text;
mod transaction_utils;
pub mod prelude {
pub use crate::compact_text::certifications::parse_compact_certifications;
pub use crate::compact_text::identities::parse_compact_identities;
pub use crate::compact_text::memberships::parse_compact_memberships;
pub use crate::compact_text::revoked::parse_compact_revocations;
pub use crate::compact_text::ParseCompactDocError;
pub use crate::json::transactions::{parse_json_transactions, ParseJsonTxError};
pub use crate::raw_text::{ParseFromRawText, Rule};
}
pub use crate::json::serde_json_value_to_pest_json_value;
pub(crate) use crate::json::DefaultHasher;
pub(crate) use crate::prelude::*;
pub(crate) use crate::raw_text::{FromPestPair, RawDocumentsParser};
pub(crate) use crate::transaction_utils::{
tx_input_v10_from_str, tx_output_v10_from_str, tx_unlock_v10_from_str,
};
pub(crate) use dubp_documents::certification::{
v10::CertificationDocumentV10Builder, CertificationDocument, CertificationDocumentV10,
CompactCertificationDocumentV10,
};
pub(crate) use dubp_documents::dubp_common::crypto::bases::BaseConversionError;
pub(crate) use dubp_documents::dubp_common::crypto::hashs::Hash;
pub(crate) use dubp_documents::dubp_common::crypto::keys::*;
pub(crate) use dubp_documents::dubp_common::prelude::*;
pub(crate) use dubp_documents::identity::{
IdentityDocument, IdentityDocumentV10, IdentityDocumentV10Builder,
};
pub(crate) use dubp_documents::membership::{
MembershipDocument, MembershipDocumentV10, MembershipDocumentV10Builder, MembershipType,
};
pub(crate) use dubp_documents::prelude::*;
pub(crate) use dubp_documents::revocation::{
v10::RevocationDocumentV10Builder, CompactRevocationDocumentV10, RevocationDocument,
RevocationDocumentV10,
};
pub(crate) use dubp_documents::smallvec::{smallvec as svec, SmallVec};
pub(crate) use dubp_documents::transaction::{
v10::TransactionInputUnlocksV10, OutputIndex, TransactionDocument, TransactionDocumentBuilder,
TransactionDocumentV10, TransactionDocumentV10Builder, TransactionInputV10,
TransactionOutputCondition, TransactionOutputV10, TransactionUnlockProof, TxAmount, TxBase,
UTXOConditions, UTXOConditionsGroup,
};
pub(crate) use json_pest_parser::{JSONValue, Number};
pub(crate) use pest::{
iterators::{Pair, Pairs},
Parser,
};
pub(crate) use pest_derive::Parser;
pub(crate) use serde_json::Value;
pub(crate) use std::{collections::HashMap, net::AddrParseError, num::ParseIntError, str::FromStr};
pub(crate) use thiserror::Error;
pub(crate) use unwrap::unwrap;
#[derive(Debug, Clone, Eq, Error, PartialEq)]
#[error("Grammar error: {0}")]
pub struct PestError(pub String);
impl<T: pest::RuleType> From<pest::error::Error<T>> for PestError {
fn from(e: pest::error::Error<T>) -> Self {
PestError(format!("{}", e))
}
}
#[derive(Debug, Clone, Eq, Error, PartialEq)]
pub enum RawTextParseError {
#[error("TextDocumentParseError: Invalid inner format: {0}")]
InvalidInnerFormat(String),
#[error("TextDocumentParseError: invalid ip: {0}")]
IpAddrError(AddrParseError),
#[error("TextDocumentParseError: {0}")]
PestError(PestError),
#[error("TextDocumentParseError: Unexpected rule: '{0}'")]
UnexpectedRule(String),
#[error("TextDocumentParseError: Unexpected version: '{0}'")]
UnexpectedVersion(String),
#[error("TextDocumentParseError: UnknownType.")]
UnknownType,
}
impl From<AddrParseError> for RawTextParseError {
fn from(e: AddrParseError) -> Self {
RawTextParseError::IpAddrError(e)
}
}
impl From<PestError> for RawTextParseError {
fn from(e: PestError) -> Self {
RawTextParseError::PestError(e)
}
}
impl<T: pest::RuleType> From<pest::error::Error<T>> for RawTextParseError {
fn from(e: pest::error::Error<T>) -> Self {
RawTextParseError::PestError(e.into())
}
}