types

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2025 License: LGPL-3.0 Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const CometBFTGovVotingPeriod = 5 * time.Second

Variables

This section is empty.

Functions

func NewChainApp

func NewChainApp(chainCfg ChainConfig, disableCometBFT bool, testConfig TestConfig, encCfg params.EncodingConfig, db cmtdb.DB, validatorAccounts TestAccounts, walletAccounts TestAccounts, genesisAccountBalance sdk.Coins, tempHolder *TemporaryHolder, logger log.Logger) (chainApp ChainApp, cometApp CometBftApp, validatorSet *cmttypes.ValidatorSet)

func NewIntegrationTestKeyring

func NewIntegrationTestKeyring(accounts TestAccounts) keyring.Keyring

func NewSigner

func NewSigner(sk cryptotypes.PrivKey) keyring.Signer

Types

type AnteTestSpec

type AnteTestSpec struct {
	Ante                    sdk.AnteHandler
	Simulate                bool
	NodeMinGasPrices        *sdk.DecCoins
	CheckTx                 bool
	ReCheckTx               bool
	WantPriority            *int64
	WantErr                 bool
	WantErrMsgContains      *string
	WantPanic               bool
	PostRunOnSuccess        func(ctx sdk.Context, tx sdk.Tx)                // will be executed only when ante ran success
	PostRunOnFail           func(ctx sdk.Context, anteErr error, tx sdk.Tx) // will be executed only when ante ran failed
	PostRunRegardlessStatus func(ctx sdk.Context, anteErr error, tx sdk.Tx) // will be executed regardless ante ran success or not
}

func NewAnteTestSpec

func NewAnteTestSpec() *AnteTestSpec

func (*AnteTestSpec) OnFail

func (ts *AnteTestSpec) OnFail(f func(ctx sdk.Context, anteErr error, tx sdk.Tx)) *AnteTestSpec

func (*AnteTestSpec) OnSuccess

func (ts *AnteTestSpec) OnSuccess(f func(ctx sdk.Context, tx sdk.Tx)) *AnteTestSpec

func (*AnteTestSpec) PostRun

func (ts *AnteTestSpec) PostRun(f func(ctx sdk.Context, anteErr error, tx sdk.Tx)) *AnteTestSpec

func (*AnteTestSpec) WantsErr

func (ts *AnteTestSpec) WantsErr() *AnteTestSpec

func (*AnteTestSpec) WantsErrMsgContains

func (ts *AnteTestSpec) WantsErrMsgContains(msg string) *AnteTestSpec

func (*AnteTestSpec) WantsErrMultiEthTx

func (ts *AnteTestSpec) WantsErrMultiEthTx() *AnteTestSpec

func (*AnteTestSpec) WantsPanic

func (ts *AnteTestSpec) WantsPanic() *AnteTestSpec

func (*AnteTestSpec) WantsPriority

func (ts *AnteTestSpec) WantsPriority(wantPriority int64) *AnteTestSpec

func (*AnteTestSpec) WantsSuccess

func (ts *AnteTestSpec) WantsSuccess() *AnteTestSpec

func (*AnteTestSpec) WithCheckTx

func (ts *AnteTestSpec) WithCheckTx() *AnteTestSpec

func (*AnteTestSpec) WithDecorator

func (ts *AnteTestSpec) WithDecorator(d sdk.AnteDecorator) *AnteTestSpec

func (*AnteTestSpec) WithNodeMinGasPrices

func (ts *AnteTestSpec) WithNodeMinGasPrices(minGasPrices sdk.DecCoins) *AnteTestSpec

func (*AnteTestSpec) WithReCheckTx

func (ts *AnteTestSpec) WithReCheckTx() *AnteTestSpec

func (*AnteTestSpec) WithSimulateOn

func (ts *AnteTestSpec) WithSimulateOn() *AnteTestSpec

type ChainApp

