Skip to main content

wearable_collection/
msgs.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3use cosmwasm_std::{Binary, Coin};
4
5#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
6#[serde(rename_all = "snake_case")]
7pub enum ExecuteMsg {
8    /// Multiple NFTs can linked to the target NFT and ownership is changed(locked)
9    ComposeNft {
10        target_token_id: String,
11        parts_token_ids: Vec<String>,
12    },
13    
14    /// Multiple NFTs can unlinked from the Target NFT and ownership returns to it's original state.
15    DecomposeNft {
16        target_token_id: String,
17        parts_token_ids: Vec<String>,
18    },
19
20    /// All parts NFT of the target NFT are unlinked and ownership is returned to the original state.
21    DecomposeAll {
22        target_token_id: String,
23    },
24
25    /// Transfer is a base message to move a composed token to another account without triggering actions
26    /// Only composed NFT with a dependency of 1 depth can be transfer
27    TransferComposedNft { 
28        recipient: String, 
29        token_id: String 
30    },
31    
32    /// Send is a base message to transfer a composed token to a contract and trigger an action
33    /// on the receiving contract.
34    /// Only composed NFT with a dependency of 1 depth can be send
35    SendComposedNft {
36        contract: String,
37        token_id: String,
38        msg: Binary,
39    },
40
41    /// Sets address to send withdrawn fees to. Only owner can call this.
42    SetWithdrawAddress { address: String },
43    /// Removes the withdraw address, so fees are sent to the contract. Only owner can call this.
44    RemoveWithdrawAddress {},
45    /// Withdraw from the contract to the given address. Anyone can call this,
46    /// which is okay since withdraw address has been set by owner.
47    WithdrawFunds { amount: Coin },
48}
49
50#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
51#[serde(rename_all = "snake_case")]
52pub enum QueryMsg {
53    ChildDependentTokenInfo { 
54        token_id: String 
55    },
56
57    ParentDependentTokenInfo { 
58        token_id: String 
59    },
60
61    GetWithdrawAddress {},
62}
63
64#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
65pub struct Trait {
66    pub display_type: Option<String>,
67    pub trait_type: String,
68    pub value: String,
69}
70
71#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
72pub struct Metadata {
73    pub image: Option<String>,
74    pub image_data: Option<String>,
75    pub external_url: Option<String>,
76    pub description: Option<String>,
77    pub name: Option<String>,
78    pub attributes: Option<Vec<Trait>>,
79    pub background_color: Option<String>,
80    pub animation_url: Option<String>,
81    pub youtube_url: Option<String>,
82}
83
84#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
85pub struct NftInfoResponse {
86    /// Universal resource identifier for this NFT
87    /// Should point to a JSON file that conforms to the ERC721
88    /// Metadata JSON Schema
89    pub token_uri: Option<String>,
90    /// You can add any custom metadata here when you extend cw721-base
91    pub extension: Option<Metadata>,
92    /// Token ID for dependent NFTs
93    pub dependent_tokens: Option<Vec<String>>,
94}