Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | UniValue importprivkey(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importprivkey", | "importprivkey", | ||||
"\nAdds a private key (as returned by dumpprivkey) to your wallet. " | "Adds a private key (as returned by dumpprivkey) to your wallet. " | ||||
"Requires a new wallet backup.\n" | "Requires a new wallet backup.\n" | ||||
"Hint: use importmulti to import more than one private key.\n" | "Hint: use importmulti to import more than one private key.\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, " | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
"during that time, other rpc calls\n" | "during that time, other rpc calls\n" | ||||
"may report that the imported key exists but related transactions are " | "may report that the imported key exists but related transactions are " | ||||
"still missing, leading to temporarily incorrect/bogus balances and " | "still missing, leading to temporarily incorrect/bogus balances and " | ||||
"unspent outputs until rescan completes.\n", | "unspent outputs until rescan completes.\n", | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | UniValue abortrescan(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"abortrescan", | "abortrescan", | ||||
"\nStops current wallet rescan triggered by an RPC call, e.g. by an " | "Stops current wallet rescan triggered by an RPC call, e.g. by an " | ||||
"importprivkey call.\n", | "importprivkey call.\n", | ||||
{}, | {}, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{"\nImport a private key\n" + | RPCExamples{"\nImport a private key\n" + | ||||
HelpExampleCli("importprivkey", "\"mykey\"") + | HelpExampleCli("importprivkey", "\"mykey\"") + | ||||
"\nAbort the running wallet rescan\n" + | "\nAbort the running wallet rescan\n" + | ||||
HelpExampleCli("abortrescan", "") + | HelpExampleCli("abortrescan", "") + | ||||
"\nAs a JSON-RPC call\n" + | "\nAs a JSON-RPC call\n" + | ||||
Show All 12 Lines | UniValue importaddress(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importaddress", | "importaddress", | ||||
"\nAdds an address or script (in hex) that can be watched as if it " | "Adds an address or script (in hex) that can be watched as if it " | ||||
"were in your wallet but cannot be used to spend. Requires a new " | "were in your wallet but cannot be used to spend. Requires a new " | ||||
"wallet backup.\n" | "wallet backup.\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, " | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
"during that time, other rpc calls\n" | "during that time, other rpc calls\n" | ||||
"may report that the imported address exists but related transactions " | "may report that the imported address exists but related transactions " | ||||
"are still missing, leading to temporarily incorrect/bogus balances " | "are still missing, leading to temporarily incorrect/bogus balances " | ||||
"and unspent outputs until rescan completes.\n" | "and unspent outputs until rescan completes.\n" | ||||
"If you have the full public key, you should call importpubkey instead " | "If you have the full public key, you should call importpubkey instead " | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | UniValue importprunedfunds(const Config &config, | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importprunedfunds", | "importprunedfunds", | ||||
"\nImports funds without rescan. Corresponding address or script must " | "Imports funds without rescan. Corresponding address or script must " | ||||
"previously be included in wallet. Aimed towards pruned wallets. The " | "previously be included in wallet. Aimed towards pruned wallets. The " | ||||
"end-user is responsible to import additional transactions that " | "end-user is responsible to import additional transactions that " | ||||
"subsequently spend the imported outputs or rescan after the point in " | "subsequently spend the imported outputs or rescan after the point in " | ||||
"the blockchain the transaction is included.\n", | "the blockchain the transaction is included.\n", | ||||
{ | { | ||||
{"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"A raw transaction in hex funding an already-existing address in " | "A raw transaction in hex funding an already-existing address in " | ||||
"wallet"}, | "wallet"}, | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | UniValue removeprunedfunds(const Config &config, | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"removeprunedfunds", | "removeprunedfunds", | ||||
"\nDeletes the specified transaction from the wallet. Meant for use " | "Deletes the specified transaction from the wallet. Meant for use " | ||||
"with pruned wallets and as a companion to importprunedfunds. This " | "with pruned wallets and as a companion to importprunedfunds. This " | ||||
"will affect wallet balances.\n", | "will affect wallet balances.\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The hex-encoded id of the transaction you are deleting"}, | "The hex-encoded id of the transaction you are deleting"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("removeprunedfunds", | RPCExamples{HelpExampleCli("removeprunedfunds", | ||||
Show All 31 Lines | UniValue importpubkey(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importpubkey", | "importpubkey", | ||||
"\nAdds a public key (in hex) that can be watched as if it were in " | "Adds a public key (in hex) that can be watched as if it were in " | ||||
"your wallet but cannot be used to spend. Requires a new wallet " | "your wallet but cannot be used to spend. Requires a new wallet " | ||||
"backup.\n" | "backup.\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, " | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
"during that time, other rpc calls\n" | "during that time, other rpc calls\n" | ||||
"may report that the imported pubkey exists but related transactions " | "may report that the imported pubkey exists but related transactions " | ||||
"are still missing, leading to temporarily incorrect/bogus balances " | "are still missing, leading to temporarily incorrect/bogus balances " | ||||
"and unspent outputs until rescan completes.\n", | "and unspent outputs until rescan completes.\n", | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | UniValue importwallet(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importwallet", | "importwallet", | ||||
"\nImports keys from a wallet dump file (see dumpwallet). Requires a " | "Imports keys from a wallet dump file (see dumpwallet). Requires a " | ||||
"new wallet backup to include imported keys.\n", | "new wallet backup to include imported keys.\n", | ||||
{ | { | ||||
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, | {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The wallet file"}, | "The wallet file"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{"\nDump the wallet\n" + | RPCExamples{"\nDump the wallet\n" + | ||||
HelpExampleCli("dumpwallet", "\"test\"") + | HelpExampleCli("dumpwallet", "\"test\"") + | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | UniValue dumpprivkey(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"dumpprivkey", | "dumpprivkey", | ||||
"\nReveals the private key corresponding to 'address'.\n" | "Reveals the private key corresponding to 'address'.\n" | ||||
"Then the importprivkey can be used with this output\n", | "Then the importprivkey can be used with this output\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The bitcoin address for the private key"}, | "The bitcoin address for the private key"}, | ||||
}, | }, | ||||
RPCResult{"\"key\" (string) The private key\n"}, | RPCResult{"\"key\" (string) The private key\n"}, | ||||
RPCExamples{HelpExampleCli("dumpprivkey", "\"myaddress\"") + | RPCExamples{HelpExampleCli("dumpprivkey", "\"myaddress\"") + | ||||
HelpExampleCli("importprivkey", "\"mykey\"") + | HelpExampleCli("importprivkey", "\"mykey\"") + | ||||
Show All 31 Lines | UniValue dumpwallet(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"dumpwallet", | "dumpwallet", | ||||
"\nDumps all wallet keys in a human-readable format to a server-side " | "Dumps all wallet keys in a human-readable format to a server-side " | ||||
"file. This does not allow overwriting existing files.\n" | "file. This does not allow overwriting existing files.\n" | ||||
"Imported scripts are included in the dumpsfile, but corresponding " | "Imported scripts are included in the dumpsfile, but corresponding " | ||||
"addresses may not be added automatically by importwallet.\n" | "addresses may not be added automatically by importwallet.\n" | ||||
"Note that if your wallet contains keys which are not derived from " | "Note that if your wallet contains keys which are not derived from " | ||||
"your HD seed (e.g. imported keys), these are not covered by\n" | "your HD seed (e.g. imported keys), these are not covered by\n" | ||||
"only backing up the seed itself, and must be backed up too (e.g. " | "only backing up the seed itself, and must be backed up too (e.g. " | ||||
"ensure you back up the whole dumpfile).\n", | "ensure you back up the whole dumpfile).\n", | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 643 Lines • ▼ Show 20 Lines | std::shared_ptr<CWallet> const wallet = | ||||
GetWalletForJSONRPCRequest(mainRequest); | GetWalletForJSONRPCRequest(mainRequest); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, mainRequest.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, mainRequest.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"importmulti", | "importmulti", | ||||
"\nImport addresses/scripts (with private or public keys, redeem " | "Import addresses/scripts (with private or public keys, redeem " | ||||
"script (P2SH)), rescanning all addresses in one-shot-only (rescan can " | "script (P2SH)), rescanning all addresses in one-shot-only (rescan can " | ||||
"be disabled via options). Requires a new wallet backup.\n", | "be disabled via options). Requires a new wallet backup.\n", | ||||
{ | { | ||||
{"requests", | {"requests", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
RPCArg::Optional::NO, | RPCArg::Optional::NO, | ||||
"Data to be imported", | "Data to be imported", | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 276 Lines • Show Last 20 Lines |