gpu-compute-chain/x/cosmostest/client/cli/tx_new_bid.go

45 lines
924 B
Go
Raw Normal View History

2022-08-28 10:57:06 -07:00
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 CmdNewBid() *cobra.Command {
cmd := &cobra.Command{
Use: "new-bid [auction-index] [amount]",
Short: "Broadcast message newBid",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argAuctionIndex := args[0]
argAmount := args[1]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgNewBid(
clientCtx.GetFromAddress().String(),
argAuctionIndex,
argAmount,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}