-
Notifications
You must be signed in to change notification settings - Fork 74
/
tx.go
35 lines (28 loc) · 840 Bytes
/
tx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ sdk.Msg = &MsgUpdateParams{}
func (msg *MsgUpdateParams) Route() string {
return RouterKey
}
func (msg *MsgUpdateParams) Type() string {
return "update-params"
}
func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress {
authority, err := sdk.AccAddressFromBech32(msg.Authority)
if err != nil { // should never happen as valid basic rejects invalid addresses
panic(err.Error())
}
return []sdk.AccAddress{authority}
}
func (msg *MsgUpdateParams) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))
}
func (msg *MsgUpdateParams) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
return errorsmod.Wrap(err, "authority is invalid")
}
return nil
}