Documentation ¶
Overview ¶
Package commands contains any general setup/helpers valid for all subcommands
Index ¶
- Constants
- Variables
- func AddBasicFlags(cmd *cobra.Command)
- func GetCertifier() (*certifiers.InquiringCertifier, error)
- func GetChainID() string
- func GetNode() rpcclient.Client
- func GetOneArg(args []string, argname string) (string, error)
- func GetProviders() (trusted certifiers.Provider, source certifiers.Provider)
- func GetSourceProvider() certifiers.Provider
- func GetTrustedProvider() certifiers.Provider
- func ParseActor(input string) (res sdk.Actor, err error)
- func ParseActors(key string) (signers []sdk.Actor, err error)
- func ParseHexFlag(flag string) ([]byte, error)
- func WasInited(root string) (bool, error)
- type Config
- type Runable
Constants ¶
const ( ChainFlag = "chain-id" NodeFlag = "node" )
const ( SeedFlag = "seed" HashFlag = "valhash" GenesisFlag = "genesis" FlagTrustNode = "trust-node" ConfigFile = "config.toml" )
nolint
Variables ¶
var CommitHash = ""
CommitHash should be filled by linker flags
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,
}
var VersionCmd = &cobra.Command{ Use: "version", Short: "Show version info", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("v%s %s\n", version.Version, CommitHash) }, }
VersionCmd - command to show the application version
Functions ¶
func AddBasicFlags ¶
AddBasicFlags adds --node and --chain-id, which we need for everything
func GetCertifier ¶
func GetCertifier() (*certifiers.InquiringCertifier, error)
GetCertifier constructs a dynamic certifier from the config info
func GetProviders ¶
func GetProviders() (trusted certifiers.Provider, source certifiers.Provider)
GetProviders creates a trusted (local) seed provider and a remote provider based on configuration.
func GetSourceProvider ¶
func GetSourceProvider() certifiers.Provider
GetSourceProvider returns a provider pointing to an rpc handler
func GetTrustedProvider ¶
func GetTrustedProvider() certifiers.Provider
GetTrustedProvider returns a reference to a local store with cache
func ParseActor ¶
ParseActor parses an address of form: [<chain>:][<app>:]<hex address> into a sdk.Actor. If app is not specified or "", then assume auth.NameSigs
func ParseActors ¶
ParseActors takes a comma-separated list of actors and parses them into a slice
func ParseHexFlag ¶
ParseHexFlag takes a flag name and parses the viper contents as hex
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.