Documentation ¶
Index ¶
- Constants
- Variables
- func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress
- func AllCapabilities() []string
- func BlockedAddresses() map[string]bool
- func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawMessage, ...) (map[string]json.RawMessage, error)
- func GetMaccPerms() map[string][]string
- func MakeEncodingConfig() params.EncodingConfig
- func ModuleAccountAddrs() map[string]bool
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewTestNetworkFixture() network.TestFixture
- func SignAndDeliverWithoutCommit(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, ...) (sdk.GasInfo, *sdk.Result, error)
- type GenesisState
- type HandlerOptions
- type SetupOptions
- type WasmApp
- func NewWasmApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, ...) *WasmApp
- func NewWasmAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *WasmApp
- func Setup(t *testing.T, opts ...wasmkeeper.Option) *WasmApp
- func SetupWithEmptyStore(tb testing.TB) *WasmApp
- func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *WasmApp
- func (app *WasmApp) AppCodec() codec.Codec
- func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *WasmApp) Configurator() module.Configurator
- func (app *WasmApp) DefaultGenesis() map[string]json.RawMessage
- func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *WasmApp) GetAccountKeeper() authkeeper.AccountKeeper
- func (app *WasmApp) GetBankKeeper() bankkeeper.Keeper
- func (app *WasmApp) GetBaseApp() *baseapp.BaseApp
- func (app *WasmApp) GetIBCKeeper() *ibckeeper.Keeper
- func (app *WasmApp) GetKey(storeKey string) *storetypes.KVStoreKey
- func (app *WasmApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
- func (app *WasmApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
- func (app *WasmApp) GetStakingKeeper() *stakingkeeper.Keeper
- func (app *WasmApp) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *WasmApp) GetTKey(storeKey string) *storetypes.TransientStoreKey
- func (app *WasmApp) GetWasmKeeper() wasmkeeper.Keeper
- func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *WasmApp) InterfaceRegistry() types.InterfaceRegistry
- func (app *WasmApp) LegacyAmino() *codec.LegacyAmino
- func (app *WasmApp) LoadHeight(height int64) error
- func (app *WasmApp) Name() string
- func (app *WasmApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *WasmApp) RegisterNodeService(clientCtx client.Context)
- func (app *WasmApp) RegisterTendermintService(clientCtx client.Context)
- func (app *WasmApp) RegisterTxService(clientCtx client.Context)
- func (app WasmApp) RegisterUpgradeHandlers()
- func (app *WasmApp) SimulationManager() *module.SimulationManager
- func (app *WasmApp) TxConfig() client.TxConfig
Constants ¶
const UpgradeName = "v0.4x"
UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade from v046 to v047.
NOTE: This upgrade defines a reference implementation of what an upgrade could look like when an application is migrating from Cosmos SDK version v0.46.x to v0.47.x.
Variables ¶
var ( NodeDir = ".wasmd" Bech32Prefix = "wasm" )
We pull these out so we can set them with LDFLAGS in the Makefile
var ( // DefaultNodeHome default home directories for wasmd DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address Bech32PrefixAccAddr = Bech32Prefix // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic )
These constants are derived from the above variables. These are the ones we will want to use in the code, based on any overrides above
var ( // ModuleBasics defines the module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, groupmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, nftmodule.AppModuleBasic{}, consensus.AppModuleBasic{}, wasm.AppModuleBasic{}, ibc.AppModuleBasic{}, ibctm.AppModuleBasic{}, transfer.AppModuleBasic{}, ica.AppModuleBasic{}, ibcfee.AppModuleBasic{}, ) )
Functions ¶
func AddTestAddrsIncremental ¶ added in v0.16.0
func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress
AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AllCapabilities ¶ added in v0.32.0
func AllCapabilities() []string
AllCapabilities returns all capabilities available with the current wasmvm See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md This functionality is going to be moved upstream: https://github.com/CosmWasm/wasmvm/issues/425
func BlockedAddresses ¶ added in v0.40.0
BlockedAddresses returns all the app's blocked account addresses.
func GenesisStateWithValSet ¶ added in v0.40.0
func GenesisStateWithValSet( codec codec.Codec, genesisState map[string]json.RawMessage, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance, ) (map[string]json.RawMessage, error)
GenesisStateWithValSet returns a new genesis state with the validator set copied from simtestutil with delegation not added to supply
func GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
NOTE: This is solely to be used for testing purposes.
func MakeEncodingConfig ¶ added in v0.12.0
func MakeEncodingConfig() params.EncodingConfig
MakeEncodingConfig creates a new EncodingConfig with all modules registered
func ModuleAccountAddrs ¶ added in v0.40.0
ModuleAccountAddrs provides a list of blocked module accounts from configuration in AppConfig
Ported from WasmApp
func NewAnteHandler ¶ added in v0.20.0
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
func NewTestNetworkFixture ¶ added in v0.40.0
func NewTestNetworkFixture() network.TestFixture
NewTestNetworkFixture returns a new WasmApp AppConstructor for network simulation tests
func SignAndDeliverWithoutCommit ¶ added in v0.40.0
func SignAndDeliverWithoutCommit( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, fees sdk.Coins, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error)
SignAndDeliverWithoutCommit signs and delivers a transaction. No commit
Types ¶
type GenesisState ¶
type GenesisState map[string]json.RawMessage
GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.
func GenesisStateWithSingleValidator ¶ added in v0.40.0
func GenesisStateWithSingleValidator(t *testing.T, app *WasmApp) GenesisState
GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts that also act as delegators.
func NewDefaultGenesisState ¶
func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState
NewDefaultGenesisState generates the default state for the application.
type HandlerOptions ¶ added in v0.22.0
type HandlerOptions struct { ante.HandlerOptions IBCKeeper *keeper.Keeper WasmKeeper *wasmkeeper.Keeper WasmConfig *wasmTypes.WasmConfig TXCounterStoreKey storetypes.StoreKey }
HandlerOptions extend the SDK's AnteHandler options by requiring the IBC channel keeper.
type SetupOptions ¶ added in v0.40.0
type SetupOptions struct { Logger log.Logger DB *dbm.MemDB AppOpts servertypes.AppOptions WasmOpts []wasmkeeper.Option }
SetupOptions defines arguments that are passed into `WasmApp` constructor.
type WasmApp ¶
type WasmApp struct { *baseapp.BaseApp // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper AuthzKeeper authzkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly IBCFeeKeeper ibcfeekeeper.Keeper ICAControllerKeeper icacontrollerkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper TransferKeeper ibctransferkeeper.Keeper WasmKeeper wasmkeeper.Keeper ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper ScopedWasmKeeper capabilitykeeper.ScopedKeeper // the module manager ModuleManager *module.Manager // contains filtered or unexported fields }
WasmApp extended ABCI application
func NewWasmApp ¶
func NewWasmApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *WasmApp
NewWasmApp returns a reference to an initialized WasmApp.
func NewWasmAppWithCustomOptions ¶ added in v0.40.0
func NewWasmAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *WasmApp
NewWasmAppWithCustomOptions initializes a new WasmApp with custom options.
func Setup ¶ added in v0.16.0
func Setup(t *testing.T, opts ...wasmkeeper.Option) *WasmApp
Setup initializes a new WasmApp. A Nop logger is set in WasmApp.
func SetupWithEmptyStore ¶ added in v0.27.0
SetupWithEmptyStore set up a wasmd app instance with empty DB
func SetupWithGenesisValSet ¶ added in v0.16.0
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) *WasmApp
SetupWithGenesisValSet initializes a new WasmApp 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 in the default token of the WasmApp from first genesis account. A Nop logger is set in WasmApp.
func (*WasmApp) AppCodec ¶ added in v0.16.0
AppCodec returns app codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*WasmApp) BeginBlocker ¶
func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*WasmApp) Configurator ¶ added in v0.40.0
func (app *WasmApp) Configurator() module.Configurator
func (*WasmApp) DefaultGenesis ¶ added in v0.40.0
func (app *WasmApp) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
func (*WasmApp) EndBlocker ¶
func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*WasmApp) ExportAppStateAndValidators ¶
func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*WasmApp) GetAccountKeeper ¶ added in v0.40.0
func (app *WasmApp) GetAccountKeeper() authkeeper.AccountKeeper
func (*WasmApp) GetBankKeeper ¶ added in v0.40.0
func (app *WasmApp) GetBankKeeper() bankkeeper.Keeper
func (*WasmApp) GetBaseApp ¶ added in v0.40.0
func (*WasmApp) GetIBCKeeper ¶ added in v0.40.0
func (*WasmApp) GetKey ¶ added in v0.40.0
func (app *WasmApp) GetKey(storeKey string) *storetypes.KVStoreKey
GetKey returns the KVStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*WasmApp) GetMemKey ¶ added in v0.40.0
func (app *WasmApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*WasmApp) GetScopedIBCKeeper ¶ added in v0.40.0
func (app *WasmApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
func (*WasmApp) GetStakingKeeper ¶ added in v0.40.0
func (app *WasmApp) GetStakingKeeper() *stakingkeeper.Keeper
func (*WasmApp) GetSubspace ¶ added in v0.40.0
func (app *WasmApp) 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 (*WasmApp) GetTKey ¶ added in v0.40.0
func (app *WasmApp) GetTKey(storeKey string) *storetypes.TransientStoreKey
GetTKey returns the TransientStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*WasmApp) GetWasmKeeper ¶ added in v0.40.0
func (app *WasmApp) GetWasmKeeper() wasmkeeper.Keeper
func (*WasmApp) InitChainer ¶
func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer application update at chain initialization
func (*WasmApp) InterfaceRegistry ¶ added in v0.40.0
func (app *WasmApp) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns WasmApp's InterfaceRegistry
func (*WasmApp) LegacyAmino ¶ added in v0.12.0
func (app *WasmApp) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns legacy amino codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*WasmApp) LoadHeight ¶
LoadHeight loads a particular height
func (*WasmApp) RegisterAPIRoutes ¶ added in v0.12.0
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*WasmApp) RegisterNodeService ¶ added in v0.40.0
func (*WasmApp) RegisterTendermintService ¶ added in v0.14.0
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*WasmApp) RegisterTxService ¶ added in v0.12.0
RegisterTxService implements the Application.RegisterTxService method.
func (WasmApp) RegisterUpgradeHandlers ¶ added in v0.40.0
func (app WasmApp) RegisterUpgradeHandlers()
func (*WasmApp) SimulationManager ¶
func (app *WasmApp) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface