write_api!() { /* proc-macro */ }
Expand description

Takes care of generating the interface description file for a contract. The body describes the message types included and allows setting contract name and version overrides.

The only obligatory field is instantiate - to set the InstantiateMsg type.

§Available fields

  • name - contract name, crate name by default
  • version - contract version, crate version by default
  • instantiate - instantiate msg type
  • query - query msg type, empty by default
  • execute - execute msg type, empty by default
  • migrate - migrate msg type, empty by default
  • sudo - sudo msg type, empty by default

§Example

use cosmwasm_schema::{cw_serde, write_api};

#[cw_serde]
struct InstantiateMsg;

#[cw_serde]
struct MigrateMsg;

write_api! {
    name: "cw20",
    instantiate: InstantiateMsg,
    migrate: MigrateMsg,
};