2018-02-22 07:17:19 -08:00
|
|
|
package keys
|
|
|
|
|
|
|
|
import (
|
2018-09-13 11:17:32 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
2018-02-22 07:17:19 -08:00
|
|
|
)
|
|
|
|
|
2019-12-12 13:52:24 -08:00
|
|
|
// KeysCdc defines codec to be used with key operations
|
2020-08-10 12:41:21 -07:00
|
|
|
var KeysCdc *codec.LegacyAmino
|
2018-02-22 07:17:19 -08:00
|
|
|
|
|
|
|
func init() {
|
2020-09-07 07:47:12 -07:00
|
|
|
KeysCdc = codec.NewLegacyAmino()
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec.RegisterCrypto(KeysCdc)
|
2019-12-12 13:52:24 -08:00
|
|
|
KeysCdc.Seal()
|
2018-02-22 07:17:19 -08:00
|
|
|
}
|
|
|
|
|
2018-04-14 13:52:58 -07:00
|
|
|
// marshal keys
|
2018-02-22 07:17:19 -08:00
|
|
|
func MarshalJSON(o interface{}) ([]byte, error) {
|
2019-12-12 13:52:24 -08:00
|
|
|
return KeysCdc.MarshalJSON(o)
|
2018-02-22 07:17:19 -08:00
|
|
|
}
|
2018-04-14 13:52:58 -07:00
|
|
|
|
|
|
|
// unmarshal json
|
|
|
|
func UnmarshalJSON(bz []byte, ptr interface{}) error {
|
2019-12-12 13:52:24 -08:00
|
|
|
return KeysCdc.UnmarshalJSON(bz, ptr)
|
2018-04-14 13:52:58 -07:00
|
|
|
}
|