| 183 | } |
| 184 | |
| 185 | static RPCMethod listwallets() |
| 186 | { |
| 187 | return RPCMethod{"listwallets", |
| 188 | "Returns a list of currently loaded wallets.\n" |
| 189 | "For full information on the wallet, use \"getwalletinfo\"\n", |
| 190 | {}, |
| 191 | RPCResult{ |
| 192 | RPCResult::Type::ARR, "", "", |
| 193 | { |
| 194 | {RPCResult::Type::STR, "walletname", "the wallet name"}, |
| 195 | } |
| 196 | }, |
| 197 | RPCExamples{ |
| 198 | HelpExampleCli("listwallets", "") |
| 199 | + HelpExampleRpc("listwallets", "") |
| 200 | }, |
| 201 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue |
| 202 | { |
| 203 | UniValue obj(UniValue::VARR); |
| 204 | |
| 205 | WalletContext& context = EnsureWalletContext(request.context); |
| 206 | for (const std::shared_ptr<CWallet>& wallet : GetWallets(context)) { |
| 207 | LOCK(wallet->cs_wallet); |
| 208 | obj.push_back(wallet->GetName()); |
| 209 | } |
| 210 | |
| 211 | return obj; |
| 212 | }, |
| 213 | }; |
| 214 | } |
| 215 | |
| 216 | static RPCMethod loadwallet() |
| 217 | { |
nothing calls this directly
no test coverage detected