From 0a2853871c432aa1c9aa8227c2df87cd062d8d68 Mon Sep 17 00:00:00 2001 From: Joseph Wyman Date: Mon, 23 Sep 2024 08:38:03 -0400 Subject: [PATCH 1/9] update todos --- TODO.md | 8 ++------ src/main/main.ts | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index fcc9a498..d44397f9 100644 --- a/TODO.md +++ b/TODO.md @@ -13,18 +13,14 @@ - Also set the default custom fee rate to the current rate # TODOs build -- reduce startup time. +- build for rpm redhat linux +- reduce startup time on macOS. - use a random port to run the backend on -- build for not just macOS? - - https://github.com/pyinstaller/pyinstaller/wiki/FAQ#features - - "Since pyinstaller is not a cross-compiler (which means with pyinstaller you cannot create an executable for any other system than the one you are on), you will have to look for other tools." - - use wine? - Analyze the build size and try to make it smaller - e2e tests # Feature Ideas -- consolidation recommendation support. - utxo cost breakdown. - individual non wallet fee estimation. - additional hardware wallet support diff --git a/src/main/main.ts b/src/main/main.ts index c99dcbf8..a41f77df 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -227,8 +227,6 @@ const createWindow = async () => { height: 900, minHeight: 874, minWidth: 824, - // TODO add logic to detect linux? - // test build on mac to see if this still shows icons icon: path.join(__dirname, 'resources/assets/icons'), title: 'UXTO Fee Estimator', webPreferences: { From 9dcae4bd7525bfe51818749c2d7d48da366b5cf1 Mon Sep 17 00:00:00 2001 From: jwyman328 Date: Tue, 24 Sep 2024 08:13:27 -0400 Subject: [PATCH 2/9] add rpm based builds --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index 124c7752..22c758b3 100644 --- a/package.json +++ b/package.json @@ -242,6 +242,13 @@ "arm64" ] }, + { + "target": "rpm", + "arch": [ + "x64", + "arm64" + ] + }, { "target": "AppImage", "arch": [ From 19c74fcbb438c51f4b3cee3aef0fcc895d79ada0 Mon Sep 17 00:00:00 2001 From: jwyman328 Date: Thu, 26 Sep 2024 20:14:14 -0400 Subject: [PATCH 3/9] add changes for windows builds, new build scripts and remove icon that was too small --- assets/icon.ico | Bin 3230 -> 0 bytes backend/build_windows_executable.sh | 6 ++++++ package.json | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) delete mode 100644 assets/icon.ico create mode 100644 backend/build_windows_executable.sh diff --git a/assets/icon.ico b/assets/icon.ico deleted file mode 100644 index cd8a93a369db63dab9e6f50c07023aaa8c752a1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3230 zcmc&%TToP27VY_;n$M|x=5s#hCzXn+$;44Xx!p~_o7gWPH1wKv?rqUFmS2;~p?05p&)Mg!b@pES zbYn35fq#!bW)Po-mOmN{e>NBlf1y22`zuY1YmIZ!Kk23q7z_|Cnf&by#P~g%fPV;u zL}VKF*Y?16suZ^N?f2OZDD5S%w-saZ%r@9xHU8R88!<_{H&@DMVMZwIh1pMUgY9H7 zW}OrI>643TQAk9mF;TM`BRikK=$>U5EqjW#3}az;zSE)#Oisx*_TR?>GR|C`Vs_ud@wa;=10hC9h`?xN;8GhIKHLw}tC0^*N9^ z?zwOTo=;jdAM3$<_J7lS1zvJ-L3C-&^;#J$f_Hr$dE~-=APYCjN-$Qlo?OtBHL(0Zs%MJX$U+PDrX`KaWf9^OFzJh<9Q5&EhF zcIv=+dXMa6{KcWYEi5gbHUGFeF#1f@y}txG!JW+8ER`O+zlDHRk4LyD8dwT z;iLwg2eTQAb#OFqg0r<4PM&v?nsXd}PQwaZXo2_b8n{kuMS%5TXFdYdpyymURMvvZ z+Hs%V1ztcp2YxQaKahaba|h<3d6;_wP%mDe6bbQ{$Y52WS zSWIEarZ}v(fd0+^#(H9~++2iwGYNSpsqvF;%)l-GBG_yD%$k3|6!E7R2hYi^m>Iqf zAM43QK4R?WuV06UF>wo?%vEgYijL1ZOvCSqz|tRu+!ujuFbdPB4vcn%VC|2<+{f7T zg~>0%IECSsW;A?pe~UKFnshf6!cDy3JGJn&m%_vIx|`M`#99cPufh~_=cYENsST|? zc>X2)C~QM<^j~se^x8Bm12LFQQOyKDiGFTrHnoL*m(58-@Dkrg?RlG@hfmy9$2P-z z-i@P9D>ch67!!8iskPhsr)pC65%3ZU38*s%-#))x^F z`V%$4-cOB&d1s0iVSV@+AOF!!n0M&k#}AKx6jtI7cDgav{b+nm0;yV#n>yidDnPK^ zh+ta@f~Wq?-iSc+2E_X=Bl2|z0b)gP#-sI`Ib? zf5u&yn3w41mi73j{ia!1K=iA#2(>Wg#0eeWjL^v~v|{afnwkim*n(hl5yBrers0SE z^BDi0+UMRPzh+Ym1DB>S`rS13NX%Z2)5N^+n;O^imxeE1c%XU9kBD7)9gzZek|2UxML=RM2ur!Rj{|Ee5{r>>>" }, From c2a6feb89571d6358851f8fbf5e99502d65c5a73 Mon Sep 17 00:00:00 2001 From: Joseph Wyman Date: Sat, 28 Sep 2024 09:11:01 -0400 Subject: [PATCH 4/9] add additional windows command to shut down backend process --- src/main/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/main.ts b/src/main/main.ts index a41f77df..31bf3730 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -282,7 +282,11 @@ app.on('window-all-closed', () => { app.on('before-quit', () => { if (backendProcess) { console.log('killing backend process'); - backendProcess.kill(); + if (process.platform === 'win32') { + backendProcess.kill('SIGTERM'); + } else { + backendProcess.kill(); + } } }); From 7b38c54e94348372f2f49979b0b3e0e3f9082a77 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Sep 2024 18:09:06 -0400 Subject: [PATCH 5/9] add tree kill and kill all child process in order to kill backend on windows --- package-lock.json | 4 ++-- package.json | 3 ++- src/main/main.ts | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19d214f1..991a01eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,8 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-query": "^3.39.3", - "react-router-dom": "^6.16.0" + "react-router-dom": "^6.16.0", + "tree-kill": "^1.2.2" }, "devDependencies": { "@electron/notarize": "^2.3.1", @@ -19317,7 +19318,6 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, "bin": { "tree-kill": "cli.js" } diff --git a/package.json b/package.json index 21cf658f..ad4bcccb 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,8 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-query": "^3.39.3", - "react-router-dom": "^6.16.0" + "react-router-dom": "^6.16.0", + "tree-kill": "^1.2.2" }, "devDependencies": { "@electron/notarize": "^2.3.1", diff --git a/src/main/main.ts b/src/main/main.ts index 31bf3730..db8041fe 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -213,8 +213,8 @@ const createWindow = async () => { } } - if (process.env.NODE_ENV === 'production') { - startupBackend(); + if (true) { + startupBackend(process.env.NODE_ENV === "production"); } else { console.log( 'Backend is not starting via electron, please start it separately via backend/start_app.sh', @@ -283,7 +283,8 @@ app.on('before-quit', () => { if (backendProcess) { console.log('killing backend process'); if (process.platform === 'win32') { - backendProcess.kill('SIGTERM'); + const kill = require("tree-kill") + kill(backendProcess.pid, "SIGTERM") } else { backendProcess.kill(); } From 70992768b90ae933fdb87cbf5d3f11baef085885 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Sep 2024 18:13:44 -0400 Subject: [PATCH 6/9] fix if statement --- src/main/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index db8041fe..013d2715 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -213,8 +213,8 @@ const createWindow = async () => { } } - if (true) { - startupBackend(process.env.NODE_ENV === "production"); + if (process.env.NODE_ENV === "production") { + startupBackend(); } else { console.log( 'Backend is not starting via electron, please start it separately via backend/start_app.sh', From 65abb06ad666add6aca6cf0200ad06c2370309d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Sep 2024 18:17:40 -0400 Subject: [PATCH 7/9] make single quotes --- src/main/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/main.ts b/src/main/main.ts index 013d2715..5ca9960b 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -213,7 +213,7 @@ const createWindow = async () => { } } - if (process.env.NODE_ENV === "production") { + if (process.env.NODE_ENV === 'production') { startupBackend(); } else { console.log( From 7f02fc7b6672f384c3d2a97c899d759a5284a825 Mon Sep 17 00:00:00 2001 From: Joseph Wyman Date: Sun, 29 Sep 2024 10:46:49 -0400 Subject: [PATCH 8/9] fix logout and save wallet dropdown buttons being enabled on the signin page incorrectly --- NOTES.md | 35 +++++++++++++++++++++++++++++ TODO.md | 2 +- src/app/pages/WalletSignIn.test.tsx | 2 +- src/app/pages/WalletSignIn.tsx | 2 +- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/NOTES.md b/NOTES.md index 11b2ac57..ed99c5fa 100644 --- a/NOTES.md +++ b/NOTES.md @@ -143,3 +143,38 @@ The linux system that I build the app with does not have to be the one that I te - $ sudo apt-get install open-vm-tools-desktop -y - to build the production app via $ npm run package - you must first install rpm $ sudo apt-get install rpm + + + - Fixing the issue where ubuntu would freeze on refetch. + - this was most likely do to not having enough disk space. + - a temporary fix is + - https://askubuntu.com/questions/1387469/boot-hangs-when-starting-gdm-service + - a permenant solution was to increase disk space. + - disk space can not just be allocated to the disk but must then be distributed to the file system. + - $lsblk + - this will check the current disk space + - resize the partition + - sudo apt update + - sudo apt install cloud-guest-utils + - one of the two commands below + - sudo growpart /dev/sda 1 + - sudo growpart /dev/sda 2 + - resize the file system + - sudo resize2fs /dev/sda1 + - verify the changes + - df -h + - an alternative way is to do this is to use parted. + - $ sudo parted /dev/sda + - $ print + - $ resizepart 2 100% + - $ exit + - sudo resize2fs /dev/sda2 + - df -h + + +# build for windows + - use wine on ubuntu to build the windows executable. + - wine download steps https://gitlab.winehq.org/wine/wine/-/wikis/Debian-Ubuntu + - helpful walk through https://www.makeworld.space/2021/10/linux-wine-pyinstaller.html + - after the exe is built you can build with electron-builder targeting the windows build. + diff --git a/TODO.md b/TODO.md index d44397f9..b559da59 100644 --- a/TODO.md +++ b/TODO.md @@ -13,7 +13,7 @@ - Also set the default custom fee rate to the current rate # TODOs build -- build for rpm redhat linux +- write scripts to help update the versions in the website page. - reduce startup time on macOS. - use a random port to run the backend on - Analyze the build size and try to make it smaller diff --git a/src/app/pages/WalletSignIn.test.tsx b/src/app/pages/WalletSignIn.test.tsx index 7d2744f4..861051ee 100644 --- a/src/app/pages/WalletSignIn.test.tsx +++ b/src/app/pages/WalletSignIn.test.tsx @@ -445,7 +445,7 @@ describe('WalletSignIn', () => { expect(mockElectron.ipcRenderer.sendMessage).toHaveBeenCalledWith( 'current-route', - '/signin', + Pages.SIGN_IN ); expect(mockElectron.ipcRenderer.on).toHaveBeenCalledWith( diff --git a/src/app/pages/WalletSignIn.tsx b/src/app/pages/WalletSignIn.tsx index 4b4da0ad..9cfa22c2 100644 --- a/src/app/pages/WalletSignIn.tsx +++ b/src/app/pages/WalletSignIn.tsx @@ -546,7 +546,7 @@ export const WalletSignIn = () => { // @ts-ignore window.electron.ipcRenderer.on('json-wallet', handleImportedWallet); - window.electron.ipcRenderer.sendMessage('current-route', '/signin'); + window.electron.ipcRenderer.sendMessage('current-route', Pages.SIGN_IN); }, []); const createKeyInformationTabs = () => { From 9e22b4afc6b1f288148c849e1ad10c411e02482d Mon Sep 17 00:00:00 2001 From: jwyman328 Date: Sun, 29 Sep 2024 12:22:18 -0400 Subject: [PATCH 9/9] update to version 0.9.0, and add build system to windows --- CHANGELOG.md | 4 ++++ backend/build_windows_executable.sh | 20 +++++++++++++++----- backend/setup.cfg | 2 +- release/app/package-lock.json | 4 ++-- release/app/package.json | 2 +- scripts/package_app.sh | 15 ++++++++++++--- scripts/update_app_version.sh | 21 ++++++++++++--------- 7 files changed, 47 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b35a27..16629032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9.0 +- Build for redhat linux distributions, and windows. +- bugfixes + # 0.8.0 - Linux builds and small dynamic style improvements - logout dropdown button diff --git a/backend/build_windows_executable.sh b/backend/build_windows_executable.sh index 2a94740b..7d02a01c 100644 --- a/backend/build_windows_executable.sh +++ b/backend/build_windows_executable.sh @@ -1,6 +1,16 @@ +# Check if Wine is installed +if command -v wine &> /dev/null; then + echo "Wine is installed. Running Python script with Wine." + + # pyinstaller needs to be installed in order to run this command and build the executable + # This command will result in an executable placed in assets/ directory + # --add-binary="./libusb-1.0.dylib:." is needed because libusb is a macos dependency for using the hwi hardware wallet library, without it macos will not be able to successfully communicate to devices over usb. + wine C:/Python310/python.exe -m pip install pyinstaller + ENVIRONMENT="NOT_ANYTHING" wine C:/Python310/Scripts/pyinstaller.exe -F --distpath=../assets --noconfirm --windowed --hidden-import "configparser" --hidden-import "six" --collect-submodules "bdkpython" --collect-binaries "bdkpython" --add-binary="./libusb-1.0.dylib:." --collect-submodules "hwi" --collect-binaries "hwi" --hidden-import "dependency_injector.errors" --hidden-import "hwilib.devices.trezor" --hidden-import "hwilib.devices.ledger" --hidden-import "hwilib.devices.keepkey" --hidden-import "hwilib.devices.digitalbitbox" --hidden-import "hwilib.devices.coldcard" --hidden-import "hwilib.devices.bitbox02" --hidden-import "hwilib.devices.jade" "src/app.py" +else + echo "Wine is not installed. not building for windows, exiting." + exit 1 # Exit with a non-zero status +fi + + -# pyinstaller needs to be installed in order to run this command and build the executable -# This command will result in an executable placed in assets/ directory -# --add-binary="./libusb-1.0.dylib:." is needed because libusb is a macos dependency for using the hwi hardware wallet library, without it macos will not be able to successfully communicate to devices over usb. -wine C:/Python310/python.exe -m pip install pyinstaller - ENVIRONMENT="NOT_ANYTHING" wine C:/Python310/Scripts/pyinstaller.exe -F --distpath=../assets --noconfirm --windowed --hidden-import "configparser" --hidden-import "six" --collect-submodules "bdkpython" --collect-binaries "bdkpython" --add-binary="./libusb-1.0.dylib:." --collect-submodules "hwi" --collect-binaries "hwi" --hidden-import "dependency_injector.errors" --hidden-import "hwilib.devices.trezor" --hidden-import "hwilib.devices.ledger" --hidden-import "hwilib.devices.keepkey" --hidden-import "hwilib.devices.digitalbitbox" --hidden-import "hwilib.devices.coldcard" --hidden-import "hwilib.devices.bitbox02" --hidden-import "hwilib.devices.jade" "src/app.py" diff --git a/backend/setup.cfg b/backend/setup.cfg index 0c840bb2..3eab7ee4 100644 --- a/backend/setup.cfg +++ b/backend/setup.cfg @@ -2,7 +2,7 @@ [metadata] name = local_family_wallet -version = 0.8.0 +version = 0.9.0 [options] packages = src diff --git a/release/app/package-lock.json b/release/app/package-lock.json index 11737b22..cb9bb651 100644 --- a/release/app/package-lock.json +++ b/release/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "LiveWallet", - "version": "0.8.0", + "version": "0.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "LiveWallet", - "version": "0.8.0", + "version": "0.9.0", "hasInstallScript": true, "license": "MIT" } diff --git a/release/app/package.json b/release/app/package.json index 110b8fba..c11fda48 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "LiveWallet", - "version": "0.8.0", + "version": "0.9.0", "description": "An application to understand the health of your Bitcoin wallet.", "license": "MIT", "author": { diff --git a/scripts/package_app.sh b/scripts/package_app.sh index 8839e768..2a932e89 100644 --- a/scripts/package_app.sh +++ b/scripts/package_app.sh @@ -2,14 +2,23 @@ cd ../backend source environment.sh -bash build_executable.sh +## Check if the first argument is 'windows' +if [ "$1" == "windows" ]; then + bash build_windows_executable.sh +else + bash build_executable.sh +fi + cd .. # Define the command to run npm_command="run package" # Check the operating system -if [[ "$(uname)" == "Darwin" ]]; then +if [[ "$1" == "windows" ]]; then + echo "Detected Windows variable. Running npm package for Windows." + npm $npm_command:windows +elif [[ "$(uname)" == "Darwin" ]]; then # macOS detected echo "Running on macOS. Using sudo for npm package." sudo npm $npm_command:mac @@ -19,5 +28,5 @@ else npm $npm_command:linux fi -# also notarize the macOs app via additional commandline tools +# also notarize the macOs app builds via additional commandline tools # For more details view notes # notarizing macOs app diff --git a/scripts/update_app_version.sh b/scripts/update_app_version.sh index ec54579d..34a4d114 100644 --- a/scripts/update_app_version.sh +++ b/scripts/update_app_version.sh @@ -2,7 +2,7 @@ # This script will update the app version number in all locations, add to the CHANGELOG and then create a new release build. # example usage -# $ bash update_app_version.sh "1.2.0" "I am adding another item to the change log" +# $ bash update_app_version.sh "1.2.0" "I am adding another item to the change log" "windows" # Function to install jq install_jq() { @@ -31,21 +31,24 @@ if ! command -v jq &> /dev/null; then fi # Check if the correct number of arguments are passed -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " exit 1 fi # Assign the new version from the command line argument NEW_VERSION="$1" CHANGELOG_ENTRY="$2" +OS_TYPE="$3" # Define the path to your package-lock.json file -PACKAGE_LOCK_PATH="./release/app/package-lock.json" -PACKAGE_PATH="./release/app/package.json" -SETUP_CFG_PATH="./backend/setup.cfg" -CHANGELOG_PATH="./CHANGELOG.md" -TEMP_CHANGELOG_PATH="./temp_changelog.md" +PACKAGE_LOCK_PATH="../release/app/package-lock.json" +PACKAGE_PATH="../release/app/package.json" +SETUP_CFG_PATH="../backend/setup.cfg" +CHANGELOG_PATH="../CHANGELOG.md" +TEMP_CHANGELOG_PATH="../temp_changelog.md" + +pwd # Verify that the file exists if [ ! -f "$PACKAGE_LOCK_PATH" ]; then @@ -106,5 +109,5 @@ echo "Version updated to $NEW_VERSION in $PACKAGE_LOCK_PATH and $PACKAGE_PATH an echo "Creating new release build for $NEW_VERSION" -bash ./scripts/package_app.sh +bash ./package_app.sh $OS_TYPE