Skip to content

Commit

Permalink
fix: derive serde attributes conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
msgmaxim committed Apr 26, 2024
1 parent b2bec41 commit b41969d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions state-chain/runtime/src/runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ pub struct ValidatorInfo {
pub restricted_balances: BTreeMap<EthereumAddress, u128>,
}

#[derive(Encode, Decode, Eq, PartialEq, TypeInfo, Serialize, Deserialize)]
#[derive(Encode, Decode, Eq, PartialEq, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct BoostPoolDepth {
#[serde(flatten)]
#[cfg_attr(feature = "std", serde(flatten))]
pub asset: Asset,
pub tier: u16,
#[serde(serialize_with = "serialize_as_hex")]
#[cfg_attr(feature = "std", serde(serialize_with = "serialize_as_hex"))]
pub available_amount: AssetAmount,
}

#[cfg(feature = "std")]
fn serialize_as_hex<S>(amount: &AssetAmount, s: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down

0 comments on commit b41969d

Please sign in to comment.