diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -24,6 +24,8 @@ #include #ifdef ENABLE_WALLET +#include "wallet/wallet.h" + #include #endif @@ -317,6 +319,23 @@ stack.back().begin() + 1, stack.back().end())); req.strMethod = stack.back()[0]; + +#ifdef ENABLE_WALLET + // TODO: Move this logic to WalletModel + if (!vpwallets.empty()) { + // in Qt, use always the wallet with index 0 + // when running with multiple wallets + QByteArray encodedName = + QUrl::toPercentEncoding( + QString::fromStdString( + vpwallets[0]->GetName())); + req.URI = + "/wallet/" + + std::string(encodedName.constData(), + encodedName.length()); + } +#endif + GlobalConfig config; lastResult = tableRPC.execute(config, req); }