scaffold unlock-funds message

This commit is contained in:
2022-09-08 21:49:56 +00:00
parent 275230dc76
commit 04795f8e9e
12 changed files with 613 additions and 25 deletions

View File

@@ -33,6 +33,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdNewAuction())
cmd.AddCommand(CmdNewBid())
cmd.AddCommand(CmdLockFunds())
cmd.AddCommand(CmdUnlockFunds())
// this line is used by starport scaffolding # 1
return cmd

View File

@@ -0,0 +1,42 @@
package cli
import (
"strconv"
"colinear/x/colinearcore/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 CmdUnlockFunds() *cobra.Command {
cmd := &cobra.Command{
Use: "unlock-funds [amount]",
Short: "Broadcast message unlockFunds",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argAmount := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgUnlockFunds(
clientCtx.GetFromAddress().String(),
argAmount,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}