Exemplo n.º 1
0
        /// <summary>
        /// Generate keystore by privatekey
        /// </summary>
        /// <param name="parameters">
        /// Parameters Index
        /// </param>
        /// <returns></returns>
        public static bool ImportWallet(string command, string[] parameters)
        {
            string[] usage = new string[] {
                string.Format("{0} [command option] \n", command)
            };

            string[] command_option = new string[] { HelpCommandOption.Help };

            if (parameters != null)
            {
                OutputHelpMessage(usage, null, command_option, null);
                return(true);
            }

            try
            {
                string password   = CommandLineUtil.ReadPasswordString("Please input your password.");
                string privatekey = CommandLineUtil.ReadString("Please input your private key.");

                RpcApiResult result = RpcApi.Logout();
                if (result.Result)
                {
                    result = RpcApi.ImportWallet(password, privatekey);
                }


                OutputResultMessage(command, result.Result, result.Code, result.Message);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message + "\n\n" + e.StackTrace);
            }

            return(true);
        }