type ChainApp interface {
	App() abci.Application
	BaseApp() *baseapp.BaseApp
	IbcTestingApp() ibctesting.TestingApp
	InterfaceRegistry() codectypes.InterfaceRegistry
	BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
	EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)

	AccountKeeper() *authkeeper.AccountKeeper
	BankKeeper() bankkeeper.Keeper
	DistributionKeeper() distkeeper.Keeper
	EvmKeeper() *evmkeeper.Keeper
	FeeMarketKeeper() *feemarketkeeper.Keeper
	GovKeeper() *govkeeper.Keeper
	IbcTransferKeeper() *ibctransferkeeper.Keeper
	IbcKeeper() *ibckeeper.Keeper
	SlashingKeeper() *slashingkeeper.Keeper
	StakingKeeper() *stakingkeeper.Keeper
	FeeGrantKeeper() *feegrantkeeper.Keeper
	VAuthKeeper() *vauthkeeper.Keeper
	CpcKeeper() *cpckeeper.Keeper

	FundAccount(ctx sdk.Context, account *TestAccount, amounts sdk.Coins) error
}

type ChainConfig

type ChainConfig struct {
	CosmosChainId    string
	BaseDenom        string
	Bech32Prefix     string
	EvmChainId       int64
	EvmChainIdBigInt *big.Int // dynamic: calculated from EvmChainId
}

type ChainConstantConfig

type ChainConstantConfig struct {
	// contains filtered or unexported fields
}

func NewChainConstantConfig

func NewChainConstantConfig(cosmosChainId, minDenom string, baseExponent int) ChainConstantConfig

func (ChainConstantConfig) GetBaseExponent

func (c ChainConstantConfig) GetBaseExponent() int

func (ChainConstantConfig) GetCosmosChainID

func (c ChainConstantConfig) GetCosmosChainID() string

func (ChainConstantConfig) GetMinDenom

func (c ChainConstantConfig) GetMinDenom() string

type CometBftApp

type CometBftApp interface {
	CometBftNode() *cmtnode.Node
	GetRpcAddr() (addr string, supported bool)
	Shutdown()
}

func NewCometBftApp

func NewCometBftApp(cometNode *cmtnode.Node, rpcPort int) CometBftApp

type QueryClients

type QueryClients struct {
	GrpcConnection        grpc1.ClientConn
	ClientQueryCtx        client.Context
	CometBFTRpcHttpClient *httpclient.HTTP
	Auth                  authtypes.QueryClient
	Bank                  banktypes.QueryClient
	Distribution          disttypes.QueryClient
	EVM                   evmtypes.QueryClient
	CPC                   cpctypes.QueryClient
	GovV1                 govtypesv1.QueryClient
	GovLegacy             govtypeslegacy.QueryClient
	IbcTransfer           ibctransfertypes.QueryClient
	Slashing              slashingtypes.QueryClient
	Staking               stakingtypes.QueryClient
	ServiceClient         sdktxtypes.ServiceClient
	Rpc                   *rpctypes.QueryClient
}

type ResponseDeliverEthTx

type ResponseDeliverEthTx struct {
	CosmosTxHash         string
	EthTxHash            string
	EvmError             string
	ResponseDeliverEthTx *abci.ExecTxResult
}

func NewResponseDeliverEthTx

func NewResponseDeliverEthTx(responseDeliverTx *abci.ExecTxResult) *ResponseDeliverEthTx

type TemporaryHolder

type TemporaryHolder struct {
	// contains filtered or unexported fields
}

func NewTemporaryHolder

func NewTemporaryHolder() *TemporaryHolder

func (*TemporaryHolder) AddTempFile

func (h *TemporaryHolder) AddTempFile(file string)

func (*TemporaryHolder) CacheGenesisDoc

func (h *TemporaryHolder) CacheGenesisDoc(doc *cmttypes.GenesisDoc)

func (*TemporaryHolder) GetCachedGenesisDoc

func (h *TemporaryHolder) GetCachedGenesisDoc() (*cmttypes.GenesisDoc, bool)

func (*TemporaryHolder) GetTempFiles

func (h *TemporaryHolder) GetTempFiles() ([]string, bool)

type TestAccount

type TestAccount struct {
	PrivateKey *ethsecp256k1.PrivKey
	Signer     keyring.Signer
	Type       TestAccountType
}

func (TestAccount) ComputeContractAddress

func (a TestAccount) ComputeContractAddress(nonce uint64) common.Address

func (TestAccount) GetConsensusAddress

func (a TestAccount) GetConsensusAddress() sdk.ConsAddress

func (TestAccount) GetCosmosAddress

func (a TestAccount) GetCosmosAddress() sdk.AccAddress

