-
Notifications
You must be signed in to change notification settings - Fork 42
/
tx_msg_update_did_doc.go
57 lines (44 loc) · 1.29 KB
/
tx_msg_update_did_doc.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
validation "github.com/go-ozzo/ozzo-validation/v4"
)
var _ sdk.Msg = &MsgUpdateDidDoc{}
func NewMsgUpdateDid(payload *MsgUpdateDidDocPayload, signatures []*SignInfo) *MsgUpdateDidDoc {
return &MsgUpdateDidDoc{
Payload: payload,
Signatures: signatures,
}
}
func (msg *MsgUpdateDidDoc) Route() string {
return RouterKey
}
func (msg *MsgUpdateDidDoc) Type() string {
return "MsgUpdateDidDoc"
}
func (msg *MsgUpdateDidDoc) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{}
}
func (msg *MsgUpdateDidDoc) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUpdateDidDoc) ValidateBasic() error {
err := msg.Validate(nil)
if err != nil {
return ErrBasicValidation.Wrap(err.Error())
}
return nil
}
// Validate
func (msg MsgUpdateDidDoc) Validate(allowedNamespaces []string) error {
return validation.ValidateStruct(&msg,
validation.Field(&msg.Payload, validation.Required, ValidMsgUpdateDidPayloadRule(allowedNamespaces)),
validation.Field(&msg.Signatures, IsUniqueSignInfoListRule(), validation.Each(ValidSignInfoRule(allowedNamespaces))),
)
}
// Normalize
func (msg *MsgUpdateDidDoc) Normalize() {
msg.Payload.Normalize()
NormalizeSignInfoList(msg.Signatures)
}