github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/cmd/bytomcli/commands/wallet.go (about)

     1  package commands
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/spf13/cobra"
     7  	jww "github.com/spf13/jwalterweatherman"
     8  
     9  	"github.com/bytom/bytom/util"
    10  )
    11  
    12  var walletInfoCmd = &cobra.Command{
    13  	Use:   "wallet-info",
    14  	Short: "Print the information of wallet",
    15  	Args:  cobra.NoArgs,
    16  	Run: func(cmd *cobra.Command, args []string) {
    17  		data, exitCode := util.ClientCall("/wallet-info")
    18  		if exitCode != util.Success {
    19  			os.Exit(exitCode)
    20  		}
    21  		printJSON(data)
    22  	},
    23  }
    24  
    25  var rescanWalletCmd = &cobra.Command{
    26  	Use:   "rescan-wallet",
    27  	Short: "Trigger to rescan block information into related wallet",
    28  	Args:  cobra.NoArgs,
    29  	Run: func(cmd *cobra.Command, args []string) {
    30  		if _, exitCode := util.ClientCall("/rescan-wallet"); exitCode != util.Success {
    31  			os.Exit(exitCode)
    32  		}
    33  
    34  		jww.FEEDBACK.Println("Successfully trigger rescanning wallet")
    35  	},
    36  }