@@ -1747,22 +1747,23 @@ RPCHelpMan listdescriptors()
17471747 " listdescriptors" ,
17481748 " \n List descriptors imported into a descriptor-enabled wallet." ,
17491749 {},
1750- RPCResult{
1751- RPCResult::Type::ARR, " " , " Response is an array of descriptor objects" ,
1750+ RPCResult{RPCResult::Type::OBJ, " " , " " , {
1751+ {RPCResult::Type::STR, " wallet_name" , " Name of wallet this operation was performed on" },
1752+ {RPCResult::Type::ARR, " descriptors" , " Array of descriptor objects" ,
17521753 {
17531754 {RPCResult::Type::OBJ, " " , " " , {
17541755 {RPCResult::Type::STR, " desc" , " Descriptor string representation" },
17551756 {RPCResult::Type::NUM, " timestamp" , " The creation time of the descriptor" },
17561757 {RPCResult::Type::BOOL, " active" , " Activeness flag" },
1757- {RPCResult::Type::BOOL, " internal" , true , " Whether this is internal or external descriptor; defined only for active descriptors" },
1758+ {RPCResult::Type::BOOL, " internal" , true , " Whether this is an internal or external descriptor; defined only for active descriptors" },
17581759 {RPCResult::Type::ARR_FIXED, " range" , true , " Defined only for ranged descriptors" , {
17591760 {RPCResult::Type::NUM, " " , " Range start inclusive" },
17601761 {RPCResult::Type::NUM, " " , " Range end inclusive" },
17611762 }},
17621763 {RPCResult::Type::NUM, " next" , true , " The next index to generate addresses from; defined only for ranged descriptors" },
17631764 }},
1764- }
1765- },
1765+ }}
1766+ }} ,
17661767 RPCExamples{
17671768 HelpExampleCli (" listdescriptors" , " " ) + HelpExampleRpc (" listdescriptors" , " " )
17681769 },
@@ -1779,7 +1780,7 @@ RPCHelpMan listdescriptors()
17791780
17801781 LOCK (wallet->cs_wallet );
17811782
1782- UniValue response (UniValue::VARR);
1783+ UniValue descriptors (UniValue::VARR);
17831784 const auto active_spk_mans = wallet->GetActiveScriptPubKeyMans ();
17841785 for (const auto & spk_man : wallet->GetAllScriptPubKeyMans ()) {
17851786 const auto desc_spk_man = dynamic_cast <DescriptorScriptPubKeyMan*>(spk_man);
@@ -1808,9 +1809,13 @@ RPCHelpMan listdescriptors()
18081809 spk.pushKV (" range" , range);
18091810 spk.pushKV (" next" , wallet_descriptor.next_index );
18101811 }
1811- response .push_back (spk);
1812+ descriptors .push_back (spk);
18121813 }
18131814
1815+ UniValue response (UniValue::VOBJ);
1816+ response.pushKV (" wallet_name" , wallet->GetName ());
1817+ response.pushKV (" descriptors" , descriptors);
1818+
18141819 return response;
18151820},
18161821 };
0 commit comments