x/staking: cli migration to use gRPC query client (#6728)
* migrated to use gRPC query client * removed codecs usage * review change * added read command flags * added pagination flags * fixed limit issue * added helper function for default pagination flags * review changes * review change * review changes Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
mergify[bot]
parent
cdcb51a922
commit
c37f683cc1
@@ -61,6 +61,9 @@ const (
|
||||
FlagPage = "page"
|
||||
FlagLimit = "limit"
|
||||
FlagSignMode = "sign-mode"
|
||||
FlagPageKey = "page-key"
|
||||
FlagOffset = "offset"
|
||||
FlagCountTotal = "count-total"
|
||||
)
|
||||
|
||||
// LineBreak can be included in a command list to provide a blank line
|
||||
@@ -123,6 +126,14 @@ func AddTxFlagsToCmd(cmd *cobra.Command) {
|
||||
viper.BindPFlag(FlagKeyringBackend, cmd.Flags().Lookup(FlagKeyringBackend))
|
||||
}
|
||||
|
||||
// AddPaginationFlagsToCmd adds common paginations flags to command
|
||||
func AddPaginationFlagsToCmd(cmd *cobra.Command, query string) {
|
||||
cmd.Flags().String(FlagPageKey, "", fmt.Sprintf("pagination page-key of %s to query for", query))
|
||||
cmd.Flags().Uint64(FlagOffset, 0, fmt.Sprintf("pagination offset of %s to query for", query))
|
||||
cmd.Flags().Uint64(FlagLimit, 100, fmt.Sprintf("pagination limit of %s to query for", query))
|
||||
cmd.Flags().Bool(FlagCountTotal, false, fmt.Sprintf("count total number of records in %s to query for", query))
|
||||
}
|
||||
|
||||
// GasSetting encapsulates the possible values passed through the --gas flag.
|
||||
type GasSetting struct {
|
||||
Simulate bool
|
||||
|
||||
Reference in New Issue
Block a user