26 lines
516 B
Go
26 lines
516 B
Go
package keys
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
|
)
|
|
|
|
// KeysCdc defines codec to be used with key operations
|
|
var KeysCdc *codec.LegacyAmino
|
|
|
|
func init() {
|
|
KeysCdc = codec.New()
|
|
cryptocodec.RegisterCrypto(KeysCdc)
|
|
KeysCdc.Seal()
|
|
}
|
|
|
|
// marshal keys
|
|
func MarshalJSON(o interface{}) ([]byte, error) {
|
|
return KeysCdc.MarshalJSON(o)
|
|
}
|
|
|
|
// unmarshal json
|
|
func UnmarshalJSON(bz []byte, ptr interface{}) error {
|
|
return KeysCdc.UnmarshalJSON(bz, ptr)
|
|
}
|