2018-02-23 01:49:30 -08:00
|
|
|
package client
|
|
|
|
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
|
2018-02-28 15:26:39 -08:00
|
|
|
// nolint
|
2018-02-23 01:49:30 -08:00
|
|
|
const (
|
|
|
|
FlagChainID = "chain-id"
|
|
|
|
FlagNode = "node"
|
|
|
|
FlagHeight = "height"
|
|
|
|
FlagTrustNode = "trust-node"
|
|
|
|
FlagName = "name"
|
2018-03-03 11:07:50 -08:00
|
|
|
FlagSequence = "sequence"
|
|
|
|
FlagFee = "fee"
|
2018-02-23 01:49:30 -08:00
|
|
|
)
|
|
|
|
|
2018-02-23 02:25:25 -08:00
|
|
|
// LineBreak can be included in a command list to provide a blank line
|
|
|
|
// to help with readability
|
|
|
|
var LineBreak = &cobra.Command{Run: func(*cobra.Command, []string) {}}
|
|
|
|
|
2018-02-23 01:49:30 -08:00
|
|
|
// GetCommands adds common flags to query commands
|
|
|
|
func GetCommands(cmds ...*cobra.Command) []*cobra.Command {
|
|
|
|
for _, c := range cmds {
|
|
|
|
// TODO: make this default false when we support proofs
|
|
|
|
c.Flags().Bool(FlagTrustNode, true, "Don't verify proofs for responses")
|
|
|
|
c.Flags().String(FlagChainID, "", "Chain ID of tendermint node")
|
2018-02-23 04:53:49 -08:00
|
|
|
c.Flags().String(FlagNode, "tcp://localhost:46657", "<host>:<port> to tendermint rpc interface for this chain")
|
2018-02-23 01:49:30 -08:00
|
|
|
c.Flags().Int64(FlagHeight, 0, "block height to query, omit to get most recent provable block")
|
|
|
|
}
|
|
|
|
return cmds
|
|
|
|
}
|
|
|
|
|
|
|
|
// PostCommands adds common flags for commands to post tx
|
|
|
|
func PostCommands(cmds ...*cobra.Command) []*cobra.Command {
|
|
|
|
for _, c := range cmds {
|
|
|
|
c.Flags().String(FlagName, "", "Name of private key with which to sign")
|
2018-03-03 11:07:50 -08:00
|
|
|
c.Flags().Int64(FlagSequence, 0, "Sequence number to sign the tx")
|
|
|
|
c.Flags().String(FlagFee, "", "Fee to pay along with transaction")
|
2018-02-23 01:49:30 -08:00
|
|
|
c.Flags().String(FlagChainID, "", "Chain ID of tendermint node")
|
2018-02-23 04:53:49 -08:00
|
|
|
c.Flags().String(FlagNode, "tcp://localhost:46657", "<host>:<port> to tendermint rpc interface for this chain")
|
2018-02-23 01:49:30 -08:00
|
|
|
}
|
|
|
|
return cmds
|
|
|
|
}
|