Documentation ¶
Index ¶
- Constants
- Variables
- func BufferStdin() *bufio.Reader
- func ConfigCmd() *cobra.Command
- func GetCheckPassword(prompt, prompt2 string, buf *bufio.Reader) (string, error)
- func GetCommands(cmds ...*cobra.Command) []*cobra.Command
- func GetConfirmation(prompt string, buf *bufio.Reader) (bool, error)
- func GetKeyBase(db dbm.DB) keys.Keybase
- func GetPassword(prompt string, buf *bufio.Reader) (pass string, err error)
- func GetSeed(prompt string, buf *bufio.Reader) (string, error)
- func GetString(prompt string, buf *bufio.Reader) (string, error)
- func MockKeyBase() keys.Keybase
- func ParseGas(gasStr string) (simulateAndExecute bool, gas uint64, err error)
- func PostCommands(cmds ...*cobra.Command) []*cobra.Command
- func PrintPrefixed(msg string)
- func RegisterRestServerFlags(cmd *cobra.Command) *cobra.Command
- type GasSetting
Constants ¶
const ( // DefaultGasAdjustment is applied to gas estimates to avoid tx // execution failures due to state changes that might // occur between the tx simulation and the actual run. DefaultGasAdjustment = 1.0 DefaultGasLimit = 200000 GasFlagSimulate = "simulate" FlagUseLedger = "ledger" FlagChainID = "chain-id" FlagNode = "node" FlagHeight = "height" FlagGas = "gas" FlagGasAdjustment = "gas-adjustment" FlagTrustNode = "trust-node" FlagFrom = "from" FlagName = "name" FlagAccountNumber = "account-number" FlagSequence = "sequence" FlagMemo = "memo" FlagFees = "fees" FlagAsync = "async" FlagJson = "json" FlagPrintResponse = "print-response" FlagDryRun = "dry-run" FlagGenerateOnly = "generate-only" FlagIndentResponse = "indent" FlagListenAddr = "laddr" FlagCORS = "cors" FlagMaxOpenConnections = "max-open" FlagInsecure = "insecure" FlagSSLHosts = "ssl-hosts" FlagSSLCertFile = "ssl-certfile" FlagSSLKeyFile = "ssl-keyfile" FlagOutputDocument = "output-document" // inspired by wget -O )
nolint
const MinPassLength = 8
MinPassLength is the minimum acceptable password length
Variables ¶
var ( LineBreak = &cobra.Command{Run: func(*cobra.Command, []string) {}} GasFlagVar = GasSetting{Gas: DefaultGasLimit} )
LineBreak can be included in a command list to provide a blank line to help with readability
Functions ¶
func BufferStdin ¶
BufferStdin is used to allow reading prompts for stdin multiple times, when we read from non-tty
func ConfigCmd ¶ added in v0.25.0
ConfigCmd returns a CLI command to interactively create a Gaia CLI config file.
func GetCheckPassword ¶
GetCheckPassword will prompt for a password twice to verify they match (for creating a new password). It enforces the password length. Only parses password once if input is piped in.
func GetCommands ¶
GetCommands adds common flags to query commands
func GetConfirmation ¶
GetConfirmation will request user give the confirmation from stdin. "y", "Y", "yes", "YES", and "Yes" all count as confirmations. If the input is not recognized, it will ask again.
func GetKeyBase ¶
GetKeyBase initializes a keybase based on the given db. The KeyBase manages all activity requiring access to a key.
func GetPassword ¶
GetPassword will prompt for a password one-time (to sign a tx) It enforces the password length
func GetString ¶ added in v0.25.0
GetString simply returns the trimmed string output of a given reader.
func MockKeyBase ¶
MockKeyBase generates an in-memory keybase that will be discarded useful for --dry-run to generate a seed phrase without storing the key
func PostCommands ¶
PostCommands adds common flags for commands to post tx
func PrintPrefixed ¶ added in v0.25.0
func PrintPrefixed(msg string)
PrintPrefixed prints a string with > prefixed for use in prompts.
Types ¶
type GasSetting ¶ added in v0.25.0
GasSetting encapsulates the possible values passed through the --gas flag.
func (*GasSetting) Set ¶ added in v0.25.0
func (v *GasSetting) Set(s string) (err error)
Set parses and sets the value of the --gas flag.
func (*GasSetting) String ¶ added in v0.25.0
func (v *GasSetting) String() string
func (*GasSetting) Type ¶ added in v0.25.0
func (v *GasSetting) Type() string
Type returns the flag's value type.