forked from cerc-io/laconicd-deprecated
4e01da905a
* changelog * update changelog * crypto: refactor for stargate * fixes * fix keys * changelog
28 lines
779 B
Go
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)
|
|
}
|