func (TestAccount) GetEthAddress

func (a TestAccount) GetEthAddress() common.Address

func (TestAccount) GetEthAddressP

func (a TestAccount) GetEthAddressP() *common.Address

func (TestAccount) GetPubKey

func (a TestAccount) GetPubKey() cryptotypes.PubKey

func (TestAccount) GetSdkPubKey

func (a TestAccount) GetSdkPubKey() cryptotypes.PubKey

func (TestAccount) GetTmPrivKey

func (a TestAccount) GetTmPrivKey() tmcrypto.PrivKey

func (TestAccount) GetTmPubKey

func (a TestAccount) GetTmPubKey() tmcrypto.PubKey

func (TestAccount) GetValidatorAddress

func (a TestAccount) GetValidatorAddress() sdk.ValAddress

GetValidatorAddress returns validator address of the account, deliver from sdk pubkey. Should use suite.GetValidatorAddress() instead for correcting with CometBFT node mode.

type TestAccountType

type TestAccountType int8
const (
	TestAccountTypeValidator TestAccountType = iota
	TestAccountTypeWallet
)

type TestAccounts

type TestAccounts []*TestAccount

func (TestAccounts) Number

func (a TestAccounts) Number(num int) *TestAccount

type TestConfig

type TestConfig struct {
	SecondaryDenomUnits []banktypes.DenomUnit
	InitBalanceAmount   sdkmath.Int
	DefaultFeeAmount    sdkmath.Int
	DisableCometBFT     bool
}

type TxBuilder

type TxBuilder struct {
	// contains filtered or unexported fields
}

func NewTxBuilder

func NewTxBuilder(encodingConfig params.EncodingConfig, r func() *require.Assertions) *TxBuilder

func (*TxBuilder) AutoFee

func (tb *TxBuilder) AutoFee() *TxBuilder

func (*TxBuilder) AutoGasLimit

func (tb *TxBuilder) AutoGasLimit() *TxBuilder

func (*TxBuilder) BigFeeAmount

func (tb *TxBuilder) BigFeeAmount(amountDisplay int64) *TxBuilder

func (*TxBuilder) BigGasLimit

func (tb *TxBuilder) BigGasLimit() *TxBuilder

func (*TxBuilder) ClientTxBuilder

func (tb *TxBuilder) ClientTxBuilder() client.TxBuilder

func (*TxBuilder) SetBankSendMsg

func (tb *TxBuilder) SetBankSendMsg(from, to *TestAccount, amount int64) *TxBuilder

func (*TxBuilder) SetExtensionOptions

func (tb *TxBuilder) SetExtensionOptions(extOpts ...proto.Message) *TxBuilder

func (*TxBuilder) SetFeeAmount

func (tb *TxBuilder) SetFeeAmount(fee sdk.Coins) *TxBuilder

func (*TxBuilder) SetFeeGranter

func (tb *TxBuilder) SetFeeGranter(feeGranter sdk.AccAddress) *TxBuilder

func (*TxBuilder) SetGasLimit

func (tb *TxBuilder) SetGasLimit(gasLimit uint64) *TxBuilder

func (*TxBuilder) SetMemo

func (tb *TxBuilder) SetMemo(memo string) *TxBuilder

func (*TxBuilder) SetMsgs

func (tb *TxBuilder) SetMsgs(msgs ...sdk.Msg) *TxBuilder

func (*TxBuilder) SetMultiBankSendMsg

func (tb *TxBuilder) SetMultiBankSendMsg(from, to *TestAccount, amount int64, count int) *TxBuilder

func (*TxBuilder) SetSignatures

func (tb *TxBuilder) SetSignatures(signatures ...signingtypes.SignatureV2) *TxBuilder

func (*TxBuilder) SetTimeoutHeight

func (tb *TxBuilder) SetTimeoutHeight(height uint64) *TxBuilder

func (*TxBuilder) Tx

func (tb *TxBuilder) Tx() sdk.Tx

func (*TxBuilder) WithExtOptDynamicFeeTx

func (tb *TxBuilder) WithExtOptDynamicFeeTx() *TxBuilder

func (*TxBuilder) WithExtOptEthTx

func (tb *TxBuilder) WithExtOptEthTx() *TxBuilder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL