-
Notifications
You must be signed in to change notification settings - Fork 203
/
tx_del_project.go
49 lines (40 loc) · 1.27 KB
/
tx_del_project.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/lavanet/lava/x/subscription/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdDelProject() *cobra.Command {
cmd := &cobra.Command{
Use: "del-project [project-name]",
Short: "Delete a project from a subscription",
Long: `The del-project command allows the subscription owner to delete an existing project from its
subscription. If successful, the project will be deleted at the end of the current epoch.`,
Example: `required flags: --from <subscription_consumer>
lavad tx subscription del-project <project-name> --from <subscription_consumer>`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
projectName := args[0]
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
creator := clientCtx.GetFromAddress().String()
msg := types.NewMsgDelProject(
creator,
projectName,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
cmd.MarkFlagRequired(flags.FlagFrom)
flags.AddTxFlagsToCmd(cmd)
return cmd
}