OSDN Git Service

Hulk did something
[bytom/vapor.git] / cmd / bytomcli / commands / wallet.go
diff --git a/cmd/bytomcli/commands/wallet.go b/cmd/bytomcli/commands/wallet.go
new file mode 100644 (file)
index 0000000..823781e
--- /dev/null
@@ -0,0 +1,36 @@
+package commands
+
+import (
+       "os"
+
+       "github.com/spf13/cobra"
+       jww "github.com/spf13/jwalterweatherman"
+
+       "github.com/vapor/util"
+)
+
+var walletInfoCmd = &cobra.Command{
+       Use:   "wallet-info",
+       Short: "Print the information of wallet",
+       Args:  cobra.NoArgs,
+       Run: func(cmd *cobra.Command, args []string) {
+               data, exitCode := util.ClientCall("/wallet-info")
+               if exitCode != util.Success {
+                       os.Exit(exitCode)
+               }
+               printJSON(data)
+       },
+}
+
+var rescanWalletCmd = &cobra.Command{
+       Use:   "rescan-wallet",
+       Short: "Trigger to rescan block information into related wallet",
+       Args:  cobra.NoArgs,
+       Run: func(cmd *cobra.Command, args []string) {
+               if _, exitCode := util.ClientCall("/rescan-wallet"); exitCode != util.Success {
+                       os.Exit(exitCode)
+               }
+
+               jww.FEEDBACK.Println("Successfully trigger rescanning wallet")
+       },
+}