@@ -2450,6 +2450,38 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
2450
2450
return obj;
2451
2451
}
2452
2452
2453
+ static UniValue listwalletdir (const JSONRPCRequest& request)
2454
+ {
2455
+ if (request.fHelp || request.params .size () != 0 ) {
2456
+ throw std::runtime_error (
2457
+ " listwalletdir\n "
2458
+ " Returns a list of wallets in the wallet directory.\n "
2459
+ " {\n "
2460
+ " \" wallets\" : [ (json array of objects)\n "
2461
+ " {\n "
2462
+ " \" name\" : \" name\" (string) The wallet name\n "
2463
+ " }\n "
2464
+ " ,...\n "
2465
+ " ]\n "
2466
+ " }\n "
2467
+ " \n Examples:\n "
2468
+ + HelpExampleCli (" listwalletdir" , " " )
2469
+ + HelpExampleRpc (" listwalletdir" , " " )
2470
+ );
2471
+ }
2472
+
2473
+ UniValue wallets (UniValue::VARR);
2474
+ for (const auto & path : ListWalletDir ()) {
2475
+ UniValue wallet (UniValue::VOBJ);
2476
+ wallet.pushKV (" name" , path.string ());
2477
+ wallets.push_back (wallet);
2478
+ }
2479
+
2480
+ UniValue result (UniValue::VOBJ);
2481
+ result.pushKV (" wallets" , wallets);
2482
+ return result;
2483
+ }
2484
+
2453
2485
static UniValue listwallets (const JSONRPCRequest& request)
2454
2486
{
2455
2487
if (request.fHelp || request.params .size () != 0 )
@@ -4102,6 +4134,7 @@ static const CRPCCommand commands[] =
4102
4134
{ " wallet" , " listsinceblock" , &listsinceblock, {" blockhash" ," target_confirmations" ," include_watchonly" ," include_removed" } },
4103
4135
{ " wallet" , " listtransactions" , &listtransactions, {" dummy" ," count" ," skip" ," include_watchonly" } },
4104
4136
{ " wallet" , " listunspent" , &listunspent, {" minconf" ," maxconf" ," addresses" ," include_unsafe" ," query_options" } },
4137
+ { " wallet" , " listwalletdir" , &listwalletdir, {} },
4105
4138
{ " wallet" , " listwallets" , &listwallets, {} },
4106
4139
{ " wallet" , " loadwallet" , &loadwallet, {" filename" } },
4107
4140
{ " wallet" , " lockunspent" , &lockunspent, {" unlock" ," transactions" } },
0 commit comments