5#include <bitcoin-build-config.h>
48 argsman.
AddCommand(
"create",
"Create new wallet file");
49 argsman.
AddCommand(
"salvage",
"Attempt to recover private keys from a corrupt wallet. Warning: 'salvage' is experimental.");
50 argsman.
AddCommand(
"dump",
"Print out all of the wallet key-value records");
51 argsman.
AddCommand(
"createfromdump",
"Create new wallet file from dumped records");
57 std::string error_message;
59 tfm::format(std::cerr,
"Error parsing command line arguments: %s\n", error_message);
62 const bool missing_args{argc < 2};
70 "bitcoin-wallet is an offline tool for creating and interacting with " CLIENT_NAME
" wallet files.\n\n"
71 "By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n\n"
72 "To change the target wallet, use the -datadir, -wallet and (test)chain selection arguments.\n"
74 "Usage: bitcoin-wallet [options] <command>\n"
80 tfm::format(std::cerr,
"Error: too few parameters\n");
90 tfm::format(std::cerr,
"Error: Specified data directory \"%s\" does not exist.\n",
args.
GetArg(
"-datadir",
""));
103 common::WinCmdLineArgs winArgs;
104 std::tie(argc, argv) = winArgs.get();
117 }
catch (
const std::exception& e) {
127 tfm::format(std::cerr,
"No method provided. Run `bitcoin-wallet -help` for valid methods.\n");
131 tfm::format(std::cerr,
"Error: Additional arguments provided (%s). Methods do not take arguments. Please refer to `-help`.\n",
Join(
command->args,
", "));
bool HelpRequested(const ArgsManager &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
bool CheckDataDirOption(const ArgsManager &args)
static std::optional< int > WalletAppInit(ArgsManager &args, int argc, char *argv[])
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
static void SetupWalletToolArgs(ArgsManager &argsman)
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
std::optional< const Command > GetCommand() const
Get the command and command args (returns std::nullopt if no command provided)
@ ALLOW_ANY
disable validation
@ DISALLOW_NEGATION
disallow -nofoo syntax
ChainType GetChainType() const
Returns the appropriate chain type from the program arguments.
bool ParseParameters(int argc, const char *const argv[], std::string &error)
std::string GetHelpMessage() const
Get the help string.
void AddCommand(const std::string &cmd, const std::string &help)
Add subcommand.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
RAII class initializing and deinitializing global state for elliptic curve support.
std::string FormatFullVersion()
std::string LicenseInfo()
Returns licensing information (for -version)
void PrintExceptionContinue(const std::exception *pex, std::string_view thread_name)
BCLog::Logger & LogInstance()
std::unique_ptr< Init > MakeWalletInit(int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the wallet process.
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
std::string FormatParagraph(std::string_view in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.