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

Function get_app_data_handler

crates/orderbook/src/api/get_app_data.rs:12–34  ·  view source on GitHub ↗
(
    State(state): State<Arc<AppState>>,
    Path(contract_app_data): Path<AppDataHash>,
)

Source from the content-addressed store, hash-verified

10};
11
12pub async fn get_app_data_handler(
13 State(state): State<Arc<AppState>>,
14 Path(contract_app_data): Path<AppDataHash>,
15) -> Response {
16 let result = state
17 .database_read
18 .get_full_app_data(&contract_app_data)
19 .await;
20 match result {
21 Ok(Some(response)) => (
22 StatusCode::OK,
23 Json(AppDataDocument {
24 full_app_data: response,
25 }),
26 )
27 .into_response(),
28 Ok(None) => (StatusCode::NOT_FOUND, "full app data not found").into_response(),
29 Err(err) => {
30 tracing::error!(?err, "get_app_data_by_hash");
31 crate::api::internal_error_reply()
32 }
33 }
34}

Callers

nothing calls this directly

Calls 3

internal_error_replyFunction · 0.85
get_full_app_dataMethod · 0.80
into_responseMethod · 0.45

Tested by

no test coverage detected