From 060dd3c35bfbedc1bde8c1fbe326f029292a60f3 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 1 Nov 2019 07:33:21 -0700 Subject: [PATCH 01/19] Create dir if it doesn't exist. Fixes #17 --- lib/Cargo.lock | 6 +++--- lib/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 21ff07d..55a869b 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=bc9bef6ec16b9c852134b1f3f54f53ed49114a86)", + "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481)", ] [[package]] @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "zecwalletlitelib" version = "0.1.0" -source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=bc9bef6ec16b9c852134b1f3f54f53ed49114a86#bc9bef6ec16b9c852134b1f3f54f53ed49114a86" +source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481#af0e0b9b2bcc131804d5e940f94d45c6fef74481" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)", @@ -2562,4 +2562,4 @@ dependencies = [ "checksum zcash_client_backend 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_primitives 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_proofs 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" -"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=bc9bef6ec16b9c852134b1f3f54f53ed49114a86)" = "" +"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481)" = "" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 5ce7610..bec009e 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "bc9bef6ec16b9c852134b1f3f54f53ed49114a86" } +zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "af0e0b9b2bcc131804d5e940f94d45c6fef74481" } From ba32344eb23d0e6253e2939287a5df001d6ebc7f Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:26:58 -0700 Subject: [PATCH 02/19] Update README.md --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6260847..d232f6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,21 @@ -Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash +Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. + +**Zecwallet-Lite is currently in beta** + + +## Privacy +* While all the keys and transaction detection happens on the client, the server can learn what blocks contain your shielded transactions. +* The server also learns other metadata about you like your ip address etc... +* Also remember that t-addresses don't provide any privacy protection. + + +### Note Management +Zecwallet-Lite does automatic note and utxo management, which means it doesn't allow you to manually select which address to send outgoing transactions from. It follows these principles: +* Defaults to sending shielded transactions, even if you're sending to a transparent address +* Sapling funds need at least 5 confirmations before they can be spent +* Can select funds from multiple shielded addresses in the same transaction +* Will automatically shield your transparent funds at the first opportunity + * When sending an outgoing transaction to a shielded address, Zecwallet-Lite can decide to use the transaction to additionally shield your transparent funds (i.e., send your transparent funds to your own shielded address in the same transaction) ## Compiling from source * ZecWallet is written in C++ 14, and can be compiled with g++/clang++/visual c++. From 0bbe7ec39cad9fe64023bccfc3ee2c7ce6f37121 Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:29:30 -0700 Subject: [PATCH 03/19] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d232f6d..74e7ad2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ -Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. - **Zecwallet-Lite is currently in beta** +Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. It has full support for all Zcash features: +- Send + Receive fully shileded transactions +- Supports transparent addresses and transactions +- Full support for incoming and outgoing memos +- Fully encrypt your private keys, using viewkeys to sync the blockchain + ## Privacy * While all the keys and transaction detection happens on the client, the server can learn what blocks contain your shielded transactions. From 9590b531e0ff05e67310e125044aa0f0110c4883 Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Thu, 7 Nov 2019 10:29:35 -0800 Subject: [PATCH 04/19] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 74e7ad2..a72f907 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -**Zecwallet-Lite is currently in beta** - Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. It has full support for all Zcash features: - Send + Receive fully shileded transactions - Supports transparent addresses and transactions From 2cc39a9c79ac3a921f2bb3a4b820679d7bf600f8 Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Thu, 7 Nov 2019 10:31:01 -0800 Subject: [PATCH 05/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a72f907..215d45d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. It has full support for all Zcash features: -- Send + Receive fully shileded transactions +- Send + Receive fully shielded transactions - Supports transparent addresses and transactions - Full support for incoming and outgoing memos - Fully encrypt your private keys, using viewkeys to sync the blockchain From ff84078e9571a5b4f3a850e81a1e0accc5eb7b7f Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Thu, 7 Nov 2019 10:31:48 -0800 Subject: [PATCH 06/19] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 215d45d..52b1077 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. - Full support for incoming and outgoing memos - Fully encrypt your private keys, using viewkeys to sync the blockchain +## Download +Download compiled binaries from our [release page](https://github.com/adityapk00/zecwallet-lite/releases) ## Privacy * While all the keys and transaction detection happens on the client, the server can learn what blocks contain your shielded transactions. From cf72b366bd995f97c085eb2b3875894343cc40f7 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 8 Nov 2019 13:52:40 -0800 Subject: [PATCH 07/19] Update UI strings --- src/connection.ui | 2 +- src/mainwindow.ui | 2 +- src/version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connection.ui b/src/connection.ui index d2eb84f..4e14c8c 100644 --- a/src/connection.ui +++ b/src/connection.ui @@ -14,7 +14,7 @@ - ZecWallet + ZecWallet-Lite true diff --git a/src/mainwindow.ui b/src/mainwindow.ui index b66cf15..cb8260e 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -11,7 +11,7 @@ - ZecWallet + ZecWallet-Lite diff --git a/src/version.h b/src/version.h index 3e7162c..c404d2b 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.0-beta1" +#define APP_VERSION "1.0.1" From abf488b2004cc79c08c305c2369a1c1e8dadfe57 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 8 Nov 2019 14:15:11 -0800 Subject: [PATCH 08/19] Fix unified build --- res/Info.plist | 4 ++-- src/scripts/dounifiedbuild.ps1 | 26 ++++++++++++++------------ src/scripts/mkwininstaller.ps1 | 13 +++++-------- src/scripts/signbinaries.sh | 2 +- src/scripts/zec-qt-wallet.wxs | 27 ++++++++++++--------------- 5 files changed, 34 insertions(+), 38 deletions(-) diff --git a/res/Info.plist b/res/Info.plist index 6fb916a..143d3f3 100644 --- a/res/Info.plist +++ b/res/Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile logo.icns CFBundleIdentifier - com.yourcompany.zecwallet + com.yourcompany.zecwallet-lite CFBundlePackageType APPL CFBundleSignature @@ -39,4 +39,4 @@ NSUIElement - \ No newline at end of file + diff --git a/src/scripts/dounifiedbuild.ps1 b/src/scripts/dounifiedbuild.ps1 index 42858dc..c12032f 100644 --- a/src/scripts/dounifiedbuild.ps1 +++ b/src/scripts/dounifiedbuild.ps1 @@ -7,11 +7,11 @@ param ( ) Write-Host "[Initializing]" -Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-binaries-zecwallet-v$version.tar.gz -Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-deb-zecwallet-v$version.deb -Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-binaries-zecwallet-v$version.zip -Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-installer-zecwallet-v$version.msi -Remove-Item -Force -ErrorAction Ignore ./artifacts/macOS-zecwallet-v$version.dmg +Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-binaries-zecwallet-lite-v$version.tar.gz +Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-deb-zecwallet-lite-v$version.deb +Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-binaries-lite-zecwallet-v$version.zip +Remove-Item -Force -ErrorAction Ignore ./artifacts/Windows-installer-lite-zecwallet-v$version.msi +Remove-Item -Force -ErrorAction Ignore ./artifacts/macOS-zecwallet--litev$version.dmg Remove-Item -Force -ErrorAction Ignore ./artifacts/signatures-v$version.tar.gz @@ -27,7 +27,7 @@ Write-Host "" Write-Host "[Building on Mac]" -bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --zcash_path ~/prod/zcash +bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version if (! $?) { Write-Output "[Error]" exit 1; @@ -37,9 +37,11 @@ Write-Host "" Write-Host "[Building Linux + Windows]" Write-Host -NoNewline "Copying files.........." +# Cleanup some local files to aid copying +rm -rf lib/target/ ssh $server "rm -rf /tmp/zqwbuild" ssh $server "mkdir /tmp/zqwbuild" -scp -r src/ singleapplication/ res/ ./zec-qt-wallet.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null +scp -r src/ singleapplication/ res/ lib/ ./zecwallet-lite.pro ./application.qrc ./LICENSE ./README.md ${server}:/tmp/zqwbuild/ | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/scripts/mkrelease.sh" | Out-Null ssh $server "dos2unix -q /tmp/zqwbuild/src/version.h" Write-Host "[OK]" @@ -86,11 +88,11 @@ Write-Host "[OK]" # Finally, test to make sure all files exist Write-Host -NoNewline "Checking Build........." -if (! (Test-Path ./artifacts/linux-binaries-zecwallet-v$version.tar.gz) -or - ! (Test-Path ./artifacts/linux-deb-zecwallet-v$version.deb) -or - ! (Test-Path ./artifacts/Windows-binaries-zecwallet-v$version.zip) -or - ! (Test-Path ./artifacts/macOS-zecwallet-v$version.dmg) -or - ! (Test-Path ./artifacts/Windows-installer-zecwallet-v$version.msi) ) { +if (! (Test-Path ./artifacts/linux-binaries-zecwallet-lite-v$version.tar.gz) -or + ! (Test-Path ./artifacts/linux-deb-zecwallet-lite-v$version.deb) -or + ! (Test-Path ./artifacts/Windows-binaries-zecwallet-lite-v$version.zip) -or + ! (Test-Path ./artifacts/macOS-zecwallet-lite-v$version.dmg) -or + ! (Test-Path ./artifacts/Windows-installer-zecwallet-lite-v$version.msi) ) { Write-Host "[Error]" exit 1; } diff --git a/src/scripts/mkwininstaller.ps1 b/src/scripts/mkwininstaller.ps1 index 603d05c..af72eb1 100644 --- a/src/scripts/mkwininstaller.ps1 +++ b/src/scripts/mkwininstaller.ps1 @@ -2,16 +2,13 @@ param ( [Parameter(Mandatory=$true)][string]$version ) -$target="zecwallet-v$version" +$target="zecwallet-lite-v$version" Remove-Item -Path release/wininstaller -Recurse -ErrorAction Ignore | Out-Null New-Item release/wininstaller -itemtype directory | Out-Null -Copy-Item release/$target/zecwallet.exe release/wininstaller/ -Copy-Item release/$target/LICENSE release/wininstaller/ -Copy-Item release/$target/README.md release/wininstaller/ -Copy-Item release/$target/zcashd.exe release/wininstaller/ -Copy-Item release/$target/zcash-cli.exe release/wininstaller/ +Copy-Item release/$target/zecwallet-lite.exe release/wininstaller/ +Copy-Item release/$target/LICENSE release/wininstaller/ Get-Content src/scripts/zec-qt-wallet.wxs | ForEach-Object { $_ -replace "RELEASE_VERSION", "$version" } | Out-File -Encoding utf8 release/wininstaller/zec-qt-wallet.wxs @@ -20,10 +17,10 @@ if (!$?) { exit 1; } -light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/zec-qt-wallet.wixobj -out release/wininstaller/zecwallet.msi +light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/zec-qt-wallet.wixobj -out release/wininstaller/zecwallet-lite.msi if (!$?) { exit 1; } New-Item artifacts -itemtype directory -Force | Out-Null -Copy-Item release/wininstaller/zecwallet.msi ./artifacts/Windows-installer-$target.msi \ No newline at end of file +Copy-Item release/wininstaller/zecwallet-lite.msi ./artifacts/Windows-installer-$target.msi \ No newline at end of file diff --git a/src/scripts/signbinaries.sh b/src/scripts/signbinaries.sh index 679b279..657c04f 100755 --- a/src/scripts/signbinaries.sh +++ b/src/scripts/signbinaries.sh @@ -35,7 +35,7 @@ rm -f signatures-v$APP_VERSION.tar.gz # sha256sum the binaries gsha256sum *$APP_VERSION* > sha256sum-v$APP_VERSION.txt -for i in $( ls *zecwallet-v$APP_VERSION* sha256sum-v$APP_VERSION* ); do +for i in $( ls *zecwallet-lite-v$APP_VERSION* sha256sum-v$APP_VERSION* ); do echo "Signing" $i gpg --batch --output ../release/signatures/$i.sig --detach-sig $i done diff --git a/src/scripts/zec-qt-wallet.wxs b/src/scripts/zec-qt-wallet.wxs index a781c8f..d97688c 100644 --- a/src/scripts/zec-qt-wallet.wxs +++ b/src/scripts/zec-qt-wallet.wxs @@ -1,15 +1,15 @@ - + - - + + - + @@ -37,13 +37,13 @@ - + - - + + - @@ -55,24 +55,21 @@ - + + Name="ZecWallet" WorkingDirectory="INSTALLFOLDER" Icon="zecwalletliteicon.exe" > - - - - + - + From 4d93418cc39ad56d80bc4456f1666f8ee694d265 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Fri, 8 Nov 2019 14:24:55 -0800 Subject: [PATCH 09/19] Add macos code signing --- src/scripts/dounifiedbuild.ps1 | 3 ++- src/scripts/mkmacdmg.sh | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/scripts/dounifiedbuild.ps1 b/src/scripts/dounifiedbuild.ps1 index c12032f..0173c1e 100644 --- a/src/scripts/dounifiedbuild.ps1 +++ b/src/scripts/dounifiedbuild.ps1 @@ -2,6 +2,7 @@ param ( [Parameter(Mandatory=$true)][string]$version, [Parameter(Mandatory=$true)][string]$prev, + [Parameter(Mandatory=$true)][string]$certificate, [Parameter(Mandatory=$true)][string]$server, [Parameter(Mandatory=$true)][string]$winserver ) @@ -27,7 +28,7 @@ Write-Host "" Write-Host "[Building on Mac]" -bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version +bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --certificate "$certificate" if (! $?) { Write-Output "[Error]" exit 1; diff --git a/src/scripts/mkmacdmg.sh b/src/scripts/mkmacdmg.sh index 3592266..6dea8e6 100755 --- a/src/scripts/mkmacdmg.sh +++ b/src/scripts/mkmacdmg.sh @@ -12,8 +12,8 @@ case $key in shift # past argument shift # past value ;; - -z|--zcash_path) - ZCASH_DIR="$2" + -c|--certificate) + CERTIFICATE="$2" shift # past argument shift # past value ;; @@ -35,6 +35,11 @@ if [ -z $QT_PATH ]; then 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; +fi + if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set. Please set it to the current release version of the app"; exit 1; @@ -71,6 +76,7 @@ mkdir artifacts >/dev/null 2>&1 rm -f artifcats/zecwallet-lite.dmg >/dev/null 2>&1 rm -f artifacts/rw* >/dev/null 2>&1 $QT_PATH/bin/macdeployqt zecwallet-lite.app +codesign --deep --force --verify --verbose -s "$CERTIFICATE" --options runtime --timestamp Zecwallet-Lite.app/ echo "[OK]" From c98da96b976a5c038a28acea9c9328e2200600eb Mon Sep 17 00:00:00 2001 From: adityapk00 <31996805+adityapk00@users.noreply.github.com> Date: Tue, 12 Nov 2019 17:30:26 -0800 Subject: [PATCH 10/19] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52b1077..4a2538c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Zecwallet-Lite is z-Addr first, Sapling compatible wallet lightwallet for Zcash. It has full support for all Zcash features: +## ZecWallet Lite +Zecwallet-Lite is z-Addr first, Sapling compatible lightwallet client for Zcash. It has full support for all Zcash features: - Send + Receive fully shielded transactions - Supports transparent addresses and transactions - Full support for incoming and outgoing memos From bcf2d4e9d6e46e0cbd81c761f7e523dcaeae39eb Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Wed, 13 Nov 2019 15:11:11 -0800 Subject: [PATCH 11/19] Use latest block instead of info --- lib/Cargo.lock | 6 +++--- lib/Cargo.toml | 2 +- src/connection.cpp | 5 +++-- src/connection.h | 6 +++++- src/controller.cpp | 44 ++++++++++++++++++++++++------------------- src/controller.h | 1 + src/liteinterface.cpp | 9 +++++++++ src/liteinterface.h | 3 +++ src/settings.cpp | 4 ++-- src/settings.h | 11 +++++------ src/txtablemodel.cpp | 17 ++++++++++------- 11 files changed, 67 insertions(+), 41 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 55a869b..2a9ad8f 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481)", + "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a)", ] [[package]] @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "zecwalletlitelib" version = "0.1.0" -source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481#af0e0b9b2bcc131804d5e940f94d45c6fef74481" +source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a#61dc063fe155d1510e9a074e5a3577a0621f8c3a" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)", @@ -2562,4 +2562,4 @@ dependencies = [ "checksum zcash_client_backend 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_primitives 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_proofs 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" -"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=af0e0b9b2bcc131804d5e940f94d45c6fef74481)" = "" +"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a)" = "" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index bec009e..a2f32a9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "af0e0b9b2bcc131804d5e940f94d45c6fef74481" } +zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "61dc063fe155d1510e9a074e5a3577a0621f8c3a" } diff --git a/src/connection.cpp b/src/connection.cpp index a2a882d..41ea1d6 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -49,7 +49,7 @@ void ConnectionLoader::doAutoConnect() { main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server); // Check to see if there's an existing wallet - if (litelib_wallet_exists(Settings::getChainName().toStdString().c_str())) { + if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) { main->logger->write(QObject::tr("Using existing wallet.")); char* resp = litelib_initialize_existing(config->dangerous, config->server.toStdString().c_str()); QString response = litelib_process_response(resp); @@ -68,9 +68,10 @@ void ConnectionLoader::doAutoConnect() { auto me = this; // After the lib is initialized, try to do get info - connection->doRPC("info", "", [=](auto) { + connection->doRPC("info", "", [=](auto reply) { // If success, set the connection main->logger->write("Connection is online."); + connection->setInfo(reply); isSyncing = new QAtomicInteger(); isSyncing->store(true); diff --git a/src/connection.h b/src/connection.h index 7ea28b1..636dd73 100644 --- a/src/connection.h +++ b/src/connection.h @@ -123,8 +123,12 @@ public: void showTxError(const QString& error); + json getInfo() { return serverInfo; } + void setInfo(const json& info) { serverInfo = info; } + private: - bool shutdownInProgress = false; + bool shutdownInProgress = false; + json serverInfo; }; #endif diff --git a/src/controller.cpp b/src/controller.cpp index d482f38..8459236 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -67,6 +67,8 @@ void Controller::setConnection(Connection* c) { ui->statusBar->showMessage("Ready!"); + processInfo(c->getInfo()); + // If we're allowed to get the Zec Price, get the prices if (Settings::getInstance()->getAllowFetchPrices()) refreshZECPrice(); @@ -137,42 +139,46 @@ void Controller::refresh(bool force) { getInfoThenRefresh(force); } +void Controller::processInfo(const json& info) { + // Testnet? + QString chainName; + if (!info["chain_name"].is_null()) { + chainName = QString::fromStdString(info["chain_name"].get()); + Settings::getInstance()->setTestnet(chainName == "test"); + }; + + + QString version = QString::fromStdString(info["version"].get()); + Settings::getInstance()->setZcashdVersion(version); + + // Recurring pamynets are testnet only + if (!Settings::getInstance()->isTestnet()) + main->disableRecurring(); +} + void Controller::getInfoThenRefresh(bool force) { if (!zrpc->haveConnection()) return noConnection(); static bool prevCallSucceeded = false; - zrpc->fetchInfo([=] (const json& reply) { - prevCallSucceeded = true; - - // Testnet? - QString chainName; - if (!reply["chain_name"].is_null()) { - chainName = QString::fromStdString(reply["chain_name"].get()); - Settings::getInstance()->setTestnet(chainName == "test"); - }; + zrpc->fetchLatestBlock([=] (const json& reply) { + prevCallSucceeded = true; - // Recurring pamynets are testnet only - if (!Settings::getInstance()->isTestnet()) - main->disableRecurring(); - - int curBlock = reply["latest_block_height"].get(); + int curBlock = reply["height"].get(); bool doUpdate = force || (model->getLatestBlock() != curBlock); model->setLatestBlock(curBlock); // Connected, so display checkmark. - auto tooltip = Settings::getInstance()->getSettings().server + "\n" + QString::fromStdString(reply.dump()); + auto tooltip = Settings::getInstance()->getSettings().server + "\n" + + QString::fromStdString(zrpc->getConnection()->getInfo().dump()); QIcon i(":/icons/res/connected.gif"); + QString chainName = Settings::getInstance()->isTestnet() ? "test" : "main"; main->statusLabel->setText(chainName + "(" + QString::number(curBlock) + ")"); main->statusLabel->setToolTip(tooltip); main->statusIcon->setPixmap(i.pixmap(16, 16)); main->statusIcon->setToolTip(tooltip); - //int version = reply["version"].get(); - int version = 1; - Settings::getInstance()->setZcashdVersion(version); - // See if recurring payments needs anything Recurring::getInstance()->processPending(main); diff --git a/src/controller.h b/src/controller.h index 1394fad..981730d 100644 --- a/src/controller.h +++ b/src/controller.h @@ -107,6 +107,7 @@ public: QString getDefaultTAddress(); private: + void processInfo(const json&); void refreshBalances(); void refreshTransactions(); diff --git a/src/liteinterface.cpp b/src/liteinterface.cpp index 30f1a0b..0f4bfe9 100644 --- a/src/liteinterface.cpp +++ b/src/liteinterface.cpp @@ -130,6 +130,15 @@ void LiteInterface::fetchInfo(const std::function& cb, conn->doRPC("info", "", cb, err); } + +void LiteInterface::fetchLatestBlock(const std::function& cb, + const std::function& err) { + if (conn == nullptr) + return; + + conn->doRPC("height", "", cb, err); +} + /** * Method to get all the private keys for both z and t addresses. It will make 2 batch calls, * combine the result, and call the callback with a single list containing both the t-addr and z-addr diff --git a/src/liteinterface.h b/src/liteinterface.h index 203967f..70b5732 100644 --- a/src/liteinterface.h +++ b/src/liteinterface.h @@ -44,6 +44,9 @@ public: void fetchInfo(const std::function& cb, const std::function& err); + + void fetchLatestBlock(const std::function& cb, + const std::function& err); void fetchBalance(const std::function& cb); diff --git a/src/settings.cpp b/src/settings.cpp index a96b7af..ed1891f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -74,11 +74,11 @@ bool Settings::isTAddress(QString addr) { return addr.startsWith("t"); } -int Settings::getZcashdVersion() { +QString Settings::getZcashdVersion() { return _zcashdVersion; } -void Settings::setZcashdVersion(int version) { +void Settings::setZcashdVersion(QString version) { _zcashdVersion = version; } diff --git a/src/settings.h b/src/settings.h index d2cbfbf..a031d89 100644 --- a/src/settings.h +++ b/src/settings.h @@ -42,8 +42,8 @@ public: bool isSyncing(); void setSyncing(bool syncing); - int getZcashdVersion(); - void setZcashdVersion(int version); + QString getZcashdVersion(); + void setZcashdVersion(QString version); void setUseEmbedded(bool r) { _useEmbedded = r; } bool useEmbedded() { return _useEmbedded; } @@ -95,12 +95,11 @@ public: static bool isValidAddress(QString addr); - static QString getChainName() { return QString("main"); } + static QString getDefaultChainName() { return QString("main"); } static const QString labelRegExp; - static const int updateSpeed = 20 * 1000; // 20 sec - static const int quickUpdateSpeed = 5 * 1000; // 5 sec + static const int updateSpeed = 60 * 1000; // 60 sec static const int priceRefreshSpeed = 60 * 60 * 1000; // 1 hr private: @@ -114,7 +113,7 @@ private: bool _isTestnet = false; bool _isSyncing = false; int _blockNumber = 0; - int _zcashdVersion = 0; + QString _zcashdVersion = 0; bool _useEmbedded = false; bool _headless = false; diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index 9df59e4..07815dc 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -70,15 +70,18 @@ bool TxTableModel::exportToCsv(QString fileName) const { } QString TxTableModel::concatMultipleMemos(const TransactionItem& dat) const { - // Concat all the memos - QString memo; - for (auto item : dat.items) { - if (!item.memo.trimmed().isEmpty()) { - memo += item.address + ": \"" + item.memo + "\"\n"; + if (dat.items.length() == 1) { + return dat.items[0].memo; + } else { + // Concat all the memos + QString memo; + for (auto item : dat.items) { + if (!item.memo.trimmed().isEmpty()) { + memo += item.address + ": \"" + item.memo + "\"\n"; + } } + return memo; } - - return memo; }; QVariant TxTableModel::data(const QModelIndex &index, int role) const { From b32a1d4732cb07b4e855c028cceae2b77761253c Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Wed, 13 Nov 2019 15:12:46 -0800 Subject: [PATCH 12/19] Naming --- src/about.ui | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/about.ui b/src/about.ui index 962f36b..056bd55 100644 --- a/src/about.ui +++ b/src/about.ui @@ -17,7 +17,7 @@ - Zecwallet Lightclient + Zecwallet Lite diff --git a/src/main.cpp b/src/main.cpp index f4f6a0f..982280b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -205,7 +205,7 @@ public: w = new MainWindow(); - w->setWindowTitle("Zecwallet Lightclient v" + QString(APP_VERSION)); + w->setWindowTitle("Zecwallet Lite v" + QString(APP_VERSION)); // If there was a payment URI on the command line, pay it if (parser.positionalArguments().length() > 0) { From ae546b701514652638ac487b48b7ae15b3e22c72 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 14 Nov 2019 01:05:06 -0800 Subject: [PATCH 13/19] Fix compiler warning pertaining to deprecated method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously when compiling, the following deprecation warning would be encountered: ``` src/mainwindow.cpp:447:70: warning: ‘QList QObject::findChildren(const QRegExp&, Qt::FindChildOptions) const [with T = QLineEdit*; Qt::FindChildOptions = QFlags]’ is deprecated: Use findChildren(const QRegularExpression &, ...) instead. [-Wdeprecated-declarations] ``` This commit updates this line to the non-deprecated QT5 version of this method, which uses QRegularExpression rather than QRegExp, thus removing the warning. --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6d40796..eafdbac 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -16,6 +16,7 @@ #include "connection.h" #include "requestdialog.h" #include "websockets.h" +#include using json = nlohmann::json; @@ -443,7 +444,7 @@ void MainWindow::setupSettingsModal() { void MainWindow::addressBook() { // Check to see if there is a target. - QRegExp re("Address[0-9]+", Qt::CaseInsensitive); + QRegularExpression re("Address[0-9]+", QRegularExpression::CaseInsensitiveOption); for (auto target: ui->sendToWidgets->findChildren(re)) { if (target->hasFocus()) { AddressBook::open(this, target); From add46f996099ab632044b249f9e251d0fc1b282c Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Thu, 14 Nov 2019 09:21:00 -0800 Subject: [PATCH 14/19] Fix regular exp warning --- src/sendtab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 6c8023d..8b3e5d9 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -158,7 +158,7 @@ void MainWindow::updateLabelsAutoComplete() { labelCompleter->setCaseSensitivity(Qt::CaseInsensitive); // Then, find all the address fields and update the completer. - QRegExp re("Address[0-9]+", Qt::CaseInsensitive); + QRegularExpression re("Address[0-9]+", QRegularExpression::CaseInsensitiveOption); for (auto target: ui->sendToWidgets->findChildren(re)) { target->setCompleter(labelCompleter); } From 6520a09e6d790940e67ef035cbc229f63b43d607 Mon Sep 17 00:00:00 2001 From: Arjun Date: Fri, 15 Nov 2019 10:31:50 -0800 Subject: [PATCH 15/19] Init logging with yeclite --- lib/Cargo.toml | 2 +- lib/src/lib.rs | 9 +++++++++ src/controller.cpp | 2 ++ src/settings.h | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index a2f32a9..ccab1bf 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "61dc063fe155d1510e9a074e5a3577a0621f8c3a" } +zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "96997c5a467b710286bc9c6fea818b9d7d76f254" } diff --git a/lib/src/lib.rs b/lib/src/lib.rs index afe5456..39c5989 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -57,6 +57,9 @@ pub extern fn litelib_initialize_new(dangerous: bool, server: *const c_char) -> } }; + // Initialize logging + let _ = lightclient.init_logging(); + let seed = match lightclient.do_seed_phrase() { Ok(s) => s.dump(), Err(e) => { @@ -105,6 +108,9 @@ pub extern fn litelib_initialize_new_from_phrase(dangerous: bool, server: *const } }; + // Initialize logging + let _ = lightclient.init_logging(); + LIGHTCLIENT.lock().unwrap().replace(Some(Arc::new(lightclient))); let c_str = CString::new("OK").unwrap(); @@ -137,6 +143,9 @@ pub extern fn litelib_initialize_existing(dangerous: bool, server: *const c_char } }; + // Initialize logging + let _ = lightclient.init_logging(); + LIGHTCLIENT.lock().unwrap().replace(Some(Arc::new(lightclient))); let c_str = CString::new("OK").unwrap(); diff --git a/src/controller.cpp b/src/controller.cpp index 8459236..3b9b045 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -169,6 +169,8 @@ void Controller::getInfoThenRefresh(bool force) { bool doUpdate = force || (model->getLatestBlock() != curBlock); model->setLatestBlock(curBlock); + main->logger->write(QString("Refresh. curblock ") % QString::number(curBlock) % ", update=" % (doUpdate ? "true" : "false") ); + // Connected, so display checkmark. auto tooltip = Settings::getInstance()->getSettings().server + "\n" + QString::fromStdString(zrpc->getConnection()->getInfo().dump()); diff --git a/src/settings.h b/src/settings.h index a031d89..78e824e 100644 --- a/src/settings.h +++ b/src/settings.h @@ -99,7 +99,7 @@ public: static const QString labelRegExp; - static const int updateSpeed = 60 * 1000; // 60 sec + static const int updateSpeed = 30 * 1000; // 30 sec static const int priceRefreshSpeed = 60 * 60 * 1000; // 1 hr private: From 1a762b01c8835f12c47ff7b7de267afde8006d7e Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Sat, 16 Nov 2019 16:03:43 -0800 Subject: [PATCH 16/19] Allow multiple servers in settings --- lib/Cargo.lock | 6 +++--- src/mainwindow.cpp | 16 ++++++++++++---- src/settings.ui | 23 +++++++++-------------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 2a9ad8f..e32ab35 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a)", + "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)", ] [[package]] @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "zecwalletlitelib" version = "0.1.0" -source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a#61dc063fe155d1510e9a074e5a3577a0621f8c3a" +source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254#96997c5a467b710286bc9c6fea818b9d7d76f254" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)", @@ -2562,4 +2562,4 @@ dependencies = [ "checksum zcash_client_backend 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_primitives 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_proofs 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" -"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=61dc063fe155d1510e9a074e5a3577a0621f8c3a)" = "" +"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)" = "" diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eafdbac..a85f692 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -408,9 +408,13 @@ void MainWindow::setupSettingsModal() { // Fetch prices settings.chkFetchPrices->setChecked(Settings::getInstance()->getAllowFetchPrices()); + // List of default servers + settings.cmbServer->addItem("https://lightd-main.zecwallet.co:443"); + settings.cmbServer->addItem("https://lightd-main.zcashfr.io:443"); + // Load current values into the dialog auto conf = Settings::getInstance()->getSettings(); - settings.txtServer->setText(conf.server); + settings.cmbServer->setCurrentText(conf.server); // Connection tab by default settings.tabWidget->setCurrentIndex(0); @@ -429,11 +433,15 @@ void MainWindow::setupSettingsModal() { Settings::getInstance()->setAllowFetchPrices(settings.chkFetchPrices->isChecked()); // Save the server - Settings::getInstance()->saveSettings(settings.txtServer->text().trimmed()); + bool reloadConnection = false; + if (conf.server != settings.cmbServer->currentText().trimmed()) { + reloadConnection = true; + } + Settings::getInstance()->saveSettings(settings.cmbServer->currentText().trimmed()); - if (false /* connection needs reloading?*/) { + if (reloadConnection) { // Save settings - Settings::getInstance()->saveSettings(settings.txtServer->text()); + Settings::getInstance()->saveSettings(settings.cmbServer->currentText()); auto cl = new ConnectionLoader(this, rpc); cl->loadConnection(); diff --git a/src/settings.ui b/src/settings.ui index b18879e..4c031c4 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -10,12 +10,6 @@ 539 - - - 540 - 500 - - Settings @@ -57,14 +51,15 @@ - - - - - - - - + + + + + true + + + + From 66c60464e6498bd13ba439e42803f8147d1d8cf7 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Sat, 16 Nov 2019 16:05:11 -0800 Subject: [PATCH 17/19] Require TLS cert --- src/connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.cpp b/src/connection.cpp index 41ea1d6..f74584f 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -42,7 +42,7 @@ void ConnectionLoader::doAutoConnect() { qDebug() << "Doing autoconnect"; auto config = std::shared_ptr(new ConnectionConfig()); - config->dangerous = true; + config->dangerous = false; config->server = Settings::getInstance()->getSettings().server; // Initialize the library From 7a9552f5f11688c06d27636b27814597f4ef82db Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Sat, 16 Nov 2019 20:45:13 -0800 Subject: [PATCH 18/19] Allow custom servers --- src/mainwindow.cpp | 10 +++++++--- src/settings.ui | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a85f692..d03ef72 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -442,9 +442,13 @@ void MainWindow::setupSettingsModal() { if (reloadConnection) { // Save settings Settings::getInstance()->saveSettings(settings.cmbServer->currentText()); - - auto cl = new ConnectionLoader(this, rpc); - cl->loadConnection(); + + // Save the wallet + getRPC()->saveWallet([=] (auto) { + // Then reload the connection + auto cl = new ConnectionLoader(this, rpc); + cl->loadConnection(); + }); } } }); diff --git a/src/settings.ui b/src/settings.ui index 4c031c4..ae44092 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -46,7 +46,7 @@ - Server + Lightwallet Server From d81fac8b08fb98a007ab249b652888d735a515b3 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Sat, 16 Nov 2019 21:22:31 -0800 Subject: [PATCH 19/19] Add rescan to UI --- lib/Cargo.lock | 6 +++--- lib/Cargo.toml | 2 +- src/connection.cpp | 1 - src/controller.h | 2 ++ src/liteinterface.cpp | 7 +++++++ src/liteinterface.h | 1 + src/mainwindow.cpp | 22 +++++++++++++------- src/mainwindow.ui | 13 +++++++++--- src/settings.ui | 48 ++----------------------------------------- 9 files changed, 41 insertions(+), 61 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index e32ab35..540dfaf 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)", + "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf)", ] [[package]] @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "zecwalletlitelib" version = "0.1.0" -source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254#96997c5a467b710286bc9c6fea818b9d7d76f254" +source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf#165c22e39e5b43d417f8719edcf91b07c15906bf" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)", @@ -2562,4 +2562,4 @@ dependencies = [ "checksum zcash_client_backend 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_primitives 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_proofs 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" -"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)" = "" +"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf)" = "" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index ccab1bf..3237cce 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "96997c5a467b710286bc9c6fea818b9d7d76f254" } +zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "165c22e39e5b43d417f8719edcf91b07c15906bf" } diff --git a/src/connection.cpp b/src/connection.cpp index f74584f..cb7cb4e 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -139,7 +139,6 @@ Connection* ConnectionLoader::makeConnection(std::shared_ptr c // Update the UI with the status void ConnectionLoader::showInformation(QString info, QString detail) { - qDebug() << "Showing info " << info << ":" << detail; connD->status->setText(info); connD->statusDetail->setText(detail); } diff --git a/src/controller.h b/src/controller.h index 981730d..43a8e0b 100644 --- a/src/controller.h +++ b/src/controller.h @@ -62,6 +62,8 @@ public: void saveWallet(const std::function& cb) { zrpc->saveWallet(cb); } + void clearWallet(const std::function& cb) { zrpc->clearWallet(cb); } + void createNewZaddr(bool sapling, const std::function& cb) { unlockIfEncrypted([=] () { zrpc->createNewZaddr(sapling, cb); diff --git a/src/liteinterface.cpp b/src/liteinterface.cpp index 0f4bfe9..c9e5138 100644 --- a/src/liteinterface.cpp +++ b/src/liteinterface.cpp @@ -84,6 +84,13 @@ void LiteInterface::saveWallet(const std::function& cb) { conn->doRPCWithDefaultErrorHandling("save", "", cb); } +void LiteInterface::clearWallet(const std::function& cb) { + if (conn == nullptr) + return; + + conn->doRPCWithDefaultErrorHandling("clear", "", cb); +} + void LiteInterface::unlockWallet(QString password, const std::function& cb) { if (conn == nullptr) return; diff --git a/src/liteinterface.h b/src/liteinterface.h index 70b5732..a1aea04 100644 --- a/src/liteinterface.h +++ b/src/liteinterface.h @@ -58,6 +58,7 @@ public: void fetchSeed(const std::function&); void saveWallet(const std::function& cb); + void clearWallet(const std::function& cb); void fetchWalletEncryptionStatus(const std::function& cb); void encryptWallet(QString password, const std::function& cb); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d03ef72..c9ccc94 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -105,6 +105,20 @@ MainWindow::MainWindow(QWidget *parent) : AppDataServer::getInstance()->connectAppDialog(this); }); + // Rescan + QObject::connect(ui->actionRescan, &QAction::triggered, [=]() { + // To rescan, we clear the wallet state, and then reload the connection + // This will start a sync, and show the scanning status. + getRPC()->clearWallet([=] (auto) { + // Save the wallet + getRPC()->saveWallet([=] (auto) { + // Then reload the connection. The ConnectionLoader deletes itself. + auto cl = new ConnectionLoader(this, rpc); + cl->loadConnection(); + }); + }); + }); + // Address Book QObject::connect(ui->action_Address_Book, &QAction::triggered, this, &MainWindow::addressBook); @@ -419,12 +433,6 @@ void MainWindow::setupSettingsModal() { // Connection tab by default settings.tabWidget->setCurrentIndex(0); - // Enable the troubleshooting options only if using embedded zcashd - if (!rpc->isEmbedded()) { - settings.chkRescan->setEnabled(false); - settings.chkRescan->setToolTip(tr("You're using an external zcashd. Please restart zcashd with -rescan")); - } - if (settingsDialog.exec() == QDialog::Accepted) { // Check for updates Settings::getInstance()->setCheckForUpdates(settings.chkCheckUpdates->isChecked()); @@ -445,7 +453,7 @@ void MainWindow::setupSettingsModal() { // Save the wallet getRPC()->saveWallet([=] (auto) { - // Then reload the connection + // Then reload the connection. The ConnectionLoader deletes itself. auto cl = new ConnectionLoader(this, rpc); cl->loadConnection(); }); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index cb8260e..7403eff 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -392,8 +392,8 @@ 0 0 - 1226 - 504 + 1162 + 344 @@ -1088,7 +1088,7 @@ 0 0 1274 - 22 + 39 @@ -1130,6 +1130,8 @@ + + @@ -1226,6 +1228,11 @@ Remove Wallet Encryption + + + Rescan + + diff --git a/src/settings.ui b/src/settings.ui index ae44092..a0fa476 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -6,7 +6,7 @@ 0 0 - 540 + 733 539 @@ -20,7 +20,7 @@ - 0 + 1 @@ -183,50 +183,6 @@ - - - Troubleshooting - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - Rescan the blockchain for any missing wallet transactions and to correct your wallet balance. This may take several hours. You need to restart ZecWallet for this to take effect - - - true - - - - - - - Rescan - - - - -