Expand description
Serde helper for Pooling fields exposed through the JS surface.
Pooling is #[repr(u8)] with Serialize_repr / Deserialize_repr, so the
default wire shape is the numeric discriminant (0/1/2). That number
leaks into JSON / Object output and makes XxxJSON.pooling: string
declarations false. The helper switches the human-readable path to a
camelCase string ("never"/"ifAvailable"/"standard") while keeping the
non-HR path at the original u8 so bincode (consensus binary format) is
untouched.
Apply via #[serde(with = "crate::withdrawal::pooling_serde")] on the
pooling field of any state transition that surfaces it to JS.
Functions§
- deserialize
- Deserialize accepts both shapes regardless of the deserializer’s
human-readable flag — mirrors the
BinaryData/Identifierpattern. Necessary becauseplatform_value::to_valuereports HR=false (emits the numeric discriminant on the way toJsValue), butplatform_value::from_valuereports HR=true on the way back. Without dual acceptance, thefromObject(toObject())round-trip fails on thepoolingfield. - serialize