/
msg_seal_batch.go
40 lines (30 loc) · 1.16 KB
/
msg_seal_batch.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
package core
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
var _ legacytx.LegacyMsg = &MsgSealBatch{}
// Route implements the LegacyMsg interface.
func (m MsgSealBatch) Route() string { return sdk.MsgTypeURL(&m) }
// Type implements the LegacyMsg interface. x
func (m MsgSealBatch) Type() string { return sdk.MsgTypeURL(&m) }
// GetSignBytes implements the LegacyMsg interface.
func (m MsgSealBatch) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
// ValidateBasic does a sanity check on the provided data.
func (m *MsgSealBatch) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Issuer); err != nil {
return sdkerrors.ErrInvalidAddress.Wrapf("issuer: %s", err)
}
if m.BatchDenom == "" {
return sdkerrors.ErrInvalidRequest.Wrap("batch denom cannot be empty")
}
return ValidateBatchDenom(m.BatchDenom)
}
// GetSigners returns the expected signers for MsgSealBatch.
func (m *MsgSealBatch) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(m.Issuer)
return []sdk.AccAddress{addr}
}