abstract_proxy/
reply.rs

1use cosmwasm_std::{Reply, StdError};
2
3use crate::contract::{ProxyResponse, ProxyResult};
4
5/// Add the message's data to the response
6pub fn forward_response_data(result: Reply) -> ProxyResult {
7    // get the result from the reply
8    let res = result.result.into_result().map_err(StdError::generic_err)?;
9
10    // log and add data if needed
11    let resp = if let Some(data) = res.data {
12        ProxyResponse::new(
13            "forward_response_data_reply",
14            vec![("response_data", "true")],
15        )
16        .set_data(data)
17    } else {
18        ProxyResponse::new(
19            "forward_response_data_reply",
20            vec![("response_data", "false")],
21        )
22    };
23
24    Ok(resp)
25}