MCPcopy Create free account
hub / github.com/ElementsProject/elements / listwallets

Function listwallets

src/wallet/rpc/wallet.cpp:163–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163static RPCHelpMan listwallets()
164{
165 return RPCHelpMan{"listwallets",
166 "Returns a list of currently loaded wallets.\n"
167 "For full information on the wallet, use \"getwalletinfo\"\n",
168 {},
169 RPCResult{
170 RPCResult::Type::ARR, "", "",
171 {
172 {RPCResult::Type::STR, "walletname", "the wallet name"},
173 }
174 },
175 RPCExamples{
176 HelpExampleCli("listwallets", "")
177 + HelpExampleRpc("listwallets", "")
178 },
179 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
180{
181 UniValue obj(UniValue::VARR);
182
183 WalletContext& context = EnsureWalletContext(request.context);
184 for (const std::shared_ptr<CWallet>& wallet : GetWallets(context)) {
185 LOCK(wallet->cs_wallet);
186 obj.push_back(wallet->GetName());
187 }
188
189 return obj;
190},
191 };
192}
193
194static RPCHelpMan loadwallet()
195{

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