Skip to content

Commit

Permalink
Merge pull request #1533 from CosmWasm/fix-raw-json-schema
Browse files Browse the repository at this point in the history
Fix data in raw/{query,migrate,sudo}.json
  • Loading branch information
webmaster128 authored Dec 6, 2022
2 parents bda40c5 + c939aff commit 77cfd7b
Show file tree
Hide file tree
Showing 16 changed files with 739 additions and 1,720 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ and this project adheres to
- cosmwasm-std: Add `instantiate2_address` which allows calculating the
predictable addresses for `MsgInstantiateContract2` ([#1437]).
- cosmwasm-schema: In contracts, `cosmwasm schema` will now output a separate
JSON Schema file for each entrypoint in the `raw` subdirectory.
JSON Schema file for each entrypoint in the `raw` subdirectory ([#1478],
[#1533]).

[#1437]: https://github.com/CosmWasm/cosmwasm/issues/1437
[#1481]: https://github.com/CosmWasm/cosmwasm/pull/1481
[#1478]: https://github.com/CosmWasm/cosmwasm/pull/1478
[#1533]: https://github.com/CosmWasm/cosmwasm/pull/1533

### Changed

Expand Down
14 changes: 14 additions & 0 deletions contracts/burner/schema/raw/migrate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MigrateMsg",
"type": "object",
"required": [
"payout"
],
"properties": {
"payout": {
"type": "string"
}
},
"additionalProperties": false
}
268 changes: 268 additions & 0 deletions contracts/crypto-verify/schema/raw/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"description": "Cosmos format (secp256k1 verification scheme).",
"type": "object",
"required": [
"verify_cosmos_signature"
],
"properties": {
"verify_cosmos_signature": {
"type": "object",
"required": [
"message",
"public_key",
"signature"
],
"properties": {
"message": {
"description": "Message to verify.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"public_key": {
"description": "Serialized compressed (33 bytes) or uncompressed (65 bytes) public key.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"signature": {
"description": "Serialized signature. Cosmos format (64 bytes).",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"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",
"type": "object",
"required": [
"verify_ethereum_text"
],
"properties": {
"verify_ethereum_text": {
"type": "object",
"required": [
"message",
"signature",
"signer_address"
],
"properties": {
"message": {
"description": "Message to verify. This will be wrapped in the standard container `\"\\x19Ethereum Signed Message:\\n\" + len(message) + message` before verification.",
"type": "string"
},
"signature": {
"description": "Serialized signature. Fixed length format (64 bytes `r` and `s` plus the one byte `v`).",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"signer_address": {
"description": "Signer address. This is matched case insensitive, so you can provide checksummed and non-checksummed addresses. Checksums are not validated.",
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"verify_ethereum_transaction"
],
"properties": {
"verify_ethereum_transaction": {
"type": "object",
"required": [
"chain_id",
"data",
"from",
"gas_limit",
"gas_price",
"nonce",
"r",
"s",
"to",
"v",
"value"
],
"properties": {
"chain_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"data": {
"$ref": "#/definitions/Binary"
},
"from": {
"description": "Ethereum address in hex format (42 characters, starting with 0x)",
"type": "string"
},
"gas_limit": {
"$ref": "#/definitions/Uint128"
},
"gas_price": {
"$ref": "#/definitions/Uint128"
},
"nonce": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"r": {
"$ref": "#/definitions/Binary"
},
"s": {
"$ref": "#/definitions/Binary"
},
"to": {
"description": "Ethereum address in hex format (42 characters, starting with 0x)",
"type": "string"
},
"v": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"value": {
"$ref": "#/definitions/Uint128"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Tendermint format (ed25519 verification scheme).",
"type": "object",
"required": [
"verify_tendermint_signature"
],
"properties": {
"verify_tendermint_signature": {
"type": "object",
"required": [
"message",
"public_key",
"signature"
],
"properties": {
"message": {
"description": "Message to verify.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"public_key": {
"description": "Serialized public key. Tendermint format (32 bytes).",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"signature": {
"description": "Serialized signature. Tendermint format (64 bytes).",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Tendermint format (batch ed25519 verification scheme).",
"type": "object",
"required": [
"verify_tendermint_batch"
],
"properties": {
"verify_tendermint_batch": {
"type": "object",
"required": [
"messages",
"public_keys",
"signatures"
],
"properties": {
"messages": {
"description": "Messages to verify.",
"type": "array",
"items": {
"$ref": "#/definitions/Binary"
}
},
"public_keys": {
"description": "Serialized public keys. Tendermint format (32 bytes).",
"type": "array",
"items": {
"$ref": "#/definitions/Binary"
}
},
"signatures": {
"description": "Serialized signatures. Tendermint format (64 bytes).",
"type": "array",
"items": {
"$ref": "#/definitions/Binary"
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Returns a list of supported verification schemes. No pagination - this is a short list.",
"type": "object",
"required": [
"list_verification_schemes"
],
"properties": {
"list_verification_schemes": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
}
],
"definitions": {
"Binary": {
"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>.",
"type": "string"
},
"Uint128": {
"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); ```",
"type": "string"
}
}
}
34 changes: 1 addition & 33 deletions contracts/cyberpunk/schema/raw/query.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"title": "QueryMsg",
"oneOf": [
{
"description": "Hashes some data. Uses CPU and memory, but no external calls.",
"type": "object",
"required": [
"argon2"
],
"properties": {
"argon2": {
"type": "object",
"required": [
"mem_cost",
"time_cost"
],
"properties": {
"mem_cost": {
"description": "The amount of memory requested (KB).",
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"time_cost": {
"description": "The number of passes.",
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Returns the env for testing",
"type": "object",
Expand Down
30 changes: 26 additions & 4 deletions contracts/floaty/schema/raw/query.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"title": "QueryMsg",
"oneOf": [
{
"description": "Releasing all funds in the contract to the beneficiary. This is the only \"proper\" action of this demo contract.",
"description": "returns a human-readable representation of the verifier use to ensure query path works in integration tests",
"type": "object",
"required": [
"release"
"verifier"
],
"properties": {
"release": {
"verifier": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "This returns cosmwasm_std::AllBalanceResponse to demo use of the querier",
"type": "object",
"required": [
"other_balance"
],
"properties": {
"other_balance": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
}
Loading

0 comments on commit 77cfd7b

Please sign in to comment.