From 7a813db7cabd2b9995167fe7d20d38dc84656595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Tue, 21 Jan 2025 18:06:18 +0100 Subject: [PATCH 1/3] feat: Add eureka capabilities (#2342) --- docs/CAPABILITIES-BUILT-IN.md | 2 ++ packages/std/Cargo.toml | 2 ++ packages/std/src/exports.rs | 4 ++++ packages/std/src/results/cosmos_msg.rs | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/docs/CAPABILITIES-BUILT-IN.md b/docs/CAPABILITIES-BUILT-IN.md index f95913f19e..30630b8cac 100644 --- a/docs/CAPABILITIES-BUILT-IN.md +++ b/docs/CAPABILITIES-BUILT-IN.md @@ -11,6 +11,8 @@ might define others. "Stargate". It primarily includes protobuf messages and IBC support. - `staking` is for chains with the Cosmos SDK staking module. There are Cosmos chains that don't use this (e.g. Tgrade). +- `eureka` is for messages and queries that came with the Cosmos SDK upgrade + "Eureka". - `cosmwasm_1_1` enables the `BankQuery::Supply` query. Only chains running CosmWasm `1.1.0` or higher support this. - `cosmwasm_1_2` enables the `GovMsg::VoteWeighted` and `WasmMsg::Instantiate2` diff --git a/packages/std/Cargo.toml b/packages/std/Cargo.toml index 876a296e48..298c6c9d77 100644 --- a/packages/std/Cargo.toml +++ b/packages/std/Cargo.toml @@ -29,6 +29,8 @@ staking = [] # stargate enables stargate-dependent messages and queries, like raw protobuf messages # as well as ibc-related functionality stargate = [] +# eureka enables eureka-dependent messages and queries +eureka = [] # This feature makes `BankQuery::Supply` available for the contract to call, but requires # the host blockchain to run CosmWasm `1.1.0` or higher. cosmwasm_1_1 = [] diff --git a/packages/std/src/exports.rs b/packages/std/src/exports.rs index 6dbf72e15a..17e2cf22d7 100644 --- a/packages/std/src/exports.rs +++ b/packages/std/src/exports.rs @@ -44,6 +44,10 @@ extern "C" fn requires_staking() {} #[no_mangle] extern "C" fn requires_stargate() {} +#[cfg(feature = "eureka")] +#[no_mangle] +extern "C" fn requires_eureka() {} + #[cfg(feature = "cosmwasm_1_1")] #[no_mangle] extern "C" fn requires_cosmwasm_1_1() {} diff --git a/packages/std/src/results/cosmos_msg.rs b/packages/std/src/results/cosmos_msg.rs index 7ee12c33ed..b6ea3b116f 100644 --- a/packages/std/src/results/cosmos_msg.rs +++ b/packages/std/src/results/cosmos_msg.rs @@ -6,6 +6,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::coin::Coin; +#[cfg(feature = "eureka")] use crate::eureka::EurekaMsg; #[cfg(feature = "stargate")] use crate::ibc::IbcMsg; @@ -85,6 +86,7 @@ pub enum CosmosMsg { Wasm(WasmMsg), #[cfg(feature = "stargate")] Gov(GovMsg), + #[cfg(feature = "eureka")] Eureka(EurekaMsg), } @@ -110,6 +112,7 @@ impl CosmosMsg { CosmosMsg::Wasm(msg) => CosmosMsg::Wasm(msg), #[cfg(feature = "stargate")] CosmosMsg::Gov(msg) => CosmosMsg::Gov(msg), + #[cfg(feature = "eureka")] CosmosMsg::Eureka(msg) => CosmosMsg::Eureka(msg), }) } @@ -488,6 +491,7 @@ impl From for CosmosMsg { } } +#[cfg(feature = "eureka")] impl From for CosmosMsg { fn from(msg: EurekaMsg) -> Self { CosmosMsg::Eureka(msg) From 2b3cc7d8bd99c634d2d92e4365c9bfb8e821688d Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:16:06 +0000 Subject: [PATCH 2/3] [autofix.ci] apply automated fixes --- .../schema/ibc-reflect-send.json | 84 ------------------- .../schema/ibc/packet_msg.json | 84 ------------------- .../ibc-reflect-send/schema/raw/execute.json | 84 ------------------- .../ibc-reflect/schema/ibc/packet_msg.json | 84 ------------------- contracts/reflect/schema/raw/execute.json | 84 ------------------- contracts/reflect/schema/reflect.json | 84 ------------------- 6 files changed, 504 deletions(-) diff --git a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json index 20780b05b7..3c91ffab8e 100644 --- a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json +++ b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json @@ -305,18 +305,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -376,78 +364,6 @@ "type": "object", "additionalProperties": false }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ diff --git a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json index d8dffd2c17..974ced2dc5 100644 --- a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json +++ b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json @@ -246,18 +246,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -317,78 +305,6 @@ "type": "object", "additionalProperties": false }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ diff --git a/contracts/ibc-reflect-send/schema/raw/execute.json b/contracts/ibc-reflect-send/schema/raw/execute.json index 74ddd32026..8841eded49 100644 --- a/contracts/ibc-reflect-send/schema/raw/execute.json +++ b/contracts/ibc-reflect-send/schema/raw/execute.json @@ -294,18 +294,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -365,78 +353,6 @@ "type": "object", "additionalProperties": false }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ diff --git a/contracts/ibc-reflect/schema/ibc/packet_msg.json b/contracts/ibc-reflect/schema/ibc/packet_msg.json index 84a3308aeb..eec0371bd4 100644 --- a/contracts/ibc-reflect/schema/ibc/packet_msg.json +++ b/contracts/ibc-reflect/schema/ibc/packet_msg.json @@ -322,18 +322,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -346,78 +334,6 @@ "type": "object", "additionalProperties": false }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ diff --git a/contracts/reflect/schema/raw/execute.json b/contracts/reflect/schema/raw/execute.json index c10c85b84f..60689b4e44 100644 --- a/contracts/reflect/schema/raw/execute.json +++ b/contracts/reflect/schema/raw/execute.json @@ -294,18 +294,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -419,78 +407,6 @@ } ] }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ diff --git a/contracts/reflect/schema/reflect.json b/contracts/reflect/schema/reflect.json index 56a789bf6d..9a4c0e5364 100644 --- a/contracts/reflect/schema/reflect.json +++ b/contracts/reflect/schema/reflect.json @@ -304,18 +304,6 @@ } }, "additionalProperties": false - }, - { - "type": "object", - "required": [ - "eureka" - ], - "properties": { - "eureka": { - "$ref": "#/definitions/EurekaMsg" - } - }, - "additionalProperties": false } ] }, @@ -429,78 +417,6 @@ } ] }, - "EurekaMsg": { - "description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts", - "oneOf": [ - { - "description": "Sends an IBC packet with given payloads over the existing channel.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "payloads", - "timeout" - ], - "properties": { - "channel_id": { - "description": "existing channel to send the tokens over", - "type": "string" - }, - "payloads": { - "type": "array", - "items": { - "$ref": "#/definitions/EurekaPayload" - } - }, - "timeout": { - "$ref": "#/definitions/Timestamp" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "EurekaPayload": { - "description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "destination_port", - "encoding", - "value", - "version" - ], - "properties": { - "destination_port": { - "description": "The port id on the chain where the packet is sent to (external chain).", - "type": "string" - }, - "encoding": { - "description": "Encoding used to serialize the [EurekaPayload::value].", - "type": "string" - }, - "value": { - "description": "Encoded payload data.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "version": { - "description": "Version of the receiving contract.", - "type": "string" - } - }, - "additionalProperties": false - }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: /~https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", "oneOf": [ From a9825b8364b24ee78ee2b7dccad78225c1a4de4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Wed, 22 Jan 2025 16:48:44 +0100 Subject: [PATCH 3/3] docs: Enable eureka in docs.rs --- packages/std/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/std/Cargo.toml b/packages/std/Cargo.toml index 298c6c9d77..7d15f3e17b 100644 --- a/packages/std/Cargo.toml +++ b/packages/std/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" readme = "README.md" [package.metadata.docs.rs] -features = ["abort", "cosmwasm_2_2", "staking", "stargate"] +features = ["abort", "cosmwasm_2_2", "staking", "stargate", "eureka"] [features] default = ["iterator", "std"]