chain

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFaucetIsNotEnabled is returned when faucet is not enabled in the config.yml.
	ErrFaucetIsNotEnabled = errors.New("faucet is not enabled in the config.yml")

	// ErrFaucetAccountDoesNotExist returned when specified faucet account in the config.yml does not exist.
	ErrFaucetAccountDoesNotExist = errors.New("specified account (faucet.name) does not exist")
)

Functions

This section is empty.

Types

type Account added in v0.13.0

type Account struct {
	Name     string
	Address  string
	Mnemonic string `json:"mnemonic"`
	CoinType string
	Coins    string
}

Account represents an account in the chain.

type App

type App struct {
	Name       string
	Path       string
	ImportPath string
}

App keeps info about chain.

func NewAppAt added in v0.13.2

func NewAppAt(path string) (App, error)

NewAppAt creates an App from the blockchain source code located at path.

func (App) D added in v0.13.0

func (a App) D() string

D returns appd name.

func (App) N added in v0.13.0

func (a App) N() string

N returns app name without dashes.

func (App) ND added in v0.13.0

func (a App) ND() string

ND returns no-dash appd name.

func (App) Root added in v0.13.0

func (a App) Root() string

Root returns the root path of app.

type CannotBuildAppError

type CannotBuildAppError struct {
	Err error
}

func (*CannotBuildAppError) Error

func (e *CannotBuildAppError) Error() string

func (*CannotBuildAppError) Unwrap

func (e *CannotBuildAppError) Unwrap() error

type CannotStartAppError added in v0.14.0

type CannotStartAppError struct {
	AppName string
	Err     error
}

func (*CannotStartAppError) Error added in v0.14.0

func (e *CannotStartAppError) Error() string

func (*CannotStartAppError) ParseStartError added in v0.14.0

func (e *CannotStartAppError) ParseStartError() string

ParseStartError parses the error into a clear error string The error logs from Cosmos SDK application are too extensive to be directly printed If the error is not recognized, returns an empty string

func (*CannotStartAppError) Unwrap added in v0.14.0

func (e *CannotStartAppError) Unwrap() error

type Chain

type Chain struct {
	Version cosmosver.Version
	// contains filtered or unexported fields
}

Chain provides programatic access and tools for a Cosmos SDK blockchain.

func New

func New(path string, options ...Option) (*Chain, error)

New initializes a new Chain with options that its source lives at path.

func (*Chain) AppTOMLPath added in v0.13.0

func (c *Chain) AppTOMLPath() (string, error)

AppTOMLPath returns app.toml path of the app.

func (*Chain) Binary added in v0.14.0

func (c *Chain) Binary() (string, error)

Binary returns the name of app's default (appd) binary.

func (*Chain) Build

func (c *Chain) Build(ctx context.Context, output string) (binaryName string, err error)

Build builds and installs app binaries.

func (*Chain) BuildRelease added in v0.17.0

func (c *Chain) BuildRelease(ctx context.Context, output, prefix string, targets ...string) (releasePath string, err error)

BuildRelease builds binaries for a release. targets is a list of GOOS:GOARCH when provided. It defaults to your system when no targets provided. prefix is used as prefix to tarballs containing each target.

func (*Chain) ClientTOMLPath added in v0.17.2

func (c *Chain) ClientTOMLPath() (string, error)

ClientTOMLPath returns client.toml path of the app.

func (*Chain) Commands added in v0.13.2

func (c *Chain) Commands(ctx context.Context) (chaincmdrunner.Runner, error)

Commands returns the runner execute commands on the chain's binary

func (*Chain) Config added in v0.13.0

func (c *Chain) Config() (chainconfig.Config, error)

Config returns the config of the chain

func (*Chain) ConfigPath added in v0.15.0

func (c *Chain) ConfigPath() string

ConfigPath returns the config path of the chain Empty string means that the chain has no defined config

func (*Chain) ConfigTOMLPath added in v0.13.0

func (c *Chain) ConfigTOMLPath() (string, error)

ConfigTOMLPath returns config.toml path of the app.

func (*Chain) DefaultGentxPath added in v0.19.0

func (c *Chain) DefaultGentxPath() (string, error)

DefaultGentxPath returns default gentx.json path of the app.

func (*Chain) DefaultHome added in v0.13.0

func (c *Chain) DefaultHome() (string, error)

DefaultHome returns the blockchain node's default home dir when not specified in the app

func (*Chain) Faucet added in v0.14.0

func (c *Chain) Faucet(ctx context.Context) (cosmosfaucet.Faucet, error)

Faucet returns the faucet for the chain or an error if the faucet configuration is wrong or not configured (not enabled) at all.

func (*Chain) Generate added in v0.17.0

func (c *Chain) Generate(
	ctx context.Context,
	target GenerateTarget,
	additionalTargets ...GenerateTarget,
) error

Generate makes code generation from proto files for given target and additionalTargets.

func (*Chain) GenesisPath added in v0.13.0

func (c *Chain) GenesisPath() (string, error)

GenesisPath returns genesis.json path of the app.

func (*Chain) GentxsPath added in v0.19.0

func (c *Chain) GentxsPath() (string, error)

GentxsPath returns the directory where gentxs are stored for the app.

func (*Chain) Home added in v0.13.0

func (c *Chain) Home() (string, error)

Home returns the blockchain node's home dir.

func (*Chain) ID added in v0.13.0

func (c *Chain) ID() (string, error)

ID returns the chain's id.

func (*Chain) Init added in v0.13.0

func (c *Chain) Init(ctx context.Context, initAccounts bool) error

