Repository: CosmWasm/cosmwasm (rust)

Issue:
Rename send -> funds in WasmMsg
Both `WasmMsg::Execute` and `WasmMsg::Instantiate` have a `send` field. This should be renamed to `funds` for consistency with the wasmd message types.

Pull request description:
Rename `send` to `funds` in `WasmMsg`
Closes #916

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 279cb6677..7f192932c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ and this project adheres to
 
 ## [Unreleased]
 
+### Changed
+
+- cosmwasm-std: Rename the `send` function parameter to `funds` in `WasmMsg`
+  for consistency with the wasmd message types.
+
 ## [0.14.1] - 2021-06-14
 
 ### Added
diff --git a/contracts/ibc-reflect-send/schema/execute_msg.json b/contracts/ibc-reflect-send/schema/execute_msg.json
index 70eb8de72..6e79476d8 100644
--- a/contracts/ibc-reflect-send/schema/execute_msg.json
+++ b/contracts/ibc-reflect-send/schema/execute_msg.json
@@ -596,13 +596,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -610,12 +616,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -633,9 +633,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -649,6 +649,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -660,12 +666,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/contracts/ibc-reflect-send/schema/packet_msg.json b/contracts/ibc-reflect-send/schema/packet_msg.json
index 5d0efcdd5..0f4e9f969 100644
--- a/contracts/ibc-reflect-send/schema/packet_msg.json
+++ b/contracts/ibc-reflect-send/schema/packet_msg.json
@@ -549,13 +549,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -563,12 +569,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -586,9 +586,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -602,6 +602,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -613,12 +619,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/contracts/ibc-reflect/schema/packet_msg.json b/contracts/ibc-reflect/schema/packet_msg.json
index 3896bfcd0..df229f239 100644
--- a/contracts/ibc-reflect/schema/packet_msg.json
+++ b/contracts/ibc-reflect/schema/packet_msg.json
@@ -548,13 +548,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -562,12 +568,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -585,9 +585,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -601,6 +601,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -612,12 +618,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/contracts/ibc-reflect/src/contract.rs b/contracts/ibc-reflect/src/contract.rs
index 88965263e..4af0858cb 100644
--- a/contracts/ibc-reflect/src/contract.rs
+++ b/contracts/ibc-reflect/src/contract.rs
@@ -164,7 +164,7 @@ pub fn ibc_channel_connect(
         admin: None,
         code_id: cfg.reflect_code_id,
         msg: b"{}".into(),
-        send: vec![],
+        funds: vec![],
         label: format!("ibc-reflect-{}", &chan_id),
     };
     let sub_msg = SubMsg {
@@ -477,13 +477,13 @@ mod tests {
             admin,
             code_id,
             msg: _,
-            send,
+            funds,
             label,
         }) = &res.submessages[0].msg
         {
             assert_eq!(*admin, None);
             assert_eq!(*code_id, REFLECT_ID);
-            assert_eq!(send.len(), 0);
+            assert_eq!(funds.len(), 0);
             assert!(label.contains(channel_id));
         } else {
             panic!("invalid return message: {:?}", res.messages[0]);
@@ -576,11 +576,11 @@ mod tests {
         if let CosmosMsg::Wasm(WasmMsg::Execute {
             contract_addr,
             msg,
-            send,
+            funds,
         }) = &res.submessages[0].msg
         {
             assert_eq!(account, contract_addr.as_str());
-            assert_eq!(0, send.len());
+            assert_eq!(0, funds.len());
             // parse the message - should callback with proper channel_id
             let rmsg: ReflectExecuteMsg = from_slice(&msg).unwrap();
             assert_eq!(
diff --git a/contracts/reflect/schema/execute_msg.json b/contracts/reflect/schema/execute_msg.json
index c8608f023..c93b3084b 100644
--- a/contracts/reflect/schema/execute_msg.json
+++ b/contracts/reflect/schema/execute_msg.json
@@ -632,13 +632,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -646,12 +652,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -669,9 +669,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -685,6 +685,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -696,12 +702,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/contracts/reflect/schema/response_for__custom_msg.json b/contracts/reflect/schema/response_for__custom_msg.json
index 651213151..859982100 100644
--- a/contracts/reflect/schema/response_for__custom_msg.json
+++ b/contracts/reflect/schema/response_for__custom_msg.json
@@ -620,13 +620,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -634,12 +640,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -657,9 +657,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -673,6 +673,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -684,12 +690,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/contracts/staking/src/contract.rs b/contracts/staking/src/contract.rs
index 44224438a..c52bb447d 100644
--- a/contracts/staking/src/contract.rs
+++ b/contracts/staking/src/contract.rs
@@ -325,7 +325,7 @@ pub fn reinvest(deps: DepsMut, env: Env, _info: MessageInfo) -> StdResult<Respon
             WasmMsg::Execute {
                 contract_addr: contract_addr.into(),
                 msg,
-                send: vec![],
+                funds: vec![],
             }
             .into(),
         ],
diff --git a/packages/std/schema/cosmos_msg.json b/packages/std/schema/cosmos_msg.json
index c1bd30038..00bf12f6a 100644
--- a/packages/std/schema/cosmos_msg.json
+++ b/packages/std/schema/cosmos_msg.json
@@ -138,13 +138,19 @@
               "type": "object",
               "required": [
                 "contract_addr",
-                "msg",
-                "send"
+                "funds",
+                "msg"
               ],
               "properties": {
                 "contract_addr": {
                   "type": "string"
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "msg": {
                   "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)",
                   "allOf": [
@@ -152,12 +158,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
@@ -175,9 +175,9 @@
               "type": "object",
               "required": [
                 "code_id",
+                "funds",
                 "label",
-                "msg",
-                "send"
+                "msg"
               ],
               "properties": {
                 "admin": {
@@ -191,6 +191,12 @@
                   "format": "uint64",
                   "minimum": 0.0
                 },
+                "funds": {
+                  "type": "array",
+                  "items": {
+                    "$ref": "#/definitions/Coin"
+                  }
+                },
                 "label": {
                   "description": "A human-readbale label for the contract",
                   "type": "string"
@@ -202,12 +208,6 @@
                       "$ref": "#/definitions/Binary"
                     }
                   ]
-                },
-                "send": {
-                  "type": "array",
-                  "items": {
-                    "$ref": "#/definitions/Coin"
-                  }
                 }
               }
             }
diff --git a/packages/std/src/results/cosmos_msg.rs b/packages/std/src/results/cosmos_msg.rs
index 546b510dc..bb4273080 100644
--- a/packages/std/src/results/cosmos_msg.rs
+++ b/packages/std/src/results/cosmos_msg.rs
@@ -120,7 +120,7 @@ pub enum WasmMsg {
         contract_addr: String,
         /// msg is the json-encoded ExecuteMsg struct (as raw Binary)
         msg: Binary,
-        send: Vec<Coin>,
+        funds: Vec<Coin>,
     },
     /// Instantiates a new contracts from previously uploaded Wasm code.
     ///
@@ -131,7 +131,7 @@ pub enum WasmMsg {
         code_id: u64,
         /// msg is the JSON-encoded InstantiateMsg struct (as raw Binary)
         msg: Binary,
-        send: Vec<Coin>,
+        funds: Vec<Coin>,
         /// A human-readbale label for the contract
         label: String,
     },
@@ -166,7 +166,7 @@ pub enum WasmMsg {
 pub fn wasm_instantiate<T>(
     code_id: u64,
     msg: &T,
-    send: Vec<Coin>,
+    funds: Vec<Coin>,
     label: String,
 ) -> StdResult<WasmMsg>
 where
@@ -177,13 +177,13 @@ where
         admin: None,
         code_id,
         msg: payload,
-        send,
+        funds,
         label,
     })
 }
 
 /// Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code
-pub fn wasm_execute<T, U>(contract_addr: T, msg: &U, send: Vec<Coin>) -> StdResult<WasmMsg>
+pub fn wasm_execute<T, U>(contract_addr: T, msg: &U, funds: Vec<Coin>) -> StdResult<WasmMsg>
 where
     T: Into<String>,
     U: Serialize,
@@ -192,7 +192,7 @@ where
     Ok(WasmMsg::Execute {
         contract_addr: contract_addr.into(),
         msg: payload,
-        send,
+        funds,
     })
 }
 


Test patch:
diff --git a/contracts/ibc-reflect/tests/integration.rs b/contracts/ibc-reflect/tests/integration.rs
index f01b1eaf9..54f5da742 100644
--- a/contracts/ibc-reflect/tests/integration.rs
+++ b/contracts/ibc-reflect/tests/integration.rs
@@ -145,13 +145,13 @@ fn proper_handshake_flow() {
         admin,
         code_id,
         msg: _,
-        send,
+        funds,
         label,
     }) = &res.submessages[0].msg
     {
         assert_eq!(*admin, None);
         assert_eq!(*code_id, REFLECT_ID);
-        assert_eq!(send.len(), 0);
+        assert_eq!(funds.len(), 0);
         assert!(label.contains(channel_id));
     } else {
         panic!("invalid return message: {:?}", res.messages[0]);
@@ -249,11 +249,11 @@ fn handle_dispatch_packet() {
     if let CosmosMsg::Wasm(WasmMsg::Execute {
         contract_addr,
         msg,
-        send,
+        funds,
     }) = &res.submessages[0].msg
     {
         assert_eq!(account, contract_addr.as_str());
-        assert_eq!(0, send.len());
+        assert_eq!(0, funds.len());
         // parse the message - should callback with proper channel_id
         let rmsg: ReflectExecuteMsg = from_slice(&msg).unwrap();
         assert_eq!(