You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Execute an interchain account transaction](#execute-an-interchain-account-transaction)
26
-
-[`SendCosmosMsgs`](#sendcosmosmsgs)
26
+
-[Querying the host chain](#querying-the-host-chain)
27
27
-[Execute a callback](#execute-a-callback)
28
28
-[Channel Closing and Reopening](#channel-closing-and-reopening)
29
29
-[Channel Closing](#channel-closing)
@@ -99,11 +99,9 @@ Learn more about channel closing and reopening [here](#channel-closing-and-reope
99
99
100
100
### Execute an interchain account transaction
101
101
102
-
`ExecuteMsg::SendCosmosMsgs` is used to commit a packet to be sent to the host chain. It accepts `cosmwasm_std::CosmosMsg`s to be sent to the host chain. (The contract then these messages to protobuf messages and sends them to the host chain. You can execute any custom message using `CosmosMsg::Stargate`.
102
+
`ExecuteMsg::SendCosmosMsgs` is used to commit a packet to be sent to the host chain. It accepts `cosmwasm_std::CosmosMsg`s to be sent to the host chain. (The contract then these messages to protobuf messages and sends them to the host chain. You can execute any custom message using `CosmosMsg::Stargate`).
103
103
104
-
#### `SendCosmosMsgs`
105
-
106
-
In CosmWasm contracts, `CosmosMsg` are used to execute transactions on the chain that the contract is deployed on. In this contract, we use `CosmosMsg`s to execute transactions on the host chain. This is done by converting the `CosmosMsg`s to an ICA tx based on the encoding of the channel. The ICA tx is then sent to the host chain. The host chain then executes the ICA tx and sends the result back to this contract.
104
+
In CosmWasm contracts, `CosmosMsg` are used to execute transactions on the chain that the contract is deployed on. In this contract, we use `CosmosMsg`s to execute transactions on the host (counterparty) chain. This is done by converting the `CosmosMsg`s to a protobuf ICA tx. The ICA tx is then sent to the host chain. The host chain then executes the ICA tx and sends the result back to this contract.
107
105
108
106
This execute message allows the user to submit an array of [`cosmwasm_std::CosmosMsg`](https://github.com/CosmWasm/cosmwasm/blob/v1.5.0/packages/std/src/results/cosmos_msg.rs#L27) which are then converted by the contract to an atomic ICA tx.
109
107
@@ -117,7 +115,15 @@ pub enum ExecuteMsg {
117
115
/// **This is the recommended way to send messages to the ICA host.**
118
116
SendCosmosMsgs {
119
117
/// The stargate messages to convert and send to the ICA host.
(`Stargate` allows the user to submit any protobuf message to the host chain.)
140
+
(`CosmosMsg::Stargate` allows the user to submit any protobuf message to the host chain.)
135
141
136
142
Here is an example execute message that delegates tokens to a validator on the host chain and then votes on a proposal (atomically).
137
143
@@ -163,6 +169,14 @@ Here is an example execute message that delegates tokens to a validator on the h
163
169
}
164
170
```
165
171
172
+
#### Querying the host chain
173
+
174
+
This contract also supports querying the host chain. To do this, you can submit a `ExecuteMsg::SendCosmosMsgs` with the queries field filled out. The queries are always executed after the messages, and their results are deserialized and returned in the [callbacks](#execute-a-callback).
175
+
176
+
Similarly to `CosmosMsg`, in CosmWasm contracts, `QueryRequest` are used to execute queries on the chain that the contract is deployed on. In this contract, we use `QueryRequest`s to execute queries as transactions on the host (counterparty) chain. This is done by converting the `QueryRequests`s to a protobuf ICA tx. The ICA tx is then sent to the host chain. The host chain then executes the ICA tx and sends the result back to this contract.
177
+
178
+
Note that if both `messages` and `queries` are provided, the `queries` are executed after the `messages`.
179
+
166
180
### Execute a callback
167
181
168
182
This contract supports external contract callbacks. See [`src/types/callbacks.rs`](./src/types/callbacks.rs) to learn what callbacks are supported.
@@ -183,6 +197,20 @@ pub enum ExecuteMsg {
183
197
}
184
198
```
185
199
200
+
Note that this crate also includes a proc-macro to add the `ReceiveIcaCallback` variant to the `ExecuteMsg` enum. This is done by adding the following macro to the callback contract:
201
+
202
+
```rust, ignore
203
+
use cosmwasm_schema::cw_serde;
204
+
use cw_ica_controller::helpers::ica_callback_execute;
205
+
206
+
#[ica_callback_execute]
207
+
#[cw_serde]
208
+
/// This is the execute message of the contract.
209
+
pub enum ExecuteMsg {
210
+
// ... other variants
211
+
}
212
+
```
213
+
186
214
Any contract that imports the `cw-ica-controller` as a library needs to disable the `default-features` of the `cw-ica-controller` crate.
187
215
This is because the `default-features` of the `cw-ica-controller` crate includes the CosmWasm entry points.
0 commit comments