Enum cosmwasm_std::IbcMsg
source · #[non_exhaustive]pub enum IbcMsg {
Transfer {
channel_id: String,
to_address: String,
amount: Coin,
timeout: IbcTimeout,
memo: Option<String>,
},
SendPacket {
channel_id: String,
data: Binary,
timeout: IbcTimeout,
},
CloseChannel {
channel_id: String,
},
}
Expand description
These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Transfer
Sends bank 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.
Fields
amount: Coin
packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20
timeout: IbcTimeout
when packet times out, measured on remote chain
memo: Option<String>
An optional memo. See the blog post “Moving Beyond Simple Token Transfers” for more information.
There is no difference between setting this to None
or an empty string.
This field is only supported on chains with CosmWasm >= 2.0 and silently
ignored on older chains.
If you need support for both 1.x and 2.x chain with the same codebase,
it is recommended to use CosmosMsg::Stargate
with a custom MsgTransfer
protobuf encoder instead.
SendPacket
Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.
Fields
timeout: IbcTimeout
when packet times out, measured on remote chain
CloseChannel
This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract’s IBC port
Trait Implementations§
source§impl<'de> Deserialize<'de> for IbcMsg
impl<'de> Deserialize<'de> for IbcMsg
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl JsonSchema for IbcMsg
impl JsonSchema for IbcMsg
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more