| 124 | } |
| 125 | |
| 126 | static RPCHelpMan listwalletdir() |
| 127 | { |
| 128 | return RPCHelpMan{"listwalletdir", |
| 129 | "Returns a list of wallets in the wallet directory.\n", |
| 130 | {}, |
| 131 | RPCResult{ |
| 132 | RPCResult::Type::OBJ, "", "", |
| 133 | { |
| 134 | {RPCResult::Type::ARR, "wallets", "", |
| 135 | { |
| 136 | {RPCResult::Type::OBJ, "", "", |
| 137 | { |
| 138 | {RPCResult::Type::STR, "name", "The wallet name"}, |
| 139 | }}, |
| 140 | }}, |
| 141 | } |
| 142 | }, |
| 143 | RPCExamples{ |
| 144 | HelpExampleCli("listwalletdir", "") |
| 145 | + HelpExampleRpc("listwalletdir", "") |
| 146 | }, |
| 147 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 148 | { |
| 149 | UniValue wallets(UniValue::VARR); |
| 150 | for (const auto& path : ListDatabases(GetWalletDir())) { |
| 151 | UniValue wallet(UniValue::VOBJ); |
| 152 | wallet.pushKV("name", path.u8string()); |
| 153 | wallets.push_back(wallet); |
| 154 | } |
| 155 | |
| 156 | UniValue result(UniValue::VOBJ); |
| 157 | result.pushKV("wallets", wallets); |
| 158 | return result; |
| 159 | }, |
| 160 | }; |
| 161 | } |
| 162 | |
| 163 | static RPCHelpMan listwallets() |
| 164 | { |
nothing calls this directly
no test coverage detected