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

Function listwalletdir

src/wallet/rpc/wallet.cpp:126–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static 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
163static RPCHelpMan listwallets()
164{

Callers

nothing calls this directly

Calls 6

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ListDatabasesFunction · 0.85
GetWalletDirFunction · 0.85
pushKVMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected