Skip to content

Commit b131ab5

Browse files
committed
Apply 2.0 changes to reflect and ibc-reflect
1 parent 7533a21 commit b131ab5

File tree

6 files changed

+257
-2
lines changed

6 files changed

+257
-2
lines changed

contracts/ibc-reflect/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cranelift = ["cosmwasm-vm/cranelift"]
3030

3131
[dependencies]
3232
cosmwasm-schema = { path = "../../packages/schema" }
33-
cosmwasm-std = { path = "../../packages/std", features = ["iterator", "stargate"] }
33+
cosmwasm-std = { path = "../../packages/std", features = ["iterator", "stargate", "cosmwasm_2_0"] }
3434
schemars = "0.8.3"
3535
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
3636

contracts/ibc-reflect/schema/ibc/packet_msg.json

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@
112112
}
113113
],
114114
"definitions": {
115+
"AnyMsg": {
116+
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
117+
"type": "object",
118+
"required": [
119+
"type_url",
120+
"value"
121+
],
122+
"properties": {
123+
"type_url": {
124+
"type": "string"
125+
},
126+
"value": {
127+
"$ref": "#/definitions/Binary"
128+
}
129+
}
130+
},
115131
"BankMsg": {
116132
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
117133
"oneOf": [
@@ -214,6 +230,18 @@
214230
},
215231
"additionalProperties": false
216232
},
233+
{
234+
"type": "object",
235+
"required": [
236+
"any"
237+
],
238+
"properties": {
239+
"any": {
240+
"$ref": "#/definitions/AnyMsg"
241+
}
242+
},
243+
"additionalProperties": false
244+
},
217245
{
218246
"type": "object",
219247
"required": [
@@ -252,6 +280,10 @@
252280
}
253281
]
254282
},
283+
"Decimal": {
284+
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
285+
"type": "string"
286+
},
255287
"Empty": {
256288
"description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)",
257289
"type": "object"
@@ -290,6 +322,36 @@
290322
}
291323
},
292324
"additionalProperties": false
325+
},
326+
{
327+
"description": "This maps directly to [MsgVoteWeighted](https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/proto/cosmos/gov/v1beta1/tx.proto#L66-L78) in the Cosmos SDK with voter set to the contract address.",
328+
"type": "object",
329+
"required": [
330+
"vote_weighted"
331+
],
332+
"properties": {
333+
"vote_weighted": {
334+
"type": "object",
335+
"required": [
336+
"options",
337+
"proposal_id"
338+
],
339+
"properties": {
340+
"options": {
341+
"type": "array",
342+
"items": {
343+
"$ref": "#/definitions/WeightedVoteOption"
344+
}
345+
},
346+
"proposal_id": {
347+
"type": "integer",
348+
"format": "uint64",
349+
"minimum": 0.0
350+
}
351+
}
352+
}
353+
},
354+
"additionalProperties": false
293355
}
294356
]
295357
},
@@ -568,6 +630,60 @@
568630
},
569631
"additionalProperties": false
570632
},
633+
{
634+
"description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.",
635+
"type": "object",
636+
"required": [
637+
"instantiate2"
638+
],
639+
"properties": {
640+
"instantiate2": {
641+
"type": "object",
642+
"required": [
643+
"code_id",
644+
"funds",
645+
"label",
646+
"msg",
647+
"salt"
648+
],
649+
"properties": {
650+
"admin": {
651+
"type": [
652+
"string",
653+
"null"
654+
]
655+
},
656+
"code_id": {
657+
"type": "integer",
658+
"format": "uint64",
659+
"minimum": 0.0
660+
},
661+
"funds": {
662+
"type": "array",
663+
"items": {
664+
"$ref": "#/definitions/Coin"
665+
}
666+
},
667+
"label": {
668+
"description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace",
669+
"type": "string"
670+
},
671+
"msg": {
672+
"description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)",
673+
"allOf": [
674+
{
675+
"$ref": "#/definitions/Binary"
676+
}
677+
]
678+
},
679+
"salt": {
680+
"$ref": "#/definitions/Binary"
681+
}
682+
}
683+
}
684+
},
685+
"additionalProperties": false
686+
},
571687
{
572688
"description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.",
573689
"type": "object",
@@ -652,6 +768,21 @@
652768
"additionalProperties": false
653769
}
654770
]
771+
},
772+
"WeightedVoteOption": {
773+
"type": "object",
774+
"required": [
775+
"option",
776+
"weight"
777+
],
778+
"properties": {
779+
"option": {
780+
"$ref": "#/definitions/VoteOption"
781+
},
782+
"weight": {
783+
"$ref": "#/definitions/Decimal"
784+
}
785+
}
655786
}
656787
}
657788
}

contracts/reflect/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cranelift = ["cosmwasm-vm/cranelift"]
3131

3232
[dependencies]
3333
cosmwasm-schema = { path = "../../packages/schema" }
34-
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "staking", "stargate", "cosmwasm_1_4"] }
34+
cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "staking", "stargate", "cosmwasm_2_0"] }
3535
schemars = "0.8.3"
3636
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
3737
thiserror = "1.0.26"

