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

Function parse

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

Source from the content-addressed store, hash-verified

296}
297
298pub fn parse(full_app_data: &[u8]) -> Result<ProtocolAppData, serde_json::Error> {
299 let root = serde_json::from_slice::<Root>(full_app_data)?;
300 let parsed = root
301 .metadata
302 .or_else(|| root.backend.map(ProtocolAppData::from))
303 // If the key doesn't exist, default. Makes life easier for API
304 // consumers, who don't care about protocol app data.
305 .unwrap_or_default();
306 Ok(parsed)
307}
308
309/// Extracts the `appCode` from a full app-data document, if present.
310///

Callers 15

parse_multiple_solversFunction · 0.85
auth_token_is_redactedFunction · 0.85
join_urlFunction · 0.85
url_joinFunction · 0.85
validateMethod · 0.85
get_cached_or_fetchMethod · 0.85
join_urlFunction · 0.85
worksFunction · 0.85
worksFunction · 0.85
works_xdaiFunction · 0.85

Calls

no outgoing calls

Tested by 13

parse_multiple_solversFunction · 0.68
auth_token_is_redactedFunction · 0.68
swap_sell_all_chainsFunction · 0.68
swap_buy_all_chainsFunction · 0.68
swap_buy_disabledFunction · 0.68
swap_sell_regularFunction · 0.68
swap_buy_disabledFunction · 0.68
swap_buy_enabledFunction · 0.68
swap_api_errorFunction · 0.68