| 779 | } |
| 780 | |
| 781 | void interactive_open_wallet() |
| 782 | { |
| 783 | FC_ASSERT(_client->get_wallet()->is_enabled(), "Wallet is not enabled in this client!"); |
| 784 | |
| 785 | if (_client->get_wallet()->is_open()) |
| 786 | return; |
| 787 | |
| 788 | *_out << "A wallet must be open to execute this command. You can:\n"; |
| 789 | *_out << "(o) Open an existing wallet\n"; |
| 790 | *_out << "(c) Create a new wallet\n"; |
| 791 | *_out << "(q) Abort command\n"; |
| 792 | |
| 793 | string choice = get_line("Choose [o/c/q]: "); |
| 794 | |
| 795 | if (choice == "c") |
| 796 | { |
| 797 | fc::istream_ptr argument_stream = std::make_shared<fc::stringstream>(); |
| 798 | try |
| 799 | { |
| 800 | parse_and_execute_interactive_command("wallet_create", argument_stream); |
| 801 | } |
| 802 | catch (const thinkyoung::cli::abort_cli_command&) |
| 803 | { |
| 804 | } |
| 805 | } |
| 806 | else if (choice == "o") |
| 807 | { |
| 808 | fc::istream_ptr argument_stream = std::make_shared<fc::stringstream>(); |
| 809 | try |
| 810 | { |
| 811 | parse_and_execute_interactive_command("wallet_open", argument_stream); |
| 812 | } |
| 813 | catch (const thinkyoung::cli::abort_cli_command&) |
| 814 | { |
| 815 | } |
| 816 | } |
| 817 | else if (choice == "q") |
| 818 | { |
| 819 | FC_THROW_EXCEPTION(thinkyoung::cli::abort_cli_command, ""); |
| 820 | } |
| 821 | else |
| 822 | { |
| 823 | *_out << "Wrong answer!\n"; |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | void interactive_open_sandbox() |
| 828 | { |
no test coverage detected