Macro adapter_msg_types

Source
macro_rules! adapter_msg_types {
    ($adapter_type:ty, $adapter_execute_msg: ty, $adapter_query_msg: ty) => { ... };
}
Expand description

Generates boilerplate code and entrypoint message types.

§Usage

Requires three arguments:

  1. The Adapter type.
  2. The Adapter’s custom execute message type.
  3. The Adapter’s custom query message type.
abstract_adapter::adapter_msg_types!(MyAdapter, MyAdapterExecuteMsg, MyAdapterQueryMsg);

Generates:

// These are the entry point messages expected by the smart-contract. Our custom messages get wrapped by the abstract base message.
pub type InstantiateMsg =
    <MyAdapter as abstract_sdk::base::InstantiateEndpoint>::InstantiateMsg;
pub type ExecuteMsg = <MyAdapter as abstract_sdk::base::ExecuteEndpoint>::ExecuteMsg;
pub type QueryMsg = <MyAdapter as abstract_sdk::base::QueryEndpoint>::QueryMsg;

// Implements the trait-bounds for the abstract adapter messages, which allows them to be used in the Adapter type.
// Also implements `Into<ExecuteMsg> for MyAdapterExecuteMsg` and `Into<QueryMsg> for MyAdapterQueryMsg`.
// This enables the use of the `impl_into` macro of cw-orchestrator.
impl abstract_std::adapter::AdapterExecuteMsg for MyAdapterExecuteMsg {}
impl abstract_std::adapter::AdapterQueryMsg for MyAdapterQueryMsg {}