client

package
v0.34.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: Apache-2.0 Imports: 14 Imported by: 19,098

Documentation

Index

Constants

View Source
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
	GasFlagAuto          = "auto"

	// BroadcastBlock defines a tx broadcasting mode where the client waits for
	// the tx to be committed in a block.
	BroadcastBlock = "block"
	// BroadcastSync defines a tx broadcasting mode where the client waits for
	// a CheckTx execution response only.
	BroadcastSync = "sync"
	// BroadcastAsync defines a tx broadcasting mode where the client returns
	// immediately.
	BroadcastAsync = "async"

	FlagUseLedger          = "ledger"
	FlagChainID            = "chain-id"
	FlagNode               = "node"
	FlagHeight             = "height"
	FlagGasAdjustment      = "gas-adjustment"
	FlagTrustNode          = "trust-node"
	FlagFrom               = "from"
	FlagName               = "name"
	FlagAccountNumber      = "account-number"
	FlagSequence           = "sequence"
	FlagMemo               = "memo"
	FlagFees               = "fees"
	FlagGasPrices          = "gas-prices"
	FlagBroadcastMode      = "broadcast-mode"
	FlagPrintResponse      = "print-response"
	FlagDryRun             = "dry-run"
	FlagGenerateOnly       = "generate-only"
	FlagIndentResponse     = "indent"
	FlagListenAddr         = "laddr"
	FlagCORS               = "cors"
	FlagMaxOpenConnections = "max-open"
	FlagOutputDocument     = "output-document" // inspired by wget -O
	FlagSkipConfirmation   = "yes"
)

nolint

View Source
const MinPassLength = 8

MinPassLength is the minimum acceptable password length

Variables

View Source
var (
	ErrInvalidGasAdjustment = errors.New("invalid gas adjustment")
	ErrInvalidSigner        = errors.New("tx intended signer does not match the given signer")
)

common errors for CLI and REST clients

View Source
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 added in v0.2.0

func BufferStdin() *bufio.Reader

BufferStdin is used to allow reading prompts for stdin multiple times, when we read from non-tty

func ConfigCmd

func ConfigCmd(defaultCLIHome string) *cobra.Command

ConfigCmd returns a CLI command to interactively create a Gaia CLI config file.

func GetCheckPassword added in v0.2.0

func GetCheckPassword(prompt, prompt2 string, buf *bufio.Reader) (string, error)

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 added in v0.2.0

func GetCommands(cmds ...*cobra.Command) []*cobra.Command

GetCommands adds common flags to query commands

func GetConfirmation added in v0.2.0

func GetConfirmation(prompt string, buf *bufio.Reader) (bool, error)

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 GetPassword added in v0.2.0

func GetPassword(prompt string, buf *bufio.Reader) (pass string, err error)

GetPassword will prompt for a password one-time (to sign a tx) It enforces the password length

func GetString added in v0.25.0

func GetString(prompt string, buf *bufio.Reader) (string, error)

GetString simply returns the trimmed string output of a given reader.

func NewCompletionCmd added in v0.30.0

func NewCompletionCmd(rootCmd *cobra.Command, hidden bool) *cobra.Command

NewCompletionCmd builds a cobra.Command that generate bash completion scripts for the given root command. If hidden is true, the command will not show up in the root command's list of available commands.

func OverrideStdin added in v0.31.0

func OverrideStdin(newStdin *bufio.Reader) (cleanUp func())

OverrideStdin allows to temporarily override stdin

func ParseGas added in v0.30.0

func ParseGas(gasStr string) (simulateAndExecute bool, gas uint64, err error)

ParseGas parses the value of the gas option.

func PostCommands added in v0.2.0

func PostCommands(cmds ...*cobra.Command) []*cobra.Command

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.

func RegisterRestServerFlags added in v0.27.0

func RegisterRestServerFlags(cmd *cobra.Command) *cobra.Command

RegisterRestServerFlags registers the flags required for rest server

Types

type GasSetting added in v0.25.0

type GasSetting struct {
	Simulate bool
	Gas      uint64
}

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.

Directories

Path Synopsis
module
lcd

Jump to

Keyboard shortcuts

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