Skip to content

Commit

Permalink
fix(genesis_bridge): added genesisInfo query (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin authored Oct 13, 2024
1 parent 69c1b7c commit 1899432
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x/hub-genesis/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func GetQueryCmd() *cobra.Command {
hubGenQueryCmd.AddCommand(
GetCmdQueryParams(),
GetCmdQueryState(),
GetCmdQueryGenesisInfo(),
)

return hubGenQueryCmd
Expand Down Expand Up @@ -86,3 +87,32 @@ func GetCmdQueryState() *cobra.Command {

return cmd
}

// GetCmdQueryGenesisInfo implements a command to return the current hub-genesis
// genesis info.
func GetCmdQueryGenesisInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "genesis-info",
Short: "Query the current hub-genesis genesis info",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

genesisInfo := &types.QueryGenesisInfoRequest{}
res, err := queryClient.GenesisInfo(context.Background(), genesisInfo)
if err != nil {
return err
}

return clientCtx.PrintProto(&res.GenesisInfo)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

0 comments on commit 1899432

Please sign in to comment.