| 3069 | } |
| 3070 | |
| 3071 | static UniValue listwallets(const JSONRPCRequest& request) |
| 3072 | { |
| 3073 | if (request.fHelp || request.params.size() != 0) |
| 3074 | throw std::runtime_error( |
| 3075 | "listwallets\n" |
| 3076 | "Returns a list of currently loaded wallets.\n" |
| 3077 | "For full information on the wallet, use \"getwalletinfo\"\n" |
| 3078 | "\nResult:\n" |
| 3079 | "[ (json array of strings)\n" |
| 3080 | " \"walletname\" (string) the wallet name\n" |
| 3081 | " ...\n" |
| 3082 | "]\n" |
| 3083 | "\nExamples:\n" |
| 3084 | + HelpExampleCli("listwallets", "") |
| 3085 | + HelpExampleRpc("listwallets", "") |
| 3086 | ); |
| 3087 | |
| 3088 | UniValue obj(UniValue::VARR); |
| 3089 | |
| 3090 | for (const std::shared_ptr<CWallet>& wallet : GetWallets()) { |
| 3091 | if (!EnsureWalletIsAvailable(wallet.get(), request.fHelp)) { |
| 3092 | return NullUniValue; |
| 3093 | } |
| 3094 | |
| 3095 | LOCK(wallet->cs_wallet); |
| 3096 | |
| 3097 | obj.push_back(wallet->GetName()); |
| 3098 | } |
| 3099 | |
| 3100 | return obj; |
| 3101 | } |
| 3102 | |
| 3103 | static UniValue loadwallet(const JSONRPCRequest& request) |
| 3104 | { |
nothing calls this directly
no test coverage detected