Documentation ¶
Index ¶
- Constants
- Variables
- func AddTestAddrs(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func AddTestAddrsFromPubKeys(app *NewApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
- func AddTestAddrsIncremental(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
- func CheckBalance(t *testing.T, app *NewApp, addr sdk.AccAddress, balances sdk.Coins)
- func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
- func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
- func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, ...) error
- func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, ...) error
- func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, ...) ([]sdk.Tx, error)
- func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, ...) (sdk.Tx, error)
- func GetMaccPerms() map[string][]string
- func MakeTestEncodingConfig() simappparams.EncodingConfig
- func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
- func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts
- func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router)
- func SignCheckDeliver(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, ...) (sdk.GasInfo, *sdk.Result, error)
- func SignCheckDeliverWithFee(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, ...) (sdk.GasInfo, *sdk.Result, error)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- type EVMKeeperApp
- type EmptyAppOptions
- type GenerateAccountStrategy
- type NewApp
- func NewInitApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, ...) *NewApp
- func Setup(isCheckTx bool, chainId string) *NewApp
- func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, chainId string, ...) *NewApp
- func SetupWithGenesisNodeSet(t *testing.T, freshStart bool, valSet *tmtypes.ValidatorSet, ...) *NewApp
- func (app *NewApp) AppCodec() codec.Codec
- func (app *NewApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *NewApp) BlockedAddrs() map[string]bool
- func (app *NewApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *NewApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string) (servertypes.ExportedApp, error)
- func (app *NewApp) GetAccountKeeper() authkeeper.AccountKeeper
- func (app *NewApp) GetBankKeeper() bankkeeper.Keeper
- func (app *NewApp) GetDistrKeeper() distrkeeper.Keeper
- func (app *NewApp) GetEVMKeeper() *evmkeeper.Keeper
- func (app *NewApp) GetPotKeeper() potkeeper.Keeper
- func (app *NewApp) GetRegisterKeeper() registerkeeper.Keeper
- func (app *NewApp) GetStakingKeeper() stakingkeeper.Keeper
- func (app *NewApp) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *NewApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *NewApp) LegacyAmino() *codec.LegacyAmino
- func (app *NewApp) LoadHeight(height int64) error
- func (app *NewApp) ModuleAccountAddrs() map[string]bool
- func (app *NewApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *NewApp) RegisterTendermintService(clientCtx client.Context)
- func (app *NewApp) RegisterTxService(clientCtx client.Context)
- func (app *NewApp) SimulationManager() *module.SimulationManager
Constants ¶
const (
DefaultGenTxGas = 50000000000
)
Variables ¶
var ( DefaultNodeHome = os.ExpandEnv("$HOME/.stchaind") ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, authzmodule.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, register.AppModuleBasic{}, pot.AppModuleBasic{}, sds.AppModuleBasic{}, evm.AppModuleBasic{}, ) )
var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, MaxGas: -1, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, MaxBytes: 10000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ tmtypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in SimApp testing.
Functions ¶
func AddTestAddrs ¶ added in v0.8.0
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AddTestAddrsFromPubKeys ¶ added in v0.8.0
func AddTestAddrsFromPubKeys(app *NewApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int)
AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.
func AddTestAddrsIncremental ¶ added in v0.8.0
func AddTestAddrsIncremental(app *NewApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func CheckBalance ¶ added in v0.8.0
CheckBalance checks the balance of an account.
func ConvertAddrsToValAddrs ¶ added in v0.8.0
func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress
ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
func CreateTestPubKeys ¶ added in v0.8.0
func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
func FundAccount ¶ added in v0.8.0
func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error
FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!
TODO: Instead of using the mint module account, which has the permission of minting, create a "faucet" account. (@fdymylja)
func FundModuleAccount ¶ added in v0.8.0
func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error
FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address. This should be used for testing purposes only!
TODO: Instead of using the mint module account, which has the permission of minting, create a "faucet" account. (@fdymylja)
func GenSequenceOfTxs ¶ added in v0.8.0
func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...cryptotypes.PrivKey) ([]sdk.Tx, error)
GenSequenceOfTxs generates a set of signed transactions of messages, such that they differ only by having the sequence numbers incremented between every transaction.
func GenTx ¶ added in v0.8.0
func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)
GenTx generates a signed mock transaction.
func GetMaccPerms ¶
func MakeTestEncodingConfig ¶ added in v0.8.0
func MakeTestEncodingConfig() simappparams.EncodingConfig
MakeTestEncodingConfig creates an EncodingConfig for testing. This function should be used only in tests or when creating a new app instance (NewApp*()). App user shouldn't create new codecs - use the app.AppCodec instead. [DEPRECATED]
func NewPubKeyFromHex ¶ added in v0.8.0
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)
NewPubKeyFromHex returns a PubKey from a hex string.
func RandomGenesisAccounts ¶ added in v0.8.0
func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAccounts
RandomGenesisAccounts is used by the auth module to create random genesis accounts in simulation when a genesis.json is not specified. In contrast, the default auth module's RandomGenesisAccounts implementation creates only base accounts and vestings accounts.
func RegisterSwaggerAPI ¶ added in v0.8.0
RegisterSwaggerAPI registers swagger route with API Server
func SignCheckDeliver ¶ added in v0.8.0
func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error)
SignCheckDeliver checks a generated signed transaction and simulates a block commitment with the given transaction. A test assertion is made using the parameter 'expPass' against the result. A corresponding result is returned.
func SignCheckDeliverWithFee ¶ added in v0.10.0
Types ¶
type EVMKeeperApp ¶ added in v0.10.0
type EmptyAppOptions ¶ added in v0.8.0
type EmptyAppOptions struct{}
EmptyAppOptions is a stub implementing AppOptions
func (EmptyAppOptions) Get ¶ added in v0.8.0
func (ao EmptyAppOptions) Get(o string) interface{}
Get implements AppOptions
type GenerateAccountStrategy ¶ added in v0.8.0
type GenerateAccountStrategy func(int) []sdk.AccAddress
type NewApp ¶
type NewApp struct { *baseapp.BaseApp // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper // contains filtered or unexported fields }
func NewInitApp ¶
func SetupWithGenesisAccounts ¶ added in v0.8.0
func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, chainId string, balances ...banktypes.Balance) *NewApp
SetupWithGenesisAccounts initializes a new SimApp with the provided genesis accounts and possible balances.
func SetupWithGenesisNodeSet ¶ added in v0.8.0
func SetupWithGenesisNodeSet(t *testing.T, freshStart bool, valSet *tmtypes.ValidatorSet, metaNodes []registertypes.MetaNode, resourceNodes []registertypes.ResourceNode, genAccs []authtypes.GenesisAccount, chainId string, balances ...banktypes.Balance) *NewApp
SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit (10^6) in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.
func (*NewApp) BeginBlocker ¶
func (app *NewApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
func (*NewApp) BlockedAddrs ¶ added in v0.8.0
BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.
func (*NewApp) EndBlocker ¶
func (app *NewApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
func (*NewApp) ExportAppStateAndValidators ¶
func (app *NewApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*NewApp) GetAccountKeeper ¶ added in v0.8.0
func (app *NewApp) GetAccountKeeper() authkeeper.AccountKeeper
func (*NewApp) GetBankKeeper ¶ added in v0.8.0
func (app *NewApp) GetBankKeeper() bankkeeper.Keeper
func (*NewApp) GetDistrKeeper ¶ added in v0.10.0
func (app *NewApp) GetDistrKeeper() distrkeeper.Keeper
func (*NewApp) GetEVMKeeper ¶ added in v0.10.0
func (*NewApp) GetPotKeeper ¶ added in v0.8.0
func (*NewApp) GetRegisterKeeper ¶ added in v0.8.0
func (app *NewApp) GetRegisterKeeper() registerkeeper.Keeper
func (*NewApp) GetStakingKeeper ¶ added in v0.8.0
func (app *NewApp) GetStakingKeeper() stakingkeeper.Keeper
func (*NewApp) GetSubspace ¶ added in v0.8.0
func (app *NewApp) GetSubspace(moduleName string) paramstypes.Subspace
GetSubspace returns a param subspace for a given module name.
NOTE: This is solely to be used for testing purposes.
func (*NewApp) InitChainer ¶
func (app *NewApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
func (*NewApp) LegacyAmino ¶ added in v0.8.0
func (app *NewApp) LegacyAmino() *codec.LegacyAmino
func (*NewApp) LoadHeight ¶
func (*NewApp) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*NewApp) RegisterAPIRoutes ¶ added in v0.8.0
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*NewApp) RegisterTendermintService ¶ added in v0.8.0
func (*NewApp) RegisterTxService ¶ added in v0.8.0
func (*NewApp) SimulationManager ¶
func (app *NewApp) SimulationManager() *module.SimulationManager