MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / listwallets

Function listwallets

src/wallet/rpc/wallet.cpp:185–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185static 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
216static RPCMethod loadwallet()
217{

Callers

nothing calls this directly

Calls 5

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetWalletsFunction · 0.85
push_backMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected