Skip to content

Instantly share code, notes, and snippets.

@whalelephant
Created March 12, 2023 20:45
Show Gist options
  • Save whalelephant/957540ad83f8a35c05cd08fa7a009385 to your computer and use it in GitHub Desktop.
Save whalelephant/957540ad83f8a35c05cd08fa7a009385 to your computer and use it in GitHub Desktop.
issue on ts-codegen: supporting $ref link in execMsg and queryMsg
{
"contract_name": "vectis-plugin-registry",
"contract_version": "0.1.0",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"install_fee",
"registry_fee"
],
"properties": {
"install_fee": {
"$ref": "#/definitions/Coin"
},
"registry_fee": {
"$ref": "#/definitions/Coin"
}
},
"definitions": {
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"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"
}
}
},
"execute": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"anyOf": [
{
"$ref": "#/definitions/InstallableExecMsg"
},
{
"$ref": "#/definitions/ExecMsg"
}
],
"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"
},
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"ExecMsg": {
"oneOf": [
{
"type": "object",
"required": [
"register_plugin"
],
"properties": {
"register_plugin": {
"type": "object",
"required": [
"checksum",
"code_id",
"creator",
"ipfs_hash",
"name",
"version"
],
"properties": {
"checksum": {
"type": "string"
},
"code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"creator": {
"type": "string"
},
"ipfs_hash": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"unregister_plugin"
],
"properties": {
"unregister_plugin": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"update_plugin"
],
"properties": {
"update_plugin": {
"type": "object",
"required": [
"id"
],
"properties": {
"checksum": {
"type": [
"string",
"null"
]
},
"code_id": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"creator": {
"type": [
"string",
"null"
]
},
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"ipfs_hash": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"version": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"update_registry_fee"
],
"properties": {
"update_registry_fee": {
"type": "object",
"required": [
"new_fee"
],
"properties": {
"new_fee": {
"$ref": "#/definitions/Coin"
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"update_dao_addr"
],
"properties": {
"update_dao_addr": {
"type": "object",
"required": [
"new_addr"
],
"properties": {
"new_addr": {
"type": "string"
}
}
}
},
"additionalProperties": false
}
]
},
"InstallableExecMsg": {
"oneOf": [
{
"type": "object",
"required": [
"proxy_install_plugin"
],
"properties": {
"proxy_install_plugin": {
"type": "object",
"required": [
"id",
"instantiate_msg"
],
"properties": {
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"instantiate_msg": {
"$ref": "#/definitions/Binary"
}
}
}
},
"additionalProperties": false
}
]
},
"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"
}
}
},
"query": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"anyOf": [
{
"$ref": "#/definitions/InstallableQueryMsg"
},
{
"$ref": "#/definitions/QueryMsg"
}
],
"definitions": {
"InstallableQueryMsg": {
"type": "string",
"enum": []
},
"QueryMsg": {
"oneOf": [
{
"type": "object",
"required": [
"get_config"
],
"properties": {
"get_config": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_plugins"
],
"properties": {
"get_plugins": {
"type": "object",
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"start_after": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_plugin_by_id"
],
"properties": {
"get_plugin_by_id": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
}
]
}
}
},
"migrate": null,
"sudo": null,
"responses": {
"get_config": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ConfigResponse",
"type": "object",
"required": [
"dao_addr",
"registry_fee"
],
"properties": {
"dao_addr": {
"type": "string"
},
"registry_fee": {
"$ref": "#/definitions/Coin"
}
},
"additionalProperties": false,
"definitions": {
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"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"
}
}
},
"get_plugin_by_id": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Nullable_Plugin",
"anyOf": [
{
"$ref": "#/definitions/Plugin"
},
{
"type": "null"
}
],
"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"
},
"CanonicalAddr": {
"description": "A blockchain address in its binary form.\n\nThe specific implementation is up to the underlying chain and CosmWasm as well as contracts should not make assumptions on that data. In Ethereum for example, an `Addr` would contain a user visible address like 0x14d3cc818735723ab86eaf9502376e847a64ddad and the corresponding `CanonicalAddr` would store the 20 bytes 0x14, 0xD3, ..., 0xAD. In Cosmos, the bech32 format is used for `Addr`s and the `CanonicalAddr` holds the encoded bech32 data without the checksum. Typical sizes are 20 bytes for externally owned addresses and 32 bytes for module addresses (such as x/wasm contract addresses). That being said, a chain might decide to use any size other than 20 or 32 bytes.\n\nThe safe way to obtain a valid `CanonicalAddr` is using `Api::addr_canonicalize`. In addition to that there are many unsafe ways to convert any binary data into an instance. So the type shoud be treated as a marker to express the intended data type, not as a validity guarantee of any sort.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"Plugin": {
"type": "object",
"required": [
"checksum",
"code_id",
"creator",
"id",
"ipfs_hash",
"name",
"version"
],
"properties": {
"checksum": {
"type": "string"
},
"code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"creator": {
"$ref": "#/definitions/CanonicalAddr"
},
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"ipfs_hash": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"get_plugins": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "PluginsResponse",
"type": "object",
"required": [
"plugins",
"total"
],
"properties": {
"plugins": {
"type": "array",
"items": {
"$ref": "#/definitions/Plugin"
}
},
"total": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
},
"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"
},
"CanonicalAddr": {
"description": "A blockchain address in its binary form.\n\nThe specific implementation is up to the underlying chain and CosmWasm as well as contracts should not make assumptions on that data. In Ethereum for example, an `Addr` would contain a user visible address like 0x14d3cc818735723ab86eaf9502376e847a64ddad and the corresponding `CanonicalAddr` would store the 20 bytes 0x14, 0xD3, ..., 0xAD. In Cosmos, the bech32 format is used for `Addr`s and the `CanonicalAddr` holds the encoded bech32 data without the checksum. Typical sizes are 20 bytes for externally owned addresses and 32 bytes for module addresses (such as x/wasm contract addresses). That being said, a chain might decide to use any size other than 20 or 32 bytes.\n\nThe safe way to obtain a valid `CanonicalAddr` is using `Api::addr_canonicalize`. In addition to that there are many unsafe ways to convert any binary data into an instance. So the type shoud be treated as a marker to express the intended data type, not as a validity guarantee of any sort.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
},
"Plugin": {
"type": "object",
"required": [
"checksum",
"code_id",
"creator",
"id",
"ipfs_hash",
"name",
"version"
],
"properties": {
"checksum": {
"type": "string"
},
"code_id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"creator": {
"$ref": "#/definitions/CanonicalAddr"
},
"id": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"ipfs_hash": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
},
"additionalProperties": false
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment