Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helpers to wrap ibc message variants #254

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions types/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,23 @@ type IBCOpenInit struct {
Channel IBCChannel `json:"channel"`
}

func (m *IBCOpenInit) ToMsg() IBCChannelOpenMsg {
return IBCChannelOpenMsg{
OpenInit: m,
}
}

type IBCOpenTry struct {
Channel IBCChannel `json:"channel"`
CounterpartyVersion string `json:"counterparty_version"`
}

func (m *IBCOpenTry) ToMsg() IBCChannelOpenMsg {
return IBCChannelOpenMsg{
OpenTry: m,
}
}

type IBCChannelConnectMsg struct {
OpenAck *IBCOpenAck `json:"open_ack,omitempty"`
OpenConfirm *IBCOpenConfirm `json:"open_confirm,omitempty"`
Expand Down Expand Up @@ -71,10 +83,22 @@ type IBCOpenAck struct {
CounterpartyVersion string `json:"counterparty_version"`
}

func (m *IBCOpenAck) ToMsg() IBCChannelConnectMsg {
return IBCChannelConnectMsg{
OpenAck: m,
}
}

type IBCOpenConfirm struct {
Channel IBCChannel `json:"channel"`
}

func (m *IBCOpenConfirm) ToMsg() IBCChannelConnectMsg {
return IBCChannelConnectMsg{
OpenConfirm: m,
}
}

type IBCChannelCloseMsg struct {
CloseInit *IBCCloseInit `json:"close_init,omitempty"`
CloseConfirm *IBCCloseConfirm `json:"close_confirm,omitempty"`
Expand All @@ -92,10 +116,22 @@ type IBCCloseInit struct {
Channel IBCChannel `json:"channel"`
}

func (m *IBCCloseInit) ToMsg() IBCChannelCloseMsg {
return IBCChannelCloseMsg{
CloseInit: m,
}
}

type IBCCloseConfirm struct {
Channel IBCChannel `json:"channel"`
}

func (m *IBCCloseConfirm) ToMsg() IBCChannelCloseMsg {
return IBCChannelCloseMsg{
CloseConfirm: m,
}
}

type IBCPacketReceiveMsg struct {
Packet IBCPacket `json:"packet"`
}
Expand Down