scaffold auction-bids query

This commit is contained in:
2022-08-30 21:27:12 +00:00
parent 3eb2cd36c4
commit 1105b49c6e
9 changed files with 644 additions and 38 deletions

View File

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

View File

@@ -0,0 +1,46 @@
package cli
import (
"strconv"
"cosmos-test/x/cosmostest/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdAuctionBids() *cobra.Command {
cmd := &cobra.Command{
Use: "auction-bids [index]",
Short: "Query auctionBids",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqIndex := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryAuctionBidsRequest{
Index: reqIndex,
}
res, err := queryClient.AuctionBids(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}