Skip to main content

komple_framework_mint_module/
helper.rs

1use crate::msg::ExecuteMsg;
2use cosmwasm_schema::cw_serde;
3use cosmwasm_std::{to_binary, Addr, Coin, StdResult, WasmMsg};
4
5/// Helper methods for the mint module.
6///
7/// Used for constructing some of the execute messages and performing queries.
8#[cw_serde]
9pub struct KompleMintModule(pub Addr);
10
11impl KompleMintModule {
12    pub fn addr(&self) -> Addr {
13        self.0.clone()
14    }
15
16    pub fn admin_mint_msg(
17        &self,
18        recipient: String,
19        collection_id: u32,
20        metadata_id: Option<u32>,
21        funds: Vec<Coin>,
22    ) -> StdResult<WasmMsg> {
23        let msg = ExecuteMsg::AdminMint {
24            recipient,
25            collection_id,
26            metadata_id,
27        };
28        Ok(WasmMsg::Execute {
29            contract_addr: self.0.to_string(),
30            msg: to_binary(&msg)?,
31            funds,
32        })
33    }
34}