Documentation ¶
Overview ¶
Package chaincmdrunner provides a high level access to a blockchain's commands.
Index ¶
- Variables
- type Account
- type Event
- type EventAttribute
- type EventSelector
- type KV
- type NodeStatus
- type Option
- type Runner
- func (r Runner) AddAccount(ctx context.Context, name, mnemonic, coinType string) (Account, error)
- func (r Runner) AddGenesisAccount(ctx context.Context, address, coins string) error
- func (r Runner) AddVestingAccount(ctx context.Context, address, originalCoins, vestingCoins string, ...) error
- func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount, amount string) (string, error)
- func (r Runner) CheckAccountExist(ctx context.Context, name string) error
- func (r Runner) Cmd() chaincmd.ChainCmd
- func (r Runner) CollectGentxs(ctx context.Context) error
- func (r Runner) Copy(options ...Option) Runner
- func (r Runner) Export(ctx context.Context, exportedFile string) error
- func (r Runner) Gentx(ctx context.Context, validatorName, selfDelegation string, ...) (gentxPath string, err error)
- func (r Runner) ImportAccount(ctx context.Context, name, keyFile, passphrase string) (Account, error)
- func (r Runner) Init(ctx context.Context, moniker string) error
- func (r Runner) LaunchpadSetConfigs(ctx context.Context, kvs ...KV) error
- func (r Runner) LaunchpadStartRestServer(ctx context.Context, apiAddress, rpcAddress string) error
- func (r Runner) QueryTxEvents(ctx context.Context, selector EventSelector, moreSelectors ...EventSelector) ([]Event, error)
- func (r Runner) ShowAccount(ctx context.Context, name string) (Account, error)
- func (r Runner) ShowNodeID(ctx context.Context) (nodeID string, err error)
- func (r Runner) Simulation(ctx context.Context, appPath string, enabled bool, verbose bool, ...) error
- func (r Runner) Start(ctx context.Context, args ...string) error
- func (r Runner) Status(ctx context.Context) (NodeStatus, error)
- func (r Runner) UnsafeReset(ctx context.Context) error
- func (r Runner) ValidateGenesis(ctx context.Context) error
- func (r Runner) WaitTx(ctx context.Context, txHash string, retryDelay time.Duration, maxRetry int) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAccountAlreadyExists returned when an already exists account attempted to be imported. ErrAccountAlreadyExists = errors.New("account already exists") // ErrAccountDoesNotExist returned when account does not exit. ErrAccountDoesNotExist = errors.New("account does not exit") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Name string `json:"name"` Address string `json:"address"` Mnemonic string `json:"mnemonic,omitempty"` }
Account represents a user account.
type Event ¶ added in v0.14.0
type Event struct { Type string Attributes []EventAttribute Time time.Time }
Event represents a TX event.
type EventAttribute ¶ added in v0.14.0
EventAttribute holds event's attributes.
type EventSelector ¶ added in v0.14.0
type EventSelector struct {
// contains filtered or unexported fields
}
EventSelector is used to query events.
func NewEventSelector ¶ added in v0.14.0
func NewEventSelector(typ, addr, value string) EventSelector
NewEventSelector creates a new event selector.
type NodeStatus ¶ added in v0.14.0
type NodeStatus struct {
ChainID string
}
NodeStatus keeps info about node's status.
type Option ¶
type Option func(r *Runner)
Option configures Runner.
func CLILogPrefix ¶
CLILogPrefix is a prefix added to app's cli logs.
func DaemonLogPrefix ¶
DaemonLogPrefix is a prefix added to app's daemon logs.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner provides a high level access to a blockchain's commands.
func (Runner) AddAccount ¶
AddAccount creates a new account or imports an account when mnemonic is provided. returns with an error if the operation went unsuccessful or an account with the provided name already exists.
func (Runner) AddGenesisAccount ¶
AddGenesisAccount adds account to genesis by its address.
func (Runner) AddVestingAccount ¶ added in v0.19.0
func (r Runner) AddVestingAccount( ctx context.Context, address, originalCoins, vestingCoins string, vestingEndTime int64, ) error
AddVestingAccount adds vesting account to genesis by its address.
func (Runner) BankSend ¶ added in v0.14.0
func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount, amount string) (string, error)
BankSend sends amount from fromAccount to toAccount.
func (Runner) CheckAccountExist ¶ added in v0.19.0
CheckAccountExist returns an error if the account already exists in the chain keyring
func (Runner) CollectGentxs ¶
CollectGentxs collects gentxs.
func (Runner) Export ¶ added in v0.14.0
Export exports the state of the chain into the specified file
func (Runner) Gentx ¶
func (r Runner) Gentx( ctx context.Context, validatorName, selfDelegation string, options ...chaincmd.GentxOption, ) (gentxPath string, err error)
Gentx generates a genesis tx carrying a self delegation.
func (Runner) ImportAccount ¶ added in v0.19.0
func (r Runner) ImportAccount(ctx context.Context, name, keyFile, passphrase string) (Account, error)
ImportAccount import an account from a key file
func (Runner) LaunchpadSetConfigs ¶
LaunchpadSetConfigs updates configurations for a launchpad app.
func (Runner) LaunchpadStartRestServer ¶
LaunchpadStartRestServer start launchpad rest server.
func (Runner) QueryTxEvents ¶ added in v0.14.0
func (r Runner) QueryTxEvents( ctx context.Context, selector EventSelector, moreSelectors ...EventSelector, ) ([]Event, error)
QueryTxEvents queries tx events by event selectors.
func (Runner) ShowAccount ¶
ShowAccount shows details of an account.
func (Runner) ShowNodeID ¶
ShowNodeID shows node id.
func (Runner) Simulation ¶ added in v0.19.0
func (r Runner) Simulation( ctx context.Context, appPath string, enabled bool, verbose bool, config simulation.Config, period uint, genesisTime int64, ) error
Simulation run the chain simulation.
func (Runner) Status ¶ added in v0.14.0
func (r Runner) Status(ctx context.Context) (NodeStatus, error)
Status returns the node's status.
func (Runner) UnsafeReset ¶ added in v0.14.0
UnsafeReset resets the blockchain database.
func (Runner) ValidateGenesis ¶
ValidateGenesis validates genesis.