laconicd/crypto/encoding/amino.go
Austin Abell 72fc3ca3af
Transaction signing and encoding (#95)
* WIP setting up evm tx command and updating emint keys output

* Fix linting issue

* Wip restructuring to allow for ethereum signing and encoding

* WIP setting up keybase and context to use Ethermint keys

* Fixed encoding and decoding of emint keys

* Adds command for generating explicit ethereum tx

* Fixed evm route for handling tx

* Fixed tx and msg encoding which allows transactions to be sent

* Added relevant documentation for changes and cleaned up code

* Added documentation and indicators why code was overriden
2019-09-15 12:12:59 -04:00

36 lines
1.1 KiB
Go

package encoding
import (
emintcrypto "github.com/cosmos/ethermint/crypto"
amino "github.com/tendermint/go-amino"
tmcrypto "github.com/tendermint/tendermint/crypto"
)
var cdc = amino.NewCodec()
func init() {
RegisterAmino(cdc)
}
// RegisterAmino registers all crypto related types in the given (amino) codec.
func RegisterAmino(cdc *amino.Codec) {
// These are all written here instead of
cdc.RegisterInterface((*tmcrypto.PubKey)(nil), nil)
cdc.RegisterConcrete(emintcrypto.PubKeySecp256k1{}, emintcrypto.PubKeyAminoName, nil)
cdc.RegisterInterface((*tmcrypto.PrivKey)(nil), nil)
cdc.RegisterConcrete(emintcrypto.PrivKeySecp256k1{}, emintcrypto.PrivKeyAminoName, nil)
}
// PrivKeyFromBytes unmarshalls emint private key from encoded bytes
func PrivKeyFromBytes(privKeyBytes []byte) (privKey tmcrypto.PrivKey, err error) {
err = cdc.UnmarshalBinaryBare(privKeyBytes, &privKey)
return
}
// PubKeyFromBytes unmarshalls emint public key from encoded bytes
func PubKeyFromBytes(pubKeyBytes []byte) (pubKey tmcrypto.PubKey, err error) {
err = cdc.UnmarshalBinaryBare(pubKeyBytes, &pubKey)
return
}