planetmint-go/x/dao/client/cli/query_get_reissuance.go
Julian Strobl 7d65bff35f
Switch BlockHeight to int64 (#158)
To align with cosmos-sdk and make interoperability easier.

* Fix typo: blockheight -> blockHeight

* Generate protobuf and openapi

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-10-20 13:43:44 +02:00

51 lines
996 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 CmdGetReissuance() *cobra.Command {
cmd := &cobra.Command{
Use: "get-reissuance [block-height]",
Short: "Query get_reissuance",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqBlockHeight, 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.QueryGetReissuanceRequest{
BlockHeight: reqBlockHeight,
}
res, err := queryClient.GetReissuance(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}