MCPcopy Index your code
hub / github.com/Commit-Boost/commit-boost-client / deserialize

Function deserialize

crates/common/src/utils.rs:192–212  ·  view source on GitHub ↗
(deserializer: D)

Source from the content-addressed store, hash-verified

190 }
191
192 pub fn deserialize<'de, D>(deserializer: D) -> Result<U256, D::Error>
193 where
194 D: serde::Deserializer<'de>,
195 {
196 #[derive(Deserialize)]
197 #[serde(untagged)]
198 enum StringOrF64 {
199 Str(String),
200 F64(f64),
201 }
202
203 let value = StringOrF64::deserialize(deserializer)?;
204 let wei = match value {
205 StringOrF64::Str(s) => {
206 parse_ether(&s).map_err(|_| serde::de::Error::custom("invalid eth amount"))?
207 }
208 StringOrF64::F64(f) => eth_to_wei(f),
209 };
210
211 Ok(wei)
212 }
213}
214
215pub const fn default_u64<const U: u64>() -> u64 {

Callers 15

start_mock_relayFunction · 0.85
load_simple_accountsFunction · 0.85
bls_pubkey_from_hexFunction · 0.85
deserializeMethod · 0.85
base64_list_decodeFunction · 0.85

Calls 1

eth_to_weiFunction · 0.85

Tested by 4