MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / interactive_open_wallet

Function interactive_open_wallet

src/Chain/libraries/cli/Cli.cpp:781–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

execute_commandFunction · 0.85

Calls 5

is_enabledMethod · 0.80
get_walletMethod · 0.80
get_lineFunction · 0.70
is_openMethod · 0.45

Tested by

no test coverage detected