mirror of
https://github.com/floor-licker/polyfill-rs.git
synced 2026-08-16 05:58:06 +00:00
fix: align V2 client with official SDK fee behavior
This commit is contained in:
@@ -186,6 +186,16 @@ pub mod deserializers {
|
||||
serde::de::Error::custom("Expected decimal as string/number, got null/empty string")
|
||||
})
|
||||
}
|
||||
|
||||
/// Deserialize a Decimal from string/number/null, defaulting missing-ish values to zero.
|
||||
pub fn decimal_from_string_or_zero<'de, D>(
|
||||
deserializer: D,
|
||||
) -> std::result::Result<Decimal, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Ok(optional_decimal_from_string(deserializer)?.unwrap_or(Decimal::ZERO))
|
||||
}
|
||||
}
|
||||
|
||||
/// Raw API response types for efficient parsing
|
||||
|
||||
Reference in New Issue
Block a user