2020-10-06 18:57:55 +00:00
|
|
|
package ethsecp256k1
|
2018-12-18 16:10:04 +00:00
|
|
|
|
2019-08-11 14:42:46 +00:00
|
|
|
import (
|
2020-08-11 15:01:15 +00:00
|
|
|
cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
|
|
|
|
2019-08-11 14:42:46 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2020-08-23 21:41:54 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
2019-08-11 14:42:46 +00:00
|
|
|
)
|
2018-12-18 16:10:04 +00:00
|
|
|
|
2020-08-11 15:01:15 +00:00
|
|
|
// CryptoCodec is the default amino codec used by ethermint
|
|
|
|
var CryptoCodec = codec.New()
|
2018-12-18 16:10:04 +00:00
|
|
|
|
|
|
|
func init() {
|
2020-08-11 15:01:15 +00:00
|
|
|
// replace the keyring codec with the ethermint crypto codec to prevent
|
|
|
|
// amino panics because of unregistered Priv/PubKey
|
2020-08-23 21:41:54 +00:00
|
|
|
keys.CryptoCdc = CryptoCodec
|
|
|
|
keys.RegisterCodec(CryptoCodec)
|
2020-08-11 15:01:15 +00:00
|
|
|
cryptoamino.RegisterAmino(CryptoCodec)
|
|
|
|
RegisterCodec(CryptoCodec)
|
2018-12-18 16:10:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterCodec registers all the necessary types with amino for the given
|
|
|
|
// codec.
|
|
|
|
func RegisterCodec(cdc *codec.Codec) {
|
2020-10-06 18:57:55 +00:00
|
|
|
cdc.RegisterConcrete(PubKey{}, PubKeyName, nil)
|
|
|
|
cdc.RegisterConcrete(PrivKey{}, PrivKeyName, nil)
|
2018-12-18 16:10:04 +00:00
|
|
|
}
|