1
1
use alloc:: fmt;
2
2
use alloc:: string:: String ;
3
3
use alloc:: vec:: Vec ;
4
+ use derivative:: Derivative ;
4
5
use serde:: { Deserialize , Serialize } ;
5
6
6
7
use crate :: binary:: Binary ;
@@ -120,8 +121,10 @@ pub enum DistributionMsg {
120
121
} ,
121
122
}
122
123
123
- #[ cfg( feature = "std" ) ]
124
- fn binary_to_string ( data : & Binary , fmt : & mut alloc:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
124
+ fn binary_to_string (
125
+ data : & Binary ,
126
+ fmt : & mut alloc:: fmt:: Formatter ,
127
+ ) -> Result < ( ) , core:: fmt:: Error > {
125
128
match core:: str:: from_utf8 ( data. as_slice ( ) ) {
126
129
Ok ( s) => fmt. write_str ( s) ,
127
130
Err ( _) => write ! ( fmt, "{:?}" , data) ,
@@ -133,10 +136,8 @@ fn binary_to_string(data: &Binary, fmt: &mut alloc::fmt::Formatter) -> Result<()
133
136
/// See https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto
134
137
#[ non_exhaustive]
135
138
#[ cfg_attr( feature = "std" , derive( schemars:: JsonSchema ) ) ]
136
- #[ cfg_attr( feature = "std" , derive( derivative:: Derivative ) ) ]
137
- #[ cfg_attr( not( feature = "std" ) , derive( Debug ) ) ]
138
- #[ derive( Serialize , Deserialize , Clone , PartialEq , Eq ) ]
139
- #[ cfg_attr( feature = "std" , derivative( Debug ) ) ]
139
+ #[ derive( Serialize , Deserialize , Clone , Derivative , PartialEq , Eq ) ]
140
+ #[ derivative( Debug ) ]
140
141
#[ serde( rename_all = "snake_case" ) ]
141
142
pub enum WasmMsg {
142
143
/// Dispatches a call to another contract at a known address (with known ABI).
@@ -146,7 +147,7 @@ pub enum WasmMsg {
146
147
Execute {
147
148
contract_addr : String ,
148
149
/// msg is the json-encoded ExecuteMsg struct (as raw Binary)
149
- #[ cfg_attr ( feature = "std" , derivative( Debug ( format_with = "binary_to_string" ) ) ) ]
150
+ #[ derivative( Debug ( format_with = "binary_to_string" ) ) ]
150
151
msg : Binary ,
151
152
funds : Vec < Coin > ,
152
153
} ,
@@ -158,7 +159,7 @@ pub enum WasmMsg {
158
159
admin : Option < String > ,
159
160
code_id : u64 ,
160
161
/// msg is the JSON-encoded InstantiateMsg struct (as raw Binary)
161
- #[ cfg_attr ( feature = "std" , derivative( Debug ( format_with = "binary_to_string" ) ) ) ]
162
+ #[ derivative( Debug ( format_with = "binary_to_string" ) ) ]
162
163
msg : Binary ,
163
164
funds : Vec < Coin > ,
164
165
/// A human-readbale label for the contract
@@ -176,7 +177,7 @@ pub enum WasmMsg {
176
177
/// the code_id of the new logic to place in the given contract
177
178
new_code_id : u64 ,
178
179
/// msg is the json-encoded MigrateMsg struct that will be passed to the new code
179
- #[ cfg_attr ( feature = "std" , derivative( Debug ( format_with = "binary_to_string" ) ) ) ]
180
+ #[ derivative( Debug ( format_with = "binary_to_string" ) ) ]
180
181
msg : Binary ,
181
182
} ,
182
183
/// Sets a new admin (for migrate) on the given contract.
0 commit comments