dcc9585595
* all: bump SDK to v0.43.0-rc0 * more updates * keys * accounting * update account * ante changes * readonly * readonly build * minor changes from self review * fixes * evm debug * custom config & rosetta * fix
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package types_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
|
|
cryptocodec "github.com/tharsis/ethermint/crypto/codec"
|
|
"github.com/tharsis/ethermint/crypto/ethsecp256k1"
|
|
ethermintcodec "github.com/tharsis/ethermint/encoding/codec"
|
|
"github.com/tharsis/ethermint/types"
|
|
)
|
|
|
|
func init() {
|
|
amino := codec.NewLegacyAmino()
|
|
cryptocodec.RegisterCrypto(amino)
|
|
}
|
|
|
|
type AccountTestSuite struct {
|
|
suite.Suite
|
|
|
|
account *types.EthAccount
|
|
cdc codec.JSONCodec
|
|
}
|
|
|
|
func (suite *AccountTestSuite) SetupTest() {
|
|
privKey, err := ethsecp256k1.GenerateKey()
|
|
suite.Require().NoError(err)
|
|
pubKey := privKey.PubKey()
|
|
addr := sdk.AccAddress(pubKey.Address())
|
|
baseAcc := authtypes.NewBaseAccount(addr, pubKey, 10, 50)
|
|
suite.account = &types.EthAccount{
|
|
BaseAccount: baseAcc,
|
|
CodeHash: common.Hash{}.String(),
|
|
}
|
|
|
|
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
|
ethermintcodec.RegisterInterfaces(interfaceRegistry)
|
|
suite.cdc = codec.NewProtoCodec(interfaceRegistry)
|
|
}
|
|
|
|
func TestAccountTestSuite(t *testing.T) {
|
|
suite.Run(t, new(AccountTestSuite))
|
|
}
|