Skip to content

Commit 92f5512

Browse files
committed
Add test for pre-2.0 SubMsgResponse
1 parent 4a0d6e1 commit 92f5512

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/std/src/results/submessages.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,18 @@ mod tests {
265265
})
266266
);
267267

268+
// should work with `data` and no `msg_responses`
269+
// this is the case for pre-2.0 CosmWasm chains
270+
let result: SubMsgResult = from_json(br#"{"ok":{"events":[],"data":"aGk="}}"#).unwrap();
271+
assert_eq!(
272+
result,
273+
SubMsgResult::Ok(SubMsgResponse {
274+
events: vec![],
275+
data: Some(Binary::from_base64("aGk=").unwrap()),
276+
msg_responses: vec![]
277+
})
278+
);
279+
268280
let result: SubMsgResult = from_json(
269281
br#"{"ok":{"events":[{"type":"wasm","attributes":[{"key":"fo","value":"ba"}]}],"data":"MTIzCg==",
270282
"msg_responses":[{"type_url":"URL","value":"MTIzCg=="}]}}"#).unwrap();

0 commit comments

Comments
 (0)