Browse Source

Merge branch 'dev'

pull/140/head
Duke Leto 4 years ago
parent
commit
96350537fc
  1. 19
      src/mainwindow.cpp
  2. 2
      src/mainwindow.h
  3. 4
      src/rpc.cpp
  4. 2
      src/rpc.h
  5. 0
      src/scripts/dotranslations.sh
  6. 46
      src/scripts/mkmacdmg.sh
  7. 7
      src/scripts/signbinaries.sh
  8. 8
      src/sendtab.cpp
  9. 3
      src/websockets.cpp

19
src/mainwindow.cpp

@ -993,8 +993,7 @@ void MainWindow::setupTransactionsTab() {
int lastPost = memo.trimmed().lastIndexOf(QRegExp("[\r\n]+"));
QString lastWord = memo.right(memo.length() - lastPost - 1);
if (Settings::getInstance()->isSaplingAddress(lastWord) ||
Settings::getInstance()->isSproutAddress(lastWord)) {
if (Settings::getInstance()->isSaplingAddress(lastWord)) {
menu.addAction(tr("Reply to ") + lastWord.left(25) + "...", [=]() {
// First, cancel any pending stuff in the send tab by pretending to click
// the cancel button
@ -1020,26 +1019,24 @@ void MainWindow::setupTransactionsTab() {
});
}
void MainWindow::addNewZaddr(bool sapling) {
rpc->newZaddr(sapling, [=] (json reply) {
void MainWindow::addNewZaddr() {
rpc->newZaddr( [=] (json reply) {
QString addr = QString::fromStdString(reply.get<json::string_t>());
// Make sure the RPC class reloads the z-addrs for future use
rpc->refreshAddresses();
// Just double make sure the z-address is still checked
if ( sapling && ui->rdioZSAddr->isChecked() ) {
if ( ui->rdioZSAddr->isChecked() ) {
ui->listReceiveAddresses->insertItem(0, addr);
ui->listReceiveAddresses->setCurrentIndex(0);
ui->statusBar->showMessage(QString::fromStdString("Created new zAddr") %
(sapling ? "(Sapling)" : "(Sprout)"),
10 * 1000);
ui->statusBar->showMessage(QString::fromStdString("Created new Sapling zaddr"), 10 * 1000);
}
});
}
// Adds sapling or sprout z-addresses to the combo box. Technically, returns a
// Adds z-addresses to the combo box. Technically, returns a
// lambda, which can be connected to the appropriate signal
std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
return [=] (bool checked) {
@ -1059,7 +1056,7 @@ std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
// If z-addrs are empty, then create a new one.
if (addrs->isEmpty()) {
addNewZaddr(sapling);
addNewZaddr();
}
}
};
@ -1144,7 +1141,7 @@ void MainWindow::setupReceiveTab() {
return;
if (ui->rdioZSAddr->isChecked()) {
addNewZaddr(true);
addNewZaddr();
} else if (ui->rdioTAddr->isChecked()) {
addNewTAddr();
}

2
src/mainwindow.h

@ -106,7 +106,7 @@ private:
void addressChanged(int number, const QString& text);
void amountChanged (int number, const QString& text);
void addNewZaddr(bool sapling);
void addNewZaddr();
std::function<void(bool)> addZAddrsToComboList(bool sapling);
void memoButtonClicked(int number, bool includeReplyTo = false);

4
src/rpc.cpp

@ -153,12 +153,12 @@ void RPC::getZUnspent(const std::function<void(json)>& cb) {
conn->doRPCWithDefaultErrorHandling(payload, cb);
}
void RPC::newZaddr(bool sapling, const std::function<void(json)>& cb) {
void RPC::newZaddr(const std::function<void(json)>& cb) {
json payload = {
{"jsonrpc", "1.0"},
{"id", "someid"},
{"method", "z_getnewaddress"},
{"params", { sapling ? "sapling" : "sprout" }},
{"params", { "sapling" }},
};
conn->doRPCWithDefaultErrorHandling(payload, cb);

2
src/rpc.h

@ -68,7 +68,7 @@ public:
const QMap<QString, double>* getAllBalances() { return allBalances; }
const QMap<QString, bool>* getUsedAddresses() { return usedAddresses; }
void newZaddr(bool sapling, const std::function<void(json)>& cb);
void newZaddr(const std::function<void(json)>& cb);
void newTaddr(const std::function<void(json)>& cb);
void getZPrivKey(QString addr, const std::function<void(json)>& cb);

0
src/scripts/dotranslations.sh

46
src/scripts/mkmacdmg.sh

@ -17,7 +17,17 @@ case $key in
shift # past argument
shift # past value
;;
-c|--certificate)
-u|--username)
APPLE_USERNAME="$2"
shift # past argument
shift # past value
;;
-p|--password)
APPLE_PASSWORD="$2"
shift # past argument
shift # past value
;;
-c|--certificate)
CERTIFICATE="$2"
shift # past argument
shift # past value
@ -45,6 +55,16 @@ if [ -z $HUSH_DIR ]; then
exit 1;
fi
if [ -z "$APPLE_USERNAME" ]; then
echo "APPLE_USERNAME is not set. Please set it the name of the MacOS developer login email to submit the binary for Apple for notarization";
exit 1;
fi
if [ -z "$APPLE_PASSWORD" ]; then
echo "APPLE_PASSWORD is not set. Please set it the name of the MacOS developer Application password to submit the binary for Apple for notarization";
exit 1;
fi
if [ -z "$CERTIFICATE" ]; then
echo "CERTIFICATE is not set. Please set it the name of the MacOS developer certificate to sign the binary with";
exit 1;
@ -94,31 +114,25 @@ cp $HUSH_DIR/src/hushd silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/hush-cli silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/komodod silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/src/komodo-cli silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/sapling-output.params silentdragon.app/Contents/MacOS/
cp $HUSH_DIR/sapling-spend.params silentdragon.app/Contents/MacOS/
$QT_PATH/bin/macdeployqt silentdragon.app
codesign --deep --force --verify --verbose -s "$CERTIFICATE" --options runtime --timestamp silentdragon.app
echo "[OK]"
# Code Signing Note:
# On MacOS, you still need to run these 3 commands:
# xcrun altool --notarize-app -t osx -f macOS-zecwallet-v0.8.0.dmg --primary-bundle-id="com.yourcompany.zecwallet" -u "apple developer id@email.com" -p "one time password"
# xcrun altool --notarization-info <output from pervious command> -u "apple developer id@email.com" -p "one time password"
#...wait for the notarization to finish...
# xcrun stapler staple macOS-zecwallet-v0.8.0.dmg
# On MacOS, you still need to run signbinaries.sh to staple.
#
echo -n "Building dmg..........."
mv silentdragon.app silentdragon.app
create-dmg --volname "silentdragon-v$APP_VERSION" --volicon "res/logo.icns" --window-pos 200 120 --icon "silentdragon.app" 200 190 --app-drop-link 600 185 --hide-extension "silentdragon.app" --window-size 800 400 --hdiutil-quiet --background res/dmgbg.png artifacts/macOS-silentdragon-v$APP_VERSION.dmg silentdragon.app >/dev/null 2>&1
#mkdir bin/dmgbuild >/dev/null 2>&1
#sed "s/RELEASE_VERSION/${APP_VERSION}/g" res/appdmg.json > bin/dmgbuild/appdmg.json
#cp res/logo.icns bin/dmgbuild/
#cp res/dmgbg.png bin/dmgbuild/
#cp -r silentdragon.app bin/dmgbuild/
#appdmg --quiet bin/dmgbuild/appdmg.json artifacts/macOS-silentdragon-v$APP_VERSION.dmg >/dev/null
if [ ! -f artifacts/macOS-silentdragon-v$APP_VERSION.dmg ]; then
echo "[ERROR]"
exit 1
fi
echo "[OK]"
# Submit to Apple for notarization
echo -n "Apple notarization....."
xcrun altool --notarize-app -t osx -f artifacts/macOS-silentdragon-v$APP_VERSION.dmg --primary-bundle-id="com.myHush.silentdragon" -u "$APPLE_USERNAME" -p "$APPLE_PASSWORD"
echo "[OK]"

7
src/scripts/signbinaries.sh

@ -24,7 +24,12 @@ if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
# Store the hash and signatures here
rm -rf release/signatures
mkdir -p release/signatures
mkdir -p release/signatures
# Staple the notarization
xcrun stapler staple artifacts/macOS-silentdragon-v$APP_VERSION.dmg
cd artifacts
cd artifacts

8
src/sendtab.cpp

@ -497,9 +497,6 @@ Tx MainWindow::createTxFromSendPage() {
// Remove label if it exists
addr = AddressBook::addressFromAddressLabel(addr);
// If address is sprout, then we can't send change to sapling, because of turnstile.
//sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr);
double amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble();
totalAmt += amt;
QString memo = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
@ -732,7 +729,10 @@ void MainWindow::sendButton() {
QString MainWindow::doSendTxValidations(Tx tx) {
//TODO: Feedback fromAddr is empty for some reason
if (!Settings::isValidAddress(tx.fromAddr)) return QString(tr("From Address is Invalid"));
if (!Settings::isValidAddress(tx.fromAddr)){
qDebug() << "address is invalid! " << tx.fromAddr;
return QString(tr("From Address is Invalid!"));
}
for (auto toAddr : tx.toAddrs) {
if (!Settings::isValidAddress(toAddr.addr)) {

3
src/websockets.cpp

@ -747,9 +747,6 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, st
auto allBalances = mainwindow->getRPC()->getAllBalances();
QList<QPair<QString, double>> bals;
for (auto i : allBalances->keys()) {
// Filter out sprout addresses
if (Settings::getInstance()->isSproutAddress(i))
continue;
// Filter out balances that don't have the requisite amount
// TODO: should this be amt+tx.fee?
if (allBalances->value(i) < amt)

Loading…
Cancel
Save