laconicd-deprecated/crypto/ethsecp256k1/codec.go
Federico Kunze 4e01da905a
crypto: refactor for stargate (#559)
* changelog

* update changelog

* crypto: refactor for stargate

* fixes

* fix keys

* changelog
2020-10-06 20:57:55 +02:00

28 lines
779 B
Go

package ethsecp256k1
import (
cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys"
)
// CryptoCodec is the default amino codec used by ethermint
var CryptoCodec = codec.New()
func init() {
// replace the keyring codec with the ethermint crypto codec to prevent
// amino panics because of unregistered Priv/PubKey
keys.CryptoCdc = CryptoCodec
keys.RegisterCodec(CryptoCodec)
cryptoamino.RegisterAmino(CryptoCodec)
RegisterCodec(CryptoCodec)
}
// RegisterCodec registers all the necessary types with amino for the given
// codec.
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(PubKey{}, PubKeyName, nil)
cdc.RegisterConcrete(PrivKey{}, PrivKeyName, nil)
}