MCPcopy Create free account
hub / github.com/cowprotocol/services / parse

Function parse

crates/app-data/src/app_data.rs:307–315  ·  view source on GitHub ↗
(full_app_data: &[u8])

Source from the content-addressed store, hash-verified

305}
306
307pub fn parse(full_app_data: &[u8]) -> Result<ProtocolAppData, serde_json::Error> {
308 let root = serde_json::from_slice::<Root>(full_app_data)?;
309 Ok(root
310 .metadata
311 .or_else(|| root.backend.map(ProtocolAppData::from))
312 // If the key doesn't exist, default. Makes life easier for API
313 // consumers, who don't care about protocol app data.
314 .unwrap_or_default())
315}
316
317/// The wire form of [`ProtocolAppData`], mirroring the flat JSON `metadata`
318/// object one-to-one. It exists because `enableFastPath` and `validFrom` arrive

Calls

no outgoing calls