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

feat: adding Route, Type, GetSignBytes for all messages #743

Merged
merged 3 commits into from
Jan 21, 2022
Merged
Changes from 1 commit
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
47 changes: 47 additions & 0 deletions modules/apps/29-fee/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
// msg types
const (
TypeMsgRegisterCounterpartyAddress = "registerCounterpartyAddress"
TypeMsgPayPacketFee = "payPacketFee"
TypeMsgPayPacketFeeAsync = "payPacketFeeAsync"
)

// NewMsgRegisterCounterpartyAddress creates a new instance of MsgRegisterCounterpartyAddress
Expand Down Expand Up @@ -44,6 +46,21 @@ func (msg MsgRegisterCounterpartyAddress) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{signer}
}

// Route implements sdk.Msg
func (msg MsgRegisterCounterpartyAddress) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (msg MsgRegisterCounterpartyAddress) Type() string {
return TypeMsgRegisterCounterpartyAddress
}

// GetSignBytes implements sdk.Msg.
func (msg MsgRegisterCounterpartyAddress) GetSignBytes() []byte {
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

// NewMsgPayPacketFee creates a new instance of MsgPayPacketFee
func NewMsgPayPacketFee(fee Fee, sourcePortId, sourceChannelId, signer string, relayers []string) *MsgPayPacketFee {
return &MsgPayPacketFee{
Expand Down Expand Up @@ -102,6 +119,21 @@ func (msg MsgPayPacketFee) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{signer}
}

// Route implements sdk.Msg
func (msg MsgPayPacketFee) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (msg MsgPayPacketFee) Type() string {
return TypeMsgPayPacketFee
}

// GetSignBytes implements sdk.Msg.
func (msg MsgPayPacketFee) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}

// NewMsgPayPacketAsync creates a new instance of MsgPayPacketFee
func NewMsgPayPacketFeeAsync(identifiedPacketFee IdentifiedPacketFee) *MsgPayPacketFeeAsync {
return &MsgPayPacketFeeAsync{
Expand Down Expand Up @@ -135,6 +167,21 @@ func (msg MsgPayPacketFeeAsync) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{signer}
}

// Route implements sdk.Msg
func (msg MsgPayPacketFeeAsync) Route() string {
return RouterKey
}

// Type implements sdk.Msg
func (msg MsgPayPacketFeeAsync) Type() string {
return TypeMsgPayPacketFeeAsync
}

// GetSignBytes implements sdk.Msg.
func (msg MsgPayPacketFeeAsync) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}

func NewIdentifiedPacketFee(packetId *channeltypes.PacketId, fee Fee, refundAddr string, relayers []string) *IdentifiedPacketFee {
return &IdentifiedPacketFee{
PacketId: packetId,
Expand Down