mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 04:44:25 -08:00
scaffold newBid tx
This commit is contained in:
@@ -31,6 +31,7 @@ func GetTxCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.AddCommand(CmdNewAuction())
|
||||
cmd.AddCommand(CmdNewBid())
|
||||
// this line is used by starport scaffolding # 1
|
||||
|
||||
return cmd
|
||||
|
||||
44
x/cosmostest/client/cli/tx_new_bid.go
Normal file
44
x/cosmostest/client/cli/tx_new_bid.go
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user