Repository: vegaprotocol/vegawallet (go)

Issue:
Scope  `sign` and `verify` under a `message` subcommand
We have several ways of signing _things_ on the CLI. For now, we have `command` and messages at the root. More might come later.

In order to make it clear, we should scope the `sign` and `verify` at the root under a `message` sub-command.

Before:
```sh
vegawallet sign
vegawallet verify
```

After:
```sh
vegawallet message sign
vegawallet message verify
```

It's probably not used so, I think we don't have to deprecated it, just replace it entirely.

Pull request description:
Move sign and verify to a message subcommand
Closes #434 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a9ba21b..659697d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@
 - [446](https://github.com/vegaprotocol/vegawallet/pull/446) - Field `mnemonic` in HTTP response for wallet creation has been removed in favor of `recoveryPhrase`
 - [446](https://github.com/vegaprotocol/vegawallet/pull/446) - Field `mnemonic` in HTTP request for wallet import has been removed in favor of `recoveryPhrase`
 - [446](https://github.com/vegaprotocol/vegawallet/pull/446) - The key printed on the JSON output for the `key generate` command is now at the root of the response, just like the output of the `key describe` command.
+- [450](https://github.com/vegaprotocol/vegawallet/pull/450) - Move `sign` and `verify` commands to a a `message` subcommand, e.g. `message sign` and `message verify`
 
 ### 🗑️  Deprecation
 - [](https://github.com/vegaprotocol/vegawallet/pull/) -
diff --git a/cmd/message.go b/cmd/message.go
new file mode 100644
index 0000000..c3eea0c
--- /dev/null
+++ b/cmd/message.go
@@ -0,0 +1,19 @@
+package cmd
+
+import (
+	"io"
+
+	"github.com/spf13/cobra"
+)
+
+func NewCmdMessage(w io.Writer, rf *RootFlags) *cobra.Command {
+	cmd := &cobra.Command{
+		Use:   "message",
+		Short: "Sign and verify messages",
+		Long:  "Sign and verify messages",
+	}
+
+	cmd.AddCommand(NewCmdSignMessage(w, rf))
+	cmd.AddCommand(NewCmdVerifyMessage(w, rf))
+	return cmd
+}
diff --git a/cmd/sign.go b/cmd/message_sign.go
similarity index 97%
rename from cmd/sign.go
rename to cmd/message_sign.go
index 7151d49..96da07a 100644
--- a/cmd/sign.go
+++ b/cmd/message_sign.go
@@ -21,7 +21,7 @@ var (
 
 	signMessageExample = cli.Examples(`
 		# Sign a message
-		vegawallet sign --message MESSAGE --wallet WALLET --pubkey PUBKEY
+		vegawallet message sign --message MESSAGE --wallet WALLET --pubkey PUBKEY
 	`)
 )
 
diff --git a/cmd/verify.go b/cmd/message_verify.go
similarity index 97%
rename from cmd/verify.go
rename to cmd/message_verify.go
index b5935d0..cd8c1ef 100644
--- a/cmd/verify.go
+++ b/cmd/message_verify.go
@@ -22,7 +22,7 @@ var (
 
 	verifyMessageExample = cli.Examples(`
 		# Verify the signature of a message
-		vegawallet verify --message MESSAGE --signature SIGNATURE --pubkey PUBKEY
+		vegawallet message verify --message MESSAGE --signature SIGNATURE --pubkey PUBKEY
 	`)
 )
 
diff --git a/cmd/root.go b/cmd/root.go
index 4aa1b42..ed864ee 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -118,8 +118,6 @@ func BuildCmdRoot(w io.Writer, vh CheckVersionHandler) *cobra.Command {
 	// Root commands
 	cmd.AddCommand(NewCmdInit(w, f))
 	cmd.AddCommand(NewCmdCompletion(w))
-	cmd.AddCommand(NewCmdSignMessage(w, f))
-	cmd.AddCommand(NewCmdVerifyMessage(w, f))
 	cmd.AddCommand(NewCmdVersion(w, f))
 
 	// Sub-commands
@@ -128,6 +126,7 @@ func BuildCmdRoot(w io.Writer, vh CheckVersionHandler) *cobra.Command {
 	cmd.AddCommand(NewCmdNetwork(w, f))
 	cmd.AddCommand(NewCmdService(w, f))
 	cmd.AddCommand(NewCmdTx(w, f))
+	cmd.AddCommand(NewCmdMessage(w, f))
 
 	// Wallet commands
 	// We don't have a wrapper sub-command for wallet commands.


Test patch:
diff --git a/tests/commands_for_test.go b/tests/commands_for_test.go
index fcebfaf..d80156a 100644
--- a/tests/commands_for_test.go
+++ b/tests/commands_for_test.go
@@ -614,7 +614,7 @@ type SignMessageResponse struct {
 
 func SignMessage(t *testing.T, args []string) (*SignMessageResponse, error) {
 	t.Helper()
-	argsWithCmd := []string{"sign"}
+	argsWithCmd := []string{"message", "sign"}
 	argsWithCmd = append(argsWithCmd, args...)
 	output, err := ExecuteCmd(t, argsWithCmd)
 	if err != nil {
@@ -655,7 +655,7 @@ type VerifyMessageResponse struct {
 
 func VerifyMessage(t *testing.T, args []string) (*VerifyMessageResponse, error) {
 	t.Helper()
-	argsWithCmd := []string{"verify"}
+	argsWithCmd := []string{"message", "verify"}
 	argsWithCmd = append(argsWithCmd, args...)
 	output, err := ExecuteCmd(t, argsWithCmd)
 	if err != nil {