Init initializes the chain and applies all optional configurations.

func (*Chain) InitAccounts added in v0.14.0

func (c *Chain) InitAccounts(ctx context.Context, conf chainconfig.Config) error

InitAccounts initializes the chain accounts and creates validator gentxs

func (*Chain) InitChain added in v0.17.0

func (c *Chain) InitChain(ctx context.Context) error

InitChain initializes the chain.

func (*Chain) IsInitialized added in v0.14.0

func (c *Chain) IsInitialized() (bool, error)

IsInitialized checks if the chain is initialized the check is performed by checking if the gentx dir exist in the config

func (Chain) IssueGentx added in v0.19.0

func (c Chain) IssueGentx(ctx context.Context, v Validator) (string, error)

IssueGentx generates a gentx from the validator information in chain config and import it in the chain genesis

func (*Chain) KeyringBackend added in v0.17.2

func (c *Chain) KeyringBackend() (chaincmd.KeyringBackend, error)

KeyringBackend returns the keyring backend chosen for the chain.

func (*Chain) Name added in v0.19.0

func (c *Chain) Name() string

func (*Chain) RPCPublicAddress added in v0.13.0

func (c *Chain) RPCPublicAddress() (string, error)

RPCPublicAddress points to the public address of Tendermint RPC, this is shared by other chains for relayer related actions.

func (*Chain) Serve

func (c *Chain) Serve(ctx context.Context, options ...ServeOption) error

Serve serves an app.

func (*Chain) SetHome added in v0.19.0

func (c *Chain) SetHome(home string)

SetHome sets the chain home directory.

func (*Chain) Simulate added in v0.19.0

func (c *Chain) Simulate(ctx context.Context, options ...SimappOption) error

type GenerateTarget added in v0.17.0

type GenerateTarget func(*generateOptions)

GenerateTarget is a target to generate code for from proto files.

func GenerateDart added in v0.18.0

func GenerateDart() GenerateTarget

GenerateDart enables generating Dart client.

func GenerateGo added in v0.17.0

func GenerateGo() GenerateTarget

GenerateGo enables generating proto based Go code needed for the chain's source code.

func GenerateOpenAPI added in v0.17.0

func GenerateOpenAPI() GenerateTarget

GenerateOpenAPI enables generating OpenAPI spec for your chain.

func GenerateVuex added in v0.17.0

func GenerateVuex() GenerateTarget

GenerateVuex enables generating proto based Vuex store.

type LogLvl added in v0.13.2

type LogLvl int
const (
	LogSilent LogLvl = iota
	LogRegular
	LogVerbose
)

type Option added in v0.13.2

type Option func(*Chain)

Option configures Chain.

func ConfigFile added in v0.15.0

func ConfigFile(configFile string) Option

ConfigFile specifies a custom config file to use

func EnableThirdPartyModuleCodegen added in v0.15.0

func EnableThirdPartyModuleCodegen() Option

EnableThirdPartyModuleCodegen enables code generation for third party modules, including the SDK.

func HomePath added in v0.13.2

func HomePath(path string) Option

HomePath replaces chain's configuration home path with given path.

func ID added in v0.13.2

func ID(id string) Option

ID replaces chain's id with given id.

func KeyringBackend added in v0.14.0

func KeyringBackend(keyringBackend chaincmd.KeyringBackend) Option

KeyringBackend specifies the keyring backend to use for the chain command

func LogLevel added in v0.13.0

func LogLevel(level LogLvl) Option

LogLevel sets logging level.

type Plugin

type Plugin interface {
	// Name of a Cosmos version.
	Name() string

	// Gentx returns step.Exec configuration for gentx command.
	Gentx(context.Context, chaincmdrunner.Runner, Validator) (path string, err error)

	// Configure configures config defaults.
	Configure(string, chainconfig.Config) error

	// Start returns step.Exec configuration to start servers.
	Start(context.Context, chaincmdrunner.Runner, chainconfig.Config) error

	// Home returns the blockchain node's home dir.
	Home() string
}

type ServeOption added in v0.14.0

type ServeOption func(*serveOptions)

ServeOption provides options for the serve command

func ServeForceReset added in v0.14.0

func ServeForceReset() ServeOption

ServeForceReset allows to force reset of the state when the chain is served and on every source change

func ServeResetOnce added in v0.14.0

func ServeResetOnce() ServeOption

ServeResetOnce allows to reset of the state when the chain is served once

type SimappOption added in v0.19.0

type SimappOption func(*simappOptions)

SimappOption provides options for the simapp command

func SimappWithConfig added in v0.19.0

func SimappWithConfig(config simulation.Config) SimappOption

SimappWithConfig allows to add a simulation config

func SimappWithGenesisTime added in v0.19.0

func SimappWithGenesisTime(genesisTime int64) SimappOption

SimappWithGenesisTime allows overriding genesis UNIX time instead of using a random UNIX time

func SimappWithPeriod added in v0.19.0

func SimappWithPeriod(period uint) SimappOption

SimappWithPeriod allows running slow invariants only once every period assertions

func SimappWithVerbose added in v0.19.0

func SimappWithVerbose(verbose bool) SimappOption

SimappWithVerbose enable the verbose mode

type Validator added in v0.13.0

type Validator struct {
	Name                    string
	Moniker                 string
	StakingAmount           string
	CommissionRate          string
	CommissionMaxRate       string
	CommissionMaxChangeRate string
	MinSelfDelegation       string
	GasPrices               string
	Details                 string
	Identity                string
	Website                 string
	SecurityContact         string
}

Jump to

Keyboard shortcuts

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