From b41969d416c61529014a71dd960b2a25e034ca80 Mon Sep 17 00:00:00 2001 From: Maxim Shishmarev Date: Fri, 26 Apr 2024 14:06:58 +1000 Subject: [PATCH] fix: derive serde attributes conditionally --- state-chain/runtime/src/runtime_apis.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index 3e52b7f08c..36fc42738a 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -62,15 +62,17 @@ pub struct ValidatorInfo { pub restricted_balances: BTreeMap, } -#[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(amount: &AssetAmount, s: S) -> Result where S: serde::Serializer,