From 23fa2eb2c8787f2ce4c199513c589473adb52896 Mon Sep 17 00:00:00 2001 From: leonz789 Date: Mon, 28 Oct 2024 18:19:19 +0800 Subject: [PATCH] fix cli for stakerlist need 1 arg --- x/oracle/client/cli/query_native_token.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/x/oracle/client/cli/query_native_token.go b/x/oracle/client/cli/query_native_token.go index a6aff0a89..6d6224214 100644 --- a/x/oracle/client/cli/query_native_token.go +++ b/x/oracle/client/cli/query_native_token.go @@ -86,18 +86,24 @@ func CmdQueryStakerInfo() *cobra.Command { func CmdQueryStakerList() *cobra.Command { cmd := &cobra.Command{ - Use: "show-staker-list", + Use: "show-staker-list [assetID]", Short: "shows staker list including all staker addresses", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) (err error) { + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } + assetID := args[0] + + if _, _, err := assetstypes.ValidateID(assetID, true, false); err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.StakerList(cmd.Context(), &types.QueryStakerListRequest{}) + res, err := queryClient.StakerList(cmd.Context(), &types.QueryStakerListRequest{AssetId: assetID}) if err != nil { return err }