Changeset View
Changeset View
Standalone View
Standalone View
src/qt/rpcconsole.cpp
Show First 20 Lines • Show All 331 Lines • ▼ Show 20 Lines | for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) { | ||||
stack.back()[0], | stack.back()[0], | ||||
std::vector<std::string>( | std::vector<std::string>( | ||||
stack.back().begin() + 1, | stack.back().begin() + 1, | ||||
stack.back().end())); | stack.back().end())); | ||||
std::string method = stack.back()[0]; | std::string method = stack.back()[0]; | ||||
std::string uri; | std::string uri; | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
if (walletID && !walletID->empty()) { | if (walletID) { | ||||
QByteArray encodedName = | QByteArray encodedName = | ||||
QUrl::toPercentEncoding( | QUrl::toPercentEncoding( | ||||
QString::fromStdString(*walletID)); | QString::fromStdString(*walletID)); | ||||
uri = "/wallet/" + | uri = "/wallet/" + | ||||
std::string(encodedName.constData(), | std::string(encodedName.constData(), | ||||
encodedName.length()); | encodedName.length()); | ||||
} | } | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | try { | ||||
"Results without keys can be queried using an integer " | "Results without keys can be queried using an integer " | ||||
"in brackets.\n" | "in brackets.\n" | ||||
" example: " | " example: " | ||||
"getblock(getblockhash(0),true)[tx][0]\n\n"))); | "getblock(getblockhash(0),true)[tx][0]\n\n"))); | ||||
return; | return; | ||||
} | } | ||||
std::string wallet_id = walletID.toStdString(); | std::string wallet_id = walletID.toStdString(); | ||||
if (!RPCConsole::RPCExecuteCommandLine( | if (!RPCConsole::RPCExecuteCommandLine( | ||||
m_node, result, executableCommand, nullptr, &wallet_id)) { | m_node, result, executableCommand, nullptr, | ||||
walletID.isNull() ? nullptr : &wallet_id)) { | |||||
Q_EMIT reply(RPCConsole::CMD_ERROR, | Q_EMIT reply(RPCConsole::CMD_ERROR, | ||||
QString("Parse error: unbalanced ' or \"")); | QString("Parse error: unbalanced ' or \"")); | ||||
return; | return; | ||||
} | } | ||||
Q_EMIT reply(RPCConsole::CMD_REPLY, QString::fromStdString(result)); | Q_EMIT reply(RPCConsole::CMD_REPLY, QString::fromStdString(result)); | ||||
} catch (UniValue &objError) { | } catch (UniValue &objError) { | ||||
// Nice formatting for standard-format error | // Nice formatting for standard-format error | ||||
▲ Show 20 Lines • Show All 550 Lines • ▼ Show 20 Lines | |||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
const int wallet_index = ui->WalletSelector->currentIndex(); | const int wallet_index = ui->WalletSelector->currentIndex(); | ||||
if (wallet_index > 0) { | if (wallet_index > 0) { | ||||
walletID = (QString)ui->WalletSelector->itemData(wallet_index) | walletID = (QString)ui->WalletSelector->itemData(wallet_index) | ||||
.value<QString>(); | .value<QString>(); | ||||
} | } | ||||
if (m_last_wallet_id != walletID) { | if (m_last_wallet_id != walletID) { | ||||
if (walletID.isEmpty()) { | if (walletID.isNull()) { | ||||
message(CMD_REQUEST, | message(CMD_REQUEST, | ||||
tr("Executing command without any wallet")); | tr("Executing command without any wallet")); | ||||
} else { | } else { | ||||
message( | message( | ||||
CMD_REQUEST, | CMD_REQUEST, | ||||
tr("Executing command using \"%1\" wallet").arg(walletID)); | tr("Executing command using \"%1\" wallet").arg(walletID)); | ||||
} | } | ||||
m_last_wallet_id = walletID; | m_last_wallet_id = walletID; | ||||
▲ Show 20 Lines • Show All 378 Lines • Show Last 20 Lines |