Skip to content

Commit 77cfd7b

Browse files
authored
Merge pull request #1533 from CosmWasm/fix-raw-json-schema
Fix data in raw/{query,migrate,sudo}.json
2 parents bda40c5 + c939aff commit 77cfd7b

File tree

16 files changed

+739
-1720
lines changed

16 files changed

+739
-1720
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ and this project adheres to
1515
- cosmwasm-std: Add `instantiate2_address` which allows calculating the
1616
predictable addresses for `MsgInstantiateContract2` ([#1437]).
1717
- cosmwasm-schema: In contracts, `cosmwasm schema` will now output a separate
18-
JSON Schema file for each entrypoint in the `raw` subdirectory.
18+
JSON Schema file for each entrypoint in the `raw` subdirectory ([#1478],
19+
[#1533]).
1920

2021
[#1437]: https://github.com/CosmWasm/cosmwasm/issues/1437
2122
[#1481]: https://github.com/CosmWasm/cosmwasm/pull/1481
23+
[#1478]: https://github.com/CosmWasm/cosmwasm/pull/1478
24+
[#1533]: https://github.com/CosmWasm/cosmwasm/pull/1533
2225

2326
### Changed
2427

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "MigrateMsg",
4+
"type": "object",
5+
"required": [
6+
"payout"
7+
],
8+
"properties": {
9+
"payout": {
10+
"type": "string"
11+
}
12+
},
13+
"additionalProperties": false
14+
}
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "QueryMsg",
4+
"oneOf": [
5+
{
6+
"description": "Cosmos format (secp256k1 verification scheme).",
7+
"type": "object",
8+
"required": [
9+
"verify_cosmos_signature"
10+
],
11+
"properties": {
12+
"verify_cosmos_signature": {
13+
"type": "object",
14+
"required": [
15+
"message",
16+
"public_key",
17+
"signature"
18+
],
19+
"properties": {
20+
"message": {
21+
"description": "Message to verify.",
22+
"allOf": [
23+
{
24+
"$ref": "#/definitions/Binary"
25+
}
26+
]
27+
},
28+
"public_key": {
29+
"description": "Serialized compressed (33 bytes) or uncompressed (65 bytes) public key.",
30+
"allOf": [
31+
{
32+
"$ref": "#/definitions/Binary"
33+
}
34+
]
35+
},
36+
"signature": {
37+
"description": "Serialized signature. Cosmos format (64 bytes).",
38+
"allOf": [
39+
{
40+
"$ref": "#/definitions/Binary"
41+
}
42+
]
43+
}
44+
},
45+
"additionalProperties": false
46+
}
47+
},
48+
"additionalProperties": false
49+
},
50+
{
51+
"description": "Ethereum text verification (compatible to the eth_sign RPC/web3 enpoint). This cannot be used to verify transaction.\n\nSee https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#sign",
52+
"type": "object",
53+
"required": [
54+
"verify_ethereum_text"
55+
],
56+
"properties": {
57+
"verify_ethereum_text": {
58+
"type": "object",
59+
"required": [
60+
"message",
61+
"signature",
62+
"signer_address"
63+
],
64+
"properties": {
65+
"message": {
66+
"description": "Message to verify. This will be wrapped in the standard container `\"\\x19Ethereum Signed Message:\\n\" + len(message) + message` before verification.",
67+
"type": "string"
68+
},
69+
"signature": {
70+
"description": "Serialized signature. Fixed length format (64 bytes `r` and `s` plus the one byte `v`).",
71+
"allOf": [
72+
{
73+
"$ref": "#/definitions/Binary"
74+
}
75+
]
76+
},
77+
"signer_address": {
78+
"description": "Signer address. This is matched case insensitive, so you can provide checksummed and non-checksummed addresses. Checksums are not validated.",
79+
"type": "string"
80+
}
81+
},
82+
"additionalProperties": false
83+
}
84+
},
85+
"additionalProperties": false
86+
},
87+
{
88+
"type": "object",
89+
"required": [
90+
"verify_ethereum_transaction"
91+
],
92+
"properties": {
93+
"verify_ethereum_transaction": {
94+
"type": "object",
95+
"required": [
96+
"chain_id",
97+
"data",
98+
"from",
99+
"gas_limit",
100+
"gas_price",
101+
"nonce",
102+
"r",
103+
"s",
104+
"to",
105+
"v",
106+
"value"
107+
],
108+
"properties": {
109+
"chain_id": {
110+
"type": "integer",
111+
"format": "uint64",
112+
"minimum": 0.0
113+
},
114+
"data": {
115+
"$ref": "#/definitions/Binary"
116+
},
117+
"from": {
118+
"description": "Ethereum address in hex format (42 characters, starting with 0x)",
119+
"type": "string"
120+
},
121+
"gas_limit": {
122+
"$ref": "#/definitions/Uint128"
123+
},
124+
"gas_price": {
125+
"$ref": "#/definitions/Uint128"
126+
},
127+
"nonce": {
128+
"type": "integer",
129+
"format": "uint64",
130+
"minimum": 0.0
131+
},
132+
"r": {
133+
"$ref": "#/definitions/Binary"
134+
},
135+
"s": {
136+
"$ref": "#/definitions/Binary"
137+
},
138+
"to": {
139+
"description": "Ethereum address in hex format (42 characters, starting with 0x)",
140+
"type": "string"
141+
},
142+
"v": {
143+
"type": "integer",
144+
"format": "uint64",
145+
"minimum": 0.0
146+
},
147+
"value": {
148+
"$ref": "#/definitions/Uint128"
149+
}
150+
},
151+
"additionalProperties": false
152+
}
153+
},
154+
"additionalProperties": false
155+
},
156+
{
157+
"description": "Tendermint format (ed25519 verification scheme).",
158+
"type": "object",
159+
"required": [
160+
"verify_tendermint_signature"
161+
],
162+
"properties": {
163+
"verify_tendermint_signature": {
164+
"type": "object",
165+
"required": [
166+
"message",
167+
"public_key",
168+
"signature"
169+
],
170+
"properties": {
171+
"message": {
172+
"description": "Message to verify.",
173+
"allOf": [
174+
{
175+
"$ref": "#/definitions/Binary"
176+
}
177+
]
178+
},
179+
"public_key": {
180+
"description": "Serialized public key. Tendermint format (32 bytes).",
181+
"allOf": [
182+
{
183+
"$ref": "#/definitions/Binary"
184+
}
185+
]
186+
},
187+
"signature": {
188+
"description": "Serialized signature. Tendermint format (64 bytes).",
189+
"allOf": [
190+
{
191+
"$ref": "#/definitions/Binary"
192+
}
193+
]
194+
}
195+
},
196+
"additionalProperties": false
197+
}
198+
},
199+
"additionalProperties": false
200+
},
201+
{
202+
"description": "Tendermint format (batch ed25519 verification scheme).",
203+
"type": "object",
204+
"required": [
205+
"verify_tendermint_batch"
206+
],
207+
"properties": {
208+
"verify_tendermint_batch": {
209+
"type": "object",
210+
"required": [
211+
"messages",
212+
"public_keys",
213+
"signatures"
214+
],
215+
"properties": {
216+
"messages": {
217+
"description": "Messages to verify.",
218+
"type": "array",
219+
"items": {
220+
"$ref": "#/definitions/Binary"
221+
}
222+
},
223+
"public_keys": {
224+
"description": "Serialized public keys. Tendermint format (32 bytes).",
225+
"type": "array",
226+
"items": {
227+
"$ref": "#/definitions/Binary"
228+
}
229+
},
230+
"signatures": {
231+
"description": "Serialized signatures. Tendermint format (64 bytes).",
232+
"type": "array",
233+
"items": {
234+
"$ref": "#/definitions/Binary"
235+
}
236+
}
237+
},
238+
"additionalProperties": false
239+
}
240+
},
241+
"additionalProperties": false
242+
},
243+
{
244+
"description": "Returns a list of supported verification schemes. No pagination - this is a short list.",
245+
"type": "object",
246+
"required": [
247+
"list_verification_schemes"
248+
],
249+
"properties": {
250+
"list_verification_schemes": {
251+
"type": "object",
252+
"additionalProperties": false
253+
}
254+
},
255+
"additionalProperties": false
256+
}
257+
],
258+
"definitions": {
259+
"Binary": {
260+
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>. See also <https://github.com/CosmWasm/cosmwasm/blob/main/docs/MESSAGE_TYPES.md>.",
261+
"type": "string"
262+
},
263+
"Uint128": {
264+
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
265+
"type": "string"
266+
}
267+
}
268+
}

contracts/cyberpunk/schema/raw/query.json

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"title": "ExecuteMsg",
3+
"title": "QueryMsg",
44
"oneOf": [
5-
{
6-
"description": "Hashes some data. Uses CPU and memory, but no external calls.",
7-
"type": "object",
8-
"required": [
9-
"argon2"
10-
],
11-
"properties": {
12-
"argon2": {
13-
"type": "object",
14-
"required": [
15-
"mem_cost",
16-
"time_cost"
17-
],
18-
"properties": {
19-
"mem_cost": {
20-
"description": "The amount of memory requested (KB).",
21-
"type": "integer",
22-
"format": "uint32",
23-
"minimum": 0.0
24-
},
25-
"time_cost": {
26-
"description": "The number of passes.",
27-
"type": "integer",
28-
"format": "uint32",
29-
"minimum": 0.0
30-
}
31-
},
32-
"additionalProperties": false
33-
}
34-
},
35-
"additionalProperties": false
36-
},
375
{
386
"description": "Returns the env for testing",
397
"type": "object",
Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"title": "ExecuteMsg",
3+
"title": "QueryMsg",
44
"oneOf": [
55
{
6-
"description": "Releasing all funds in the contract to the beneficiary. This is the only \"proper\" action of this demo contract.",
6+
"description": "returns a human-readable representation of the verifier use to ensure query path works in integration tests",
77
"type": "object",
88
"required": [
9-
"release"
9+
"verifier"
1010
],
1111
"properties": {
12-
"release": {
12+
"verifier": {
1313
"type": "object",
1414
"additionalProperties": false
1515
}
1616
},
1717
"additionalProperties": false
18+
},
19+
{
20+
"description": "This returns cosmwasm_std::AllBalanceResponse to demo use of the querier",
21+
"type": "object",
22+
"required": [
23+
"other_balance"
24+
],
25+
"properties": {
26+
"other_balance": {
27+
"type": "object",
28+
"required": [
29+
"address"
30+
],
31+
"properties": {
32+
"address": {
33+
"type": "string"
34+
}
35+
},
36+
"additionalProperties": false
37+
}
38+
},
39+
"additionalProperties": false
1840
}
1941
]
2042
}

0 commit comments

Comments
 (0)