diff options
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r-- | src/wallet/rpcdump.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index a2872f10ae..748d911efe 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1747,22 +1747,23 @@ RPCHelpMan listdescriptors() "listdescriptors", "\nList descriptors imported into a descriptor-enabled wallet.", {}, - RPCResult{ - RPCResult::Type::ARR, "", "Response is an array of descriptor objects", + RPCResult{RPCResult::Type::OBJ, "", "", { + {RPCResult::Type::STR, "wallet_name", "Name of wallet this operation was performed on"}, + {RPCResult::Type::ARR, "descriptors", "Array of descriptor objects", { {RPCResult::Type::OBJ, "", "", { {RPCResult::Type::STR, "desc", "Descriptor string representation"}, {RPCResult::Type::NUM, "timestamp", "The creation time of the descriptor"}, {RPCResult::Type::BOOL, "active", "Activeness flag"}, - {RPCResult::Type::BOOL, "internal", true, "Whether this is internal or external descriptor; defined only for active descriptors"}, + {RPCResult::Type::BOOL, "internal", true, "Whether this is an internal or external descriptor; defined only for active descriptors"}, {RPCResult::Type::ARR_FIXED, "range", true, "Defined only for ranged descriptors", { {RPCResult::Type::NUM, "", "Range start inclusive"}, {RPCResult::Type::NUM, "", "Range end inclusive"}, }}, {RPCResult::Type::NUM, "next", true, "The next index to generate addresses from; defined only for ranged descriptors"}, }}, - } - }, + }} + }}, RPCExamples{ HelpExampleCli("listdescriptors", "") + HelpExampleRpc("listdescriptors", "") }, @@ -1779,7 +1780,7 @@ RPCHelpMan listdescriptors() LOCK(wallet->cs_wallet); - UniValue response(UniValue::VARR); + UniValue descriptors(UniValue::VARR); const auto active_spk_mans = wallet->GetActiveScriptPubKeyMans(); for (const auto& spk_man : wallet->GetAllScriptPubKeyMans()) { const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man); @@ -1808,9 +1809,13 @@ RPCHelpMan listdescriptors() spk.pushKV("range", range); spk.pushKV("next", wallet_descriptor.next_index); } - response.push_back(spk); + descriptors.push_back(spk); } + UniValue response(UniValue::VOBJ); + response.pushKV("wallet_name", wallet->GetName()); + response.pushKV("descriptors", descriptors); + return response; }, }; |