mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 14:24:26 -08:00
scaffold new auction tx
This commit is contained in:
@@ -30,6 +30,7 @@ func GetTxCmd() *cobra.Command {
|
||||
RunE: client.ValidateCmd,
|
||||
}
|
||||
|
||||
cmd.AddCommand(CmdNewAuction())
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
|
||||
46
x/cosmostest/client/cli/tx_new_auction.go
Normal file
46
x/cosmostest/client/cli/tx_new_auction.go
Normal 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/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdNewAuction() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "new-auction [owner] [name] [description]",
|
||||
Short: "Broadcast message newAuction",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
argOwner := args[0]
|
||||
argName := args[1]
|
||||
argDescription := args[2]
|
||||
|
||||
clientCtx, err := client.GetClientTxContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := types.NewMsgNewAuction(
|
||||
clientCtx.GetFromAddress().String(),
|
||||
argOwner,
|
||||
argName,
|
||||
argDescription,
|
||||
)
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user