@@ -20,8 +20,6 @@ use parity_scale_codec::{Decode, Encode};
20
20
use serde:: { Deserialize , Serialize } ;
21
21
use serde_with:: { DeserializeFromStr , SerializeDisplay } ;
22
22
23
- #[ cfg( feature = "transparent_api" ) ]
24
- use crate :: Registrable ;
25
23
use crate :: {
26
24
asset:: {
27
25
prelude:: { Asset , AssetId } ,
@@ -58,15 +56,15 @@ model! {
58
56
/// # Examples
59
57
///
60
58
/// ```rust
61
- /// use iroha_data_model::account::Id ;
59
+ /// use iroha_data_model::account::AccountId ;
62
60
///
63
- /// let id = "user@company".parse::<Id >().expect("Valid");
61
+ /// let id = "user@company".parse::<AccountId >().expect("Valid");
64
62
/// ```
65
63
#[ derive( Debug , Display , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Constructor , Getters , Decode , Encode , DeserializeFromStr , SerializeDisplay , IntoSchema ) ]
66
64
#[ display( fmt = "{name}@{domain_id}" ) ]
67
65
#[ getset( get = "pub" ) ]
68
66
#[ ffi_type]
69
- pub struct Id {
67
+ pub struct AccountId {
70
68
/// [`Account`]'s name.
71
69
pub name: Name ,
72
70
/// [`Account`]'s [`Domain`](`crate::domain::Domain`) id.
@@ -80,7 +78,7 @@ model! {
80
78
#[ ffi_type]
81
79
pub struct Account {
82
80
/// An Identification of the [`Account`].
83
- pub id: Id ,
81
+ pub id: AccountId ,
84
82
/// Assets in this [`Account`].
85
83
pub assets: AssetsMap ,
86
84
/// [`Account`]'s signatories.
@@ -116,14 +114,14 @@ model! {
116
114
pub struct SignatureCheckCondition ( pub EvaluatesTo <bool >) ;
117
115
}
118
116
119
- impl Id {
120
- #[ cfg( feature = "transparent_api" ) ]
117
+ impl AccountId {
118
+ #[ cfg( any ( test , feature = "transparent_api" ) ) ]
121
119
const GENESIS_ACCOUNT_NAME : & str = "genesis" ;
122
120
123
121
/// Construct [`Id`] of the genesis account.
124
122
#[ inline]
125
123
#[ must_use]
126
- #[ cfg( feature = "transparent_api" ) ]
124
+ #[ cfg( any ( test , feature = "transparent_api" ) ) ]
127
125
pub fn genesis ( ) -> Self {
128
126
Self {
129
127
name : Self :: GENESIS_ACCOUNT_NAME . parse ( ) . expect ( "Valid" ) ,
@@ -180,7 +178,7 @@ impl Account {
180
178
}
181
179
}
182
180
183
- #[ cfg( feature = "transparent_api" ) ]
181
+ #[ cfg( any ( test , feature = "transparent_api" ) ) ]
184
182
impl Account {
185
183
/// Add [`Asset`] into the [`Account`] returning previous asset stored under the same id
186
184
#[ inline]
@@ -282,8 +280,8 @@ impl Default for SignatureCheckCondition {
282
280
}
283
281
}
284
282
285
- #[ cfg( feature = "transparent_api" ) ]
286
- impl Registrable for NewAccount {
283
+ #[ cfg( any ( test , feature = "transparent_api" ) ) ]
284
+ impl crate :: Registrable for NewAccount {
287
285
type Target = Account ;
288
286
289
287
#[ must_use]
@@ -326,7 +324,7 @@ impl FromIterator<Account> for crate::Value {
326
324
}
327
325
328
326
/// Account Identification is represented by `name@domain_name` string.
329
- impl FromStr for Id {
327
+ impl FromStr for AccountId {
330
328
type Err = ParseError ;
331
329
332
330
fn from_str ( string : & str ) -> Result < Self , Self :: Err > {
@@ -335,7 +333,7 @@ impl FromStr for Id {
335
333
Some ( ( "" , _) ) => Err ( ParseError {
336
334
reason : "`AccountId` cannot be empty" ,
337
335
} ) ,
338
- Some ( ( name, domain_id) ) if !name. is_empty ( ) && !domain_id. is_empty ( ) => Ok ( Id {
336
+ Some ( ( name, domain_id) ) if !name. is_empty ( ) && !domain_id. is_empty ( ) => Ok ( AccountId {
339
337
name : name. parse ( ) ?,
340
338
domain_id : domain_id. parse ( ) ?,
341
339
} ) ,
@@ -348,5 +346,5 @@ impl FromStr for Id {
348
346
349
347
/// The prelude re-exports most commonly used traits, structs and macros from this crate.
350
348
pub mod prelude {
351
- pub use super :: { Account , Id as AccountId , SignatureCheckCondition } ;
349
+ pub use super :: { Account , AccountId , SignatureCheckCondition } ;
352
350
}
0 commit comments