Documentation ¶
Overview ¶
Package commands contains any general setup/helpers valid for all subcommands
Index ¶
- Constants
- Variables
- func AddBasicFlags(cmd *cobra.Command)
- func GetChainID() string
- func GetNode() rpcclient.Client
- func GetProviders() (trusted lite.Provider, source lite.Provider)
- func GetSourceProvider() lite.Provider
- func GetTrustedProvider() lite.Provider
- func WasInited(root string) (bool, error)
- type Config
- type Runable
Constants ¶
const ( ChainFlag = "chain-id" NodeFlag = "node" CliHomeFlag = "cli-home" )
const ( CommitFlag = "commit" HashFlag = "valhash" GenesisFlag = "genesis" FlagTrustNode = "trust-node" ConfigFile = "config.toml" )
nolint
Variables ¶
var InitCmd = &cobra.Command{
Use: "init",
Short: "Initialize the light client for a new chain",
RunE: runInit,
}
InitCmd will initialize the basecli store
var ResetCmd = &cobra.Command{
Use: "reset_all",
Short: "DANGEROUS: Wipe out all client data, including keys",
RunE: runResetAll,
}
Functions ¶
func AddBasicFlags ¶
AddBasicFlags adds --node and --chain-id, which we need for everything
func GetProviders ¶
GetProviders creates a trusted (local) seed provider and a remote provider based on configuration.
func GetSourceProvider ¶
GetSourceProvider returns a provider pointing to an rpc handler
func GetTrustedProvider ¶
GetTrustedProvider returns a reference to a local store with cache
Types ¶
type Runable ¶
func RequireInit ¶
Any commands that require and init'ed basecoin directory should wrap their RunE command with RequireInit to make sure that the client is initialized.
This cannot be called during PersistentPreRun, as they are called from the most specific command first, and root last, and the root command sets up viper, which is needed to find the home dir.