Browse Source

start adding plumbing for a market tab

pull/140/head
Jonathan "Duke" Leto 4 years ago
parent
commit
0832091e4e
  1. 2
      README.md
  2. 9
      src/mainwindow.cpp
  3. 3
      src/mainwindow.h
  4. 21
      src/mainwindow.ui
  5. 7
      src/rpc.cpp

2
README.md

@ -9,9 +9,11 @@ This is experimental software under active development!
SilentDragon contacts a few different external websites to get various
bits of data.
* coingecko.com for price data API
* explorer.myhush.org for explorer links
* dexstats.info for address utilities
* wormhole.myhush.org for Wormhole services
This means your IP address is known to these servers. Enable Tor setting
in SilentDragon to prevent this, or better yet, use TAILS: https://tails.boum.org/

9
src/mainwindow.cpp

@ -119,7 +119,8 @@ MainWindow::MainWindow(QWidget *parent) :
setupTransactionsTab();
setupReceiveTab();
setupBalancesTab();
setupZcashdTab();
setupHushTab();
setupMarketTab();
rpc = new RPC(this);
qDebug() << "Created RPC";
@ -914,10 +915,14 @@ void MainWindow::setupBalancesTab() {
});
}
void MainWindow::setupZcashdTab() {
void MainWindow::setupHushTab() {
ui->hushlogo->setBasePixmap(QPixmap(":/img/res/zcashdlogo.gif"));
}
void MainWindow::setupMarketTab() {
qDebug() << "Setting up market tab";
}
void MainWindow::setupTransactionsTab() {
// Double click opens up memo if one exists
QObject::connect(ui->transactionsTable, &QTableView::doubleClicked, [=] (auto index) {

3
src/mainwindow.h

@ -80,7 +80,8 @@ private:
void setupTransactionsTab();
void setupReceiveTab();
void setupBalancesTab();
void setupZcashdTab();
void setupHushTab();
void setupMarketTab();
void slot_change_theme(const QString& themeName);
void setupTurnstileDialog();

21
src/mainwindow.ui

@ -935,6 +935,26 @@
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Market</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="5" column="0" colspan="3">
<widget class="QLabel" name="volumelabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
@ -1370,6 +1390,7 @@
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>

7
src/rpc.cpp

@ -1090,7 +1090,8 @@ void RPC::refreshZECPrice() {
return noConnection();
// TODO: use/render all this data
QUrl cmcURL("https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true");
QString price_feed = "https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur%2Ceth%2Cgbp%2Ccny%2Cjpy%2Crub%2Ccad%2Csgd%2Cchf%2Cinr%2Caud%2Cinr&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true";
QUrl cmcURL(price_feed);
QNetworkRequest req;
req.setUrl(cmcURL);
QNetworkReply *reply = conn->restclient->get(req);
@ -1130,7 +1131,9 @@ void RPC::refreshZECPrice() {
// TODO: support BTC/EUR prices as well
//QString price = QString::fromStdString(hush["usd"].get<json::string_t>());
qDebug() << "HUSH = $" << QString::number((double)hush["usd"]);
qDebug() << "HUSH = " << QString::number((double)hush["btc"]) << " sat ";
qDebug() << "HUSH = " << QString::number((double)hush["eur"]) << " EUR";
qDebug() << "HUSH = " << QString::number((int) 100000000 * (double) hush["btc"]) << " sat ";
//TODO: based on current fiat selection, store that fiat price
Settings::getInstance()->setZECPrice( hush["usd"] );
Settings::getInstance()->setBTCPrice( (unsigned int) 100000000 * (double)hush["btc"] );

Loading…
Cancel
Save