scaffold locked-funds query

This commit is contained in:
2022-09-08 21:52:01 +00:00
parent 04795f8e9e
commit f048bfac01
7 changed files with 604 additions and 44 deletions

View File

@@ -31,6 +31,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdAuctionBids())
cmd.AddCommand(CmdShowLockedUsers())
cmd.AddCommand(CmdLockedFunds())
// this line is used by starport scaffolding # 1
return cmd

View File

@@ -0,0 +1,46 @@
package cli
import (
"strconv"
"colinear/x/colinearcore/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdLockedFunds() *cobra.Command {
cmd := &cobra.Command{
Use: "locked-funds [owner]",
Short: "Query lockedFunds",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqOwner := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryLockedFundsRequest{
Owner: reqOwner,
}
res, err := queryClient.LockedFunds(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}