github.com/InjectiveLabs/sdk-go@v1.53.0/chain/crypto/codec/amino.go (about)

     1  package codec
     2  
     3  import (
     4  	"github.com/cosmos/cosmos-sdk/codec"
     5  	"github.com/cosmos/cosmos-sdk/codec/legacy"
     6  
     7  	cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
     8  	"github.com/cosmos/cosmos-sdk/crypto/keyring"
     9  	cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
    10  
    11  	"github.com/InjectiveLabs/sdk-go/chain/crypto/ethsecp256k1"
    12  )
    13  
    14  var amino *codec.LegacyAmino
    15  
    16  func init() {
    17  	amino = codec.NewLegacyAmino()
    18  	RegisterCrypto(amino)
    19  	codec.RegisterEvidences(amino)
    20  	amino.Seal()
    21  }
    22  
    23  var (
    24  	_ cryptotypes.PubKey  = &ethsecp256k1.PubKey{}
    25  	_ cryptotypes.PrivKey = &ethsecp256k1.PrivKey{}
    26  )
    27  
    28  // RegisterCrypto registers all crypto dependency types with the provided Amino
    29  // codec.
    30  func RegisterCrypto(cdc *codec.LegacyAmino) {
    31  	cryptocodec.RegisterCrypto(cdc)
    32  
    33  	cdc.RegisterConcrete(&ethsecp256k1.PubKey{},
    34  		ethsecp256k1.PubKeyName, nil)
    35  	cdc.RegisterConcrete(&ethsecp256k1.PrivKey{},
    36  		ethsecp256k1.PrivKeyName, nil)
    37  
    38  	keyring.RegisterLegacyAminoCodec(cdc)
    39  	legacy.Cdc = cdc
    40  }