mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-07 14:46:39 +00:00

* added InitPoP message * added getChallenge query to inspect challenges * adjusted towards a unique block height identification unit: int64, not uint64 * added challenge param finished to identify challenges that weren't completed but will be part of re-issuance. Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
51 lines
970 B
Go
51 lines
970 B
Go
package cli
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
"github.com/spf13/cast"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var _ = strconv.Itoa(0)
|
|
|
|
func CmdGetChallenge() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "get-challenge [height]",
|
|
Short: "Query get_challenge",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
reqHeight, err := cast.ToInt64E(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
clientCtx, err := client.GetClientQueryContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
queryClient := types.NewQueryClient(clientCtx)
|
|
|
|
params := &types.QueryGetChallengeRequest{
|
|
|
|
Height: reqHeight,
|
|
}
|
|
|
|
res, err := queryClient.GetChallenge(cmd.Context(), params)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return clientCtx.PrintProto(res)
|
|
},
|
|
}
|
|
|
|
flags.AddQueryFlagsToCmd(cmd)
|
|
|
|
return cmd
|
|
}
|