From 58d33dd1c1d4fff8555bc44b5789b7c635101c4f Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 12 Jan 2021 20:21:02 +0100 Subject: [PATCH] Add IbcSend message type to stargate code --- packages/std/src/query.rs | 2 +- packages/std/src/results/cosmos_msg.rs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/std/src/query.rs b/packages/std/src/query.rs index 4bbeab1f4f..92de6620f4 100644 --- a/packages/std/src/query.rs +++ b/packages/std/src/query.rs @@ -13,6 +13,7 @@ pub enum QueryRequest { Bank(BankQuery), Custom(C), Staking(StakingQuery), + Wasm(WasmQuery), /// A Stargate query encoded the same way as abci_query, with path and protobuf encoded Data. /// The format is defined in [ADR-21](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md) /// The response is also protobuf encoded. The caller is responsible for compiling the proper protobuf definitions @@ -24,7 +25,6 @@ pub enum QueryRequest { /// this is the expected protobuf message type (not any), binary encoded data: Binary, }, - Wasm(WasmQuery), } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] diff --git a/packages/std/src/results/cosmos_msg.rs b/packages/std/src/results/cosmos_msg.rs index ce941f6090..b62a77350d 100644 --- a/packages/std/src/results/cosmos_msg.rs +++ b/packages/std/src/results/cosmos_msg.rs @@ -19,6 +19,7 @@ where // to call into more app-specific code (whatever they define) Custom(T), Staking(StakingMsg), + Wasm(WasmMsg), /// A Stargate message encoded the same way as a protobof [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) #[cfg(feature = "stargate")] @@ -26,7 +27,21 @@ where type_url: String, data: Binary, }, - Wasm(WasmMsg), + /// Sends *native tokens* owned by the contract to the given address on another chain. + /// The channel must already be established between the ibctransfer module on this chain + /// and a matching module on the remote chain. + /// We cannot select the port_id, this is whatever the local chain has bound the ibctransfer + /// module to. + #[cfg(feature = "stargate")] + IbcSend { + /// exisiting channel to send the tokens over + channel_id: String, + /// address on the remote chain to receive these tokens + to_address: HumanAddr, + /// packet data only supports one coin + /// https://github.com/cosmos/cosmos-sdk/blob/master/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20 + amount: Coin, + }, } /// The message types of the bank module.