diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index 623324d6ceb3..2cd9e002221a 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -17,19 +17,19 @@ namespace wallet { RPCHelpMan getnewaddress() { return RPCHelpMan{"getnewaddress", - "\nReturns a new Dash address for receiving payments.\n" - "If 'label' is specified, it is added to the address book \n" - "so payments received with the address will be associated with 'label'.\n", - { - {"label", RPCArg::Type::STR, RPCArg::Default{""}, "The label name for the address to be linked to. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name."}, - }, - RPCResult{ - RPCResult::Type::STR, "address", "The new Dash address" - }, - RPCExamples{ - HelpExampleCli("getnewaddress", "") - + HelpExampleRpc("getnewaddress", "") - }, + "\nReturns a new Dash address for receiving payments.\n" + "If 'label' is specified, it is added to the address book \n" + "so payments received with the address will be associated with 'label'.\n", + { + {"label", RPCArg::Type::STR, RPCArg::Default{""}, "The label name for the address to be linked to. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name."}, + }, + RPCResult{ + RPCResult::Type::STR, "address", "The new Dash address" + }, + RPCExamples{ + HelpExampleCli("getnewaddress", "") + + HelpExampleRpc("getnewaddress", "") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -58,16 +58,16 @@ RPCHelpMan getnewaddress() RPCHelpMan getrawchangeaddress() { return RPCHelpMan{"getrawchangeaddress", - "\nReturns a new Dash address, for receiving change.\n" - "This is for use with raw transactions, NOT normal use.\n", - {}, - RPCResult{ - RPCResult::Type::STR, "address", "The address" - }, - RPCExamples{ - HelpExampleCli("getrawchangeaddress", "") - + HelpExampleRpc("getrawchangeaddress", "") - }, + "\nReturns a new Dash address, for receiving change.\n" + "This is for use with raw transactions, NOT normal use.\n", + {}, + RPCResult{ + RPCResult::Type::STR, "address", "The address" + }, + RPCExamples{ + HelpExampleCli("getrawchangeaddress", "") + + HelpExampleRpc("getrawchangeaddress", "") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -91,16 +91,16 @@ RPCHelpMan getrawchangeaddress() RPCHelpMan setlabel() { return RPCHelpMan{"setlabel", - "\nSets the label associated with the given address.\n", - { - {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to be associated with a label."}, - {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"") - + HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"") - }, + "\nSets the label associated with the given address.\n", + { + {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address to be associated with a label."}, + {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"") + + HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -129,27 +129,28 @@ RPCHelpMan setlabel() RPCHelpMan listaddressgroupings() { return RPCHelpMan{"listaddressgroupings", - "\nLists groups of addresses which have had their common ownership\n" - "made public by common use as inputs or as the resulting change\n" - "in past transactions\n", - {}, - RPCResult{ - RPCResult::Type::ARR, "", "", - { - {RPCResult::Type::ARR, "", "", - { - {RPCResult::Type::ARR_FIXED, "", "", + "\nLists groups of addresses which have had their common ownership\n" + "made public by common use as inputs or as the resulting change\n" + "in past transactions\n", + {}, + RPCResult{ + RPCResult::Type::ARR, "", "", { - {RPCResult::Type::STR, "address", "The Dash address"}, - {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT}, - {RPCResult::Type::STR, "label", /*optional=*/true, "The label"}, - }}, - }}, - }}, - RPCExamples{ - HelpExampleCli("listaddressgroupings", "") - + HelpExampleRpc("listaddressgroupings", "") - }, + {RPCResult::Type::ARR, "", "", + { + {RPCResult::Type::ARR_FIXED, "", "", + { + {RPCResult::Type::STR, "address", "The Dash address"}, + {RPCResult::Type::STR_AMOUNT, "amount", "The amount in " + CURRENCY_UNIT}, + {RPCResult::Type::STR, "label", /*optional=*/true, "The label"}, + }}, + }}, + } + }, + RPCExamples{ + HelpExampleCli("listaddressgroupings", "") + + HelpExampleRpc("listaddressgroupings", "") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); @@ -188,35 +189,35 @@ RPCHelpMan listaddressgroupings() RPCHelpMan addmultisigaddress() { return RPCHelpMan{"addmultisigaddress", - "\nAdd an nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n" - "Each key is a Dash address or hex-encoded public key.\n" - "This functionality is only intended for use with non-watchonly addresses.\n" - "See `importaddress` for watchonly p2sh address support.\n" - "If 'label' is specified, assign address to that label.\n" - "Note: This command is only compatible with legacy wallets.\n", - { - {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys or addresses."}, - {"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The Dash addresses or hex-encoded public keys", + "\nAdd an nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n" + "Each key is a Dash address or hex-encoded public key.\n" + "This functionality is only intended for use with non-watchonly addresses.\n" + "See `importaddress` for watchonly p2sh address support.\n" + "If 'label' is specified, assign address to that label.\n" + "Note: This command is only compatible with legacy wallets.\n", { - {"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Dash address or hex-encoded public key"}, + {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys or addresses."}, + {"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The Dash addresses or hex-encoded public keys", + { + {"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Dash address or hex-encoded public key"}, + }, + }, + {"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A label to assign the addresses to."}, }, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR, "address", "The value of the new multisig address"}, + {RPCResult::Type::STR_HEX, "redeemScript", "The string value of the hex-encoded redemption script"}, + {RPCResult::Type::STR, "descriptor", "The descriptor for this multisig."}, + } + }, + RPCExamples{ + "\nAdd a multisig address from 2 addresses\n" + + HelpExampleCli("addmultisigaddress", "2 \"[\\\"" + EXAMPLE_ADDRESS[0] + "\\\",\\\"" + EXAMPLE_ADDRESS[1] + "\\\"]\"") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("addmultisigaddress", "2, \"[\\\"" + EXAMPLE_ADDRESS[0] + "\\\",\\\"" + EXAMPLE_ADDRESS[1] + "\\\"]\"") }, - {"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A label to assign the addresses to."}, - }, - RPCResult{ - RPCResult::Type::OBJ, "", "", - { - {RPCResult::Type::STR, "address", "The value of the new multisig address"}, - {RPCResult::Type::STR_HEX, "redeemScript", "The string value of the hex-encoded redemption script"}, - {RPCResult::Type::STR, "descriptor", "The descriptor for this multisig."}, - } - }, - RPCExamples{ - "\nAdd a multisig address from 2 addresses\n" - + HelpExampleCli("addmultisigaddress", "2 \"[\\\"" + EXAMPLE_ADDRESS[0] + "\\\",\\\"" + EXAMPLE_ADDRESS[1] + "\\\"]\"") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("addmultisigaddress", "2, \"[\\\"" + EXAMPLE_ADDRESS[0] + "\\\",\\\"" + EXAMPLE_ADDRESS[1] + "\\\"]\"") - }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -418,56 +419,56 @@ static UniValue DescribeWalletAddress(const CWallet& wallet, const CTxDestinatio RPCHelpMan getaddressinfo() { return RPCHelpMan{"getaddressinfo", - "\nReturn information about the given Dash address.\n" - "Some of the information will only be present if the address is in the active wallet.\n", - { - {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address for which to get information."}, - }, - RPCResult{ - RPCResult::Type::OBJ, "", "", - { - {RPCResult::Type::STR, "address", "The Dash address validated."}, - {RPCResult::Type::STR_HEX, "scriptPubKey", "The hex-encoded scriptPubKey generated by the address."}, - {RPCResult::Type::BOOL, "ismine", "If the address is yours."}, - {RPCResult::Type::BOOL, "iswatchonly", "If the address is watchonly."}, - {RPCResult::Type::BOOL, "solvable", "If we know how to spend coins sent to this address, ignoring the possible lack of private keys."}, - {RPCResult::Type::STR, "desc", /*optional=*/true, "A descriptor for spending coins sent to this address (only when solvable)."}, - {RPCResult::Type::STR, "parent_desc", /*optional=*/true, "The descriptor used to derive this address if this is a descriptor wallet"}, - {RPCResult::Type::BOOL, "isscript", "If the key is a script."}, - {RPCResult::Type::BOOL, "ischange", "If the address was used for change output."}, - {RPCResult::Type::STR, "script", /*optional=*/true, "The output script type. Only if isscript is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata"}, - {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "The redeemscript for the p2sh address."}, - {RPCResult::Type::ARR, "pubkeys", /*optional=*/true, "Array of pubkeys associated with the known redeemscript (only if script is multisig).", - { - {RPCResult::Type::STR, "pubkey", ""}, - }}, - {RPCResult::Type::ARR, "addresses", /*optional=*/true, "Array of addresses associated with the known redeemscript (only if script is multisig).", - { - {RPCResult::Type::STR, "address", ""}, - }}, - {RPCResult::Type::NUM, "sigsrequired", /*optional=*/true, "The number of signatures required to spend multisig output (only if script is multisig)."}, - {RPCResult::Type::STR_HEX, "pubkey", /*optional=*/true, "The hex value of the raw public key, for single-key addresses."}, - {RPCResult::Type::OBJ, "embedded", /*optional=*/true, "Information about the address embedded in P2SH, if relevant and known.", + "\nReturn information about the given Dash address.\n" + "Some of the information will only be present if the address is in the active wallet.\n", { - {RPCResult::Type::ELISION, "", "Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid)\n" - "and relation to the wallet (ismine, iswatchonly)."}, - }}, - {RPCResult::Type::BOOL, "iscompressed", /*optional=*/true, "If the pubkey is compressed."}, - {RPCResult::Type::NUM_TIME, "timestamp", /*optional=*/true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."}, - {RPCResult::Type::STR_HEX, "hdchainid", /*optional=*/true, "The ID of the HD chain."}, - {RPCResult::Type::STR, "hdkeypath", /*optional=*/true, "The HD keypath, if the key is HD and available."}, - {RPCResult::Type::STR_HEX, "hdseedid", /*optional=*/true, "The Hash160 of the HD seed."}, - {RPCResult::Type::STR_HEX, "hdmasterfingerprint", /*optional=*/true, "The fingerprint of the master key."}, - {RPCResult::Type::ARR, "labels", "An array of labels associated with the address. Currently limited to one label but returned as an array to keep the API stable if multiple labels are enabled in the future.", - { - {RPCResult::Type::STR, "label name", "Label name (defaults to \"\")."}, - }}, - } - }, - RPCExamples{ - HelpExampleCli("getaddressinfo", EXAMPLE_ADDRESS[0]) - + HelpExampleRpc("getaddressinfo", EXAMPLE_ADDRESS[0]) - }, + {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address for which to get information."}, + }, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR, "address", "The Dash address validated."}, + {RPCResult::Type::STR_HEX, "scriptPubKey", "The hex-encoded scriptPubKey generated by the address."}, + {RPCResult::Type::BOOL, "ismine", "If the address is yours."}, + {RPCResult::Type::BOOL, "iswatchonly", "If the address is watchonly."}, + {RPCResult::Type::BOOL, "solvable", "If we know how to spend coins sent to this address, ignoring the possible lack of private keys."}, + {RPCResult::Type::STR, "desc", /*optional=*/true, "A descriptor for spending coins sent to this address (only when solvable)."}, + {RPCResult::Type::STR, "parent_desc", /*optional=*/true, "The descriptor used to derive this address if this is a descriptor wallet"}, + {RPCResult::Type::BOOL, "isscript", "If the key is a script."}, + {RPCResult::Type::BOOL, "ischange", "If the address was used for change output."}, + {RPCResult::Type::STR, "script", /*optional=*/true, "The output script type. Only if isscript is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata"}, + {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "The redeemscript for the p2sh address."}, + {RPCResult::Type::ARR, "pubkeys", /*optional=*/true, "Array of pubkeys associated with the known redeemscript (only if script is multisig).", + { + {RPCResult::Type::STR, "pubkey", ""}, + }}, + {RPCResult::Type::ARR, "addresses", /*optional=*/true, "Array of addresses associated with the known redeemscript (only if script is multisig).", + { + {RPCResult::Type::STR, "address", ""}, + }}, + {RPCResult::Type::NUM, "sigsrequired", /*optional=*/true, "The number of signatures required to spend multisig output (only if script is multisig)."}, + {RPCResult::Type::STR_HEX, "pubkey", /*optional=*/true, "The hex value of the raw public key, for single-key addresses."}, + {RPCResult::Type::OBJ, "embedded", /*optional=*/true, "Information about the address embedded in P2SH, if relevant and known.", + { + {RPCResult::Type::ELISION, "", "Includes all getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath, hdseedid)\n" + "and relation to the wallet (ismine, iswatchonly)."}, + }}, + {RPCResult::Type::BOOL, "iscompressed", /*optional=*/true, "If the pubkey is compressed."}, + {RPCResult::Type::NUM_TIME, "timestamp", /*optional=*/true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."}, + {RPCResult::Type::STR_HEX, "hdchainid", /*optional=*/true, "The ID of the HD chain."}, + {RPCResult::Type::STR, "hdkeypath", /*optional=*/true, "The HD keypath, if the key is HD and available."}, + {RPCResult::Type::STR_HEX, "hdseedid", /*optional=*/true, "The Hash160 of the HD seed."}, + {RPCResult::Type::STR_HEX, "hdmasterfingerprint", /*optional=*/true, "The fingerprint of the master key."}, + {RPCResult::Type::ARR, "labels", "An array of labels associated with the address. Currently limited to one label but returned as an array to keep the API stable if multiple labels are enabled in the future.", + { + {RPCResult::Type::STR, "label name", "Label name (defaults to \"\")."}, + }}, + } + }, + RPCExamples{ + HelpExampleCli("getaddressinfo", EXAMPLE_ADDRESS[0]) + + HelpExampleRpc("getaddressinfo", EXAMPLE_ADDRESS[0]) + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); @@ -565,23 +566,23 @@ RPCHelpMan getaddressinfo() RPCHelpMan getaddressesbylabel() { return RPCHelpMan{"getaddressesbylabel", - "\nReturns the list of addresses assigned the specified label.\n", - { - {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label."}, - }, - RPCResult{ - RPCResult::Type::OBJ_DYN, "", "json object with addresses as keys", - { - {RPCResult::Type::OBJ, "address", "json object with information about address", + "\nReturns the list of addresses assigned the specified label.\n", { - {RPCResult::Type::STR, "purpose", "Purpose of address (\"send\" for sending address, \"receive\" for receiving address)"}, - }}, - } - }, - RPCExamples{ - HelpExampleCli("getaddressesbylabel", "\"tabby\"") - + HelpExampleRpc("getaddressesbylabel", "\"tabby\"") - }, + {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label."}, + }, + RPCResult{ + RPCResult::Type::OBJ_DYN, "", "json object with addresses as keys", + { + {RPCResult::Type::OBJ, "address", "json object with information about address", + { + {RPCResult::Type::STR, "purpose", "Purpose of address (\"send\" for sending address, \"receive\" for receiving address)"}, + }}, + } + }, + RPCExamples{ + HelpExampleCli("getaddressesbylabel", "\"tabby\"") + + HelpExampleRpc("getaddressesbylabel", "\"tabby\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); @@ -625,26 +626,26 @@ RPCHelpMan getaddressesbylabel() RPCHelpMan listlabels() { return RPCHelpMan{"listlabels", - "\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n", - { - {"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."}, - }, - RPCResult{ - RPCResult::Type::ARR, "", "", - { - {RPCResult::Type::STR, "label", "Label name"}, - } - }, - RPCExamples{ - "\nList all labels\n" - + HelpExampleCli("listlabels", "") + - "\nList labels that have receiving addresses\n" - + HelpExampleCli("listlabels", "receive") + - "\nList labels that have sending addresses\n" - + HelpExampleCli("listlabels", "send") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("listlabels", "receive") - }, + "\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n", + { + {"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."}, + }, + RPCResult{ + RPCResult::Type::ARR, "", "", + { + {RPCResult::Type::STR, "label", "Label name"}, + } + }, + RPCExamples{ + "\nList all labels\n" + + HelpExampleCli("listlabels", "") + + "\nList labels that have receiving addresses\n" + + HelpExampleCli("listlabels", "receive") + + "\nList labels that have sending addresses\n" + + HelpExampleCli("listlabels", "send") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("listlabels", "receive") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp index caca41089fd2..b47d0e68634f 100644 --- a/src/wallet/rpc/backup.cpp +++ b/src/wallet/rpc/backup.cpp @@ -87,31 +87,31 @@ static void RescanWallet(CWallet& wallet, const WalletRescanReserver& reserver, RPCHelpMan importprivkey() { return RPCHelpMan{"importprivkey", - "\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n" - "Hint: use importmulti to import more than one private key.\n" - "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" - "may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" - "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" - "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" - "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"combo(X)\" for descriptor wallets.\n", - { - {"privkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The private key (see dumpprivkey)"}, - {"label", RPCArg::Type::STR, RPCArg::DefaultHint{"current label if address exists, otherwise \"\""}, "An optional label"}, - {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - "\nDump a private key\n" - + HelpExampleCli("dumpprivkey", "\"myaddress\"") + - "\nImport the private key with rescan\n" - + HelpExampleCli("importprivkey", "\"mykey\"") + - "\nImport using a label and without rescan\n" - + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" false") + - "\nImport using default blank label and without rescan\n" - + HelpExampleCli("importprivkey", "\"mykey\" \"\" false") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false") - }, + "\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n" + "Hint: use importmulti to import more than one private key.\n" + "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" + "may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" + "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" + "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" + "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"combo(X)\" for descriptor wallets.\n", + { + {"privkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The private key (see dumpprivkey)"}, + {"label", RPCArg::Type::STR, RPCArg::DefaultHint{"current label if address exists, otherwise \"\""}, "An optional label"}, + {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + "\nDump a private key\n" + + HelpExampleCli("dumpprivkey", "\"myaddress\"") + + "\nImport the private key with rescan\n" + + HelpExampleCli("importprivkey", "\"mykey\"") + + "\nImport using a label and without rescan\n" + + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" false") + + "\nImport using default blank label and without rescan\n" + + HelpExampleCli("importprivkey", "\"mykey\" \"\" false") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -207,31 +207,31 @@ RPCHelpMan abortrescan() RPCHelpMan importaddress() { return RPCHelpMan{"importaddress", - "\nAdds 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 wallet backup.\n" - "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" - "may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" - "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" - "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" - "If you have the full public key, you should call importpubkey instead of this.\n" - "Hint: use importmulti to import more than one address.\n" - "\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n" - "as change, and not show up in many RPCs.\n" - "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"addr(X)\" for descriptor wallets.\n", - { - {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address (or hex-encoded script)"}, - {"label", RPCArg::Type::STR, RPCArg::Default{""}, "An optional label"}, - {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, - {"p2sh", RPCArg::Type::BOOL, RPCArg::Default{false}, "Add the P2SH version of the script as well"}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - "\nImport an address with rescan\n" - + HelpExampleCli("importaddress", "\"myaddress\"") + - "\nImport using a label without rescan\n" - + HelpExampleCli("importaddress", "\"myaddress\" \"testing\" false") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false") - }, + "\nAdds 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 wallet backup.\n" + "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" + "may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" + "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" + "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" + "If you have the full public key, you should call importpubkey instead of this.\n" + "Hint: use importmulti to import more than one address.\n" + "\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n" + "as change, and not show up in many RPCs.\n" + "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"addr(X)\" for descriptor wallets.\n", + { + {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address (or hex-encoded script)"}, + {"label", RPCArg::Type::STR, RPCArg::Default{""}, "An optional label"}, + {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, + {"p2sh", RPCArg::Type::BOOL, RPCArg::Default{false}, "Add the P2SH version of the script as well"}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + "\nImport an address with rescan\n" + + HelpExampleCli("importaddress", "\"myaddress\"") + + "\nImport using a label without rescan\n" + + HelpExampleCli("importaddress", "\"myaddress\" \"testing\" false") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -310,13 +310,13 @@ RPCHelpMan importaddress() RPCHelpMan importprunedfunds() { return RPCHelpMan{"importprunedfunds", - "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n", - { - {"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A raw transaction in hex funding an already-existing address in wallet"}, - {"txoutproof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex output from gettxoutproof that contains the transaction"}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{""}, + "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n", + { + {"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A raw transaction in hex funding an already-existing address in wallet"}, + {"txoutproof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex output from gettxoutproof that contains the transaction"}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -366,16 +366,16 @@ RPCHelpMan importprunedfunds() RPCHelpMan removeprunedfunds() { return RPCHelpMan{"removeprunedfunds", - "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n", - { - {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") - }, + "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n", + { + {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -404,27 +404,27 @@ RPCHelpMan removeprunedfunds() RPCHelpMan importpubkey() { return RPCHelpMan{"importpubkey", - "\nAdds 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 backup.\n" - "Hint: use importmulti to import more than one public key.\n" - "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" - "may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" - "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" - "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" - "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"combo(X)\" for descriptor wallets.\n", - { - {"pubkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The hex-encoded public key"}, - {"label", RPCArg::Type::STR, RPCArg::Default{""}, "An optional label"}, - {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - "\nImport a public key with rescan\n" - + HelpExampleCli("importpubkey", "\"mypubkey\"") + - "\nImport using a label without rescan\n" - + HelpExampleCli("importpubkey", "\"mypubkey\" \"testing\" false") + - "\nAs a JSON-RPC call\n" - + HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false") - }, + "\nAdds 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 backup.\n" + "Hint: use importmulti to import more than one public key.\n" + "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" + "may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n" + "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" + "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" + "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" with \"combo(X)\" for descriptor wallets.\n", + { + {"pubkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The hex-encoded public key"}, + {"label", RPCArg::Type::STR, RPCArg::Default{""}, "An optional label"}, + {"rescan", RPCArg::Type::BOOL, RPCArg::Default{true}, "Scan the chain and mempool for wallet transactions."}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + "\nImport a public key with rescan\n" + + HelpExampleCli("importpubkey", "\"mypubkey\"") + + "\nImport using a label without rescan\n" + + HelpExampleCli("importpubkey", "\"mypubkey\" \"testing\" false") + + "\nAs a JSON-RPC call\n" + + HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -489,21 +489,21 @@ RPCHelpMan importpubkey() RPCHelpMan importwallet() { return RPCHelpMan{"importwallet", - "\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n" - "Note: Blockchain and Mempool will be rescanned after a successful import. Use \"getwalletinfo\" to query the scanning progress.\n" - "Note: This command is only compatible with legacy wallets.\n", - { - {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet file"}, - }, - RPCResult{RPCResult::Type::NONE, "", ""}, - RPCExamples{ - "\nDump the wallet\n" - + HelpExampleCli("dumpwallet", "\"test\"") + - "\nImport the wallet\n" - + HelpExampleCli("importwallet", "\"test\"") + - "\nImport using the json rpc call\n" - + HelpExampleRpc("importwallet", "\"test\"") - }, + "\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n" + "Note: Blockchain and Mempool will be rescanned after a successful import. Use \"getwalletinfo\" to query the scanning progress.\n" + "Note: This command is only compatible with legacy wallets.\n", + { + {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet file"}, + }, + RPCResult{RPCResult::Type::NONE, "", ""}, + RPCExamples{ + "\nDump the wallet\n" + + HelpExampleCli("dumpwallet", "\"test\"") + + "\nImport the wallet\n" + + HelpExampleCli("importwallet", "\"test\"") + + "\nImport using the json rpc call\n" + + HelpExampleRpc("importwallet", "\"test\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::shared_ptr const pwallet = GetWalletForJSONRPCRequest(request); @@ -831,20 +831,20 @@ RPCHelpMan importelectrumwallet() RPCHelpMan dumpprivkey() { return RPCHelpMan{"dumpprivkey", - "\nReveals the private key corresponding to 'address'.\n" - "Then the importprivkey can be used with this output\n" - "Note: This command is only compatible with legacy wallets.\n", - { - {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address for the private key"}, - }, - RPCResult{ - RPCResult::Type::STR, "key", "The private key" - }, - RPCExamples{ - HelpExampleCli("dumpprivkey", "\"myaddress\"") - + HelpExampleCli("importprivkey", "\"mykey\"") - + HelpExampleRpc("dumpprivkey", "\"myaddress\"") - }, + "\nReveals the private key corresponding to 'address'.\n" + "Then the importprivkey can be used with this output\n" + "Note: This command is only compatible with legacy wallets.\n", + { + {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Dash address for the private key"}, + }, + RPCResult{ + RPCResult::Type::STR, "key", "The private key" + }, + RPCExamples{ + HelpExampleCli("dumpprivkey", "\"myaddress\"") + + HelpExampleCli("importprivkey", "\"mykey\"") + + HelpExampleRpc("dumpprivkey", "\"myaddress\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); @@ -926,26 +926,26 @@ RPCHelpMan dumphdinfo() RPCHelpMan dumpwallet() { return RPCHelpMan{"dumpwallet", - "\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n" - "Imported scripts are included in the dumpfile too, their corresponding addresses will be added automatically by importwallet.\n" - "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" - "only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n" - "Note: This command is only compatible with legacy wallets.\n", - { - {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The filename with path (absolute path recommended)"}, - }, - RPCResult{ - RPCResult::Type::OBJ, "", "", + "\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n" + "Imported scripts are included in the dumpfile too, their corresponding addresses will be added automatically by importwallet.\n" + "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" + "only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n" + "Note: This command is only compatible with legacy wallets.\n", { + {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The filename with path (absolute path recommended)"}, + }, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { {RPCResult::Type::NUM, "keys", "The number of keys contained in the wallet dump"}, {RPCResult::Type::STR, "filename", "The filename with full absolute path"}, {RPCResult::Type::STR, "warning", "A warning about not sharing the wallet dump with anyone"}, - } - }, - RPCExamples{ - HelpExampleCli("dumpwallet", "\"test\"") - + HelpExampleRpc("dumpwallet", "\"test\"") - }, + } + }, + RPCExamples{ + HelpExampleCli("dumpwallet", "\"test\"") + + HelpExampleRpc("dumpwallet", "\"test\"") + }, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const std::shared_ptr pwallet = GetWalletForJSONRPCRequest(request); @@ -1478,80 +1478,79 @@ static int64_t GetImportTimestamp(const UniValue& data, int64_t now) RPCHelpMan importmulti() { return RPCHelpMan{"importmulti", - "\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.\n" - "If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.\n" - "Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.\n" - "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" - "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" - "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" - "may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n" - "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" for descriptor wallets.\n", - { - {"requests", RPCArg::Type::ARR, RPCArg::Optional::NO, "Data to be imported", + "\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.\n" + "If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.\n" + "Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.\n" + "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" + "may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n" + "The rescan parameter can be set to false if the key was never used to create transactions. If it is set to false,\n" + "but the key was used to create transactions, rescanwallet needs to be called with the appropriate block range.\n" + "Note: This command is only compatible with legacy wallets. Use \"importdescriptors\" for descriptor wallets.\n", { - {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "", + {"requests", RPCArg::Type::ARR, RPCArg::Optional::NO, "Data to be imported", { - {"desc", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys" - }, - {"scriptPubKey", RPCArg::Type::STR, RPCArg::Optional::NO, "Type of scriptPubKey (string for script, json for address). Should not be provided if using a descriptor", - /*oneline_description=*/"", {"\"