cmd

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGenesisAccountCmd

func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command

AddGenesisAccountCmd returns add-genesis-account cobra Command.

func InterceptConfigsPreRunHandler

func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate string, customAppConfig interface{}) error

InterceptConfigsPreRunHandler performs a pre-run function for the root daemon application command. It will create a Viper literal and a default server Context. The server Tendermint configuration will either be read and parsed or created and saved to disk, where the server Context is updated to reflect the Tendermint configuration. It takes custom app config template and config settings to create a custom Tendermint configuration. If the custom template is empty, it uses default-template provided by the server. The Viper literal is used to read and parse the application configuration. Command handlers can fetch the server Context to get the Tendermint configuration or to get access to Viper.

func SetPrefixes

func SetPrefixes(accountAddressPrefix string)

Types

type App

type App interface {
	servertypes.Application
	ExportableApp
}

App represents a Cosmos SDK application that can be run as a server and with an exportable state

type AppBuilder

type AppBuilder func(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	encodingConfig EncodingConfig,
	appOpts servertypes.AppOptions,
	baseAppOptions ...func(*baseapp.BaseApp),
) App

AppBuilder is a method that allows to build an app

type CosmosApp

type CosmosApp interface {
	// Name is the assigned name of the app.
	Name() string

	// The application types codec.
	// NOTE: This should be sealed before being returned.
	LegacyAmino() *codec.LegacyAmino

	// BeginBlocker updates every begin block.
	BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

	// EndBlocker updates every end block.
	EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

	// InitChainer updates at chain (i.e app) initialization.
	InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

	// LoadHeight loads the app at a given height.
	LoadHeight(height int64) error

	// ExportAppStateAndValidators exports the state of the application for a genesis file.
	ExportAppStateAndValidators(
		forZeroHeight bool, jailAllowedAddrs []string,
	) (types.ExportedApp, error)

	// ModuleAccountAddrs are registered module account addreses.
	ModuleAccountAddrs() map[string]bool
}

CosmosApp implements the common methods for a Cosmos SDK-based application specific blockchain.

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func MakeEncodingConfig

func MakeEncodingConfig(moduleBasics module.BasicManager) EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

func NewRootCmd

func NewRootCmd(
	appName,
	accountAddressPrefix,
	defaultNodeHome,
	defaultChainID string,
	moduleBasics module.BasicManager,
	buildApp AppBuilder,
	options ...Option,
) (*cobra.Command, EncodingConfig)

NewRootCmd creates a new root command for a Cosmos SDK application

type ExportableApp

type ExportableApp interface {
	ExportAppStateAndValidators(
		forZeroHeight bool,
		jailAllowedAddrs []string,
	) (servertypes.ExportedApp, error)
	LoadHeight(height int64) error
}

ExportableApp represents an app with an exportable state

type Option

type Option func(*rootOptions)

Option configures root command option.

func AddSubCmd

func AddSubCmd(cmd ...*cobra.Command) Option

AddSubCmd adds sub commands.

func CustomizeStartCmd

func CustomizeStartCmd(h func(startCmd *cobra.Command)) Option

CustomizeStartCmd accepts a handler to customize the start command.

func WithEnvPrefix

func WithEnvPrefix(envPrefix string) Option

WithEnvPrefix accepts a new prefix for environment variables.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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