-
Notifications
You must be signed in to change notification settings - Fork 13
/
msgs.go
79 lines (62 loc) · 1.94 KB
/
msgs.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// ---------------------------
// --- MsgBlockAccountSend
// ---------------------------
type MsgBlockAccountSend struct {
Address sdk.AccAddress `json:"address"`
Signer sdk.AccAddress `json:"signer"`
}
// Route Implements Msg.
func (msg MsgBlockAccountSend) Route() string { return RouterKey }
// Type Implements Msg.
func (msg MsgBlockAccountSend) Type() string { return MsgTypeBlockAccountSend }
// ValidateBasic Implements Msg.
func (msg MsgBlockAccountSend) ValidateBasic() sdk.Error {
if msg.Address.Empty() {
return sdk.ErrInvalidAddress(msg.Address.String())
}
if msg.Signer.Empty() {
return sdk.ErrInvalidAddress(msg.Signer.String())
}
return nil
}
// GetSignBytes Implements Msg.
func (msg MsgBlockAccountSend) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))
}
// GetSigners Implements Msg.
func (msg MsgBlockAccountSend) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{msg.Signer}
}
// ---------------------------
// --- MsgUnlockAccountSend
// ---------------------------
type MsgUnlockAccountSend struct {
Address sdk.AccAddress `json:"address"`
Signer sdk.AccAddress `json:"signer"`
}
// Route Implements Msg.
func (msg MsgUnlockAccountSend) Route() string { return RouterKey }
// Type Implements Msg.
func (msg MsgUnlockAccountSend) Type() string { return MsgTypeUnlockAccountSend }
// ValidateBasic Implements Msg.
func (msg MsgUnlockAccountSend) ValidateBasic() sdk.Error {
if msg.Address.Empty() {
return sdk.ErrInvalidAddress(msg.Address.String())
}
if msg.Signer.Empty() {
return sdk.ErrInvalidAddress(msg.Signer.String())
}
return nil
}
// GetSignBytes Implements Msg.
func (msg MsgUnlockAccountSend) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))
}
// GetSigners Implements Msg.
func (msg MsgUnlockAccountSend) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{msg.Signer}
}