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"
|
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
|
|
|
|
var KeysCdc *codec.Codec
|
2018-02-22 07:17:19 -08:00
|
|
|
|
|
|
|
func init() {
|
2019-12-12 13:52:24 -08:00
|
|
|
KeysCdc = codec.New()
|
|
|
|
codec.RegisterCrypto(KeysCdc)
|
|
|
|
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
|
|
|
}
|