@@ -148,6 +148,26 @@ type IBCPacketTimeoutMsg struct {
148
148
Relayer string `json:"relayer"`
149
149
}
150
150
151
+ // The type of IBC callback that is being called.
152
+ //
153
+ // IBC callbacks are needed for cases where your contract triggers the sending of an IBC packet
154
+ // through some other message (i.e. not through [`IbcMsg::SendPacket`]) and needs to know whether
155
+ // or not the packet was successfully received on the other chain. A prominent example is the
156
+ // [`IbcMsg::Transfer`] message.
157
+ // Without callbacks, you cannot know whether the transfer was successful or not.
158
+ //
159
+ // Note that there are some prerequisites that need to be fulfilled to receive source chain callbacks:
160
+ // - The contract must implement the `ibc_source_chain_callback` entrypoint.
161
+ // - The module that sends the packet must be wrapped by an `IBCMiddleware`
162
+ // (i.e. the source chain needs to support callbacks for the message you are sending).
163
+ // - You have to add json-encoded [`IbcCallbackData`] to a specific field of the message.
164
+ // For `IbcMsg::Transfer`, this is the `memo` field.
165
+ // - The receiver of the callback must also be the sender of the message.
166
+ type IBCSourceChainCallbackMsg struct {
167
+ Acknowledgement * IBCPacketAckMsg `json:"Acknowledgement,omitempty"`
168
+ Timeout * IBCPacketTimeoutMsg `json:"Timeout,omitempty"`
169
+ }
170
+
151
171
// TODO: test what the sdk Order.String() represents and how to parse back
152
172
// Proto files: https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/core/channel/v1/channel.proto#L69-L80
153
173
// Auto-gen code: https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/x/ibc/core/04-channel/types/channel.pb.go#L70-L101
0 commit comments