Skip to content

Commit

Permalink
Fix epochs CLI (#3700) (#3724)
Browse files Browse the repository at this point in the history
(cherry picked from commit d69dd69)

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
  • Loading branch information
mergify[bot] and ValarDragon authored Dec 14, 2022
1 parent 925746a commit dc3de03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions osmoutils/osmocli/query_cmd_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func GetParams[reqP proto.Message, querier any](moduleName string,
func callQueryClientFn(ctx context.Context, fnName string, req proto.Message, q any) (res proto.Message, err error) {
qVal := reflect.ValueOf(q)
method := qVal.MethodByName(fnName)
if (method == reflect.Value{}) {
return nil, fmt.Errorf("Method %s does not exist on the querier."+
" You likely need to override QueryFnName in your Query descriptor", fnName)
}
args := []reflect.Value{
reflect.ValueOf(ctx),
reflect.ValueOf(req),
Expand Down
5 changes: 3 additions & 2 deletions x/epochs/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ func GetCmdEpochInfos() (*osmocli.QueryDescriptor, *types.QueryEpochsInfoRequest
Use: "epoch-infos",
Short: "Query running epoch infos.",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}}`}, &types.QueryEpochsInfoRequest{}
{{.CommandPrefix}}`,
QueryFnName: "EpochInfos"}, &types.QueryEpochsInfoRequest{}
}

func GetCmdCurrentEpoch() (*osmocli.QueryDescriptor, *types.QueryCurrentEpochRequest) {
return &osmocli.QueryDescriptor{
Use: "current-epoch",
Short: "Query current epoch by specified identifier.",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} day`}, &types.QueryCurrentEpochRequest{}
{{.CommandPrefix}} day`}, &types.QueryCurrentEpochRequest{}
}

0 comments on commit dc3de03

Please sign in to comment.