cosmos-sdk/client/keys/codec.go
Aaron Craelius 81d647e505
Move codec.RegisterCrypto and codec.Cdc to new packages (#6330)
* Move codec.Cdc to legacy_global.Cdc

* Update CHANGELOG.md

* Updates

* nit

* Fix imports

* Updates

* Use cosmos multisig instead of tendermint multisig everywhere

* Fix tests

* Rename legacy_global -> legacy

* Add doc.go

* Linting, move all RegisterCrypto calls to crypto/codec

* Update crypto/codec/amino.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-04 10:38:24 +00:00

26 lines
510 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.Codec
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)
}