Skip to content

Commit 3852424

Browse files
committed
Update ibc callback types
1 parent bc9921f commit 3852424

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

types/ibc.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,25 @@ type IBCPacketTimeoutMsg struct {
148148
Relayer string `json:"relayer"`
149149
}
150150

151-
// The type of IBC callback that is being called.
151+
// The type of IBC source chain callback that is being called.
152152
//
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.
153+
// IBC source chain callbacks are needed for cases where your contract triggers the sending of an IBC packet through some other message (i.e. not through [`IbcMsg::SendPacket`]) and needs to know whether or not the packet was successfully received on the other chain. A prominent example is the [`IbcMsg::Transfer`] message. Without callbacks, you cannot know whether the transfer was successful or not.
158154
//
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.
155+
// Note that there are some prerequisites that need to be fulfilled to receive source chain callbacks: - The contract must implement the `ibc_source_chain_callback` entrypoint. - The IBC application in the source chain must have support for the callbacks middleware. - You have to add serialized [`IbcCallbackRequest`] to a specific field of the message. For `IbcMsg::Transfer`, this is the `memo` field and it needs to be json-encoded. - The receiver of the callback must also be the sender of the message.
166156
type IBCSourceChainCallbackMsg struct {
167-
Acknowledgement *IBCPacketAckMsg `json:"acknowledgement,omitempty"`
168-
Timeout *IBCPacketTimeoutMsg `json:"timeout,omitempty"`
157+
Acknowledgement *IBCAckCallbackMsg `json:"acknowledgement,omitempty"`
158+
Timeout *IBCTimeoutCallbackMsg `json:"timeout,omitempty"`
159+
}
160+
161+
type IBCAckCallbackMsg struct {
162+
Acknowledgement IBCAcknowledgement `json:"acknowledgement"`
163+
OriginalPacket IBCPacket `json:"original_packet"`
164+
Relayer string `json:"relayer"`
165+
}
166+
167+
type IBCTimeoutCallbackMsg struct {
168+
Packet IBCPacket `json:"packet"`
169+
Relayer string `json:"relayer"`
169170
}
170171

171172
// The message type of the IBC destination chain callback.

0 commit comments

Comments
 (0)