package cli import ( "strconv" "cosmos-test/x/cosmostest/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" ) var _ = strconv.Itoa(0) func CmdNewAuction() *cobra.Command { cmd := &cobra.Command{ Use: "new-auction [name] [description] [ceiling] [denom] [end date]", Short: "Broadcast message newAuction", Args: cobra.ExactArgs(5), RunE: func(cmd *cobra.Command, args []string) (err error) { argName := args[0] argDescription := args[1] argCeiling := args[2] argDenom := args[3] argLeaseEnd := args[4] clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } var le int le, err = strconv.Atoi(argLeaseEnd) if err != nil { return err } msg := types.NewMsgNewAuction( clientCtx.GetFromAddress().String(), argName, argDescription, argCeiling, argDenom, uint64(le), ) if err := msg.ValidateBasic(); err != nil { return err } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } flags.AddTxFlagsToCmd(cmd) return cmd }