Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | static UniValue getnewaddress(const Config &config, | ||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getnewaddress", | "getnewaddress", | ||||
"\nReturns a new Bitcoin address for receiving payments.\n" | "\nReturns a new Bitcoin address for receiving payments.\n" | ||||
"If 'label' is specified, it is added to the address book \n" | "If 'label' is specified, it is added to the address book \n" | ||||
"so payments received with the address will be associated with " | "so payments received with the address will be associated with " | ||||
"'label'.\n", | "'label'.\n", | ||||
{ | { | ||||
{"label", RPCArg::Type::STR, /* opt */ true, | {"label", RPCArg::Type::STR, /* default */ "null", | ||||
/* default_val */ "null", | |||||
"The label name for the address to be linked to. If not " | "The label name for the address to be linked to. If not " | ||||
"provided, the default label \"\" is used. It can also be set " | "provided, the default label \"\" is used. It can also be set " | ||||
"to the empty string \"\" to represent the default label. The " | "to the empty string \"\" to represent the default label. The " | ||||
"label does not need to exist, it will be created if there is " | "label does not need to exist, it will be created if there is " | ||||
"no label by the given name."}, | "no label by the given name."}, | ||||
}, | }, | ||||
RPCResult{"\"address\" (string) The new bitcoin address\n"}, | RPCResult{"\"address\" (string) The new bitcoin address\n"}, | ||||
RPCExamples{HelpExampleCli("getnewaddress", "") + | RPCExamples{HelpExampleCli("getnewaddress", "") + | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"setlabel", | "setlabel", | ||||
"\nSets the label associated with the given address.\n", | "\nSets the label associated with the given address.\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The bitcoin address to be associated with a label."}, | "The bitcoin address to be associated with a label."}, | ||||
{"label", RPCArg::Type::STR, /* opt */ false, | {"label", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The label to assign to the address."}, | "The label to assign to the address."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{ | RPCExamples{ | ||||
HelpExampleCli( | HelpExampleCli( | ||||
"setlabel", | "setlabel", | ||||
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"tabby\"") + | "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"tabby\"") + | ||||
HelpExampleRpc( | HelpExampleRpc( | ||||
"setlabel", | "setlabel", | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static UniValue sendtoaddress(const Config &config, | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 5) { | request.params.size() > 5) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"sendtoaddress", | "sendtoaddress", | ||||
"\nSend an amount to a given address.\n" + | "\nSend an amount to a given address.\n" + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The bitcoin address to send to."}, | "The bitcoin address to send to."}, | ||||
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, | {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The amount in " + CURRENCY_UNIT + " to send. eg 0.1"}, | "The amount in " + CURRENCY_UNIT + " to send. eg 0.1"}, | ||||
{"comment", RPCArg::Type::STR, /* opt */ true, | {"comment", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"A comment used to store what the transaction is for.\n" | "A comment used to store what the transaction is for.\n" | ||||
" This is not part of the " | " This is not part of the " | ||||
"transaction, just kept in your wallet."}, | "transaction, just kept in your wallet."}, | ||||
{"comment_to", RPCArg::Type::STR, /* opt */ true, | {"comment_to", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"A comment to store the name of the person or organization\n" | "A comment to store the name of the person or organization\n" | ||||
" to which you're sending the " | " to which you're sending the " | ||||
"transaction. This is not part of the \n" | "transaction. This is not part of the \n" | ||||
" transaction, just kept in " | " transaction, just kept in " | ||||
"your wallet."}, | "your wallet."}, | ||||
{"subtractfeefromamount", RPCArg::Type::BOOL, | {"subtractfeefromamount", RPCArg::Type::BOOL, | ||||
/* opt */ true, /* default_val */ "false", | /* default */ "false", | ||||
"The fee will be deducted from the amount being sent.\n" | "The fee will be deducted from the amount being sent.\n" | ||||
" The recipient will receive " | " The recipient will receive " | ||||
"less bitcoins than you enter in the amount field."}, | "less bitcoins than you enter in the amount field."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"\"txid\" (string) The transaction id.\n"}, | "\"txid\" (string) The transaction id.\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
HelpExampleCli("sendtoaddress", | HelpExampleCli("sendtoaddress", | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | static UniValue signmessage(const Config &config, | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"signmessage", | "signmessage", | ||||
"\nSign a message with the private key of an address" + | "\nSign a message with the private key of an address" + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The bitcoin address to use for the private key."}, | "The bitcoin address to use for the private key."}, | ||||
{"message", RPCArg::Type::STR, /* opt */ false, | {"message", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The message to create a signature of."}, | "The message to create a signature of."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"\"signature\" (string) The signature of the message " | "\"signature\" (string) The signature of the message " | ||||
"encoded in base 64\n"}, | "encoded in base 64\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nUnlock the wallet for 30 seconds\n" + | "\nUnlock the wallet for 30 seconds\n" + | ||||
HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") + | HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") + | ||||
"\nCreate the signature\n" + | "\nCreate the signature\n" + | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | static UniValue getreceivedbyaddress(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getreceivedbyaddress", | "getreceivedbyaddress", | ||||
"\nReturns the total amount received by the given address in " | "\nReturns the total amount received by the given address in " | ||||
"transactions with at least minconf confirmations.\n", | "transactions with at least minconf confirmations.\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The bitcoin address for transactions."}, | "The bitcoin address for transactions."}, | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"Only include transactions confirmed at least this many " | "Only include transactions confirmed at least this many " | ||||
"times."}, | "times."}, | ||||
}, | }, | ||||
RPCResult{"amount (numeric) The total amount in " + | RPCResult{"amount (numeric) The total amount in " + | ||||
CURRENCY_UNIT + " received at this address.\n"}, | CURRENCY_UNIT + " received at this address.\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nThe amount from transactions with at least 1 " | "\nThe amount from transactions with at least 1 " | ||||
"confirmation\n" + | "confirmation\n" + | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | static UniValue getreceivedbylabel(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getreceivedbylabel", | "getreceivedbylabel", | ||||
"\nReturns the total amount received by addresses with <label> " | "\nReturns the total amount received by addresses with <label> " | ||||
"in transactions with at least [minconf] confirmations.\n", | "in transactions with at least [minconf] confirmations.\n", | ||||
{ | { | ||||
{"label", RPCArg::Type::STR, /* opt */ false, | {"label", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The selected label, may be the default label " | "The selected label, may be the default label " | ||||
"using \"\"."}, | "using \"\"."}, | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"Only include transactions confirmed at least this " | "Only include transactions confirmed at least this " | ||||
"many times."}, | "many times."}, | ||||
}, | }, | ||||
RPCResult{"amount (numeric) The total amount in " + | RPCResult{"amount (numeric) The total amount in " + | ||||
CURRENCY_UNIT + " received for this label.\n"}, | CURRENCY_UNIT + " received for this label.\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nAmount received by the default label with at least 1 " | "\nAmount received by the default label with at least 1 " | ||||
"confirmation\n" + | "confirmation\n" + | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if (request.fHelp || (request.params.size() > 3)) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getbalance", | "getbalance", | ||||
"\nReturns the total available balance.\n" | "\nReturns the total available balance.\n" | ||||
"The available balance is what the wallet considers " | "The available balance is what the wallet considers " | ||||
"currently spendable, and is\n" | "currently spendable, and is\n" | ||||
"thus affected by options which limit spendability such " | "thus affected by options which limit spendability such " | ||||
"as -spendzeroconfchange.\n", | "as -spendzeroconfchange.\n", | ||||
{ | { | ||||
{"dummy", RPCArg::Type::STR, /* opt */ true, | {"dummy", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"Remains for backward compatibility. Must be excluded or set " | "Remains for backward compatibility. Must be excluded or set " | ||||
"to \"*\"."}, | "to \"*\"."}, | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "0", | ||||
/* default_val */ "0", | |||||
"Only include transactions confirmed at least this " | "Only include transactions confirmed at least this " | ||||
"many times."}, | "many times."}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, | {"include_watchonly", RPCArg::Type::BOOL, | ||||
/* opt */ true, /* default_val */ "false", | /* default */ "false", | ||||
"Also include balance in watch-only addresses (see " | "Also include balance in watch-only addresses (see " | ||||
"'importaddress')"}, | "'importaddress')"}, | ||||
}, | }, | ||||
RPCResult{"amount (numeric) The total amount in " + | RPCResult{"amount (numeric) The total amount in " + | ||||
CURRENCY_UNIT + " received for this wallet.\n"}, | CURRENCY_UNIT + " received for this wallet.\n"}, | ||||
RPCExamples{"\nThe total amount in the wallet with 1 or more " | RPCExamples{"\nThe total amount in the wallet with 1 or more " | ||||
"confirmations\n" + | "confirmations\n" + | ||||
HelpExampleCli("getbalance", "") + | HelpExampleCli("getbalance", "") + | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | static UniValue sendmany(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 5) { | request.params.size() > 5) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"sendmany", | "sendmany", | ||||
"\nSend multiple times. Amounts are double-precision " | "\nSend multiple times. Amounts are double-precision " | ||||
"floating point numbers." + | "floating point numbers." + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"dummy", RPCArg::Type::STR, /* opt */ false, | {"dummy", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"Must be set to \"\" for backwards compatibility.", "\"\""}, | "Must be set to \"\" for backwards compatibility.", "\"\""}, | ||||
{ | { | ||||
"amounts", | "amounts", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"A json object with addresses and amounts", | "A json object with addresses and amounts", | ||||
{ | { | ||||
{"address", RPCArg::Type::AMOUNT, /* opt */ false, | {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The bitcoin address is the key, the numeric " | "The bitcoin address is the key, the numeric " | ||||
"amount (can be string) in " + | "amount (can be string) in " + | ||||
CURRENCY_UNIT + " is the value"}, | CURRENCY_UNIT + " is the value"}, | ||||
}, | }, | ||||
}, | }, | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"Only use the balance confirmed at least this many " | "Only use the balance confirmed at least this many " | ||||
"times."}, | "times."}, | ||||
{"comment", RPCArg::Type::STR, /* opt */ true, | {"comment", RPCArg::Type::STR, | ||||
/* default_val */ "null", "A comment"}, | RPCArg::Optional::OMITTED_NAMED_ARG, "A comment"}, | ||||
{ | { | ||||
"subtractfeefrom", | "subtractfeefrom", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"A json array with addresses.\n" | "A json array with addresses.\n" | ||||
" The fee will be equally " | " The fee will be equally " | ||||
"deducted from the amount of each selected address.\n" | "deducted from the amount of each selected address.\n" | ||||
" Those recipients will " | " Those recipients will " | ||||
"receive less bitcoins than you enter in their " | "receive less bitcoins than you enter in their " | ||||
"corresponding amount field.\n" | "corresponding amount field.\n" | ||||
" If no addresses are " | " If no addresses are " | ||||
"specified here, the sender pays the fee.", | "specified here, the sender pays the fee.", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ true, | {"address", RPCArg::Type::STR, | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED, | ||||
"Subtract fee from this address"}, | "Subtract fee from this address"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"\"txid\" (string) The transaction id for " | "\"txid\" (string) The transaction id for " | ||||
"the send. Only 1 transaction is created regardless of \n" | "the send. Only 1 transaction is created regardless of \n" | ||||
" the number of " | " the number of " | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
"addmultisigaddress", | "addmultisigaddress", | ||||
"\nAdd a nrequired-to-sign multisignature address to the " | "\nAdd a nrequired-to-sign multisignature address to the " | ||||
"wallet. " | "wallet. " | ||||
"Requires a new wallet backup.\n" | "Requires a new wallet backup.\n" | ||||
"Each key is a Bitcoin address or hex-encoded public key.\n" | "Each key is a Bitcoin address or hex-encoded public key.\n" | ||||
"If 'label' is specified (DEPRECATED), assign address to that " | "If 'label' is specified (DEPRECATED), assign address to that " | ||||
"label.\n", | "label.\n", | ||||
{ | { | ||||
{"nrequired", RPCArg::Type::NUM, /* opt */ false, | {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The number of required signatures out of the n keys or " | "The number of required signatures out of the n keys or " | ||||
"addresses."}, | "addresses."}, | ||||
{ | { | ||||
"keys", | "keys", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"A json array of bitcoin addresses or hex-encoded " | "A json array of bitcoin addresses or hex-encoded " | ||||
"public keys", | "public keys", | ||||
{ | { | ||||
{"key", RPCArg::Type::STR, /* opt */ false, | {"key", RPCArg::Type::STR, | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED, | ||||
"bitcoin address or hex-encoded public key"}, | "bitcoin address or hex-encoded public key"}, | ||||
}, | }, | ||||
}, | }, | ||||
{"label", RPCArg::Type::STR, /* opt */ true, | {"label", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"A label to assign the addresses to."}, | "A label to assign the addresses to."}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"address\":\"multisigaddress\", (string) The " | " \"address\":\"multisigaddress\", (string) The " | ||||
"value of the new multisig address.\n" | "value of the new multisig address.\n" | ||||
" \"redeemScript\":\"script\" (string) The " | " \"redeemScript\":\"script\" (string) The " | ||||
"string value of the hex-encoded redemption script.\n" | "string value of the hex-encoded redemption script.\n" | ||||
"}\n"}, | "}\n"}, | ||||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 4) { | if (request.fHelp || request.params.size() > 4) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"listreceivedbyaddress", | "listreceivedbyaddress", | ||||
"\nList balances by receiving address.\n", | "\nList balances by receiving address.\n", | ||||
{ | { | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"The minimum number of confirmations before payments are " | "The minimum number of confirmations before payments are " | ||||
"included."}, | "included."}, | ||||
{"include_empty", RPCArg::Type::BOOL, /* opt */ true, | {"include_empty", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Whether to include addresses that haven't received any " | "Whether to include addresses that haven't received any " | ||||
"payments."}, | "payments."}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, | {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Whether to include watch-only addresses (see " | "Whether to include watch-only addresses (see " | ||||
"'importaddress')."}, | "'importaddress')."}, | ||||
{"address_filter", RPCArg::Type::STR, /* opt */ true, | {"address_filter", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"If present, only return information on this address."}, | "If present, only return information on this address."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[\n" | "[\n" | ||||
" {\n" | " {\n" | ||||
" \"involvesWatchonly\" : true, (bool) Only returned " | " \"involvesWatchonly\" : true, (bool) Only returned " | ||||
"if imported addresses were involved in transaction\n" | "if imported addresses were involved in transaction\n" | ||||
" \"address\" : \"receivingaddress\", (string) The " | " \"address\" : \"receivingaddress\", (string) The " | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 3) { | if (request.fHelp || request.params.size() > 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"listreceivedbylabel", | "listreceivedbylabel", | ||||
"\nList received transactions by label.\n", | "\nList received transactions by label.\n", | ||||
{ | { | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"The minimum number of confirmations before " | "The minimum number of confirmations before " | ||||
"payments are included."}, | "payments are included."}, | ||||
{"include_empty", RPCArg::Type::BOOL, /* opt */ true, | {"include_empty", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Whether to include labels that haven't received " | "Whether to include labels that haven't received " | ||||
"any payments."}, | "any payments."}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, | {"include_watchonly", RPCArg::Type::BOOL, | ||||
/* opt */ true, /* default_val */ "false", | /* default */ "false", | ||||
"Whether to include watch-only addresses (see " | "Whether to include watch-only addresses (see " | ||||
"'importaddress')."}, | "'importaddress')."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[\n" | "[\n" | ||||
" {\n" | " {\n" | ||||
" \"involvesWatchonly\" : true, (bool) Only returned if " | " \"involvesWatchonly\" : true, (bool) Only returned if " | ||||
"imported addresses were involved in transaction\n" | "imported addresses were involved in transaction\n" | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | UniValue listtransactions(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 4) { | if (request.fHelp || request.params.size() > 4) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"listtransactions", | "listtransactions", | ||||
"\nIf a label name is provided, this will return only incoming " | "\nIf a label name is provided, this will return only incoming " | ||||
"transactions paying to addresses with the specified label.\n" | "transactions paying to addresses with the specified label.\n" | ||||
"\nReturns up to 'count' most recent transactions skipping the " | "\nReturns up to 'count' most recent transactions skipping the " | ||||
"first 'from' transactions.\n", | "first 'from' transactions.\n", | ||||
{ | { | ||||
{"label", RPCArg::Type::STR, /* opt */ true, | {"label", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"If set, should be a valid label name to return only incoming " | "If set, should be a valid label name to return only incoming " | ||||
"transactions with the specified label, or \"*\" to disable " | "transactions with the specified label, or \"*\" to disable " | ||||
"filtering and return all transactions."}, | "filtering and return all transactions."}, | ||||
{"count", RPCArg::Type::NUM, /* opt */ true, | {"count", RPCArg::Type::NUM, /* default */ "10", | ||||
/* default_val */ "10", | |||||
"The number of transactions to return"}, | "The number of transactions to return"}, | ||||
{"skip", RPCArg::Type::NUM, /* opt */ true, | {"skip", RPCArg::Type::NUM, /* default */ "0", | ||||
/* default_val */ "0", "The number of transactions to skip"}, | "The number of transactions to skip"}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, | {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Include transactions to watch-only addresses (see " | "Include transactions to watch-only addresses (see " | ||||
"'importaddress')"}, | "'importaddress')"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[\n" | "[\n" | ||||
" {\n" | " {\n" | ||||
" \"address\":\"address\", (string) The bitcoin address " | " \"address\":\"address\", (string) The bitcoin address " | ||||
"of the transaction.\n" | "of the transaction.\n" | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 4) { | ||||
"\nGet all transactions in blocks since block [blockhash], or all " | "\nGet all transactions in blocks since block [blockhash], or all " | ||||
"transactions if omitted.\n" | "transactions if omitted.\n" | ||||
"If \"blockhash\" is no longer a part of the main chain, " | "If \"blockhash\" is no longer a part of the main chain, " | ||||
"transactions from the fork point onward are included.\n" | "transactions from the fork point onward are included.\n" | ||||
"Additionally, if include_removed is set, transactions affecting " | "Additionally, if include_removed is set, transactions affecting " | ||||
"the wallet which were removed are returned in the \"removed\" " | "the wallet which were removed are returned in the \"removed\" " | ||||
"array.\n", | "array.\n", | ||||
{ | { | ||||
{"blockhash", RPCArg::Type::STR, /* opt */ true, | {"blockhash", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"If set, the block hash to list transactions since, otherwise " | "If set, the block hash to list transactions since, otherwise " | ||||
"list all transactions."}, | "list all transactions."}, | ||||
{"target_confirmations", RPCArg::Type::NUM, /* opt */ true, | {"target_confirmations", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", | |||||
"Return the nth block hash from the main chain. e.g. 1 " | "Return the nth block hash from the main chain. e.g. 1 " | ||||
"would mean the best block hash. Note: this is not used " | "would mean the best block hash. Note: this is not used " | ||||
"as a filter, but only affects [lastblock] in the return " | "as a filter, but only affects [lastblock] in the return " | ||||
"value"}, | "value"}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, | {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Include transactions to watch-only addresses (see " | "Include transactions to watch-only addresses (see " | ||||
"'importaddress')"}, | "'importaddress')"}, | ||||
{"include_removed", RPCArg::Type::BOOL, /* opt */ true, | {"include_removed", RPCArg::Type::BOOL, /* default */ "true", | ||||
/* default_val */ "true", | |||||
"Show transactions that were removed due to a reorg in " | "Show transactions that were removed due to a reorg in " | ||||
"the \"removed\" array\n" | "the \"removed\" array\n" | ||||
" " | " " | ||||
" (not guaranteed to work on pruned nodes)"}, | " (not guaranteed to work on pruned nodes)"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | "{\n" | ||||
" \"transactions\": [\n" | " \"transactions\": [\n" | ||||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | static UniValue gettransaction(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"gettransaction", | "gettransaction", | ||||
"\nGet detailed information about in-wallet transaction " | "\nGet detailed information about in-wallet transaction " | ||||
"<txid>\n", | "<txid>\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR, /* opt */ false, | {"txid", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction id"}, | "The transaction id"}, | ||||
{"include_watchonly", RPCArg::Type::BOOL, | {"include_watchonly", RPCArg::Type::BOOL, | ||||
/* opt */ true, /* default_val */ "false", | /* default */ "false", | ||||
"Whether to include watch-only addresses in " | "Whether to include watch-only addresses in " | ||||
"balance calculation and details[]"}, | "balance calculation and details[]"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | "{\n" | ||||
" \"amount\" : x.xxx, (numeric) The transaction amount " | " \"amount\" : x.xxx, (numeric) The transaction amount " | ||||
"in " + | "in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"This will mark this transaction and all its in-wallet descendants " | "This will mark this transaction and all its in-wallet descendants " | ||||
"as abandoned which will allow\n" | "as abandoned which will allow\n" | ||||
"for their inputs to be respent. It can be used to replace " | "for their inputs to be respent. It can be used to replace " | ||||
"\"stuck\" or evicted transactions.\n" | "\"stuck\" or evicted transactions.\n" | ||||
"It only works on transactions which are not included in a block " | "It only works on transactions which are not included in a block " | ||||
"and are not currently in the mempool.\n" | "and are not currently in the mempool.\n" | ||||
"It has no effect on transactions which are already abandoned.\n", | "It has no effect on transactions which are already abandoned.\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction id"}, | "The transaction id"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("abandontransaction", | RPCExamples{HelpExampleCli("abandontransaction", | ||||
"\"1075db55d416d3ca199f55b6084" | "\"1075db55d416d3ca199f55b6084" | ||||
"e2115b9345e16c5cf302fc80e9d5f" | "e2115b9345e16c5cf302fc80e9d5f" | ||||
"bf5d48d\"") + | "bf5d48d\"") + | ||||
HelpExampleRpc("abandontransaction", | HelpExampleRpc("abandontransaction", | ||||
"\"1075db55d416d3ca199f55b6084" | "\"1075db55d416d3ca199f55b6084" | ||||
Show All 35 Lines | static UniValue backupwallet(const Config &config, | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"backupwallet", | "backupwallet", | ||||
"\nSafely copies current wallet file to destination, " | "\nSafely copies current wallet file to destination, " | ||||
"which can be a directory or a path with filename.\n", | "which can be a directory or a path with filename.\n", | ||||
{ | { | ||||
{"destination", RPCArg::Type::STR, /* opt */ false, | {"destination", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The destination directory or file"}, | "The destination directory or file"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("backupwallet", "\"backup.dat\"") + | RPCExamples{HelpExampleCli("backupwallet", "\"backup.dat\"") + | ||||
HelpExampleRpc("backupwallet", "\"backup.dat\"")}, | HelpExampleRpc("backupwallet", "\"backup.dat\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 21 Lines | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"keypoolrefill", | "keypoolrefill", | ||||
"\nFills the keypool." + HelpRequiringPassphrase(pwallet) + "\n", | "\nFills the keypool." + HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"newsize", RPCArg::Type::NUM, /* opt */ true, | {"newsize", RPCArg::Type::NUM, /* default */ "100", | ||||
/* default_val */ "100", "The new keypool size"}, | "The new keypool size"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("keypoolrefill", "") + | RPCExamples{HelpExampleCli("keypoolrefill", "") + | ||||
HelpExampleRpc("keypoolrefill", "")}, | HelpExampleRpc("keypoolrefill", "")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 2)) { | ||||
"seconds.\n" | "seconds.\n" | ||||
"This is needed prior to performing transactions related to " | "This is needed prior to performing transactions related to " | ||||
"private keys such as sending bitcoins\n" | "private keys such as sending bitcoins\n" | ||||
"\nNote:\n" | "\nNote:\n" | ||||
"Issuing the walletpassphrase command while the wallet is already " | "Issuing the walletpassphrase command while the wallet is already " | ||||
"unlocked will set a new unlock\n" | "unlocked will set a new unlock\n" | ||||
"time that overrides the old one.\n", | "time that overrides the old one.\n", | ||||
{ | { | ||||
{"passphrase", RPCArg::Type::STR, /* opt */ false, | {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The wallet passphrase"}, | "The wallet passphrase"}, | ||||
{"timeout", RPCArg::Type::NUM, /* opt */ false, | {"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The time to keep the decryption key in seconds; capped " | "The time to keep the decryption key in seconds; capped " | ||||
"at 100000000 (~3 years)."}, | "at 100000000 (~3 years)."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nUnlock the wallet for 60 seconds\n" + | "\nUnlock the wallet for 60 seconds\n" + | ||||
HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") + | HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") + | ||||
"\nLock the wallet again (before 60 seconds)\n" + | "\nLock the wallet again (before 60 seconds)\n" + | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | static UniValue walletpassphrasechange(const Config &config, | ||||
} | } | ||||
if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 2)) { | if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 2)) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"walletpassphrasechange", | "walletpassphrasechange", | ||||
"\nChanges the wallet passphrase from 'oldpassphrase' to " | "\nChanges the wallet passphrase from 'oldpassphrase' to " | ||||
"'newpassphrase'.\n", | "'newpassphrase'.\n", | ||||
{ | { | ||||
{"oldpassphrase", RPCArg::Type::STR, /* opt */ false, | {"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The current passphrase"}, | "The current passphrase"}, | ||||
{"newpassphrase", RPCArg::Type::STR, /* opt */ false, | {"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The new passphrase"}, | "The new passphrase"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("walletpassphrasechange", | RPCExamples{HelpExampleCli("walletpassphrasechange", | ||||
"\"old one\" \"new one\"") + | "\"old one\" \"new one\"") + | ||||
HelpExampleRpc("walletpassphrasechange", | HelpExampleRpc("walletpassphrasechange", | ||||
"\"old one\", \"new one\"")}, | "\"old one\", \"new one\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (!pwallet->IsCrypted() && | ||||
"sending or signing \n" | "sending or signing \n" | ||||
"will require the passphrase to be set prior the making these " | "will require the passphrase to be set prior the making these " | ||||
"calls.\n" | "calls.\n" | ||||
"Use the walletpassphrase call for this, and then walletlock " | "Use the walletpassphrase call for this, and then walletlock " | ||||
"call.\n" | "call.\n" | ||||
"If the wallet is already encrypted, use the " | "If the wallet is already encrypted, use the " | ||||
"walletpassphrasechange call.\n", | "walletpassphrasechange call.\n", | ||||
{ | { | ||||
{"passphrase", RPCArg::Type::STR, /* opt */ false, | {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The pass phrase to encrypt the wallet with. It must be " | "The pass phrase to encrypt the wallet with. It must be " | ||||
"at least 1 character, but should be long."}, | "at least 1 character, but should be long."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nEncrypt your wallet\n" + | "\nEncrypt your wallet\n" + | ||||
HelpExampleCli("encryptwallet", "\"my pass phrase\"") + | HelpExampleCli("encryptwallet", "\"my pass phrase\"") + | ||||
"\nNow set the passphrase to use the wallet, such as for " | "\nNow set the passphrase to use the wallet, such as for " | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"A locked transaction output will not be chosen by automatic coin " | "A locked transaction output will not be chosen by automatic coin " | ||||
"selection, when spending bitcoins.\n" | "selection, when spending bitcoins.\n" | ||||
"Locks are stored in memory only. Nodes start with zero locked " | "Locks are stored in memory only. Nodes start with zero locked " | ||||
"outputs, and the locked output list\n" | "outputs, and the locked output list\n" | ||||
"is always cleared (by virtue of process exit) when a node stops " | "is always cleared (by virtue of process exit) when a node stops " | ||||
"or fails.\n" | "or fails.\n" | ||||
"Also see the listunspent call\n", | "Also see the listunspent call\n", | ||||
{ | { | ||||
{"unlock", RPCArg::Type::BOOL, /* opt */ false, | {"unlock", RPCArg::Type::BOOL, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"Whether to unlock (true) or lock (false) the specified " | "Whether to unlock (true) or lock (false) the specified " | ||||
"transactions"}, | "transactions"}, | ||||
{ | { | ||||
"transactions", | "transactions", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* default */ "empty array", | ||||
/* default_val */ "empty array", | |||||
"A json array of objects. Each object the txid (string) " | "A json array of objects. Each object the txid (string) " | ||||
"vout (numeric).", | "vout (numeric).", | ||||
{ | { | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"", | "", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, | {"txid", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "The transaction id"}, | ||||
"The transaction id"}, | {"vout", RPCArg::Type::NUM, | ||||
{"vout", RPCArg::Type::NUM, /* opt */ false, | RPCArg::Optional::NO, "The output number"}, | ||||
/* default_val */ "", "The output number"}, | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
RPCResult{"true|false (boolean) Whether the command was " | RPCResult{"true|false (boolean) Whether the command was " | ||||
"successful or not\n"}, | "successful or not\n"}, | ||||
RPCExamples{"\nList the unspent transactions\n" + | RPCExamples{"\nList the unspent transactions\n" + | ||||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | static UniValue settxfee(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 1) { | request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"settxfee", | "settxfee", | ||||
"\nSet the transaction fee per kB for this wallet. Overrides the " | "\nSet the transaction fee per kB for this wallet. Overrides the " | ||||
"global -paytxfee command line parameter.\n", | "global -paytxfee command line parameter.\n", | ||||
{ | { | ||||
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, | {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The transaction fee in " + CURRENCY_UNIT + "/kB"}, | "The transaction fee in " + CURRENCY_UNIT + "/kB"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"true|false (boolean) Returns true if successful\n"}, | "true|false (boolean) Returns true if successful\n"}, | ||||
RPCExamples{HelpExampleCli("settxfee", "0.00001") + | RPCExamples{HelpExampleCli("settxfee", "0.00001") + | ||||
HelpExampleRpc("settxfee", "0.00001")}, | HelpExampleRpc("settxfee", "0.00001")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"loadwallet", | "loadwallet", | ||||
"\nLoads a wallet from a wallet file or directory." | "\nLoads a wallet from a wallet file or directory." | ||||
"\nNote that all wallet command-line options used when starting " | "\nNote that all wallet command-line options used when starting " | ||||
"bitcoind will be" | "bitcoind will be" | ||||
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, " | "\napplied to the new wallet (eg -zapwallettxes, upgradewallet, " | ||||
"rescan, etc).\n", | "rescan, etc).\n", | ||||
{ | { | ||||
{"filename", RPCArg::Type::STR, /* opt */ false, | {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The wallet directory or .dat file."}, | "The wallet directory or .dat file."}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"name\" : <wallet_name>, (string) The " | " \"name\" : <wallet_name>, (string) The " | ||||
"wallet name if loaded successfully.\n" | "wallet name if loaded successfully.\n" | ||||
" \"warning\" : <warning>, (string) Warning " | " \"warning\" : <warning>, (string) Warning " | ||||
"message if wallet was not loaded cleanly.\n" | "message if wallet was not loaded cleanly.\n" | ||||
"}\n"}, | "}\n"}, | ||||
RPCExamples{HelpExampleCli("loadwallet", "\"test.dat\"") + | RPCExamples{HelpExampleCli("loadwallet", "\"test.dat\"") + | ||||
Show All 37 Lines | |||||
static UniValue createwallet(const Config &config, | static UniValue createwallet(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"createwallet", | "createwallet", | ||||
"\nCreates and loads a new wallet.\n", | "\nCreates and loads a new wallet.\n", | ||||
{ | { | ||||
{"wallet_name", RPCArg::Type::STR, /* opt */ false, | {"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The name for the new wallet. If this is a path, " | "The name for the new wallet. If this is a path, " | ||||
"the wallet will be created at the path location."}, | "the wallet will be created at the path location."}, | ||||
{"disable_private_keys", RPCArg::Type::BOOL, | {"disable_private_keys", RPCArg::Type::BOOL, | ||||
/* opt */ true, /* default_val */ "false", | /* default */ "false", | ||||
"Disable the possibility of private keys (only " | "Disable the possibility of private keys (only " | ||||
"watchonlys are possible in this mode)."}, | "watchonlys are possible in this mode)."}, | ||||
{"blank", RPCArg::Type::BOOL, /* opt */ true, | {"blank", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Create a blank wallet. A blank wallet has no keys " | "Create a blank wallet. A blank wallet has no keys " | ||||
"or HD seed. One can be set using sethdseed.\n"}, | "or HD seed. One can be set using sethdseed.\n"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | "{\n" | ||||
" \"name\" : <wallet_name>, (string) The wallet " | " \"name\" : <wallet_name>, (string) The wallet " | ||||
"name if created successfully. If the wallet was created using " | "name if created successfully. If the wallet was created using " | ||||
"a full path, the wallet_name will be the full path.\n" | "a full path, the wallet_name will be the full path.\n" | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | static UniValue unloadwallet(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"unloadwallet", | "unloadwallet", | ||||
"Unloads the wallet referenced by the request endpoint " | "Unloads the wallet referenced by the request endpoint " | ||||
"otherwise unloads the wallet specified in the argument.\n" | "otherwise unloads the wallet specified in the argument.\n" | ||||
"Specifying the wallet name on a wallet endpoint is invalid.", | "Specifying the wallet name on a wallet endpoint is invalid.", | ||||
{ | { | ||||
{"wallet_name", RPCArg::Type::STR, /* opt */ true, | {"wallet_name", RPCArg::Type::STR, | ||||
/* default_val */ "the wallet name from the RPC request", | /* default */ "the wallet name from the RPC request", | ||||
"The name of the wallet to unload."}, | "The name of the wallet to unload."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("unloadwallet", "wallet_name") + | RPCExamples{HelpExampleCli("unloadwallet", "wallet_name") + | ||||
HelpExampleRpc("unloadwallet", "wallet_name")}, | HelpExampleRpc("unloadwallet", "wallet_name")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 38 Lines | static UniValue listunspent(const Config &config, | ||||
if (request.fHelp || request.params.size() > 5) { | if (request.fHelp || request.params.size() > 5) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"listunspent", | "listunspent", | ||||
"\nReturns array of unspent transaction outputs\n" | "\nReturns array of unspent transaction outputs\n" | ||||
"with between minconf and maxconf (inclusive) confirmations.\n" | "with between minconf and maxconf (inclusive) confirmations.\n" | ||||
"Optionally filter to only include txouts paid to specified " | "Optionally filter to only include txouts paid to specified " | ||||
"addresses.\n", | "addresses.\n", | ||||
{ | { | ||||
{"minconf", RPCArg::Type::NUM, /* opt */ true, | {"minconf", RPCArg::Type::NUM, /* default */ "1", | ||||
/* default_val */ "1", "The minimum confirmations to filter"}, | "The minimum confirmations to filter"}, | ||||
{"maxconf", RPCArg::Type::NUM, /* opt */ true, | {"maxconf", RPCArg::Type::NUM, /* default */ "9999999", | ||||
/* default_val */ "9999999", | |||||
"The maximum confirmations to filter"}, | "The maximum confirmations to filter"}, | ||||
{ | { | ||||
"addresses", | "addresses", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* default */ "empty array", | ||||
/* default_val */ "empty array", | |||||
"A json array of bitcoin addresses to filter", | "A json array of bitcoin addresses to filter", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ true, | {"address", RPCArg::Type::STR, | ||||
/* default_val */ "", "bitcoin address"}, | RPCArg::Optional::OMITTED, "bitcoin address"}, | ||||
}, | }, | ||||
}, | }, | ||||
{"include_unsafe", RPCArg::Type::BOOL, /* opt */ true, | {"include_unsafe", RPCArg::Type::BOOL, /* default */ "true", | ||||
/* default_val */ "true", | |||||
"Include outputs that are not safe to spend\n" | "Include outputs that are not safe to spend\n" | ||||
" See description of \"safe\" attribute " | " See description of \"safe\" attribute " | ||||
"below."}, | "below."}, | ||||
{"query_options", | {"query_options", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"JSON with query options", | "JSON with query options", | ||||
{ | { | ||||
{"minimumAmount", RPCArg::Type::AMOUNT, /* opt */ true, | {"minimumAmount", RPCArg::Type::AMOUNT, /* default */ "0", | ||||
/* default_val */ "0", | |||||
"Minimum value of each UTXO in " + CURRENCY_UNIT + ""}, | "Minimum value of each UTXO in " + CURRENCY_UNIT + ""}, | ||||
{"maximumAmount", RPCArg::Type::AMOUNT, /* opt */ true, | {"maximumAmount", RPCArg::Type::AMOUNT, | ||||
/* default_val */ "unlimited", | /* default */ "unlimited", | ||||
"Maximum value of each UTXO in " + CURRENCY_UNIT + ""}, | "Maximum value of each UTXO in " + CURRENCY_UNIT + ""}, | ||||
{"maximumCount", RPCArg::Type::NUM, /* opt */ true, | {"maximumCount", RPCArg::Type::NUM, | ||||
/* default_val */ "unlimited", "Maximum number of UTXOs"}, | /* default */ "unlimited", "Maximum number of UTXOs"}, | ||||
{"minimumSumAmount", RPCArg::Type::AMOUNT, | {"minimumSumAmount", RPCArg::Type::AMOUNT, | ||||
/* opt */ true, /* default_val */ "unlimited", | /* default */ "unlimited", | ||||
"Minimum sum value of all UTXOs in " + CURRENCY_UNIT + | "Minimum sum value of all UTXOs in " + CURRENCY_UNIT + | ||||
""}, | ""}, | ||||
}, | }, | ||||
"query_options"}, | "query_options"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[ (array of json object)\n" | "[ (array of json object)\n" | ||||
" {\n" | " {\n" | ||||
▲ Show 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"scripts must be\n" | "scripts must be\n" | ||||
"in the wallet using importaddress or addmultisigaddress (to " | "in the wallet using importaddress or addmultisigaddress (to " | ||||
"calculate fees).\n" | "calculate fees).\n" | ||||
"You can see whether this is the case by checking the \"solvable\" " | "You can see whether this is the case by checking the \"solvable\" " | ||||
"field in the listunspent output.\n" | "field in the listunspent output.\n" | ||||
"Only pay-to-pubkey, multisig, and P2SH versions thereof are " | "Only pay-to-pubkey, multisig, and P2SH versions thereof are " | ||||
"currently supported for watch-only\n", | "currently supported for watch-only\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The hex string of the raw transaction"}, | "The hex string of the raw transaction"}, | ||||
{"options", | {"options", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"for backward compatibility: passing in a true instead of an " | "for backward compatibility: passing in a true instead of an " | ||||
"object will result in {\"includeWatching\":true}", | "object will result in {\"includeWatching\":true}", | ||||
{ | { | ||||
{"changeAddress", RPCArg::Type::STR, /* opt */ true, | {"changeAddress", RPCArg::Type::STR, | ||||
/* default_val */ "pool address", | /* default */ "pool address", | ||||
"The bitcoin address to receive the change"}, | "The bitcoin address to receive the change"}, | ||||
{"changePosition", RPCArg::Type::NUM, /* opt */ true, | {"changePosition", RPCArg::Type::NUM, /* default */ "", | ||||
/* default_val */ "", "The index of the change output"}, | "The index of the change output"}, | ||||
{"includeWatching", RPCArg::Type::BOOL, /* opt */ true, | {"includeWatching", RPCArg::Type::BOOL, | ||||
/* default_val */ "false", | /* default */ "false", | ||||
"Also select inputs which are watch only"}, | "Also select inputs which are watch only"}, | ||||
{"lockUnspents", RPCArg::Type::BOOL, /* opt */ true, | {"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Lock selected unspent outputs"}, | "Lock selected unspent outputs"}, | ||||
{"feeRate", RPCArg::Type::AMOUNT, /* opt */ true, | {"feeRate", RPCArg::Type::AMOUNT, /* default */ | ||||
/* default_val */ | |||||
"not set: makes wallet determine the fee", | "not set: makes wallet determine the fee", | ||||
"Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, | "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, | ||||
{ | { | ||||
"subtractFeeFromOutputs", | "subtractFeeFromOutputs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* default */ "empty array", | ||||
/* default_val */ "empty array", | |||||
"A json array of integers.\n" | "A json array of integers.\n" | ||||
" The fee will be " | " The fee will be " | ||||
"equally deducted from the amount of each " | "equally deducted from the amount of each " | ||||
"specified output.\n" | "specified output.\n" | ||||
" Those recipients " | " Those recipients " | ||||
"will receive less bitcoins than you enter in " | "will receive less bitcoins than you enter in " | ||||
"their corresponding amount field.\n" | "their corresponding amount field.\n" | ||||
" If no outputs are " | " If no outputs are " | ||||
"specified here, the sender pays the fee.", | "specified here, the sender pays the fee.", | ||||
{ | { | ||||
{"vout_index", RPCArg::Type::NUM, | {"vout_index", RPCArg::Type::NUM, | ||||
/* opt */ true, /* default_val */ "", | RPCArg::Optional::OMITTED, | ||||
"The zero-based output index, before a " | "The zero-based output index, before a " | ||||
"change output is added."}, | "change output is added."}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
"options"}, | "options"}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"signrawtransactionwithwallet", | "signrawtransactionwithwallet", | ||||
"\nSign inputs for raw transaction (serialized, hex-encoded).\n" | "\nSign inputs for raw transaction (serialized, hex-encoded).\n" | ||||
"The second optional argument (may be null) is an array of " | "The second optional argument (may be null) is an array of " | ||||
"previous transaction outputs that\n" | "previous transaction outputs that\n" | ||||
"this transaction depends on but may not yet be in the block " | "this transaction depends on but may not yet be in the block " | ||||
"chain.\n" + | "chain.\n" + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR, /* opt */ false, | {"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction hex string"}, | "The transaction hex string"}, | ||||
{ | { | ||||
"prevtxs", | "prevtxs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"A json array of previous dependent transaction outputs", | "A json array of previous dependent transaction outputs", | ||||
{ | { | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ false, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"", | "", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, | {"txid", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "The transaction id"}, | ||||
"The transaction id"}, | {"vout", RPCArg::Type::NUM, | ||||
{"vout", RPCArg::Type::NUM, /* opt */ false, | RPCArg::Optional::NO, "The output number"}, | ||||
/* default_val */ "", "The output number"}, | |||||
{"scriptPubKey", RPCArg::Type::STR_HEX, | {"scriptPubKey", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "script key"}, | ||||
"script key"}, | |||||
{"redeemScript", RPCArg::Type::STR_HEX, | {"redeemScript", RPCArg::Type::STR_HEX, | ||||
/* opt */ true, /* default_val */ "omitted", | RPCArg::Optional::OMITTED, | ||||
"(required for P2SH)"}, | "(required for P2SH)"}, | ||||
{"amount", RPCArg::Type::AMOUNT, | {"amount", RPCArg::Type::AMOUNT, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "The amount spent"}, | ||||
"The amount spent"}, | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"sighashtype", RPCArg::Type::STR, /* opt */ true, | {"sighashtype", RPCArg::Type::STR, /* default */ "ALL|FORKID", | ||||
/* default_val */ "ALL|FORKID", | |||||
"The signature hash type. Must be one of\n" | "The signature hash type. Must be one of\n" | ||||
" \"ALL|FORKID\"\n" | " \"ALL|FORKID\"\n" | ||||
" \"NONE|FORKID\"\n" | " \"NONE|FORKID\"\n" | ||||
" \"SINGLE|FORKID\"\n" | " \"SINGLE|FORKID\"\n" | ||||
" \"ALL|FORKID|ANYONECANPAY\"\n" | " \"ALL|FORKID|ANYONECANPAY\"\n" | ||||
" \"NONE|FORKID|ANYONECANPAY\"\n" | " \"NONE|FORKID|ANYONECANPAY\"\n" | ||||
" \"SINGLE|FORKID|ANYONECANPAY\""}, | " \"SINGLE|FORKID|ANYONECANPAY\""}, | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | UniValue generate(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"generate", | "generate", | ||||
"\nMine up to nblocks blocks immediately (before the RPC call " | "\nMine up to nblocks blocks immediately (before the RPC call " | ||||
"returns) to an address in the wallet.\n", | "returns) to an address in the wallet.\n", | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ false, | {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"How many blocks are generated immediately."}, | "How many blocks are generated immediately."}, | ||||
{"maxtries", RPCArg::Type::NUM, /* opt */ true, | {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", | ||||
/* default_val */ "1000000", "How many iterations to try."}, | "How many iterations to try."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[ blockhashes ] (array) hashes of blocks generated\n"}, | "[ blockhashes ] (array) hashes of blocks generated\n"}, | ||||
RPCExamples{"\nGenerate 11 blocks\n" + | RPCExamples{"\nGenerate 11 blocks\n" + | ||||
HelpExampleCli("generate", "11")}} | HelpExampleCli("generate", "11")}} | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
Show All 40 Lines | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"rescanblockchain", | "rescanblockchain", | ||||
"\nRescan the local blockchain for wallet related transactions.\n", | "\nRescan the local blockchain for wallet related transactions.\n", | ||||
{ | { | ||||
{"start_height", RPCArg::Type::NUM, /* opt */ true, | {"start_height", RPCArg::Type::NUM, /* default */ "0", | ||||
/* default_val */ "0", | |||||
"block height where the rescan should start"}, | "block height where the rescan should start"}, | ||||
{"stop_height", RPCArg::Type::NUM, /* opt */ true, | {"stop_height", RPCArg::Type::NUM, | ||||
/* default_val */ "tip height", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"the last block height that should be scanned"}, | "the last block height that should be scanned"}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"start_height\" (numeric) The block height where " | " \"start_height\" (numeric) The block height where " | ||||
"the rescan started (the requested height or 0\n" | "the rescan started (the requested height or 0\n" | ||||
" \"stop_height\" (numeric) The height of the last " | " \"stop_height\" (numeric) The height of the last " | ||||
"rescanned block. May be null in rare cases if there was " | "rescanned block. May be null in rare cases if there was " | ||||
"a reorg and the call didn't scan any blocks because " | "a reorg and the call didn't scan any blocks because " | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | UniValue getaddressinfo(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getaddressinfo", | "getaddressinfo", | ||||
"\nReturn information about the given bitcoin address. Some " | "\nReturn information about the given bitcoin address. Some " | ||||
"information requires the address\n" | "information requires the address\n" | ||||
"to be in the wallet.\n", | "to be in the wallet.\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The bitcoin address to get the information of."}, | "The bitcoin address to get the information of."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | "{\n" | ||||
" \"address\" : \"address\", (string) The bitcoin " | " \"address\" : \"address\", (string) The bitcoin " | ||||
"address validated\n" | "address validated\n" | ||||
" \"scriptPubKey\" : \"hex\", (string) The hex-encoded " | " \"scriptPubKey\" : \"hex\", (string) The hex-encoded " | ||||
"scriptPubKey generated by the address\n" | "scriptPubKey generated by the address\n" | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | UniValue getaddressesbylabel(const Config &config, | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getaddressesbylabel", | "getaddressesbylabel", | ||||
"\nReturns the list of addresses assigned the specified " | "\nReturns the list of addresses assigned the specified " | ||||
"label.\n", | "label.\n", | ||||
{ | { | ||||
{"label", RPCArg::Type::STR, /* opt */ false, | {"label", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The label."}, | "The label."}, | ||||
}, | }, | ||||
RPCResult{"{ (json object with addresses as keys)\n" | RPCResult{"{ (json object with addresses as keys)\n" | ||||
" \"address\": { (json object with information about " | " \"address\": { (json object with information about " | ||||
"address)\n" | "address)\n" | ||||
" \"purpose\": \"string\" (string) Purpose of " | " \"purpose\": \"string\" (string) Purpose of " | ||||
"address (\"send\" for sending address, \"receive\" for " | "address (\"send\" for sending address, \"receive\" for " | ||||
"receiving address)\n" | "receiving address)\n" | ||||
" },...\n" | " },...\n" | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | UniValue listlabels(const Config &config, const JSONRPCRequest &request) { | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"listlabels", | "listlabels", | ||||
"\nReturns the list of all labels, or labels that are " | "\nReturns the list of all labels, or labels that are " | ||||
"assigned to addresses with a specific purpose.\n", | "assigned to addresses with a specific purpose.\n", | ||||
{ | { | ||||
{"purpose", RPCArg::Type::STR, /* opt */ true, | {"purpose", RPCArg::Type::STR, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"Address purpose to list labels for ('send','receive'). An " | "Address purpose to list labels for ('send','receive'). An " | ||||
"empty string is the same as not providing this argument."}, | "empty string is the same as not providing this argument."}, | ||||
}, | }, | ||||
RPCResult{"[ (json array of string)\n" | RPCResult{"[ (json array of string)\n" | ||||
" \"label\", (string) Label name\n" | " \"label\", (string) Label name\n" | ||||
" ...\n" | " ...\n" | ||||
"]\n"}, | "]\n"}, | ||||
RPCExamples{"\nList all labels\n" + | RPCExamples{"\nList all labels\n" + | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
"\nSet or generate a new HD wallet seed. Non-HD wallets will not " | "\nSet or generate a new HD wallet seed. Non-HD wallets will not " | ||||
"be upgraded to being a HD wallet. Wallets that are already\n" | "be upgraded to being a HD wallet. Wallets that are already\n" | ||||
"HD will have a new HD seed set so that new keys added to the " | "HD will have a new HD seed set so that new keys added to the " | ||||
"keypool will be derived from this new seed.\n" | "keypool will be derived from this new seed.\n" | ||||
"\nNote that you will need to MAKE A NEW BACKUP of your wallet " | "\nNote that you will need to MAKE A NEW BACKUP of your wallet " | ||||
"after setting the HD wallet seed.\n" + | "after setting the HD wallet seed.\n" + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"newkeypool", RPCArg::Type::BOOL, /* opt */ true, | {"newkeypool", RPCArg::Type::BOOL, /* default */ "true", | ||||
/* default_val */ "true", | |||||
"Whether to flush old unused addresses, including change " | "Whether to flush old unused addresses, including change " | ||||
"addresses, from the keypool and regenerate it.\n" | "addresses, from the keypool and regenerate it.\n" | ||||
" If true, the next address from " | " If true, the next address from " | ||||
"getnewaddress and change address from getrawchangeaddress " | "getnewaddress and change address from getrawchangeaddress " | ||||
"will be from this new seed.\n" | "will be from this new seed.\n" | ||||
" If false, addresses (including " | " If false, addresses (including " | ||||
"change addresses if the wallet already had HD Chain Split " | "change addresses if the wallet already had HD Chain Split " | ||||
"enabled) from the existing\n" | "enabled) from the existing\n" | ||||
" keypool will be used until it " | " keypool will be used until it " | ||||
"has been depleted."}, | "has been depleted."}, | ||||
{"seed", RPCArg::Type::STR, /* opt */ true, | {"seed", RPCArg::Type::STR, /* default */ "random seed", | ||||
/* default_val */ "random seed", | |||||
"The WIF private key to use as the new HD seed.\n" | "The WIF private key to use as the new HD seed.\n" | ||||
" The seed value can be retrieved " | " The seed value can be retrieved " | ||||
"using the dumpwallet command. It is the private key marked " | "using the dumpwallet command. It is the private key marked " | ||||
"hdseed=1"}, | "hdseed=1"}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("sethdseed", "") + | RPCExamples{HelpExampleCli("sethdseed", "") + | ||||
HelpExampleCli("sethdseed", "false") + | HelpExampleCli("sethdseed", "false") + | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static UniValue walletprocesspsbt(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 4) { | request.params.size() > 4) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"walletprocesspsbt", | "walletprocesspsbt", | ||||
"\nUpdate a PSBT with input information from our wallet and then " | "\nUpdate a PSBT with input information from our wallet and then " | ||||
"sign inputs that we can sign for." + | "sign inputs that we can sign for." + | ||||
HelpRequiringPassphrase(pwallet) + "\n", | HelpRequiringPassphrase(pwallet) + "\n", | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR, /* opt */ false, | {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction base64 string"}, | "The transaction base64 string"}, | ||||
{"sign", RPCArg::Type::BOOL, /* opt */ true, | {"sign", RPCArg::Type::BOOL, /* default */ "true", | ||||
/* default_val */ "true", | |||||
"Also sign the transaction when updating"}, | "Also sign the transaction when updating"}, | ||||
{"sighashtype", RPCArg::Type::STR, /* opt */ true, | {"sighashtype", RPCArg::Type::STR, /* default */ "ALL|FORKID", | ||||
/* default_val */ "ALL|FORKID", | |||||
"The signature hash type to sign with if not specified by " | "The signature hash type to sign with if not specified by " | ||||
"the PSBT. Must be one of\n" | "the PSBT. Must be one of\n" | ||||
" \"ALL|FORKID\"\n" | " \"ALL|FORKID\"\n" | ||||
" \"NONE|FORKID\"\n" | " \"NONE|FORKID\"\n" | ||||
" \"SINGLE|FORKID\"\n" | " \"SINGLE|FORKID\"\n" | ||||
" \"ALL|FORKID|ANYONECANPAY\"\n" | " \"ALL|FORKID|ANYONECANPAY\"\n" | ||||
" \"NONE|FORKID|ANYONECANPAY\"\n" | " \"NONE|FORKID|ANYONECANPAY\"\n" | ||||
" \"SINGLE|FORKID|ANYONECANPAY\""}, | " \"SINGLE|FORKID|ANYONECANPAY\""}, | ||||
{"bip32derivs", RPCArg::Type::BOOL, /* opt */ true, | {"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"If true, includes the BIP 32 derivation paths for public " | "If true, includes the BIP 32 derivation paths for public " | ||||
"keys if we know them"}, | "keys if we know them"}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"psbt\" : \"value\", (string) The " | " \"psbt\" : \"value\", (string) The " | ||||
"base64-encoded partially signed transaction\n" | "base64-encoded partially signed transaction\n" | ||||
" \"complete\" : true|false, (boolean) If the " | " \"complete\" : true|false, (boolean) If the " | ||||
"transaction has a complete set of signatures\n" | "transaction has a complete set of signatures\n" | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
"\nCreates and funds a transaction in the Partially Signed " | "\nCreates and funds a transaction in the Partially Signed " | ||||
"Transaction format. Inputs will be added if supplied inputs are " | "Transaction format. Inputs will be added if supplied inputs are " | ||||
"not enough\n" | "not enough\n" | ||||
"Implements the Creator and Updater roles.\n", | "Implements the Creator and Updater roles.\n", | ||||
{ | { | ||||
{ | { | ||||
"inputs", | "inputs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"A json array of json objects", | "A json array of json objects", | ||||
{ | { | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ false, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"", | "", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, | {"txid", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "The transaction id"}, | ||||
"The transaction id"}, | {"vout", RPCArg::Type::NUM, | ||||
{"vout", RPCArg::Type::NUM, /* opt */ false, | RPCArg::Optional::NO, "The output number"}, | ||||
/* default_val */ "", "The output number"}, | |||||
{"sequence", RPCArg::Type::NUM, | {"sequence", RPCArg::Type::NUM, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, "The sequence number"}, | ||||
"The sequence number"}, | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"outputs", | "outputs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"a json array with outputs (key-value pairs).\n" | "a json array with outputs (key-value pairs).\n" | ||||
"For compatibility reasons, a dictionary, which holds " | "For compatibility reasons, a dictionary, which holds " | ||||
"the key-value pairs directly, is also\n" | "the key-value pairs directly, is also\n" | ||||
" accepted as second " | " accepted as second " | ||||
"parameter.", | "parameter.", | ||||
{ | { | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"", | "", | ||||
{ | { | ||||
{"address", RPCArg::Type::AMOUNT, | {"address", RPCArg::Type::AMOUNT, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::NO, | ||||
"A key-value pair. The key (string) is the " | "A key-value pair. The key (string) is the " | ||||
"bitcoin address, the value (float or string) " | "bitcoin address, the value (float or string) " | ||||
"is the amount in " + | "is the amount in " + | ||||
CURRENCY_UNIT + ""}, | CURRENCY_UNIT + ""}, | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED, | ||||
/* default_val */ "", | |||||
"", | "", | ||||
{ | { | ||||
{"data", RPCArg::Type::STR_HEX, /* opt */ false, | {"data", RPCArg::Type::STR_HEX, | ||||
/* default_val */ "", | RPCArg::Optional::NO, | ||||
"A key-value pair. The key must be \"data\", " | "A key-value pair. The key must be \"data\", " | ||||
"the value is hex-encoded data"}, | "the value is hex-encoded data"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"locktime", RPCArg::Type::NUM, /* opt */ true, | {"locktime", RPCArg::Type::NUM, /* default */ "0", | ||||
/* default_val */ "0", | |||||
"Raw locktime. Non-0 value also locktime-activates inputs\n" | "Raw locktime. Non-0 value also locktime-activates inputs\n" | ||||
" Allows this transaction to " | " Allows this transaction to " | ||||
"be replaced by a transaction with higher fees. If provided, " | "be replaced by a transaction with higher fees. If provided, " | ||||
"it is an error if explicit sequence numbers are " | "it is an error if explicit sequence numbers are " | ||||
"incompatible."}, | "incompatible."}, | ||||
{"options", | {"options", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"", | "", | ||||
{ | { | ||||
{"changeAddress", RPCArg::Type::STR_HEX, | {"changeAddress", RPCArg::Type::STR_HEX, | ||||
/* opt */ true, /* default_val */ "pool address", | /* default */ "pool address", | ||||
"The bitcoin address to receive the change"}, | "The bitcoin address to receive the change"}, | ||||
{"changePosition", RPCArg::Type::NUM, /* opt */ true, | {"changePosition", RPCArg::Type::NUM, | ||||
/* default_val */ "random", | /* default */ "random", "The index of the change output"}, | ||||
"The index of the change output"}, | {"includeWatching", RPCArg::Type::BOOL, | ||||
{"includeWatching", RPCArg::Type::BOOL, /* opt */ true, | /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Also select inputs which are watch only"}, | "Also select inputs which are watch only"}, | ||||
{"lockUnspents", RPCArg::Type::BOOL, /* opt */ true, | {"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"Lock selected unspent outputs"}, | "Lock selected unspent outputs"}, | ||||
{"feeRate", RPCArg::Type::AMOUNT, /* opt */ true, | {"feeRate", RPCArg::Type::AMOUNT, /* default */ | ||||
/* default_val */ | |||||
"not set: makes wallet determine the fee", | "not set: makes wallet determine the fee", | ||||
"Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, | "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, | ||||
{ | { | ||||
"subtractFeeFromOutputs", | "subtractFeeFromOutputs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* default */ "empty array", | ||||
/* default_val */ "empty array", | |||||
"A json array of integers.\n" | "A json array of integers.\n" | ||||
" The fee will be " | " The fee will be " | ||||
"equally deducted from the amount of each specified " | "equally deducted from the amount of each specified " | ||||
"output.\n" | "output.\n" | ||||
" Those recipients will " | " Those recipients will " | ||||
"receive less bitcoins than you enter in their " | "receive less bitcoins than you enter in their " | ||||
"corresponding amount field.\n" | "corresponding amount field.\n" | ||||
" If no outputs are " | " If no outputs are " | ||||
"specified here, the sender pays the fee.", | "specified here, the sender pays the fee.", | ||||
{ | { | ||||
{"vout_index", RPCArg::Type::NUM, /* opt */ true, | {"vout_index", RPCArg::Type::NUM, | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED, | ||||
"The zero-based output index, before a change " | "The zero-based output index, before a change " | ||||
"output is added."}, | "output is added."}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
"options"}, | "options"}, | ||||
{"bip32derivs", RPCArg::Type::BOOL, /* opt */ true, | {"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", | ||||
/* default_val */ "false", | |||||
"If true, includes the BIP 32 derivation paths for public " | "If true, includes the BIP 32 derivation paths for public " | ||||
"keys if we know them"}, | "keys if we know them"}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"psbt\": \"value\", (string) The resulting " | " \"psbt\": \"value\", (string) The resulting " | ||||
"raw transaction (base64-encoded string)\n" | "raw transaction (base64-encoded string)\n" | ||||
" \"fee\": n, (numeric) Fee in " + | " \"fee\": n, (numeric) Fee in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |