Skip to content

Commit 592c40c

Browse files
committed
Update contract schemas
1 parent 321e8fc commit 592c40c

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

contracts/reflect/schema/raw/response_to_sub_msg_result.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@
6767
}
6868
}
6969
},
70+
"MsgResponseValue": {
71+
"type": "object",
72+
"required": [
73+
"type_url",
74+
"value"
75+
],
76+
"properties": {
77+
"type_url": {
78+
"type": "string"
79+
},
80+
"value": {
81+
"$ref": "#/definitions/Binary"
82+
}
83+
}
84+
},
7085
"SubMsgResponse": {
7186
"description": "The information we get back from a successful sub message execution, with full Cosmos SDK events.",
7287
"type": "object",
@@ -75,6 +90,7 @@
7590
],
7691
"properties": {
7792
"data": {
93+
"deprecated": true,
7894
"anyOf": [
7995
{
8096
"$ref": "#/definitions/Binary"
@@ -89,11 +105,18 @@
89105
"items": {
90106
"$ref": "#/definitions/Event"
91107
}
108+
},
109+
"msg_responses": {
110+
"default": [],
111+
"type": "array",
112+
"items": {
113+
"$ref": "#/definitions/MsgResponseValue"
114+
}
92115
}
93116
}
94117
},
95118
"SubMsgResult": {
96-
"description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult<SubMsgResponse>` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_vec, Binary, Event, SubMsgResponse, SubMsgResult}; let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!(to_vec(&result).unwrap(), br#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\"}}\"#); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_vec, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_vec(&result).unwrap(), br#\"{\"error\":\"Something went wrong\"}\"#); ```",
119+
"description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult<SubMsgResponse>` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_json_string, Binary, Event, SubMsgResponse, SubMsgResult}; #[allow(deprecated)] let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], msg_responses: vec![], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!( to_json_string(&result).unwrap(), r#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\",\"msg_responses\":[]}}\"#, ); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_json_string, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_json_string(&result).unwrap(), r#\"{\"error\":\"Something went wrong\"}\"#); ```",
97120
"oneOf": [
98121
{
99122
"type": "object",

contracts/reflect/schema/reflect.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,21 @@
19481948
}
19491949
}
19501950
},
1951+
"MsgResponseValue": {
1952+
"type": "object",
1953+
"required": [
1954+
"type_url",
1955+
"value"
1956+
],
1957+
"properties": {
1958+
"type_url": {
1959+
"type": "string"
1960+
},
1961+
"value": {
1962+
"$ref": "#/definitions/Binary"
1963+
}
1964+
}
1965+
},
19511966
"SubMsgResponse": {
19521967
"description": "The information we get back from a successful sub message execution, with full Cosmos SDK events.",
19531968
"type": "object",
@@ -1956,6 +1971,7 @@
19561971
],
19571972
"properties": {
19581973
"data": {
1974+
"deprecated": true,
19591975
"anyOf": [
19601976
{
19611977
"$ref": "#/definitions/Binary"
@@ -1970,11 +1986,18 @@
19701986
"items": {
19711987
"$ref": "#/definitions/Event"
19721988
}
1989+
},
1990+
"msg_responses": {
1991+
"default": [],
1992+
"type": "array",
1993+
"items": {
1994+
"$ref": "#/definitions/MsgResponseValue"
1995+
}
19731996
}
19741997
}
19751998
},
19761999
"SubMsgResult": {
1977-
"description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult<SubMsgResponse>` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_vec, Binary, Event, SubMsgResponse, SubMsgResult}; let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!(to_vec(&result).unwrap(), br#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\"}}\"#); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_vec, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_vec(&result).unwrap(), br#\"{\"error\":\"Something went wrong\"}\"#); ```",
2000+
"description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult<SubMsgResponse>` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_json_string, Binary, Event, SubMsgResponse, SubMsgResult}; #[allow(deprecated)] let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], msg_responses: vec![], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!( to_json_string(&result).unwrap(), r#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\",\"msg_responses\":[]}}\"#, ); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_json_string, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_json_string(&result).unwrap(), r#\"{\"error\":\"Something went wrong\"}\"#); ```",
19782001
"oneOf": [
19792002
{
19802003
"type": "object",

0 commit comments

Comments
 (0)