Merge PR #5600: Migrate x/staking to Protobuf

This commit is contained in:
Alexander Bezobchuk
2020-02-06 14:21:02 -05:00
committed by GitHub
parent b0c6c750df
commit 53bf2271d5
57 changed files with 8805 additions and 859 deletions
+4 -4
View File
@@ -45,8 +45,8 @@ func RegisterEvidences(cdc *Codec) {
// MarshalJSONIndent provides a utility for indented JSON encoding of an object
// via an Amino codec. It returns an error if it cannot serialize or indent as
// JSON.
func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) {
bz, err := cdc.MarshalJSON(obj)
func MarshalJSONIndent(m JSONMarshaler, obj interface{}) ([]byte, error) {
bz, err := m.MarshalJSON(obj)
if err != nil {
return nil, err
}
@@ -60,8 +60,8 @@ func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) {
}
// MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure.
func MustMarshalJSONIndent(cdc *Codec, obj interface{}) []byte {
bz, err := MarshalJSONIndent(cdc, obj)
func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte {
bz, err := MarshalJSONIndent(m, obj)
if err != nil {
panic(fmt.Sprintf("failed to marshal JSON: %s", err))
}
+4
View File
@@ -30,6 +30,10 @@ type (
UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error
MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler)
JSONMarshaler
}
JSONMarshaler interface {
MarshalJSON(o interface{}) ([]byte, error) // nolint: stdmethods
MustMarshalJSON(o interface{}) []byte