Exemplo n.º 1
0
        private static void CreateWallet()
        {
            Console.Clear();
            var    walletName     = Input.String("Enter walletName: ");
            string password       = "******";
            string repeatPassword = "******";

            while (password != repeatPassword)
            {
                password       = Input.Password();
                repeatPassword = Input.Password("Enter password again: ");
                if (password != repeatPassword)
                {
                    Console.WriteLine("PAsswords do not match");
                }
            }

            var mnemonic = FullWallet.GenerateNewWallet(GetWalletPath(walletName), password);

            Console.WriteLine("Please keep mnemonic safe: " + mnemonic);
            Console.WriteLine();

            var wallet = new FullWallet(walletName, GetWalletPath(walletName), password);

            WalletHandler.PrintWalletAccounts(wallet, blockChainClient);

            Console.WriteLine();
            Console.WriteLine("Press any key");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        private static void RecoverWallet()
        {
            FullWallet wallet = null;

            try
            {
                string mnemonic   = Input.String("Enter mnemonic: ");
                string password   = Input.Password();
                string walletName = Input.String("Enter new wallet name");

                wallet = FullWallet.Recover(mnemonic, password, GetWalletPath(walletName), walletName);

                Output.WriteSuccess("Wallet recovered");
                Input.EnterKey();
            }
            catch (Exception ex)
            {
                Output.WriteError(ex.Message);
                Input.EnterKey();
            }

            if (wallet != null)
            {
                WalletHandler walletHandler = new WalletHandler(wallet, blockChainClient);
            }
        }
Exemplo n.º 3
0
        private static void OpenWallet()
        {
            try
            {
                string walletName = Input.String("Enter wallet name ");
                string password   = Input.Password();

                FullWallet wallet = new FullWallet(walletName, GetWalletPath(walletName), password);

                WalletHandler walletHandler = new WalletHandler(wallet, blockChainClient);

                walletHandler.Run();
            }
            catch (Exception ex)
            {
                Output.WriteError(ex.Message);
                Input.EnterKey();
            }
        }