github.com/okex/exchain@v1.8.0/libs/tendermint/crypto/multisig/codec.go (about)

     1  package multisig
     2  
     3  import (
     4  	amino "github.com/tendermint/go-amino"
     5  
     6  	"github.com/okex/exchain/libs/tendermint/crypto"
     7  	"github.com/okex/exchain/libs/tendermint/crypto/ed25519"
     8  	"github.com/okex/exchain/libs/tendermint/crypto/secp256k1"
     9  	"github.com/okex/exchain/libs/tendermint/crypto/sr25519"
    10  )
    11  
    12  // TODO: Figure out API for others to either add their own pubkey types, or
    13  // to make verify / marshal accept a cdc.
    14  const (
    15  	PubKeyMultisigThresholdAminoRoute = "tendermint/PubKeyMultisigThreshold"
    16  )
    17  
    18  var cdc = amino.NewCodec()
    19  
    20  func init() {
    21  	cdc.RegisterInterface((*crypto.PubKey)(nil), nil)
    22  	cdc.RegisterConcrete(PubKeyMultisigThreshold{},
    23  		PubKeyMultisigThresholdAminoRoute, nil)
    24  	cdc.RegisterConcrete(ed25519.PubKeyEd25519{},
    25  		ed25519.PubKeyAminoName, nil)
    26  	cdc.RegisterConcrete(sr25519.PubKeySr25519{},
    27  		sr25519.PubKeyAminoName, nil)
    28  	cdc.RegisterConcrete(secp256k1.PubKeySecp256k1{},
    29  		secp256k1.PubKeyAminoName, nil)
    30  }
    31  
    32  func RegisterKeyType(o interface{}, name string) {
    33  	cdc.RegisterConcrete(o, name, nil)
    34  }