Skip to content

Commit 64eba31

Browse files
authored
Merge pull request #167 from hyperweb-io/create-findSchemaFiles
Pull out findSchemaFiles, test and add CosmWasm 3 support
2 parents 5ff70e3 + 03e6408 commit 64eba31

20 files changed

+1269
-3
lines changed
Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
{
2+
"contract_name": "hackatom",
3+
"contract_version": "0.0.0",
4+
"idl_version": "1.0.0",
5+
"instantiate": {
6+
"type": "v1",
7+
"root": 0,
8+
"definitions": [
9+
{
10+
"name": "hackatom_msg_InstantiateMsg",
11+
"type": "struct",
12+
"properties": {
13+
"beneficiary": {
14+
"value": 1
15+
},
16+
"verifier": {
17+
"value": 1
18+
}
19+
}
20+
},
21+
{
22+
"name": "String",
23+
"type": "string"
24+
}
25+
]
26+
},
27+
"execute": {
28+
"type": "v1",
29+
"root": 0,
30+
"definitions": [
31+
{
32+
"name": "hackatom_msg_ExecuteMsg",
33+
"type": "enum",
34+
"cases": {
35+
"allocate_large_memory": {
36+
"description": "Allocate large amounts of memory without consuming much gas",
37+
"type": "named",
38+
"properties": {
39+
"pages": {
40+
"value": 2
41+
}
42+
}
43+
},
44+
"cpu_loop": {
45+
"description": "Infinite loop to burn cpu cycles (only run when metering is enabled)",
46+
"type": "named",
47+
"properties": {}
48+
},
49+
"memory_loop": {
50+
"description": "Infinite loop reading and writing memory",
51+
"type": "named",
52+
"properties": {}
53+
},
54+
"message_loop": {
55+
"description": "Infinite loop sending message to itself",
56+
"type": "named",
57+
"properties": {}
58+
},
59+
"panic": {
60+
"description": "Trigger a panic to ensure framework handles gracefully",
61+
"type": "named",
62+
"properties": {}
63+
},
64+
"release": {
65+
"description": "Releasing all funds of the given denom in the contract to the beneficiary.\nThis is the only \"proper\" action of this demo contract.",
66+
"type": "named",
67+
"properties": {
68+
"denom": {
69+
"value": 1
70+
}
71+
}
72+
},
73+
"storage_loop": {
74+
"description": "Infinite loop making storage calls (to test when their limit hits)",
75+
"type": "named",
76+
"properties": {}
77+
},
78+
"user_errors_in_api_calls": {
79+
"description": "Starting with CosmWasm 0.10, some API calls return user errors back to the contract.\nThis triggers such user errors, ensuring the transaction does not fail in the backend.",
80+
"type": "named",
81+
"properties": {}
82+
}
83+
}
84+
},
85+
{
86+
"name": "String",
87+
"type": "string"
88+
},
89+
{
90+
"name": "u32",
91+
"type": "integer",
92+
"precision": 32,
93+
"signed": false
94+
}
95+
]
96+
},
97+
"query": {
98+
"type": "v1",
99+
"root": 0,
100+
"definitions": [
101+
{
102+
"name": "hackatom_msg_QueryMsg",
103+
"type": "enum",
104+
"cases": {
105+
"get_int": {
106+
"description": "GetInt returns a hardcoded u32 value",
107+
"type": "named",
108+
"properties": {}
109+
},
110+
"recurse": {
111+
"description": "Recurse will execute a query into itself up to depth-times and return\nEach step of the recursion may perform some extra work to test gas metering\n(`work` rounds of sha256 on contract).\nNow that we have Env, we can auto-calculate the address to recurse into",
112+
"type": "named",
113+
"properties": {
114+
"depth": {
115+
"value": 1
116+
},
117+
"work": {
118+
"value": 1
119+
}
120+
}
121+
},
122+
"verifier": {
123+
"description": "returns a human-readable representation of the verifier\nuse to ensure query path works in integration tests",
124+
"type": "named",
125+
"properties": {}
126+
}
127+
}
128+
},
129+
{
130+
"name": "u32",
131+
"type": "integer",
132+
"precision": 32,
133+
"signed": false
134+
}
135+
]
136+
},
137+
"migrate": {
138+
"type": "v1",
139+
"root": 0,
140+
"definitions": [
141+
{
142+
"name": "hackatom_msg_MigrateMsg",
143+
"description": "MigrateMsg allows a privileged contract administrator to run\na migration on the contract. In this (demo) case it is just migrating\nfrom one hackatom code to the same code, but taking advantage of the\nmigration step to set a new validator.\n\nNote that the contract doesn't enforce permissions here, this is done\nby blockchain logic (in the future by blockchain governance)",
144+
"type": "struct",
145+
"properties": {
146+
"verifier": {
147+
"value": 1
148+
}
149+
}
150+
},
151+
{
152+
"name": "String",
153+
"type": "string"
154+
}
155+
]
156+
},
157+
"sudo": {
158+
"type": "v1",
159+
"root": 0,
160+
"definitions": [
161+
{
162+
"name": "hackatom_msg_SudoMsg",
163+
"description": "SudoMsg is only exposed for internal Cosmos SDK modules to call.\nThis is showing how we can expose \"admin\" functionality than can not be called by\nexternal users or contracts, but only trusted (native/Go) code in the blockchain",
164+
"type": "enum",
165+
"cases": {
166+
"steal_funds": {
167+
"type": "named",
168+
"properties": {
169+
"amount": {
170+
"value": 4
171+
},
172+
"recipient": {
173+
"value": 1
174+
}
175+
}
176+
}
177+
}
178+
},
179+
{
180+
"name": "String",
181+
"type": "string"
182+
},
183+
{
184+
"name": "cosmwasm_std_coin_Coin",
185+
"type": "struct",
186+
"properties": {
187+
"amount": {
188+
"value": 3
189+
},
190+
"denom": {
191+
"value": 1
192+
}
193+
}
194+
},
195+
{
196+
"name": "cosmwasm_std_math_uint256_Uint256",
197+
"description": "An implementation of u256 that is using strings for JSON encoding/decoding,\nsuch that the full u256 range can be used for clients that convert JSON numbers to floats,\nlike JavaScript and jq.\n\n# Examples\n\nUse `new` to create instances out of u128, `from` for other primitive uint types\nor `from_be_bytes` to provide big endian bytes:\n\n```\n# use cosmwasm_std::Uint256;\nlet a = Uint256::new(258u128);\nlet b = Uint256::from(258u16);\nlet c = Uint256::from_be_bytes([\n0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8,\n0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8,\n0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8,\n0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8,\n]);\nassert_eq!(a, b);\nassert_eq!(a, c);\n```",
198+
"type": "integer",
199+
"precision": 256,
200+
"signed": false
201+
},
202+
{
203+
"name": "alloc::vec::Vec<cosmwasm_std::coin::Coin>",
204+
"type": "array",
205+
"items": 2
206+
}
207+
]
208+
},
209+
"responses": {
210+
"get_int": {
211+
"type": "v1",
212+
"root": 0,
213+
"definitions": [
214+
{
215+
"name": "hackatom_msg_IntResponse",
216+
"type": "struct",
217+
"properties": {
218+
"int": {
219+
"value": 1
220+
}
221+
}
222+
},
223+
{
224+
"name": "u32",
225+
"type": "integer",
226+
"precision": 32,
227+
"signed": false
228+
}
229+
]
230+
},
231+
"recurse": {
232+
"type": "v1",
233+
"root": 0,
234+
"definitions": [
235+
{
236+
"name": "hackatom_msg_RecurseResponse",
237+
"type": "struct",
238+
"properties": {
239+
"hashed": {
240+
"description": "hashed is the result of running sha256 \"work+1\" times on the contract's human address",
241+
"value": 1
242+
}
243+
}
244+
},
245+
{
246+
"name": "cosmwasm_std_binary_Binary",
247+
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization\nwith 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>.\nSee also <https://github.com/CosmWasm/cosmwasm/blob/main/docs/MESSAGE_TYPES.md>.",
248+
"type": "binary"
249+
}
250+
]
251+
},
252+
"verifier": {
253+
"type": "v1",
254+
"root": 0,
255+
"definitions": [
256+
{
257+
"name": "hackatom_msg_VerifierResponse",
258+
"type": "struct",
259+
"properties": {
260+
"verifier": {
261+
"value": 1
262+
}
263+
}
264+
},
265+
{
266+
"name": "String",
267+
"type": "string"
268+
}
269+
]
270+
}
271+
}
272+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"type": "v1",
3+
"root": 0,
4+
"definitions": [
5+
{
6+
"name": "hackatom_msg_ExecuteMsg",
7+
"type": "enum",
8+
"cases": {
9+
"allocate_large_memory": {
10+
"description": "Allocate large amounts of memory without consuming much gas",
11+
"type": "named",
12+
"properties": {
13+
"pages": {
14+
"value": 2
15+
}
16+
}
17+
},
18+
"cpu_loop": {
19+
"description": "Infinite loop to burn cpu cycles (only run when metering is enabled)",
20+
"type": "named",
21+
"properties": {}
22+
},
23+
"memory_loop": {
24+
"description": "Infinite loop reading and writing memory",
25+
"type": "named",
26+
"properties": {}
27+
},
28+
"message_loop": {
29+
"description": "Infinite loop sending message to itself",
30+
"type": "named",
31+
"properties": {}
32+
},
33+
"panic": {
34+
"description": "Trigger a panic to ensure framework handles gracefully",
35+
"type": "named",
36+
"properties": {}
37+
},
38+
"release": {
39+
"description": "Releasing all funds of the given denom in the contract to the beneficiary.\nThis is the only \"proper\" action of this demo contract.",
40+
"type": "named",
41+
"properties": {
42+
"denom": {
43+
"value": 1
44+
}
45+
}
46+
},
47+
"storage_loop": {
48+
"description": "Infinite loop making storage calls (to test when their limit hits)",
49+
"type": "named",
50+
"properties": {}
51+
},
52+
"user_errors_in_api_calls": {
53+
"description": "Starting with CosmWasm 0.10, some API calls return user errors back to the contract.\nThis triggers such user errors, ensuring the transaction does not fail in the backend.",
54+
"type": "named",
55+
"properties": {}
56+
}
57+
}
58+
},
59+
{
60+
"name": "String",
61+
"type": "string"
62+
},
63+
{
64+
"name": "u32",
65+
"type": "integer",
66+
"precision": 32,
67+
"signed": false
68+
}
69+
]
70+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"type": "v1",
3+
"root": 0,
4+
"definitions": [
5+
{
6+
"name": "hackatom_msg_InstantiateMsg",
7+
"type": "struct",
8+
"properties": {
9+
"beneficiary": {
10+
"value": 1
11+
},
12+
"verifier": {
13+
"value": 1
14+
}
15+
}
16+
},
17+
{
18+
"name": "String",
19+
"type": "string"
20+
}
21+
]
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"type": "v1",
3+
"root": 0,
4+
"definitions": [
5+
{
6+
"name": "hackatom_msg_MigrateMsg",
7+
"description": "MigrateMsg allows a privileged contract administrator to run\na migration on the contract. In this (demo) case it is just migrating\nfrom one hackatom code to the same code, but taking advantage of the\nmigration step to set a new validator.\n\nNote that the contract doesn't enforce permissions here, this is done\nby blockchain logic (in the future by blockchain governance)",
8+
"type": "struct",
9+
"properties": {
10+
"verifier": {
11+
"value": 1
12+
}
13+
}
14+
},
15+
{
16+
"name": "String",
17+
"type": "string"
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)