contracts/reflect/schema/raw/execute.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@
7373
}
7474
],
7575
"definitions": {
76+
"AnyMsg": {
77+
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
78+
"type": "object",
79+
"required": [
80+
"type_url",
81+
"value"
82+
],
83+
"properties": {
84+
"type_url": {
85+
"type": "string"
86+
},
87+
"value": {
88+
"$ref": "#/definitions/Binary"
89+
}
90+
}
91+
},
7692
"BankMsg": {
7793
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
7894
"oneOf": [
@@ -199,6 +215,18 @@
199215
},
200216
"additionalProperties": false
201217
},
218+
{
219+
"type": "object",
220+
"required": [
221+
"any"
222+
],
223+
"properties": {
224+
"any": {
225+
"$ref": "#/definitions/AnyMsg"
226+
}
227+
},
228+
"additionalProperties": false
229+
},
202230
{
203231
"type": "object",
204232
"required": [

contracts/reflect/schema/raw/query.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,28 @@
324324
}
325325
]
326326
},
327+
"GrpcQuery": {
328+
"description": "Queries the chain using a grpc query. This allows to query information that is not exposed in our API. The chain needs to allowlist the supported queries. The drawback of this query is that you have to handle the protobuf encoding and decoding yourself.\n\nThe returned data is protobuf encoded. The protobuf type depends on the query.\n\nTo find the path, as well as the request and response types, you can query the chain's gRPC endpoint using a tool like [grpcurl](https://github.com/fullstorydev/grpcurl).",
329+
"type": "object",
330+
"required": [
331+
"data",
332+
"path"
333+
],
334+
"properties": {
335+
"data": {
336+
"description": "The expected protobuf message type (not [Any](https://protobuf.dev/programming-guides/proto3/#any)), binary encoded",
337+
"allOf": [
338+
{
339+
"$ref": "#/definitions/Binary"
340+
}
341+
]
342+
},
343+
"path": {
344+
"description": "The fully qualified endpoint path used for routing. It follows the format `/service_path/method_name`, eg. \"/cosmos.authz.v1beta1.Query/Grants\"",
345+
"type": "string"
346+
}
347+
}
348+
},
327349
"IbcQuery": {
328350
"description": "These are queries to the various IBC modules to see the state of the contract's IBC connection. These will return errors if the contract is not \"ibc enabled\"",
329351
"oneOf": [
@@ -523,6 +545,18 @@
523545
}
524546
},
525547
"additionalProperties": false
548+
},
549+
{
550+
"type": "object",
551+
"required": [
552+
"grpc"
553+
],
554+
"properties": {
555+
"grpc": {
556+
"$ref": "#/definitions/GrpcQuery"
557+
}
558+
},
559+
"additionalProperties": false
526560
}
527561
]
528562
},

contracts/reflect/schema/reflect.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@
8383
}
8484
],
8585
"definitions": {
86+
"AnyMsg": {
87+
"description": "A message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)",
88+
"type": "object",
89+
"required": [
90+
"type_url",
91+
"value"
92+
],
93+
"properties": {
94+
"type_url": {
95+
"type": "string"
96+
},
97+
"value": {
98+
"$ref": "#/definitions/Binary"
99+
}
100+
}
101+
},
86102
"BankMsg": {
87103
"description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto",
88104
"oneOf": [
@@ -209,6 +225,18 @@
209225
},
210226
"additionalProperties": false
211227
},
228+
{
229+
"type": "object",
230+
"required": [
231+
"any"
232+
],
233+
"properties": {
234+
"any": {
235+
"$ref": "#/definitions/AnyMsg"
236+
}
237+
},
238+
"additionalProperties": false
239+
},
212240
{
213241
"type": "object",
214242
"required": [
@@ -1336,6 +1364,28 @@
13361364
}
13371365
]
13381366
},
1367+
"GrpcQuery": {
1368+
"description": "Queries the chain using a grpc query. This allows to query information that is not exposed in our API. The chain needs to allowlist the supported queries. The drawback of this query is that you have to handle the protobuf encoding and decoding yourself.\n\nThe returned data is protobuf encoded. The protobuf type depends on the query.\n\nTo find the path, as well as the request and response types, you can query the chain's gRPC endpoint using a tool like [grpcurl](https://github.com/fullstorydev/grpcurl).",
1369+
"type": "object",
1370+
"required": [
1371+
"data",
1372+
"path"
1373+
],
1374+
"properties": {
1375+
"data": {
1376+
"description": "The expected protobuf message type (not [Any](https://protobuf.dev/programming-guides/proto3/#any)), binary encoded",
1377+
"allOf": [
1378+
{
1379+
"$ref": "#/definitions/Binary"
1380+
}
1381+
]
1382+
},
1383+
"path": {
1384+
"description": "The fully qualified endpoint path used for routing. It follows the format `/service_path/method_name`, eg. \"/cosmos.authz.v1beta1.Query/Grants\"",
1385+
"type": "string"
1386+
}
1387+
}
1388+
},
13391389
"IbcQuery": {
13401390
"description": "These are queries to the various IBC modules to see the state of the contract's IBC connection. These will return errors if the contract is not \"ibc enabled\"",
13411391
"oneOf": [
@@ -1535,6 +1585,18 @@
15351585
}
15361586
},
15371587
"additionalProperties": false
1588+
},
1589+
{
1590+
"type": "object",
1591+
"required": [
1592+
"grpc"
1593+
],
1594+
"properties": {
1595+
"grpc": {
1596+
"$ref": "#/definitions/GrpcQuery"
1597+
}
1598+
},
1599+
"additionalProperties": false
15381600
}
15391601
]
15401602
},

0 commit comments

Comments
 (0)