From d69dd69f0251c12077ca2bda8f085e389d58c9fd Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Wed, 14 Dec 2022 11:47:20 -0600 Subject: [PATCH] Fix epochs CLI (#3700) --- osmoutils/osmocli/query_cmd_wrap.go | 4 ++++ x/epochs/client/cli/query.go | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osmoutils/osmocli/query_cmd_wrap.go b/osmoutils/osmocli/query_cmd_wrap.go index b1327826ca0..790fd2ad5c1 100644 --- a/osmoutils/osmocli/query_cmd_wrap.go +++ b/osmoutils/osmocli/query_cmd_wrap.go @@ -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), diff --git a/x/epochs/client/cli/query.go b/x/epochs/client/cli/query.go index 0eb08251347..4255d646011 100644 --- a/x/epochs/client/cli/query.go +++ b/x/epochs/client/cli/query.go @@ -21,7 +21,8 @@ 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) { @@ -29,5 +30,5 @@ func GetCmdCurrentEpoch() (*osmocli.QueryDescriptor, *types.QueryCurrentEpochReq Use: "current-epoch", Short: "Query current epoch by specified identifier.", Long: `{{.Short}}{{.ExampleHeader}} - {{.CommandPrefix}} day`}, &types.QueryCurrentEpochRequest{} +{{.CommandPrefix}} day`}, &types.QueryCurrentEpochRequest{} }