├── .github └── workflows │ ├── linux-wallet-compile.yml │ ├── macos-wallet-compile.yml │ └── windows-wallet-compile.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LEGAL ├── LICENSE ├── README.md ├── Wallet ├── CMakeLists.txt ├── Resources │ ├── art │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon128.png │ │ │ │ ├── icon128@2x.png │ │ │ │ ├── icon16.png │ │ │ │ ├── icon16@2x.png │ │ │ │ ├── icon256.png │ │ │ │ ├── icon256@2x.png │ │ │ │ ├── icon32.png │ │ │ │ ├── icon32@2x.png │ │ │ │ ├── icon512.png │ │ │ │ └── icon512@2x.png │ │ │ └── Icon.iconset │ │ │ │ ├── icon_128x128.png │ │ │ │ ├── icon_128x128@2x.png │ │ │ │ ├── icon_16x16.png │ │ │ │ ├── icon_16x16@2x.png │ │ │ │ ├── icon_256x256.png │ │ │ │ ├── icon_256x256@2x.png │ │ │ │ ├── icon_32x32.png │ │ │ │ ├── icon_32x32@2x.png │ │ │ │ ├── icon_512x512.png │ │ │ │ └── icon_512x512@2x.png │ │ ├── icon256.ico │ │ └── logo.png │ ├── config-test-default.json │ ├── emoji │ │ ├── emoji_1.webp │ │ ├── emoji_2.webp │ │ ├── emoji_3.webp │ │ ├── emoji_4.webp │ │ └── emoji_5.webp │ ├── mac │ │ ├── Wallet.entitlements │ │ └── Wallet.plist │ ├── qrc │ │ ├── config.qrc │ │ ├── emoji_1.qrc │ │ ├── emoji_2.qrc │ │ ├── emoji_3.qrc │ │ ├── emoji_4.qrc │ │ ├── emoji_5.qrc │ │ └── wrapper.qrc │ └── win │ │ ├── Wallet.manifest │ │ └── Wallet.rc ├── SourceFiles │ ├── core │ │ ├── base_integration.cpp │ │ ├── base_integration.h │ │ ├── launcher.cpp │ │ ├── launcher.h │ │ ├── main.cpp │ │ ├── pch.cpp │ │ ├── pch.h │ │ ├── public_key.h │ │ ├── qt_static_plugins.cpp │ │ ├── sandbox.cpp │ │ ├── sandbox.h │ │ ├── ui_integration.cpp │ │ ├── ui_integration.h │ │ └── version.h │ └── wallet │ │ ├── application.cpp │ │ ├── application.h │ │ ├── config_upgrade_checker.cpp │ │ ├── config_upgrade_checker.h │ │ ├── phrases.cpp │ │ ├── phrases.h │ │ ├── ton_default_settings.cpp │ │ ├── ton_default_settings.h │ │ ├── update_info_provider.cpp │ │ ├── update_info_provider.h │ │ └── wrapper.style ├── build │ ├── build.bat │ ├── build.sh │ ├── deploy.sh │ ├── release.py │ ├── release.sh │ ├── set_version.bat │ ├── set_version.py │ ├── set_version.sh │ ├── setup.iss │ ├── updates.py │ ├── updates.sh │ └── version ├── cmake │ └── wallet_options.cmake ├── configure.bat ├── configure.py ├── configure.sh └── create.bat ├── auto-build ├── macos-10.15 │ ├── compile.sh │ ├── crashpad.patch │ └── wallet.patch ├── ubuntu-18.04 │ └── compile.sh └── windows │ ├── compile.bat │ ├── lib_storage.patch │ └── variant.patch ├── changelog.txt └── docs ├── building-cmake.md ├── building-msvc.md └── building-xcode.md /.github/workflows/linux-wallet-compile.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI Ubuntu 18.04 x86-64 TON Desktop wallet compile 2 | 3 | on: [pull_request,workflow_dispatch] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-18.04 8 | 9 | steps: 10 | - name: Check out current repository 11 | uses: actions/checkout@v2 12 | with: 13 | path: wallet-desktop 14 | - name: Compile linux desktop wallet 15 | run: | 16 | cd wallet-desktop/auto-build/ubuntu-18.04 17 | sudo chmod +x compile.sh 18 | sudo ./compile.sh 19 | - name: Find & copy binaries 20 | run: | 21 | mkdir artifacts 22 | cp wallet-desktop/auto-build/ubuntu-18.04/wallet-desktop/out/Release/bin/Wallet artifacts 23 | - name: Upload artifacts 24 | uses: actions/upload-artifact@master 25 | with: 26 | name: ton-linux-desktop-wallet 27 | path: artifacts 28 | -------------------------------------------------------------------------------- /.github/workflows/macos-wallet-compile.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI MacOS 10.15 TON Desktop wallet compile 2 | on: [pull_request,workflow_dispatch] 3 | jobs: 4 | build: 5 | runs-on: macos-10.15 6 | steps: 7 | - name: Check out current repository 8 | uses: actions/checkout@v2 9 | with: 10 | path: wallet-desktop 11 | - name: Compile macos desktop wallet 12 | run: | 13 | cd wallet-desktop/auto-build/macos-10.15 14 | chmod +x compile.sh 15 | ./compile.sh 16 | - name: Find & copy binaries 17 | run: | 18 | mkdir artifacts 19 | chmod -R 777 wallet-desktop/auto-build/macos-10.15/wallet-desktop/out/Release/Wallet.app 20 | cp -R wallet-desktop/auto-build/macos-10.15/wallet-desktop/out/Release/Wallet.app artifacts 21 | - name: Upload artifacts 22 | uses: actions/upload-artifact@master 23 | with: 24 | name: ton-macos-desktop-wallet 25 | path: artifacts 26 | -------------------------------------------------------------------------------- /.github/workflows/windows-wallet-compile.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI Windows TON Desktop wallet compile 2 | 3 | on: [pull_request,workflow_dispatch] 4 | 5 | defaults: 6 | run: 7 | shell: cmd 8 | 9 | jobs: 10 | build: 11 | runs-on: windows-2019 12 | 13 | steps: 14 | - name: Check out current repository 15 | uses: actions/checkout@v2 16 | with: 17 | path: wallet-desktop 18 | 19 | - name: Setup msbuild.exe 20 | uses: microsoft/setup-msbuild@v1.0.2 21 | 22 | - name: Set up Visual Studio shell 23 | uses: egor-tensin/vs-shell@v2 24 | with: 25 | arch: x86 26 | 27 | - name: Compile windows desktop wallet 28 | run: | 29 | cd wallet-desktop\auto-build\windows 30 | compile.bat 31 | 32 | - name: Find & copy binaries 33 | run: | 34 | mkdir artifacts 35 | cp wallet-desktop\auto-build\windows\wallet-desktop\out\Debug\Wallet.exe artifacts 36 | - name: Upload artifacts 37 | uses: actions/upload-artifact@master 38 | with: 39 | name: ton-windows-desktop-wallet 40 | path: artifacts 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /out/ 2 | Debug/ 3 | Release/ 4 | /ThirdParty/ 5 | /Wallet/build/target 6 | /Wallet/tests/ 7 | /Wallet/gyp/tests/*.test 8 | /Wallet/out/ 9 | /Wallet/*.user 10 | *.vcxproj* 11 | *.sln 12 | *.suo 13 | *.sdf 14 | *.opensdf 15 | *.opendb 16 | *.VC.db 17 | *.aps 18 | *.xcodeproj 19 | /Win32/ 20 | ipch/ 21 | .vs/ 22 | 23 | .DS_Store 24 | ._* 25 | .qmake.stash 26 | /Mac/ 27 | project.xcworkspace 28 | xcuserdata 29 | 30 | parts 31 | prime 32 | stage 33 | *.snap 34 | .snapcraft 35 | /snap/gui/*.png 36 | /snap/gui/*.desktop 37 | /snap/plugins/__pycache__ 38 | 39 | /Wallet/*.user.* 40 | *.pro.user 41 | /Linux/ 42 | /Wallet/Makefile 43 | *.*~ 44 | 45 | .idea 46 | cmake-build-debug -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Wallet/ThirdParty/variant"] 2 | path = Wallet/ThirdParty/variant 3 | url = https://github.com/mapbox/variant.git 4 | [submodule "Wallet/ThirdParty/GSL"] 5 | path = Wallet/ThirdParty/GSL 6 | url = https://github.com/Microsoft/GSL.git 7 | [submodule "Wallet/lib_crl"] 8 | path = Wallet/lib_crl 9 | url = https://github.com/desktop-app/lib_crl.git 10 | [submodule "Wallet/lib_rpl"] 11 | path = Wallet/lib_rpl 12 | url = https://github.com/desktop-app/lib_rpl.git 13 | [submodule "Wallet/lib_base"] 14 | path = Wallet/lib_base 15 | url = https://github.com/desktop-app/lib_base.git 16 | [submodule "Wallet/codegen"] 17 | path = Wallet/codegen 18 | url = https://github.com/desktop-app/codegen.git 19 | [submodule "Wallet/lib_ui"] 20 | path = Wallet/lib_ui 21 | url = https://github.com/desktop-app/lib_ui.git 22 | [submodule "Wallet/lib_tl"] 23 | path = Wallet/lib_tl 24 | url = https://github.com/newton-blockchain/lib_tl.git 25 | [submodule "Wallet/lib_ton"] 26 | path = Wallet/lib_ton 27 | url = https://github.com/newton-blockchain/lib_ton.git 28 | [submodule "Wallet/ThirdParty/rlottie"] 29 | path = Wallet/ThirdParty/rlottie 30 | url = https://github.com/desktop-app/rlottie.git 31 | [submodule "Wallet/lib_lottie"] 32 | path = Wallet/lib_lottie 33 | url = https://github.com/desktop-app/lib_lottie.git 34 | [submodule "Wallet/ThirdParty/xxHash"] 35 | path = Wallet/ThirdParty/xxHash 36 | url = https://github.com/Cyan4973/xxHash.git 37 | [submodule "Wallet/lib_storage"] 38 | path = Wallet/lib_storage 39 | url = https://github.com/desktop-app/lib_storage.git 40 | [submodule "Wallet/lib_wallet"] 41 | path = Wallet/lib_wallet 42 | url = https://github.com/newton-blockchain/lib_wallet.git 43 | [submodule "Wallet/ThirdParty/expected"] 44 | path = Wallet/ThirdParty/expected 45 | url = https://github.com/TartanLlama/expected 46 | [submodule "Wallet/ThirdParty/QR"] 47 | path = Wallet/ThirdParty/QR 48 | url = https://github.com/nayuki/QR-Code-generator 49 | [submodule "Wallet/lib_qr"] 50 | path = Wallet/lib_qr 51 | url = https://github.com/desktop-app/lib_qr.git 52 | [submodule "Wallet/lib_updater"] 53 | path = Wallet/lib_updater 54 | url = https://github.com/desktop-app/lib_updater.git 55 | [submodule "cmake"] 56 | path = cmake 57 | url = https://github.com/desktop-app/cmake_helpers.git 58 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of TON Wallet Desktop, 2 | # a desktop application for the TON Blockchain project. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | 7 | cmake_minimum_required(VERSION 3.16) 8 | cmake_policy(SET CMP0076 NEW) 9 | cmake_policy(SET CMP0091 NEW) 10 | 11 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 12 | 13 | include(cmake/validate_special_target.cmake) 14 | include(cmake/version.cmake) 15 | desktop_app_parse_version(Wallet/build/version) 16 | 17 | project(Wallet 18 | LANGUAGES C CXX 19 | VERSION ${desktop_app_version_cmake} 20 | DESCRIPTION "Test TON Wallet" 21 | HOMEPAGE_URL "https://wallet.ton.org" 22 | ) 23 | set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Wallet) 24 | 25 | get_filename_component(third_party_loc "Wallet/ThirdParty" REALPATH) 26 | get_filename_component(submodules_loc "Wallet" REALPATH) 27 | 28 | include(cmake/variables.cmake) 29 | include(cmake/nice_target_sources.cmake) 30 | include(cmake/target_link_static_libraries.cmake) 31 | include(cmake/target_link_frameworks.cmake) 32 | include(cmake/init_target.cmake) 33 | include(cmake/generate_target.cmake) 34 | 35 | include(cmake/options.cmake) 36 | 37 | include(cmake/external/qt/package.cmake) 38 | 39 | set(desktop_app_skip_libs 40 | dbusmenu_qt 41 | ffmpeg 42 | hunspell 43 | iconv 44 | lz4 45 | minizip 46 | openal 47 | opus 48 | sp_media_key_tap 49 | statusnotifieritem 50 | ) 51 | set(DESKTOP_APP_LOTTIE_USE_CACHE OFF) 52 | 53 | add_subdirectory(cmake) 54 | add_subdirectory(Wallet) 55 | -------------------------------------------------------------------------------- /LEGAL: -------------------------------------------------------------------------------- 1 | This file is part of TON Wallet Desktop, 2 | a desktop application for the TON Blockchain project. 3 | 4 | Copyright (c) 2014-2019 John Preston 5 | 6 | TON Wallet Desktop is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | It is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | In addition, as a special exception, the copyright holders give permission 17 | to link the code of portions of this program with the OpenSSL library. 18 | 19 | Full license: https://github.com/ton-blockchain/wallet-desktop/blob/master/LICENSE 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [TON Wallet][ton_wallet] (Desktop) 2 | 3 | This is the source code and build instructions for a TON Wallet implementation for desktops. 4 | 5 | The source code is published under GPLv3 with OpenSSL exception, the license is available [here][license]. 6 | 7 | ## Supported systems 8 | 9 | * Windows 7 and later 10 | * macOS 10.12 and later 11 | * Ubuntu 14.04 and later (64 bit) 12 | 13 | ## Third-party 14 | 15 | * Qt 5.12.8, slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html)) 16 | * OpenSSL 1.1.1 ([OpenSSL License](https://www.openssl.org/source/license.html)) 17 | * zlib 1.2.8 ([zlib License](http://www.zlib.net/zlib_license.html)) 18 | * LZMA SDK 9.20 ([public domain](http://www.7-zip.org/sdk.html)) 19 | * liblzma ([public domain](http://tukaani.org/xz/)) 20 | * Google Breakpad ([License](https://chromium.googlesource.com/breakpad/breakpad/+/master/LICENSE)) 21 | * Google Crashpad ([Apache License 2.0](https://chromium.googlesource.com/crashpad/crashpad/+/master/LICENSE)) 22 | * GYP ([BSD License](https://github.com/bnoordhuis/gyp/blob/master/LICENSE)) 23 | * Ninja ([Apache License 2.0](https://github.com/ninja-build/ninja/blob/master/COPYING)) 24 | * Guideline Support Library ([MIT License](https://github.com/Microsoft/GSL/blob/master/LICENSE)) 25 | * Mapbox Variant ([BSD License](https://github.com/mapbox/variant/blob/master/LICENSE)) 26 | * Range-v3 ([Boost License](https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt)) 27 | * Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)) 28 | * xxHash ([BSD License](https://github.com/Cyan4973/xxHash/blob/dev/LICENSE)) 29 | 30 | ## Build instructions 31 | 32 | * [Visual Studio 2019][msvc] 33 | * [Xcode 10][xcode] 34 | * [GYP/CMake on GNU/Linux][cmake] 35 | 36 | [//]: # (LINKS) 37 | [ton_wallet]: https://wallet.ton.org 38 | [license]: LICENSE 39 | [msvc]: docs/building-msvc.md 40 | [xcode]: docs/building-xcode.md 41 | [cmake]: docs/building-cmake.md 42 | 43 | -------------------------------------------------------------------------------- /Wallet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of TON Wallet Desktop, 2 | # a desktop application for the TON Blockchain project. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | 7 | add_executable(Wallet WIN32 MACOSX_BUNDLE) 8 | init_target(Wallet) 9 | 10 | if (${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)") 11 | set(output_folder ${CMAKE_BINARY_DIR}) 12 | elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") 13 | set(output_folder ${CMAKE_BINARY_DIR}/bin) 14 | else() 15 | set(output_folder ${CMAKE_BINARY_DIR}/$,Debug,Release>) 16 | endif() 17 | set(update_packer_output_folder ${output_folder}) 18 | 19 | add_subdirectory(lib_rpl) 20 | add_subdirectory(lib_crl) 21 | add_subdirectory(lib_base) 22 | add_subdirectory(lib_ui) 23 | add_subdirectory(lib_tl) 24 | add_subdirectory(lib_storage) 25 | add_subdirectory(lib_lottie) 26 | add_subdirectory(lib_qr) 27 | add_subdirectory(lib_ton) 28 | if (NOT disable_autoupdate) 29 | add_subdirectory(lib_updater) 30 | endif() 31 | add_subdirectory(lib_wallet) 32 | add_subdirectory(codegen) 33 | 34 | include(CheckCXXSourceCompiles) 35 | include(lib_ui/cmake/generate_styles.cmake) 36 | 37 | get_filename_component(src_loc SourceFiles REALPATH) 38 | get_filename_component(res_loc Resources REALPATH) 39 | 40 | include(cmake/wallet_options.cmake) 41 | 42 | set(style_files 43 | wallet/wrapper.style 44 | ) 45 | 46 | set(dependent_style_files 47 | ${submodules_loc}/lib_ui/ui/colors.palette 48 | ${submodules_loc}/lib_ui/ui/basic.style 49 | ${submodules_loc}/lib_ui/ui/layers/layers.style 50 | ${submodules_loc}/lib_ui/ui/widgets/widgets.style 51 | ) 52 | 53 | generate_styles(Wallet ${src_loc} "${style_files}" "${dependent_style_files}") 54 | 55 | set_target_properties(Wallet PROPERTIES AUTORCC ON) 56 | 57 | target_link_libraries(Wallet 58 | PRIVATE 59 | desktop-app::lib_crl 60 | desktop-app::lib_ui 61 | desktop-app::lib_tl 62 | desktop-app::lib_ton 63 | desktop-app::lib_storage 64 | desktop-app::lib_lottie 65 | desktop-app::lib_qr 66 | desktop-app::lib_wallet 67 | desktop-app::lib_base 68 | desktop-app::lib_base_crash_report_writer 69 | desktop-app::external_rlottie 70 | desktop-app::external_qt 71 | desktop-app::external_qr_code_generator 72 | desktop-app::external_crash_reports 73 | desktop-app::external_auto_updates 74 | desktop-app::external_openssl 75 | ) 76 | 77 | if (NOT disable_autoupdate) 78 | target_link_libraries(Wallet 79 | PRIVATE 80 | desktop-app::lib_updater 81 | ) 82 | endif() 83 | 84 | if (DESKTOP_APP_USE_PACKAGED) 85 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE) 86 | find_package(Threads) 87 | 88 | target_link_libraries(Wallet 89 | PRIVATE 90 | ${CMAKE_DL_LIBS} 91 | Threads::Threads 92 | ) 93 | endif() 94 | 95 | target_precompile_headers(Wallet PRIVATE ${src_loc}/core/pch.h) 96 | nice_target_sources(Wallet ${src_loc} 97 | PRIVATE 98 | ${style_files} 99 | 100 | core/base_integration.cpp 101 | core/base_integration.h 102 | core/launcher.cpp 103 | core/launcher.h 104 | core/main.cpp 105 | core/sandbox.cpp 106 | core/sandbox.h 107 | core/ui_integration.cpp 108 | core/ui_integration.h 109 | core/version.h 110 | wallet/application.cpp 111 | wallet/application.h 112 | wallet/config_upgrade_checker.cpp 113 | wallet/config_upgrade_checker.h 114 | wallet/phrases.cpp 115 | wallet/phrases.h 116 | wallet/ton_default_settings.cpp 117 | wallet/ton_default_settings.h 118 | wallet/update_info_provider.cpp 119 | wallet/update_info_provider.h 120 | ) 121 | 122 | if (DESKTOP_APP_USE_PACKAGED) 123 | message(FATAL_ERROR "Packaged build is not supported yet.") 124 | nice_target_sources(Wallet ${src_loc} PRIVATE core/qt_functions.cpp) 125 | else() 126 | nice_target_sources(Wallet ${src_loc} PRIVATE core/qt_static_plugins.cpp) 127 | endif() 128 | 129 | nice_target_sources(Wallet ${res_loc} 130 | PRIVATE 131 | qrc/emoji_1.qrc 132 | qrc/emoji_2.qrc 133 | qrc/emoji_3.qrc 134 | qrc/emoji_4.qrc 135 | qrc/emoji_5.qrc 136 | qrc/config.qrc 137 | qrc/wrapper.qrc 138 | win/Wallet.rc 139 | win/Wallet.manifest 140 | ) 141 | 142 | if (WIN32) 143 | elseif (APPLE) 144 | set(icons_path ${res_loc}/art/Images.xcassets) 145 | set_target_properties(Wallet PROPERTIES RESOURCE ${icons_path}) 146 | target_sources(Wallet PRIVATE ${icons_path}) 147 | 148 | if (NOT build_macstore AND NOT DESKTOP_APP_DISABLE_CRASH_REPORTS) 149 | add_custom_command(TARGET Wallet 150 | PRE_LINK 151 | COMMAND mkdir -p $/../Helpers 152 | COMMAND cp ${libs_loc}/crashpad/out/$,Debug,Release>/crashpad_handler $/../Helpers/ 153 | ) 154 | endif() 155 | elseif (LINUX) 156 | #if (NOT WALLET_DISABLE_GTK_INTEGRATION) 157 | find_package(PkgConfig REQUIRED) 158 | 159 | pkg_search_module(GTK REQUIRED gtk+-2.0 gtk+-3.0) 160 | target_include_directories(Wallet PRIVATE ${GTK_INCLUDE_DIRS}) 161 | target_compile_options(Wallet PRIVATE -Wno-register) 162 | 163 | if (DESKTOP_APP_USE_PACKAGED) 164 | find_library(X11_LIBRARY X11) 165 | target_link_libraries(Wallet PRIVATE ${X11_LIBRARY}) 166 | endif() 167 | #endif() 168 | endif() 169 | 170 | if (build_macstore) 171 | message(FATAL_ERROR "Mac App Store build is not supported.") 172 | else() 173 | set(bundle_identifier "org.ton.wallet.desktop$<$:.debug>") 174 | set(bundle_entitlements "Wallet.entitlements") 175 | if (LINUX AND DESKTOP_APP_USE_PACKAGED) 176 | set(output_name "wallet-desktop") 177 | else() 178 | set(output_name "Wallet") 179 | endif() 180 | endif() 181 | 182 | set_target_properties(Wallet PROPERTIES 183 | OUTPUT_NAME ${output_name} 184 | MACOSX_BUNDLE_GUI_IDENTIFIER ${bundle_identifier} 185 | MACOSX_BUNDLE_INFO_PLIST ${res_loc}/mac/Wallet.plist 186 | XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${res_loc}/mac/${bundle_entitlements}" 187 | XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER ${bundle_identifier} 188 | XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${desktop_app_version_string} 189 | XCODE_ATTRIBUTE_PRODUCT_NAME ${output_name} 190 | XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT $<$>:dwarf-with-dsym> 191 | XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon 192 | XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES 193 | XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES YES 194 | XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO 195 | XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO 196 | XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY libc++ 197 | XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS --deep 198 | ) 199 | set(entitlement_sources 200 | "${res_loc}/mac/Wallet.entitlements" 201 | ) 202 | target_sources(Wallet PRIVATE ${entitlement_sources}) 203 | source_group(TREE ${res_loc} PREFIX Resources FILES ${entitlement_sources}) 204 | 205 | target_include_directories(Wallet PRIVATE ${src_loc}) 206 | 207 | set_target_properties(Wallet PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) 208 | 209 | if (NOT disable_autoupdate) 210 | add_dependencies(Wallet update_packer) 211 | endif() 212 | -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon128.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon128@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon16.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon16@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon256.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon256@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon32.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon32@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon512.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/AppIcon.appiconset/icon512@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_128x128.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_16x16.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_256x256.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_32x32.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_512x512.png -------------------------------------------------------------------------------- /Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/Images.xcassets/Icon.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /Wallet/Resources/art/icon256.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/icon256.ico -------------------------------------------------------------------------------- /Wallet/Resources/art/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/art/logo.png -------------------------------------------------------------------------------- /Wallet/Resources/config-test-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "@type": "config.global", 3 | "dht": { 4 | "@type": "dht.config.global", 5 | "k": 6, 6 | "a": 3, 7 | "static_nodes": { 8 | "@type": "dht.nodes", 9 | "nodes": [ 10 | { 11 | "@type": "dht.node", 12 | "id": { 13 | "@type": "pub.ed25519", 14 | "key": "znOAvy1ECxyzeKishi4PdSO2edaVx78wynVyNKLBmQ8=" 15 | }, 16 | "addr_list": { 17 | "@type": "adnl.addressList", 18 | "addrs": [ 19 | { 20 | "@type": "adnl.address.udp", 21 | "ip": -1068377703, 22 | "port": 6302 23 | } 24 | ], 25 | "version": 0, 26 | "reinit_date": 0, 27 | "priority": 0, 28 | "expire_at": 0 29 | }, 30 | "version": -1, 31 | "signature": "KLH17nNKmOk3carKwbsUcVBc4JZpdAUdUOMxe8FSyqnkOw/lolnltbylJcC+lvPpIV5ySI/Qx8UZdNRV/4HzCA==" 32 | }, 33 | { 34 | "@type": "dht.node", 35 | "id": { 36 | "@type": "pub.ed25519", 37 | "key": "Qjhv9rmeqXm0a+nYYhCJG1AH7C2TM6DAmyIM3FgO0Eo=" 38 | }, 39 | "addr_list": { 40 | "@type": "adnl.addressList", 41 | "addrs": [ 42 | { 43 | "@type": "adnl.address.udp", 44 | "ip": -1057912003, 45 | "port": 6302 46 | } 47 | ], 48 | "version": 0, 49 | "reinit_date": 0, 50 | "priority": 0, 51 | "expire_at": 0 52 | }, 53 | "version": -1, 54 | "signature": "2Gw5eIsZR+SdbWCU139DCuBI8Rv8T9iUioxDkgV6/IjcCHf6hNz8WCyUsKd5l5P1NBs/kdaxUBIybINDpYXoCw==" 55 | }, 56 | { 57 | "@type": "dht.node", 58 | "id": { 59 | "@type": "pub.ed25519", 60 | "key": "2YsTRIu3aRYzZe8eoR8PK2N2ydHJyKllwKcLPk676d4=" 61 | }, 62 | "addr_list": { 63 | "@type": "adnl.addressList", 64 | "addrs": [ 65 | { 66 | "@type": "adnl.address.udp", 67 | "ip": -1057911744, 68 | "port": 6302 69 | } 70 | ], 71 | "version": 0, 72 | "reinit_date": 0, 73 | "priority": 0, 74 | "expire_at": 0 75 | }, 76 | "version": -1, 77 | "signature": "9/TJsaj0wELvRKXVIrBdyZWjgLKhfSvl7v0Oqq/9p9MsU/t9iRuGcpAzHqQF4bQAWrN8j9ARwMumRata7dH8Bg==" 78 | }, 79 | { 80 | "@type": "dht.node", 81 | "id": { 82 | "@type": "pub.ed25519", 83 | "key": "SHrXmMEEUBGa51TWZwHSA+2RF4Vyavw51jgtnAz1ypU=" 84 | }, 85 | "addr_list": { 86 | "@type": "adnl.addressList", 87 | "addrs": [ 88 | { 89 | "@type": "adnl.address.udp", 90 | "ip": -1057911148, 91 | "port": 6302 92 | } 93 | ], 94 | "version": 0, 95 | "reinit_date": 0, 96 | "priority": 0, 97 | "expire_at": 0 98 | }, 99 | "version": -1, 100 | "signature": "R4ku8+tvjKSLIGe18zWHBHDv1maQHD5tGbAUOgbldGpBvfqH+/b76XkJjJzDsjnCO/bpxwUZfcI1sM1h6vFJCQ==" 101 | }, 102 | { 103 | "@type": "dht.node", 104 | "id": { 105 | "@type": "pub.ed25519", 106 | "key": "G+Lr6UtSWUcyYHTUutwbxrIG9GGZan3h96j8qQPLIXQ=" 107 | }, 108 | "addr_list": { 109 | "@type": "adnl.addressList", 110 | "addrs": [ 111 | { 112 | "@type": "adnl.address.udp", 113 | "ip": -960017601, 114 | "port": 6302 115 | } 116 | ], 117 | "version": 0, 118 | "reinit_date": 0, 119 | "priority": 0, 120 | "expire_at": 0 121 | }, 122 | "version": -1, 123 | "signature": "fWU9hSNLvmaSCQOBW9M4Lja5pIWcqOzU1g9vtSywdgtASj9oQpwAslvr2sjNh9E2Np1c26NW8Sc5gUKf8YY7BA==" 124 | }, 125 | { 126 | "@type": "dht.node", 127 | "id": { 128 | "@type": "pub.ed25519", 129 | "key": "/tp8WsXfk/XpzOyaaxuOlvbOhDoH7/L81eWi0QMn0gg=" 130 | }, 131 | "addr_list": { 132 | "@type": "adnl.addressList", 133 | "addrs": [ 134 | { 135 | "@type": "adnl.address.udp", 136 | "ip": 84478511, 137 | "port": 6302 138 | } 139 | ], 140 | "version": 0, 141 | "reinit_date": 0, 142 | "priority": 0, 143 | "expire_at": 0 144 | }, 145 | "version": -1, 146 | "signature": "2kA9P0LBI7H8gmmGsnZ2bQPZP3rZDFugrc5zQWlFrPIMLvwH7/J69HIGCVYgcaEsf0HMnIJeUMl5n4qFp0quBQ==" 147 | }, 148 | { 149 | "@type": "dht.node", 150 | "id": { 151 | "@type": "pub.ed25519", 152 | "key": "fnYl5kAHcbhK65FbYxfwk83X1Sn6ZiuXWMD0F0Rh+v4=" 153 | }, 154 | "addr_list": { 155 | "@type": "adnl.addressList", 156 | "addrs": [ 157 | { 158 | "@type": "adnl.address.udp", 159 | "ip": 84478479, 160 | "port": 6302 161 | } 162 | ], 163 | "version": 0, 164 | "reinit_date": 0, 165 | "priority": 0, 166 | "expire_at": 0 167 | }, 168 | "version": -1, 169 | "signature": "h+K+YttdhqE4LzihZTnKLFBiXyY79Rqqcx8dCbkDVXu3FD7ZrTBNV5b/bf7BQbuF0PXTc7YqH0jEmqz8aX6aBg==" 170 | }, 171 | { 172 | "@type": "dht.node", 173 | "id": { 174 | "@type": "pub.ed25519", 175 | "key": "HwOhm4Vh1YGqBNmUrDwJpeo8kXAPI7J3sSH38JaAyzQ=" 176 | }, 177 | "addr_list": { 178 | "@type": "adnl.addressList", 179 | "addrs": [ 180 | { 181 | "@type": "adnl.address.udp", 182 | "ip": -2018145068, 183 | "port": 6302 184 | } 185 | ], 186 | "version": 0, 187 | "reinit_date": 0, 188 | "priority": 0, 189 | "expire_at": 0 190 | }, 191 | "version": -1, 192 | "signature": "Ianf1Wm9Y6HT9r32LFNUieKi86cSBbCckczHy+ZyBo15MpIsZxouUgfAyeW20sZm1hN5+Yx4lPwzL+Ovm6KaCw==" 193 | }, 194 | { 195 | "@type": "dht.node", 196 | "id": { 197 | "@type": "pub.ed25519", 198 | "key": "CXo+qxdYclubZqoqvVhoeYDdPV+VhlWcurf2OX0iPZs=" 199 | }, 200 | "addr_list": { 201 | "@type": "adnl.addressList", 202 | "addrs": [ 203 | { 204 | "@type": "adnl.address.udp", 205 | "ip": -2018145059, 206 | "port": 6302 207 | } 208 | ], 209 | "version": 0, 210 | "reinit_date": 0, 211 | "priority": 0, 212 | "expire_at": 0 213 | }, 214 | "version": -1, 215 | "signature": "P72kraIX5pIxQBnh7It4kyK6MPuZ56ZFZKZxegtrxwx/Vpi1wQ4PsfxWf6N0HojbNMYsVZsvwHYTLxj5nhd6Dw==" 216 | }, 217 | { 218 | "@type": "dht.node", 219 | "id": { 220 | "@type": "pub.ed25519", 221 | "key": "KiKtUV+kJWBd+M29zNvtRqdvUrtX4lfi5CyY+DRm+lk=" 222 | }, 223 | "addr_list": { 224 | "@type": "adnl.addressList", 225 | "addrs": [ 226 | { 227 | "@type": "adnl.address.udp", 228 | "ip": 1091931625, 229 | "port": 6302 230 | } 231 | ], 232 | "version": 0, 233 | "reinit_date": 0, 234 | "priority": 0, 235 | "expire_at": 0 236 | }, 237 | "version": -1, 238 | "signature": "GjarYvxTVPik8m5yI9Eq/1lW/8CuReBdhUdFUb4wJJVVc/EvHf7j47mY5ECskHjeo9MYttgF/9KQaf8KNea1Dg==" 239 | }, 240 | { 241 | "@type": "dht.node", 242 | "id": { 243 | "@type": "pub.ed25519", 244 | "key": "o15mg8SB9CY2m971NvU+aCzAEnZFg3iAnIsqBMmqnj0=" 245 | }, 246 | "addr_list": { 247 | "@type": "adnl.addressList", 248 | "addrs": [ 249 | { 250 | "@type": "adnl.address.udp", 251 | "ip": 1091931590, 252 | "port": 6302 253 | } 254 | ], 255 | "version": 0, 256 | "reinit_date": 0, 257 | "priority": 0, 258 | "expire_at": 0 259 | }, 260 | "version": -1, 261 | "signature": "6mJPM7RZMOL5uCMRCGINjxAG7L7LHt7o89caD7Kk75ahpwAhqJ3ri9zL1rzJZjmyOMLkPoGcckJsG8phCRbVDQ==" 262 | }, 263 | { 264 | "@type": "dht.node", 265 | "id": { 266 | "@type": "pub.ed25519", 267 | "key": "VCu471G41Hj8onyyeJdq8t6AZu3SR7BoGuCLs8SppBk=" 268 | }, 269 | "addr_list": { 270 | "@type": "adnl.addressList", 271 | "addrs": [ 272 | { 273 | "@type": "adnl.address.udp", 274 | "ip": 1091931623, 275 | "port": 6302 276 | } 277 | ], 278 | "version": 0, 279 | "reinit_date": 0, 280 | "priority": 0, 281 | "expire_at": 0 282 | }, 283 | "version": -1, 284 | "signature": "7cOhypsjGb4xczR20M6eg7ly8sdvzdodkKVXzvr00FsXHcguz6bP0zm/dwhiQgsJgSosYypCk/LvKQrMy+C3AQ==" 285 | }, 286 | { 287 | "@type": "dht.node", 288 | "id": { 289 | "@type": "pub.ed25519", 290 | "key": "0uEnHB6Rg4sVjiepDgHoZ3CuKjCRjU3ul4IGmmZZoig=" 291 | }, 292 | "addr_list": { 293 | "@type": "adnl.addressList", 294 | "addrs": [ 295 | { 296 | "@type": "adnl.address.udp", 297 | "ip": 1091931589, 298 | "port": 6302 299 | } 300 | ], 301 | "version": 0, 302 | "reinit_date": 0, 303 | "priority": 0, 304 | "expire_at": 0 305 | }, 306 | "version": -1, 307 | "signature": "ju40qeS5mgbJDMLUxL7qSquSdqgo3Uib4Z/Va/bpIWJJA0W3VQStJMBbV/pQySi6MoM794Du3o8Gl1bjdpwDAg==" 308 | } 309 | ] 310 | } 311 | }, 312 | "liteservers": [ 313 | { 314 | "ip": 1137658550, 315 | "port": 4924, 316 | "id": { 317 | "@type": "pub.ed25519", 318 | "key": "peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M=" 319 | } 320 | }, 321 | { 322 | "ip": 84478511, 323 | "port": 19949, 324 | "id": { 325 | "@type": "pub.ed25519", 326 | "key": "n4VDnSCUuSpjnCyUk9e3QOOd6o0ItSWYbTnW3Wnn8wk=" 327 | } 328 | }, 329 | { 330 | "ip": 84478479, 331 | "port": 48014, 332 | "id": { 333 | "@type": "pub.ed25519", 334 | "key": "3XO67K/qi+gu3T9v8G2hx1yNmWZhccL3O7SoosFo8G0=" 335 | } 336 | }, 337 | { 338 | "ip": -2018135749, 339 | "port": 53312, 340 | "id": { 341 | "@type": "pub.ed25519", 342 | "key": "aF91CuUHuuOv9rm2W5+O/4h38M3sRm40DtSdRxQhmtQ=" 343 | } 344 | }, 345 | { 346 | "ip": -2018145068, 347 | "port": 13206, 348 | "id": { 349 | "@type": "pub.ed25519", 350 | "key": "K0t3+IWLOXHYMvMcrGZDPs+pn58a17LFbnXoQkKc2xw=" 351 | } 352 | }, 353 | { 354 | "ip": -2018145059, 355 | "port": 46995, 356 | "id": { 357 | "@type": "pub.ed25519", 358 | "key": "wQE0MVhXNWUXpWiW5Bk8cAirIh5NNG3cZM1/fSVKIts=" 359 | } 360 | }, 361 | { 362 | "ip": 868462740, 363 | "port": 4194, 364 | "id": { 365 | "@type": "pub.ed25519", 366 | "key": "8sEr/sw8EmFyuJaOQlbNbT0IKj8NtoCsFw5052hVvHw=" 367 | } 368 | }, 369 | { 370 | "ip": 1091931625, 371 | "port": 30131, 372 | "id": { 373 | "@type": "pub.ed25519", 374 | "key": "wrQaeIFispPfHndEBc0s0fx7GSp8UFFvebnytQQfc6A=" 375 | } 376 | }, 377 | { 378 | "ip": 1091931590, 379 | "port": 47160, 380 | "id": { 381 | "@type": "pub.ed25519", 382 | "key": "vOe1Xqt/1AQ2Z56Pr+1Rnw+f0NmAA7rNCZFIHeChB7o=" 383 | } 384 | }, 385 | { 386 | "ip": 1091931623, 387 | "port": 17728, 388 | "id": { 389 | "@type": "pub.ed25519", 390 | "key": "BYSVpL7aPk0kU5CtlsIae/8mf2B/NrBi7DKmepcjX6Q=" 391 | } 392 | }, 393 | { 394 | "ip": 1091931589, 395 | "port": 13570, 396 | "id": { 397 | "@type": "pub.ed25519", 398 | "key": "iVQH71cymoNgnrhOT35tl/Y7k86X5iVuu5Vf68KmifQ=" 399 | } 400 | }, 401 | { 402 | "ip": -1539021362, 403 | "port": 52995, 404 | "id": { 405 | "@type": "pub.ed25519", 406 | "key": "QnGFe9kihW+TKacEvvxFWqVXeRxCB6ChjjhNTrL7+/k=" 407 | } 408 | }, 409 | { 410 | "ip": -1539021936, 411 | "port": 20334, 412 | "id": { 413 | "@type": "pub.ed25519", 414 | "key": "gyLh12v4hBRtyBygvvbbO2HqEtgl+ojpeRJKt4gkMq0=" 415 | } 416 | }, 417 | { 418 | "ip": -1136338705, 419 | "port": 19925, 420 | "id": { 421 | "@type": "pub.ed25519", 422 | "key": "ucho5bEkufbKN1JR1BGHpkObq602whJn3Q3UwhtgSo4=" 423 | } 424 | }, 425 | { 426 | "ip": 868465979, 427 | "port": 52888, 428 | "id": { 429 | "@type": "pub.ed25519", 430 | "key": "MhrcOEIlxMNe34cfb4GMmMl0OoPKe3HSDGl8miK5rRU=" 431 | } 432 | }, 433 | { 434 | "ip": 868466060, 435 | "port": 48621, 436 | "id": { 437 | "@type": "pub.ed25519", 438 | "key": "z0eg+Dll54aUJFc8WvU8CZP6CUKPqUcra+zJLxti5wU=" 439 | } 440 | } 441 | ], 442 | "validator": { 443 | "@type": "validator.config.global", 444 | "zero_state": { 445 | "workchain": -1, 446 | "shard": -9223372036854775808, 447 | "seqno": 0, 448 | "root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=", 449 | "file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24=" 450 | }, 451 | "init_block": { 452 | "root_hash": "irEt9whDfgaYwD+8AzBlYzrMZHhrkhSVp3PU1s4DOz4=", 453 | "seqno": 10171687, 454 | "file_hash": "lay/bUKUUFDJXU9S6gx9GACQFl+uK+zX8SqHWS9oLZc=", 455 | "workchain": -1, 456 | "shard": -9223372036854775808 457 | }, 458 | "hardforks": [ 459 | { 460 | "file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=", 461 | "seqno": 8536841, 462 | "root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=", 463 | "workchain": -1, 464 | "shard": -9223372036854775808 465 | } 466 | ] 467 | } 468 | } -------------------------------------------------------------------------------- /Wallet/Resources/emoji/emoji_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/emoji/emoji_1.webp -------------------------------------------------------------------------------- /Wallet/Resources/emoji/emoji_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/emoji/emoji_2.webp -------------------------------------------------------------------------------- /Wallet/Resources/emoji/emoji_3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/emoji/emoji_3.webp -------------------------------------------------------------------------------- /Wallet/Resources/emoji/emoji_4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/emoji/emoji_4.webp -------------------------------------------------------------------------------- /Wallet/Resources/emoji/emoji_5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newton-blockchain/wallet-desktop/5abb4d9d387bf4bd84988623fb0a5a6aad7ab3ff/Wallet/Resources/emoji/emoji_5.webp -------------------------------------------------------------------------------- /Wallet/Resources/mac/Wallet.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Wallet/Resources/mac/Wallet.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | $(PRODUCT_NAME) 7 | CFBundleIdentifier 8 | $(PRODUCT_BUNDLE_IDENTIFIER) 9 | CFBundlePackageType 10 | APPL 11 | CFBundleShortVersionString 12 | $(CURRENT_PROJECT_VERSION) 13 | CFBundleSignature 14 | ???? 15 | CFBundleURLTypes 16 | 17 | 18 | CFBundleTypeRole 19 | Viewer 20 | CFBundleURLIconFile 21 | Icon.icns 22 | CFBundleURLName 23 | $(PRODUCT_BUNDLE_IDENTIFIER) 24 | CFBundleURLSchemes 25 | 26 | ton 27 | 28 | 29 | 30 | CFBundleVersion 31 | $(CURRENT_PROJECT_VERSION) 32 | LSApplicationCategoryType 33 | public.app-category.finance 34 | LSMinimumSystemVersion 35 | $(MACOSX_DEPLOYMENT_TARGET) 36 | NOTE 37 | 38 | NSPrincipalClass 39 | NSApplication 40 | NSSupportsAutomaticGraphicsSwitching 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/config.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ../config-test-default.json 5 | 6 | 7 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/emoji_1.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../emoji/emoji_1.webp 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/emoji_2.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../emoji/emoji_2.webp 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/emoji_3.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../emoji/emoji_3.webp 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/emoji_4.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../emoji/emoji_4.webp 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/emoji_5.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../emoji/emoji_5.webp 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/qrc/wrapper.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../art/logo.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wallet/Resources/win/Wallet.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Wallet/Resources/win/Wallet.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | 4 | #define APSTUDIO_READONLY_SYMBOLS 5 | ///////////////////////////////////////////////////////////////////////////// 6 | // 7 | // Generated from the TEXTINCLUDE 2 resource. 8 | // 9 | #include "winres.h" 10 | 11 | ///////////////////////////////////////////////////////////////////////////// 12 | #undef APSTUDIO_READONLY_SYMBOLS 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // English (United States) resources 16 | 17 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 18 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 19 | #pragma code_page(1252) 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // 23 | // Icon 24 | // 25 | 26 | // Icon with lowest ID value placed first to ensure application icon 27 | // remains consistent on all systems. 28 | IDI_ICON1 ICON "..\\art\\icon256.ico" 29 | 30 | ///////////////////////////////////////////////////////////////////////////// 31 | // 32 | // Version 33 | // 34 | 35 | VS_VERSION_INFO VERSIONINFO 36 | FILEVERSION 0,9,8,0 37 | PRODUCTVERSION 0,9,8,0 38 | FILEFLAGSMASK 0x3fL 39 | #ifdef _DEBUG 40 | FILEFLAGS 0x1L 41 | #else 42 | FILEFLAGS 0x0L 43 | #endif 44 | FILEOS 0x40004L 45 | FILETYPE 0x0L 46 | FILESUBTYPE 0x0L 47 | BEGIN 48 | BLOCK "StringFileInfo" 49 | BEGIN 50 | BLOCK "040904b0" 51 | BEGIN 52 | VALUE "CompanyName", "TON Foundation" 53 | VALUE "FileDescription", "TON Wallet" 54 | VALUE "FileVersion", "0.9.8.0" 55 | VALUE "LegalCopyright", "Copyright (C) 2019" 56 | VALUE "ProductName", "TON Wallet" 57 | VALUE "ProductVersion", "0.9.8.0" 58 | END 59 | END 60 | BLOCK "VarFileInfo" 61 | BEGIN 62 | VALUE "Translation", 0x409, 1200 63 | END 64 | END 65 | 66 | #endif // English (United States) resources 67 | ///////////////////////////////////////////////////////////////////////////// 68 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/base_integration.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/base_integration.h" 8 | 9 | #include "core/launcher.h" 10 | #include "core/sandbox.h" 11 | 12 | namespace Core { 13 | 14 | BaseIntegration::BaseIntegration( 15 | int argc, 16 | char *argv[], 17 | not_null launcher) 18 | : Integration(argc, argv) 19 | , _launcher(launcher) { 20 | } 21 | 22 | void BaseIntegration::enterFromEventLoop(FnMut &&method) { 23 | Core::Sandbox::Instance().customEnterFromEventLoop( 24 | std::move(method)); 25 | } 26 | 27 | void BaseIntegration::logMessage(const QString &message) { 28 | _launcher->logMessage(message); 29 | } 30 | 31 | void BaseIntegration::logAssertionViolation(const QString &info) { 32 | if (QCoreApplication::instance()) { 33 | _launcher->logMessage("Assertion Failed! " + info); 34 | Core::Sandbox::Instance().reportAssertionViolation(info); 35 | } 36 | } 37 | 38 | } // namespace Core 39 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/base_integration.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "base/integration.h" 10 | 11 | namespace Core { 12 | 13 | class Launcher; 14 | 15 | class BaseIntegration : public base::Integration { 16 | public: 17 | BaseIntegration(int argc, char *argv[], not_null launcher); 18 | 19 | void enterFromEventLoop(FnMut &&method) override; 20 | void logMessage(const QString &message) override; 21 | void logAssertionViolation(const QString &info) override; 22 | 23 | private: 24 | const not_null _launcher; 25 | 26 | }; 27 | 28 | } // namespace Core 29 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/launcher.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/launcher.h" 8 | 9 | #include "ui/main_queue_processor.h" 10 | #include "ui/ui_utility.h" 11 | #include "core/sandbox.h" 12 | #include "core/version.h" 13 | #include "wallet/wallet_log.h" 14 | #include "ton/ton_wallet.h" 15 | #include "base/platform/base_platform_info.h" 16 | #include "base/platform/base_platform_url_scheme.h" 17 | #include "base/concurrent_timer.h" 18 | 19 | #ifdef WALLET_AUTOUPDATING_BUILD 20 | #include "updater/updater_instance.h" 21 | #endif // WALLET_AUTOUPDATING_BUILD 22 | 23 | #ifdef Q_OS_WIN 24 | #include "base/platform/win/base_windows_h.h" 25 | #endif // Q_OS_WIN 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace Core { 34 | namespace { 35 | 36 | // 8 hour min time between update check requests. 37 | constexpr auto kUpdaterDelayConstPart = 8 * 3600; 38 | 39 | // 8 hour max - min time between update check requests. 40 | constexpr auto kUpdaterDelayRandPart = 8 * 3600; 41 | 42 | class FilteredCommandLineArguments { 43 | public: 44 | FilteredCommandLineArguments(int argc, char **argv); 45 | 46 | int &count(); 47 | char **values(); 48 | 49 | private: 50 | static constexpr auto kForwardArgumentCount = 1; 51 | 52 | int _count = 0; 53 | char *_arguments[kForwardArgumentCount + 1] = { nullptr }; 54 | 55 | }; 56 | 57 | FilteredCommandLineArguments::FilteredCommandLineArguments( 58 | int argc, 59 | char **argv) 60 | : _count(std::clamp(argc, 0, kForwardArgumentCount)) { 61 | // For now just pass only the first argument, the executable path. 62 | for (auto i = 0; i != _count; ++i) { 63 | _arguments[i] = argv[i]; 64 | } 65 | } 66 | 67 | int &FilteredCommandLineArguments::count() { 68 | return _count; 69 | } 70 | 71 | char **FilteredCommandLineArguments::values() { 72 | return _arguments; 73 | } 74 | 75 | #ifdef WALLET_AUTOUPDATING_BUILD 76 | Updater::InfoForRegistry GetInfoForRegistry() { 77 | auto result = Updater::InfoForRegistry(); 78 | result.fullName = "TON Wallet"; 79 | result.guid = "5ED3C1CA-9AA7-4884-B01A-21D3A0CD0FB4"; 80 | result.helpLink 81 | = result.supportLink 82 | = result.updateLink 83 | = "https://toncoin.org/wallets"; 84 | result.iconGroup = "TON Wallet"; 85 | result.publisher = "TON Foundation"; 86 | return result; 87 | } 88 | #endif // WALLET_AUTOUPDATING_BUILD 89 | 90 | base::Platform::UrlSchemeDescriptor CustomSchemeDescriptor( 91 | not_null launcher, 92 | bool updateIcon = false) { 93 | auto result = base::Platform::UrlSchemeDescriptor(); 94 | result.executable = base::Integration::Instance().executablePath(); 95 | result.protocol = "ton"; 96 | result.protocolName = "TON coin Transfer Link"; 97 | result.shortAppName = "tonwallet"; 98 | result.desktopFileDir = launcher->workingPath(); 99 | result.desktopFileName = "tonwallet"; 100 | result.iconFileName = "tonwallet"; 101 | result.longAppName = "TONWallet"; 102 | result.displayAppName = "TON Wallet"; 103 | result.displayAppDescription = "Desktop wallet for TON"; 104 | result.forceUpdateIcon = updateIcon; 105 | return result; 106 | } 107 | 108 | } // namespace 109 | 110 | std::unique_ptr Launcher::Create(int argc, char *argv[]) { 111 | return std::make_unique(argc, argv); 112 | } 113 | 114 | Launcher::Launcher(int argc, char *argv[]) 115 | : _argc(argc) 116 | , _argv(argv) 117 | , _baseIntegration(argc, argv, this) { 118 | base::Integration::Set(&_baseIntegration); 119 | } 120 | 121 | Launcher::~Launcher() = default; 122 | 123 | void Launcher::init() { 124 | QApplication::setApplicationName("TON Wallet"); 125 | initAppDataPath(); 126 | initWorkingPath(); 127 | } 128 | 129 | void Launcher::initWorkingPath() { 130 | _workingPath = computeWorkingPathBase() + "data/"; 131 | WALLET_LOG(("Working path: %1").arg(_workingPath)); 132 | } 133 | 134 | QString Launcher::computeWorkingPathBase() { 135 | if (const auto path = checkPortablePath(); !path.isEmpty()) { 136 | return path; 137 | } 138 | #if defined Q_OS_MAC || defined Q_OS_LINUX 139 | #if defined _DEBUG && !defined OS_MAC_STORE 140 | return _baseIntegration.executableDir(); 141 | #else // _DEBUG 142 | return _appDataPath; 143 | #endif // !_DEBUG 144 | #elif defined OS_WIN_STORE // Q_OS_MAC || Q_OS_LINUX 145 | #ifdef _DEBUG 146 | return _baseIntegration.executableDir(); 147 | #else // _DEBUG 148 | return _appDataPath; 149 | #endif // !_DEBUG 150 | #elif defined Q_OS_WIN 151 | if (canWorkInExecutablePath()) { 152 | return _baseIntegration.executableDir(); 153 | } else { 154 | return _appDataPath; 155 | } 156 | #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || OS_WIN_STORE 157 | } 158 | 159 | void Launcher::registerUrlScheme() { 160 | constexpr auto kSchemeVersion = 2; 161 | const auto path = _workingPath + "scheme_version"; 162 | const auto version = [&] { 163 | auto file = QFile(path); 164 | if (!file.open(QIODevice::ReadOnly)) { 165 | return 0; 166 | } 167 | return file.readAll().toInt(); 168 | }(); 169 | const auto guard = gsl::finally([&] { 170 | if (version < kSchemeVersion) { 171 | auto file = QFile(path); 172 | if (file.open(QIODevice::WriteOnly)) { 173 | file.write(QString::number(kSchemeVersion).toUtf8()); 174 | } 175 | } 176 | }); 177 | base::Platform::RegisterUrlScheme(CustomSchemeDescriptor(this, version < kSchemeVersion)); 178 | } 179 | 180 | void Launcher::cleanupUrlScheme() { 181 | base::Platform::UnregisterUrlScheme(CustomSchemeDescriptor(this)); 182 | } 183 | 184 | void Launcher::logMessage(const QString &message) { 185 | if (!verbose()) { 186 | return; 187 | } 188 | Ton::Wallet::LogMessage("[wallet] " + message); 189 | std::cout << message.toStdString() << std::endl; 190 | 191 | #ifdef Q_OS_WIN 192 | const auto wide = message.toStdWString() + L'\n'; 193 | OutputDebugString(wide.c_str()); 194 | #endif // Q_OS_WIN 195 | } 196 | 197 | #ifdef WALLET_AUTOUPDATING_BUILD 198 | 199 | void Launcher::startUpdateChecker() { 200 | WALLET_LOG(("Starting checking for updates.")); 201 | _updateChecker = std::make_unique( 202 | updaterSettings(), 203 | AppVersion); 204 | if (_updateChecker->readyToRestart()) { 205 | _restartingArguments = _arguments.mid(1); 206 | restartForUpdater(); 207 | } else if (updateCheckerEnabled()) { 208 | _updateChecker->start(Updater::Instance::Start::Now); 209 | } 210 | } 211 | 212 | bool Launcher::restartingForUpdater() const { 213 | return _restartingForUpdater; 214 | } 215 | 216 | void Launcher::restartForUpdater() { 217 | Expects(_updateChecker != nullptr); 218 | 219 | _restartingForUpdater = true; 220 | Sandbox::Instance().quit(); 221 | } 222 | 223 | not_null Launcher::updateChecker() { 224 | Expects(_updateChecker != nullptr); 225 | 226 | return _updateChecker.get(); 227 | } 228 | 229 | void Launcher::setUpdateCheckerEnabled(bool enabled) { 230 | Expects(_updateChecker != nullptr); 231 | 232 | if (enabled) { 233 | QFile(updateCheckerDisabledFlagPath()).remove(); 234 | _updateChecker->start(Updater::Instance::Start::Now); 235 | } else { 236 | auto f = QFile(updateCheckerDisabledFlagPath()); 237 | f.open(QIODevice::WriteOnly); 238 | f.write("1", 1); 239 | _updateChecker->cancel(); 240 | } 241 | } 242 | 243 | bool Launcher::updateCheckerEnabled() const { 244 | return !QFile(updateCheckerDisabledFlagPath()).exists(); 245 | } 246 | 247 | QString Launcher::updateCheckerDisabledFlagPath() const { 248 | return _workingPath + "update_disabled"; 249 | } 250 | 251 | Updater::Settings Launcher::updaterSettings() const { 252 | auto result = Updater::Settings(); 253 | result.basePath = workingPath(); 254 | result.url = "https://desktop-updates.ton.org/current"; 255 | result.delayConstPart = kUpdaterDelayConstPart; 256 | result.delayRandPart = kUpdaterDelayRandPart; 257 | return result; 258 | } 259 | 260 | #endif // WALLET_AUTOUPDATING_BUILD 261 | 262 | bool Launcher::canWorkInExecutablePath() const { 263 | const auto dataPath = _baseIntegration.executableDir() + "data"; 264 | if (!QDir(dataPath).exists() && !QDir().mkpath(dataPath)) { 265 | return false; 266 | } else if (QFileInfo(dataPath + "/salt").exists()) { 267 | return true; 268 | } 269 | auto index = 0; 270 | while (true) { 271 | const auto temp = dataPath + "/temp" + QString::number(++index); 272 | auto file = QFile(temp); 273 | if (file.open(QIODevice::WriteOnly)) { 274 | file.close(); 275 | file.remove(); 276 | return true; 277 | } else if (!file.exists()) { 278 | return false; 279 | } else if (index == std::numeric_limits::max()) { 280 | return false; 281 | } 282 | } 283 | } 284 | 285 | QString Launcher::checkPortablePath() { 286 | const auto portable = _baseIntegration.executableDir() 287 | + "WalletForcePortable"; 288 | return QDir(portable).exists() ? (portable + '/') : QString(); 289 | } 290 | 291 | int Launcher::exec() { 292 | processArguments(); 293 | WALLET_LOG(("Arguments processed, action: %1").arg(int(_action))); 294 | 295 | #ifdef WALLET_AUTOUPDATING_BUILD 296 | if (_action == Action::InstallUpdate) { 297 | WALLET_LOG(("Installing update.")); 298 | return Updater::Install(_arguments, GetInfoForRegistry()); 299 | } 300 | #endif // WALLET_AUTOUPDATING_BUILD 301 | 302 | init(); 303 | if (_action == Action::Cleanup) { 304 | WALLET_LOG(("Cleanup and exit.")); 305 | cleanupInstallation(); 306 | return 0; 307 | } 308 | setupScale(); 309 | 310 | Platform::Start(QJsonObject()); 311 | WALLET_LOG(("Platform started.")); 312 | 313 | auto result = executeApplication(); 314 | 315 | WALLET_LOG(("Finished, cleaning up.")); 316 | Platform::Finish(); 317 | 318 | #ifdef WALLET_AUTOUPDATING_BUILD 319 | auto restart = (_updateChecker && _restartingForUpdater) 320 | ? _updateChecker->restarter() 321 | : nullptr; 322 | _updateChecker = nullptr; 323 | 324 | if (restart) { 325 | WALLET_LOG(("Restarting with update installer.")); 326 | restart("Wallet", _restartingArguments); 327 | } 328 | #endif // WALLET_AUTOUPDATING_BUILD 329 | 330 | return result; 331 | } 332 | 333 | void Launcher::cleanupInstallation() { 334 | cleanupUrlScheme(); 335 | } 336 | 337 | void Launcher::setupScale() { 338 | #ifdef Q_OS_MAC 339 | // macOS Retina display support is working fine, others are not. 340 | QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, false); 341 | #else // Q_OS_MAC 342 | QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); 343 | #endif // Q_OS_MAC 344 | Ui::DisableCustomScaling(); 345 | } 346 | 347 | QStringList Launcher::readArguments(int argc, char *argv[]) const { 348 | Expects(argc >= 0); 349 | 350 | auto result = QStringList(); 351 | result.reserve(argc); 352 | for (auto i = 0; i != argc; ++i) { 353 | result.push_back(base::FromUtf8Safe(argv[i])); 354 | } 355 | return result; 356 | } 357 | 358 | QString Launcher::argumentsString() const { 359 | return _arguments.join(' '); 360 | } 361 | 362 | QString Launcher::workingPath() const { 363 | return _workingPath; 364 | } 365 | 366 | QString Launcher::openedUrl() const { 367 | return _openedUrl; 368 | } 369 | 370 | bool Launcher::verbose() const { 371 | return _verbose; 372 | } 373 | 374 | void Launcher::initAppDataPath() { 375 | const auto path = QStandardPaths::writableLocation( 376 | QStandardPaths::AppDataLocation); 377 | const auto absolute = QDir(path).absolutePath(); 378 | _appDataPath = absolute.endsWith('/') ? absolute : (absolute + '/'); 379 | WALLET_LOG(("App data path: %1").arg(_appDataPath)); 380 | } 381 | 382 | void Launcher::processArguments() { 383 | _arguments = readArguments(_argc, _argv); 384 | 385 | enum class UrlState { 386 | None, 387 | Next, 388 | Done, 389 | Error, 390 | }; 391 | auto urlState = UrlState::None; 392 | for (const auto &argument : _arguments) { 393 | if (urlState == UrlState::Done) { 394 | WALLET_LOG(("App Error: Ignoring URL argument (not last one).")); 395 | _openedUrl = QString(); 396 | urlState = UrlState::Error; 397 | } 398 | if (argument == "cleanup") { 399 | _action = Action::Cleanup; 400 | } else if (argument == "installupdate") { 401 | _action = Action::InstallUpdate; 402 | break; 403 | } else if (argument == "--verbose") { 404 | _verbose = true; 405 | } else if (urlState == UrlState::Next) { 406 | _openedUrl = argument; 407 | urlState = UrlState::Done; 408 | } else if (urlState == UrlState::None && argument == "--") { 409 | urlState = UrlState::Next; 410 | } 411 | } 412 | #ifdef Q_OS_WIN 413 | if (!_openedUrl.isEmpty() 414 | && !base::Platform::CheckUrlScheme(CustomSchemeDescriptor(this))) { 415 | WALLET_LOG(("App Error: Ignoring URL argument (bad registration).")); 416 | _openedUrl = QString(); 417 | registerUrlScheme(); 418 | } 419 | #endif // Q_OS_WIN 420 | } 421 | 422 | int Launcher::executeApplication() { 423 | FilteredCommandLineArguments arguments(_argc, _argv); 424 | WALLET_LOG(("Creating sandbox..")); 425 | Sandbox sandbox(this, arguments.count(), arguments.values()); 426 | WALLET_LOG(("Sandbox created.")); 427 | Ui::MainQueueProcessor processor; 428 | base::ConcurrentTimerEnvironment environment; 429 | WALLET_LOG(("Launching QApplication.")); 430 | return sandbox.exec(); 431 | } 432 | 433 | } // namespace Core 434 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/launcher.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "core/base_integration.h" 10 | 11 | namespace Updater { 12 | class Instance; 13 | struct Settings; 14 | } // namespace Updater 15 | 16 | namespace Core { 17 | 18 | class Launcher { 19 | public: 20 | Launcher(int argc, char *argv[]); 21 | virtual ~Launcher(); 22 | 23 | static std::unique_ptr Create(int argc, char *argv[]); 24 | 25 | int exec(); 26 | 27 | [[nodiscard]] QString argumentsString() const; 28 | [[nodiscard]] QString workingPath() const; 29 | [[nodiscard]] QString openedUrl() const; 30 | [[nodiscard]] bool verbose() const; 31 | 32 | void registerUrlScheme(); 33 | 34 | void logMessage(const QString &message); 35 | 36 | #ifdef WALLET_AUTOUPDATING_BUILD 37 | void startUpdateChecker(); 38 | void restartForUpdater(); 39 | [[nodiscard]] bool restartingForUpdater() const; 40 | [[nodiscard]] not_null updateChecker(); 41 | [[nodiscard]] bool updateCheckerEnabled() const; 42 | void setUpdateCheckerEnabled(bool enabled); 43 | #endif // WALLET_AUTOUPDATING_BUILD 44 | 45 | private: 46 | enum class Action { 47 | Run, 48 | Cleanup, 49 | InstallUpdate, 50 | }; 51 | void processArguments(); 52 | void initAppDataPath(); 53 | void initWorkingPath(); 54 | void setupScale(); 55 | [[nodiscard]] QString checkPortablePath(); 56 | [[nodiscard]] QString computeWorkingPathBase(); 57 | [[nodiscard]] bool canWorkInExecutablePath() const; 58 | 59 | QStringList readArguments(int argc, char *argv[]) const; 60 | 61 | void init(); 62 | void cleanupInstallation(); 63 | void cleanupUrlScheme(); 64 | int executeApplication(); 65 | 66 | #ifdef WALLET_AUTOUPDATING_BUILD 67 | [[nodiscard]] Updater::Settings updaterSettings() const; 68 | [[nodiscard]] QString updateCheckerDisabledFlagPath() const; 69 | #endif // WALLET_AUTOUPDATING_BUILD 70 | 71 | int _argc = 0; 72 | char **_argv = nullptr; 73 | QStringList _arguments; 74 | Action _action = Action::Run; 75 | BaseIntegration _baseIntegration; 76 | 77 | #ifdef _DEBUG 78 | bool _verbose = true; 79 | #else // _DEBUG 80 | bool _verbose = false; 81 | #endif // _DEBUG 82 | 83 | #ifdef WALLET_AUTOUPDATING_BUILD 84 | std::unique_ptr _updateChecker; 85 | bool _restartingForUpdater = false; 86 | QStringList _restartingArguments; 87 | #endif // WALLET_AUTOUPDATING_BUILD 88 | 89 | QString _appDataPath; 90 | QString _workingPath; 91 | QString _openedUrl; 92 | 93 | }; 94 | 95 | } // namespace Core 96 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/main.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/launcher.h" 8 | 9 | int main(int argc, char *argv[]) { 10 | const auto launcher = Core::Launcher::Create(argc, argv); 11 | return launcher ? launcher->exec() : 1; 12 | } 13 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/pch.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/pch.h" 8 | 9 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/pch.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include "base/assertion.h" 28 | #include "base/basic_types.h" 29 | #include "base/variant.h" 30 | #include "base/optional.h" 31 | #include "base/algorithm.h" 32 | #include "base/invoke_queued.h" 33 | #include "base/flat_set.h" 34 | #include "base/flat_map.h" 35 | #include "base/weak_ptr.h" 36 | #include "base/observer.h" 37 | 38 | #include 39 | #include 40 | #include 41 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/public_key.h: -------------------------------------------------------------------------------- 1 | const char *PublicKey = "\ 2 | -----BEGIN RSA PUBLIC KEY-----\n\ 3 | MIIBCgKCAQEAsyyhTen3QqZWgx0mtEkERZbFfxbmFx5xaA90kaP+w61JYaFFarUM\n\ 4 | cF+RtfXFKWBcQIRoXtpV63VwDi4miBanBK/vVKuJOmi0sjR6snZ8AsntjfnBpSSf\n\ 5 | /g7LwGuWrqE7I7OHEeLUFayur8oihLfiZhJQPR5JEjjgJfyovWDMKSv4ssSxZ29G\n\ 6 | l6/SEsdvhtEF26EDM5c1/c5lQV3FegSM5/mJemfdpoOa2jfS/jFA6yige9Jtd1It\n\ 7 | jczc8RQuLqZRKORFLy2AjOPku3DYO7iUtOfTeHsPynx1wL3LuM63DZyk7d3JsQTO\n\ 8 | faCxaeprEuEgu9N0ixcGAyPXaW5NV04DYQIDAQAB\n\ 9 | -----END RSA PUBLIC KEY-----"; 10 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/qt_static_plugins.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include 8 | 9 | Q_IMPORT_PLUGIN(QWebpPlugin) 10 | Q_IMPORT_PLUGIN(QJpegPlugin) 11 | Q_IMPORT_PLUGIN(QGifPlugin) 12 | #ifdef Q_OS_WIN 13 | Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) 14 | #elif defined Q_OS_MAC // Q_OS_WIN 15 | Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) 16 | Q_IMPORT_PLUGIN(QGenericEnginePlugin) 17 | #elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC 18 | Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) 19 | Q_IMPORT_PLUGIN(QConnmanEnginePlugin) 20 | Q_IMPORT_PLUGIN(QGenericEnginePlugin) 21 | Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) 22 | Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) 23 | Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) 24 | Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) 25 | Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) 26 | Q_IMPORT_PLUGIN(NimfInputContextPlugin) 27 | #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX 28 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/sandbox.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/sandbox.h" 8 | 9 | #include "core/launcher.h" 10 | #include "wallet/application.h" 11 | #include "wallet/wallet_log.h" 12 | #include "ui/widgets/tooltip.h" 13 | #include "ui/emoji_config.h" 14 | #include "ui/effects/animations.h" 15 | #include "ton/ton_wallet.h" 16 | #include "base/crash_report_writer.h" 17 | #include "base/integration.h" 18 | #include "base/concurrent_timer.h" 19 | #include "base/single_instance.h" 20 | #include "base/unixtime.h" 21 | #include "base/timer.h" 22 | 23 | #ifdef WALLET_AUTOUPDATING_BUILD 24 | #include "updater/updater_instance.h" 25 | #endif // WALLET_AUTOUPDATING_BUILD 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace Core { 34 | 35 | Sandbox::Sandbox( 36 | not_null launcher, 37 | int &argc, 38 | char **argv) 39 | : QApplication(argc, argv) 40 | , _launcher(launcher) 41 | , _mainThreadId(QThread::currentThreadId()) 42 | , _animationsManager(std::make_unique()) { 43 | Ui::Integration::Set(&uiIntegration); 44 | InvokeQueued(this, [=] { checkSingleInstance(); }); 45 | } 46 | 47 | Sandbox::~Sandbox() { 48 | Ui::Emoji::Clear(); 49 | style::stopManager(); 50 | } 51 | 52 | void Sandbox::checkSingleInstance() { 53 | _singleInstance = std::make_unique(); 54 | 55 | _singleInstance->commands( 56 | ) | rpl::start_with_next([=](const base::SingleInstance::Message &cmd) { 57 | _launchCommand = cmd.data; 58 | _singleInstance->reply(cmd.id, handleLaunchCommand()); 59 | }, _lifetime); 60 | 61 | WALLET_LOG(("Checking single instance.")); 62 | _launchCommand = computeLaunchCommand(); 63 | _singleInstance->start( 64 | QApplication::applicationName(), 65 | _launcher->workingPath(), 66 | [=] { crl::on_main(this, [=] { run(); }); }, 67 | [=] { _singleInstance->send(_launchCommand, [=] { quit(); }); }, 68 | [=] { crl::on_main(this, [=] { run(); }); }); // Try running anyway. 69 | } 70 | 71 | QByteArray Sandbox::computeLaunchCommand() const { 72 | if (const auto url = _launcher->openedUrl(); !url.isEmpty()) { 73 | return "OPEN:" + url.toUtf8(); 74 | } 75 | return "SHOW"; 76 | } 77 | 78 | QWidget *Sandbox::handleLaunchCommand() { 79 | return _application 80 | ? _application->handleCommandGetActivated(base::take(_launchCommand)) 81 | : nullptr; 82 | } 83 | 84 | void Sandbox::run() { 85 | WALLET_LOG(("Single instance checked.")); 86 | Ton::Wallet::EnableLogging( 87 | _launcher->verbose(), 88 | _launcher->workingPath()); 89 | 90 | style::internal::StartFonts(); 91 | setupScreenScale(); 92 | installNativeEventFilter(this); 93 | 94 | #ifdef WALLET_AUTOUPDATING_BUILD 95 | _launcher->startUpdateChecker(); 96 | if (_launcher->restartingForUpdater()) { 97 | return; 98 | } 99 | #endif // WALLET_AUTOUPDATING_BUILD 100 | 101 | WALLET_LOG(("Starting crash reporter.")); 102 | _crashReportWriter = std::make_unique( 103 | _launcher->workingPath() + "crashes/"); 104 | //if (_crashReportWriter->lastLaunchFailed()) { 105 | // // show and check for updates.. 106 | //} 107 | _crashReportWriter->start(); 108 | 109 | WALLET_LOG(("Starting style manager.")); 110 | style::startManager(_scale); 111 | Ui::Emoji::Init(); 112 | 113 | connect( 114 | this, 115 | &Sandbox::applicationStateChanged, 116 | this, 117 | &Sandbox::stateChanged); 118 | 119 | launchApplication(); 120 | } 121 | 122 | void Sandbox::launchApplication() { 123 | WALLET_LOG(("Creating the application.")); 124 | _application = std::make_unique( 125 | _launcher->workingPath()); 126 | connect(this, &Sandbox::aboutToQuit, [=] { 127 | customEnterFromEventLoop([&] { 128 | WALLET_LOG(("Qutting the application.")); 129 | _singleInstance = nullptr; 130 | _application = nullptr; 131 | _crashReportWriter = nullptr; 132 | }); 133 | }); 134 | 135 | WALLET_LOG(("Running the application.")); 136 | _application->run(); 137 | handleLaunchCommand(); 138 | 139 | _launcher->registerUrlScheme(); 140 | } 141 | 142 | auto Sandbox::createNestedEventLoopState(not_null guard) 143 | -> std::shared_ptr { 144 | auto state = std::make_shared(); 145 | const auto waslevel = _loopNestingLevel; 146 | state->checkEntered = [=] { 147 | if (state->finished) { 148 | return; 149 | } 150 | if (_loopNestingLevel > waslevel) { 151 | state->checkEntered = nullptr; 152 | processPostponedCalls(waslevel); 153 | } else { 154 | InvokeQueued(guard, state->checkEntered); 155 | } 156 | }; 157 | InvokeQueued(guard, state->checkEntered); 158 | return state; 159 | } 160 | 161 | bool Sandbox::event(QEvent *event) { 162 | if (event->type() == QEvent::Close) { 163 | quit(); 164 | } else if (event->type() == QEvent::FileOpen) { 165 | const auto e = static_cast(event); 166 | const auto url = e->url().toEncoded().trimmed(); 167 | const auto string = QString::fromUtf8(url); 168 | if (string.startsWith("ton://", Qt::CaseInsensitive)) { 169 | _launchCommand = "OPEN:" + url.mid(0, 8192); 170 | handleLaunchCommand(); 171 | } 172 | } 173 | return QApplication::event(event); 174 | } 175 | 176 | void Sandbox::setupScreenScale() { 177 | const auto dpi = Sandbox::primaryScreen()->logicalDotsPerInch(); 178 | if (dpi <= 108) { 179 | setScale(100); // 100%: 96 DPI (0-108) 180 | } else if (dpi <= 132) { 181 | setScale(125); // 125%: 120 DPI (108-132) 182 | } else if (dpi <= 168) { 183 | setScale(150); // 150%: 144 DPI (132-168) 184 | } else if (dpi <= 216) { 185 | setScale(200); // 200%: 192 DPI (168-216) 186 | } else if (dpi <= 264) { 187 | setScale(250); // 250%: 240 DPI (216-264) 188 | } else { 189 | setScale(300); // 300%: 288 DPI (264-inf) 190 | } 191 | const auto ratio = devicePixelRatio(); 192 | if (ratio > 1.) { 193 | style::SetDevicePixelRatio(int(ratio)); 194 | setScale(style::kScaleDefault); 195 | } 196 | } 197 | 198 | void Sandbox::setScale(int scale) { 199 | WALLET_LOG(("Scale: %1").arg(scale)); 200 | _scale = scale; 201 | style::SetScale(scale); 202 | } 203 | 204 | void Sandbox::stateChanged(Qt::ApplicationState state) { 205 | if (state == Qt::ApplicationActive) { 206 | handleAppActivated(); 207 | } else { 208 | handleAppDeactivated(); 209 | } 210 | } 211 | 212 | void Sandbox::handleAppActivated() { 213 | base::CheckLocalTime(); 214 | } 215 | 216 | void Sandbox::handleAppDeactivated() { 217 | Ui::Tooltip::Hide(); 218 | } 219 | 220 | // macOS Qt bug workaround, sometimes no leaveEvent() gets to the nested widgets. 221 | void Sandbox::registerLeaveSubscription(not_null widget) { 222 | #ifdef Q_OS_MAC 223 | // if (const auto topLevel = widget->window()) { 224 | // if (topLevel == _window->widget()) { 225 | // auto weak = Ui::MakeWeak(widget); 226 | // auto subscription = _window->widget()->leaveEvents( 227 | // ) | rpl::start_with_next([weak] { 228 | // if (const auto window = weak.data()) { 229 | // QEvent ev(QEvent::Leave); 230 | // QGuiSandbox::sendEvent(window, &ev); 231 | // } 232 | // }); 233 | // _leaveSubscriptions.emplace_back(weak, std::move(subscription)); 234 | // } 235 | // } 236 | #endif // Q_OS_MAC 237 | } 238 | 239 | void Sandbox::unregisterLeaveSubscription(not_null widget) { 240 | #ifdef Q_OS_MAC 241 | // _leaveSubscriptions = std::move( 242 | // _leaveSubscriptions 243 | // ) | ranges::action::remove_if([&](const LeaveSubscription &subscription) { 244 | // auto pointer = subscription.pointer.data(); 245 | // return !pointer || (pointer == widget); 246 | // }); 247 | #endif // Q_OS_MAC 248 | } 249 | 250 | void Sandbox::postponeCall(FnMut &&callable) { 251 | Expects(callable != nullptr); 252 | Expects(_eventNestingLevel >= _loopNestingLevel); 253 | 254 | // _loopNestingLevel == _eventNestingLevel means that we had a 255 | // native event in a nesting loop that didn't get a notify() call 256 | // after. That means we already have exited the nesting loop and 257 | // there must not be any postponed calls with that nesting level. 258 | if (_loopNestingLevel == _eventNestingLevel) { 259 | Assert(_postponedCalls.empty() 260 | || _postponedCalls.back().loopNestingLevel < _loopNestingLevel); 261 | Assert(!_previousLoopNestingLevels.empty()); 262 | 263 | _loopNestingLevel = _previousLoopNestingLevels.back(); 264 | _previousLoopNestingLevels.pop_back(); 265 | } 266 | 267 | _postponedCalls.push_back({ 268 | _loopNestingLevel, 269 | std::move(callable) 270 | }); 271 | } 272 | 273 | void Sandbox::incrementEventNestingLevel() { 274 | ++_eventNestingLevel; 275 | } 276 | 277 | void Sandbox::decrementEventNestingLevel() { 278 | if (_eventNestingLevel == _loopNestingLevel) { 279 | _loopNestingLevel = _previousLoopNestingLevels.back(); 280 | _previousLoopNestingLevels.pop_back(); 281 | } 282 | const auto processTillLevel = _eventNestingLevel - 1; 283 | processPostponedCalls(processTillLevel); 284 | _eventNestingLevel = processTillLevel; 285 | } 286 | 287 | void Sandbox::registerEnterFromEventLoop() { 288 | if (_eventNestingLevel > _loopNestingLevel) { 289 | _previousLoopNestingLevels.push_back(_loopNestingLevel); 290 | _loopNestingLevel = _eventNestingLevel; 291 | } 292 | } 293 | 294 | void Sandbox::reportAssertionViolation(const QString &info) { 295 | if (_crashReportWriter) { 296 | _crashReportWriter->addAnnotation("Assertion", info.toStdString()); 297 | } 298 | } 299 | 300 | bool Sandbox::notifyOrInvoke(QObject *receiver, QEvent *e) { 301 | if (e->type() == base::InvokeQueuedEvent::kType) { 302 | static_cast(e)->invoke(); 303 | return true; 304 | } 305 | return QApplication::notify(receiver, e); 306 | } 307 | 308 | bool Sandbox::notify(QObject *receiver, QEvent *e) { 309 | if (QThread::currentThreadId() != _mainThreadId) { 310 | return notifyOrInvoke(receiver, e); 311 | } 312 | const auto wrap = createEventNestingLevelWrap(); 313 | if (e->type() == QEvent::UpdateRequest) { 314 | const auto weak = QPointer(receiver); 315 | _widgetUpdateRequests.fire({}); 316 | if (!weak) { 317 | return true; 318 | } 319 | } 320 | return notifyOrInvoke(receiver, e); 321 | } 322 | 323 | void Sandbox::processPostponedCalls(int level) { 324 | while (!_postponedCalls.empty()) { 325 | auto &last = _postponedCalls.back(); 326 | if (last.loopNestingLevel != level) { 327 | break; 328 | } 329 | auto taken = std::move(last); 330 | _postponedCalls.pop_back(); 331 | taken.callable(); 332 | } 333 | } 334 | 335 | bool Sandbox::nativeEventFilter( 336 | const QByteArray &eventType, 337 | void *message, 338 | long *result) { 339 | registerEnterFromEventLoop(); 340 | return false; 341 | } 342 | 343 | rpl::producer<> Sandbox::widgetUpdateRequests() const { 344 | return _widgetUpdateRequests.events(); 345 | } 346 | 347 | } // namespace Core 348 | 349 | namespace crl { 350 | 351 | rpl::producer<> on_main_update_requests() { 352 | return Core::Sandbox::Instance().widgetUpdateRequests(); 353 | } 354 | 355 | } // namespace crl 356 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/sandbox.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "base/timer.h" 10 | #include "core/ui_integration.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace base { 16 | class SingleInstance; 17 | class CrashReportWriter; 18 | } // namespace base 19 | 20 | namespace Ui { 21 | namespace Animations { 22 | class Manager; 23 | } // namespace Animations 24 | } // namespace Ui 25 | 26 | namespace Wallet { 27 | class Application; 28 | } // namespace Wallet 29 | 30 | namespace Core { 31 | 32 | class Launcher; 33 | 34 | class Sandbox final 35 | : public QApplication 36 | , private QAbstractNativeEventFilter { 37 | auto createEventNestingLevelWrap() { 38 | incrementEventNestingLevel(); 39 | return gsl::finally([=] { decrementEventNestingLevel(); }); 40 | } 41 | 42 | public: 43 | Sandbox(not_null launcher, int &argc, char **argv); 44 | Sandbox(const Sandbox &other) = delete; 45 | Sandbox &operator=(const Sandbox &other) = delete; 46 | ~Sandbox(); 47 | 48 | not_null launcher() const { 49 | return _launcher; 50 | } 51 | 52 | void postponeCall(FnMut &&callable); 53 | bool notify(QObject *receiver, QEvent *e) override; 54 | 55 | void reportAssertionViolation(const QString &info); 56 | 57 | template 58 | auto customEnterFromEventLoop(Callable &&callable) { 59 | registerEnterFromEventLoop(); 60 | const auto wrap = createEventNestingLevelWrap(); 61 | return callable(); 62 | } 63 | template 64 | auto runNestedEventLoop(not_null guard, Callable &&callable) { 65 | const auto state = createNestedEventLoopState(guard); 66 | const auto finish = gsl::finally([&] { state->finished = true; }); 67 | return callable(); 68 | } 69 | 70 | rpl::producer<> widgetUpdateRequests() const; 71 | 72 | static Sandbox &Instance() { 73 | Expects(QCoreApplication::instance() != nullptr); 74 | 75 | return *static_cast(QCoreApplication::instance()); 76 | } 77 | 78 | void run(); 79 | 80 | Ui::Animations::Manager &animationManager() const { 81 | return *_animationsManager; 82 | } 83 | 84 | void registerLeaveSubscription(not_null widget); 85 | void unregisterLeaveSubscription(not_null widget); 86 | 87 | void handleAppActivated(); 88 | void handleAppDeactivated(); 89 | 90 | protected: 91 | bool event(QEvent *e) override; 92 | 93 | private: 94 | static constexpr auto kDefaultSaveDelay = crl::time(1000); 95 | 96 | struct PostponedCall { 97 | int loopNestingLevel = 0; 98 | FnMut callable; 99 | }; 100 | struct NestedEventLoopState { 101 | bool finished = false; 102 | Fn checkEntered; 103 | 104 | ~NestedEventLoopState() { 105 | Expects(finished); 106 | } 107 | }; 108 | 109 | void checkSingleInstance(); 110 | bool notifyOrInvoke(QObject *receiver, QEvent *e); 111 | void registerEnterFromEventLoop(); 112 | void incrementEventNestingLevel(); 113 | void decrementEventNestingLevel(); 114 | bool nativeEventFilter( 115 | const QByteArray &eventType, 116 | void *message, 117 | long *result) override; 118 | void processPostponedCalls(int level); 119 | void launchApplication(); 120 | void setupScreenScale(); 121 | std::shared_ptr createNestedEventLoopState( 122 | not_null guard); 123 | 124 | [[nodiscard]] QByteArray computeLaunchCommand() const; 125 | QWidget *handleLaunchCommand(); 126 | 127 | void setScale(int scale); 128 | void stateChanged(Qt::ApplicationState state); 129 | 130 | const not_null _launcher; 131 | UiIntegration uiIntegration; 132 | 133 | std::unique_ptr _crashReportWriter; 134 | std::unique_ptr _singleInstance; 135 | 136 | QByteArray _launchCommand; 137 | 138 | const Qt::HANDLE _mainThreadId = nullptr; 139 | int _eventNestingLevel = 0; 140 | int _loopNestingLevel = 0; 141 | std::vector _previousLoopNestingLevels; 142 | std::vector _postponedCalls; 143 | 144 | rpl::event_stream<> _widgetUpdateRequests; 145 | 146 | const std::unique_ptr _animationsManager; 147 | int _scale = 0; 148 | 149 | std::unique_ptr _application; 150 | 151 | struct LeaveSubscription { 152 | LeaveSubscription( 153 | QPointer pointer, 154 | rpl::lifetime &&subscription) 155 | : pointer(pointer), subscription(std::move(subscription)) { 156 | } 157 | 158 | QPointer pointer; 159 | rpl::lifetime subscription; 160 | }; 161 | std::vector _leaveSubscriptions; 162 | 163 | rpl::lifetime _lifetime; 164 | 165 | }; 166 | 167 | } // namespace Core 168 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/ui_integration.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "core/ui_integration.h" 8 | 9 | #include "core/sandbox.h" 10 | 11 | namespace Core { 12 | 13 | void UiIntegration::postponeCall(FnMut &&callable) { 14 | Sandbox::Instance().postponeCall(std::move(callable)); 15 | } 16 | 17 | void UiIntegration::registerLeaveSubscription(not_null widget) { 18 | Sandbox::Instance().registerLeaveSubscription(widget); 19 | } 20 | 21 | void UiIntegration::unregisterLeaveSubscription(not_null widget) { 22 | Sandbox::Instance().unregisterLeaveSubscription(widget); 23 | } 24 | 25 | void UiIntegration::writeLogEntry(const QString &entry) { 26 | } 27 | 28 | QString UiIntegration::emojiCacheFolder() { 29 | return QString(); 30 | } 31 | 32 | void UiIntegration::textActionsUpdated() { 33 | //if (const auto window = App::wnd()) { 34 | // window->updateGlobalMenu(); 35 | //} 36 | } 37 | 38 | void UiIntegration::activationFromTopPanel() { 39 | //Platform::IgnoreApplicationActivationRightNow(); 40 | } 41 | 42 | } // namespace Core 43 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/ui_integration.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "ui/integration.h" 10 | 11 | namespace Core { 12 | 13 | class UiIntegration : public Ui::Integration { 14 | public: 15 | void postponeCall(FnMut &&callable) override; 16 | void registerLeaveSubscription(not_null widget) override; 17 | void unregisterLeaveSubscription(not_null widget) override; 18 | 19 | void writeLogEntry(const QString &entry) override; 20 | QString emojiCacheFolder() override; 21 | 22 | void textActionsUpdated() override; 23 | void activationFromTopPanel() override; 24 | 25 | }; 26 | 27 | } // namespace Core 28 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/core/version.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | inline constexpr auto AppVersion = 9008; 10 | inline constexpr auto AppVersionStr = "0.9.8"; 11 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/application.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "wallet/application.h" 8 | 9 | #include "wallet/config_upgrade_checker.h" 10 | #include "wallet/wallet_window.h" 11 | #include "wallet/wallet_update_info.h" 12 | #include "wallet/wallet_log.h" 13 | #include "wallet/ton_default_settings.h" 14 | #include "wallet/update_info_provider.h" 15 | #include "ton/ton_settings.h" 16 | #include "ton/ton_state.h" 17 | #include "ton/ton_wallet.h" 18 | #include "ton/ton_account_viewer.h" 19 | #include "ui/widgets/window.h" 20 | #include "ui/layers/generic_box.h" 21 | #include "ui/layers/layer_manager.h" 22 | #include "ui/text/text_utilities.h" 23 | #include "ui/rp_widget.h" 24 | #include "core/sandbox.h" 25 | #include "core/launcher.h" 26 | #include "base/platform/base_platform_info.h" 27 | #include "base/event_filter.h" 28 | #include "base/call_delayed.h" 29 | #include "styles/style_wrapper.h" 30 | #include "styles/style_widgets.h" 31 | #include "styles/style_layers.h" 32 | #include "styles/palette.h" 33 | 34 | #include 35 | #include 36 | 37 | namespace Wallet { 38 | 39 | Application::Application(const QString &path) 40 | : _path(path) 41 | , _wallet(std::make_unique(_path)) 42 | , _launchCommand("SHOW") { 43 | QApplication::setWindowIcon(QIcon(QPixmap(":/gui/art/logo.png", "PNG"))); 44 | } 45 | 46 | Application::~Application() { 47 | } 48 | 49 | void Application::run() { 50 | installGlobalShortcutFilter(); 51 | openWallet(); 52 | } 53 | 54 | void Application::installGlobalShortcutFilter() { 55 | const auto handleGlobalShortcut = [=](not_null e) { 56 | if (e->type() == QEvent::KeyPress) { 57 | const auto ke = static_cast(e.get()); 58 | if (ke->modifiers() == Qt::ControlModifier) { 59 | if (ke->key() == Qt::Key_W || ke->key() == Qt::Key_Q) { 60 | Core::Sandbox::Instance().quit(); 61 | } 62 | } 63 | } 64 | return base::EventFilterResult::Continue; 65 | }; 66 | base::install_event_filter( 67 | &Core::Sandbox::Instance(), 68 | handleGlobalShortcut); 69 | } 70 | 71 | QWidget *Application::handleCommandGetActivated(const QByteArray &command) { 72 | _launchCommand = command; 73 | handleLaunchCommand(); 74 | return _window ? _window->widget().get() : nullptr; 75 | } 76 | 77 | void Application::handleLaunchCommand() { 78 | if (!_window || _launchCommand.isEmpty()) { 79 | return; 80 | } 81 | _window->showAndActivate(); 82 | if (handleCommand(_launchCommand)) { 83 | _launchCommand = QByteArray(); 84 | } 85 | } 86 | 87 | bool Application::handleCommand(const QByteArray &command) { 88 | if (_launchCommand == "SHOW") { 89 | return true; 90 | } else if (command.startsWith("OPEN:")) { 91 | return _window->handleLinkOpen(QString::fromUtf8(command.mid(5))); 92 | } 93 | return false; 94 | } 95 | 96 | UpdateInfo *Application::walletUpdateInfo() { 97 | #ifdef WALLET_AUTOUPDATING_BUILD 98 | const auto launcher = Core::Sandbox::Instance().launcher(); 99 | _updateInfo = std::make_unique( 100 | launcher->updateChecker(), 101 | [=] { return launcher->updateCheckerEnabled(); }, 102 | [=](bool enabled) { launcher->setUpdateCheckerEnabled(enabled); }, 103 | [=] { launcher->restartForUpdater(); }); 104 | return _updateInfo.get(); 105 | #else // WALLET_AUTOUPDATING_BUILD 106 | return nullptr; 107 | #endif // WALLET_AUTOUPDATING_BUILD 108 | } 109 | 110 | void Application::openWallet() { 111 | WALLET_LOG(("Opening the wallet.")); 112 | 113 | const auto showError = [=](Ton::Error error) { 114 | const auto text = (error.type == Ton::Error::Type::IO) 115 | ? ("IO error at path: " + error.details) 116 | : (error.type == Ton::Error::Type::TonLib) 117 | ? ("Library error, details: " + error.details) 118 | : ("Global Password didn't work."); 119 | const auto solution = "\n\nTry deleting all at " + _path; 120 | criticalError(text + solution); 121 | }; 122 | auto started = [=](Ton::Result<> result) { 123 | if (!result) { 124 | showError(result.error()); 125 | return; 126 | } 127 | WALLET_LOG(("Creating the wallet.")); 128 | _window = std::make_unique( 129 | _wallet.get(), 130 | walletUpdateInfo()); 131 | 132 | const auto upgrades = base::take(_upgradeChecker)->takeUpgrades(); 133 | for (const auto upgrade : upgrades) { 134 | _window->showConfigUpgrade(upgrade); 135 | } 136 | handleLaunchCommand(); 137 | }; 138 | auto opened = [=](Ton::Result<> result) { 139 | if (!result) { 140 | showError(result.error()); 141 | return; 142 | } 143 | if (_wallet->settings().useNetworkCallbacks) { 144 | auto copy = _wallet->settings(); 145 | copy.useNetworkCallbacks = false; 146 | _wallet->updateSettings(copy, nullptr); 147 | } 148 | _wallet->start(started); 149 | }; 150 | 151 | _upgradeChecker = std::make_unique(_wallet.get()); 152 | 153 | _wallet->open(QByteArray(), GetDefaultSettings(), std::move(opened)); 154 | } 155 | 156 | void Application::criticalError(const QString &text) { 157 | const auto window = _lifetime.make_state(); 158 | const auto layers = _lifetime.make_state(window->body()); 159 | layers->showBox(Box([=](not_null box) { 160 | box->setCloseByEscape(false); 161 | box->setCloseByOutsideClick(false); 162 | box->setTitle(rpl::single(QString("Error"))); 163 | box->addRow(object_ptr(box, text, st::boxLabel)); 164 | box->addButton(rpl::single(QString("Quit")), [] { 165 | QCoreApplication::quit(); 166 | }); 167 | })); 168 | 169 | window->resize(2 * st::boxWidth, 3 * st::boxWidth / 2); 170 | window->show(); 171 | } 172 | 173 | } // namespace Wallet 174 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/application.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "base/weak_ptr.h" 10 | 11 | class QEvent; 12 | class QKeyEvent; 13 | class QWidget; 14 | 15 | namespace Ui { 16 | class Window; 17 | class LayerManager; 18 | } // namespace Ui 19 | 20 | namespace Ton { 21 | class Wallet; 22 | class AccountViewer; 23 | } // namespace Ton 24 | 25 | namespace Wallet { 26 | 27 | class Window; 28 | class Intro; 29 | class Info; 30 | class UpdateInfo; 31 | class ConfigUpgradeChecker; 32 | 33 | class Application final : public base::has_weak_ptr { 34 | public: 35 | explicit Application(const QString &path); 36 | Application(const Application &other) = delete; 37 | Application &operator=(const Application &other) = delete; 38 | ~Application(); 39 | 40 | void run(); 41 | QWidget *handleCommandGetActivated(const QByteArray &command); 42 | 43 | private: 44 | void installGlobalShortcutFilter(); 45 | void openWallet(); 46 | void criticalError(const QString &text); 47 | void handleLaunchCommand(); 48 | bool handleCommand(const QByteArray &command); 49 | UpdateInfo *walletUpdateInfo(); 50 | 51 | const QString _path; 52 | const std::unique_ptr _wallet; 53 | std::unique_ptr _window; 54 | std::unique_ptr _updateInfo; 55 | std::unique_ptr _upgradeChecker; 56 | QByteArray _launchCommand; 57 | 58 | rpl::lifetime _lifetime; 59 | 60 | }; 61 | 62 | } // namespace Wallet 63 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/config_upgrade_checker.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "wallet/config_upgrade_checker.h" 8 | 9 | #include "ton/ton_wallet.h" 10 | #include "ton/ton_state.h" 11 | 12 | namespace Wallet { 13 | 14 | ConfigUpgradeChecker::ConfigUpgradeChecker(not_null wallet) { 15 | wallet->updates( 16 | ) | rpl::filter([](const Ton::Update &update) { 17 | return update.data.is(); 18 | }) | rpl::start_with_next([=](const Ton::Update &update) { 19 | _upgrades.push_back(update.data.get()); 20 | }, _lifetime); 21 | } 22 | 23 | std::vector ConfigUpgradeChecker::takeUpgrades() { 24 | return std::move(_upgrades); 25 | } 26 | 27 | } // namespace Wallet 28 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/config_upgrade_checker.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | namespace Ton { 10 | class Wallet; 11 | enum class ConfigUpgrade; 12 | } // namespace Ton 13 | 14 | namespace Wallet { 15 | 16 | class ConfigUpgradeChecker final { 17 | public: 18 | ConfigUpgradeChecker(not_null wallet); 19 | 20 | std::vector takeUpgrades(); 21 | 22 | private: 23 | std::vector _upgrades; 24 | rpl::lifetime _lifetime; 25 | 26 | }; 27 | 28 | } // namespace Wallet 29 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/phrases.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "wallet/phrases.h" 8 | 9 | namespace tr { 10 | 11 | } // namespace tr 12 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/phrases.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #include "ui/ph.h" 10 | 11 | namespace tr { 12 | 13 | using now_t = ph::now_t; 14 | inline constexpr auto now = ph::now; 15 | 16 | using phrase = ph::phrase; 17 | 18 | } // namespace tr 19 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/ton_default_settings.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "wallet/ton_default_settings.h" 8 | 9 | #include "ton/ton_settings.h" 10 | 11 | #include 12 | 13 | namespace Wallet { 14 | 15 | Ton::Settings GetDefaultSettings() { 16 | auto result = Ton::Settings(); 17 | 18 | auto test = QFile(":/config/test-default.json"); 19 | test.open(QIODevice::ReadOnly); 20 | result.test.config = test.readAll(); 21 | result.test.blockchainName = "mainnet"; 22 | result.test.configUrl = "https://ton.org/global-config-wallet.json"; 23 | 24 | //auto main = QFile(":/config/default.json"); // #TODO postponed 25 | //main.open(QIODevice::ReadOnly); 26 | //result.main.config = main.readAll(); 27 | //result.main.blockchainName = "mainnet"; 28 | //result.main.configUrl = "https://ton.org/config.json"; 29 | 30 | result.useNetworkCallbacks = false; 31 | result.useTestNetwork = true; // #TODO postponed 32 | result.version = 2; 33 | return result; 34 | } 35 | 36 | } // namespace Wallet 37 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/ton_default_settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | namespace Ton { 10 | struct Settings; 11 | } // namespace Ton 12 | 13 | namespace Wallet { 14 | 15 | [[nodiscard]] Ton::Settings GetDefaultSettings(); 16 | 17 | } // namespace Wallet 18 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/update_info_provider.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #include "wallet/update_info_provider.h" 8 | 9 | #include "core/version.h" 10 | 11 | #ifdef WALLET_AUTOUPDATING_BUILD 12 | 13 | #include "updater/updater_instance.h" 14 | 15 | namespace Wallet { 16 | 17 | UpdateInfoProvider::UpdateInfoProvider( 18 | not_null updater, 19 | Fn toggled, 20 | Fn toggle, 21 | Fn install) 22 | : _updater(updater) 23 | , _toggled(toggled) 24 | , _toggle(toggle) 25 | , _install(install) { 26 | } 27 | 28 | rpl::producer<> UpdateInfoProvider::checking() { 29 | return _updater->checking(); 30 | } 31 | 32 | rpl::producer<> UpdateInfoProvider::isLatest() { 33 | return _updater->isLatest(); 34 | } 35 | 36 | rpl::producer UpdateInfoProvider::progress() { 37 | return _updater->progress( 38 | ) | rpl::map([](Updater::Progress progress) -> UpdateProgress { 39 | return { progress.already, progress.size }; 40 | }); 41 | } 42 | 43 | rpl::producer<> UpdateInfoProvider::failed() { 44 | return _updater->failed(); 45 | } 46 | 47 | rpl::producer<> UpdateInfoProvider::ready() { 48 | return _updater->ready(); 49 | } 50 | 51 | UpdateState UpdateInfoProvider::state() { 52 | switch (_updater->state()) { 53 | case Updater::State::None: return UpdateState::None; 54 | case Updater::State::Download: return UpdateState::Download; 55 | case Updater::State::Ready: return UpdateState::Ready; 56 | } 57 | Unexpected("State in UpdateInfoProvider::state."); 58 | } 59 | 60 | int64 UpdateInfoProvider::already() { 61 | return _updater->already(); 62 | } 63 | 64 | int64 UpdateInfoProvider::size() { 65 | return _updater->size(); 66 | } 67 | 68 | void UpdateInfoProvider::toggle(bool enabled) { 69 | if (enabled != toggled()) { 70 | _toggle(enabled); 71 | } 72 | } 73 | 74 | bool UpdateInfoProvider::toggled() { 75 | return _toggled(); 76 | } 77 | 78 | void UpdateInfoProvider::check() { 79 | _toggle(true); 80 | } 81 | 82 | void UpdateInfoProvider::test() { 83 | _updater->test(); 84 | } 85 | 86 | void UpdateInfoProvider::install() { 87 | _install(); 88 | } 89 | 90 | int UpdateInfoProvider::currentVersion() { 91 | return AppVersion; 92 | } 93 | 94 | } // namespace Wallet 95 | 96 | #endif // WALLET_AUTOUPDATING_BUILD 97 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/update_info_provider.h: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | #pragma once 8 | 9 | #ifdef WALLET_AUTOUPDATING_BUILD 10 | 11 | #include "wallet/wallet_update_info.h" 12 | 13 | namespace Updater { 14 | class Instance; 15 | } // namespace Updater 16 | 17 | namespace Wallet { 18 | 19 | class UpdateInfoProvider : public UpdateInfo { 20 | public: 21 | UpdateInfoProvider( 22 | not_null updater, 23 | Fn toggled, 24 | Fn toggle, 25 | Fn install); 26 | 27 | rpl::producer<> checking() override; 28 | rpl::producer<> isLatest() override; 29 | rpl::producer progress() override; 30 | rpl::producer<> failed() override; 31 | rpl::producer<> ready() override; 32 | 33 | UpdateState state() override; 34 | int64 already() override; 35 | int64 size() override; 36 | 37 | void toggle(bool enabled) override; 38 | bool toggled() override; 39 | void check() override; 40 | void test() override; 41 | void install() override; 42 | 43 | int currentVersion() override; 44 | 45 | private: 46 | const not_null _updater; 47 | Fn _toggled; 48 | Fn _toggle; 49 | Fn _install; 50 | 51 | }; 52 | 53 | } // namespace Wallet 54 | 55 | #endif // WALLET_AUTOUPDATING_BUILD 56 | -------------------------------------------------------------------------------- /Wallet/SourceFiles/wallet/wrapper.style: -------------------------------------------------------------------------------- 1 | // This file is part of TON Wallet Desktop, 2 | // a desktop application for the TON Blockchain project. 3 | // 4 | // For license and copyright information please follow this link: 5 | // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | // 7 | using "ui/basic.style"; 8 | using "ui/widgets/widgets.style"; 9 | -------------------------------------------------------------------------------- /Wallet/build/build.bat: -------------------------------------------------------------------------------- 1 | @echo OFF 2 | setlocal enabledelayedexpansion 3 | set "FullScriptPath=%~dp0" 4 | set "FullExecPath=%cd%" 5 | 6 | if not exist "%FullScriptPath%..\..\..\DesktopPrivate" ( 7 | echo. 8 | echo This script is for building the autoupdating version of TON Wallet. 9 | echo. 10 | echo For building custom versions please visit the build instructions page at: 11 | echo https://github.com/ton-blockchain/wallet-desktop/#build-instructions 12 | exit /b 13 | ) 14 | 15 | FOR /F "tokens=1* delims= " %%i in (%FullScriptPath%target) do set "BuildTarget=%%i" 16 | 17 | FOR /F "tokens=1,2* delims= " %%i in (%FullScriptPath%version) do set "%%i=%%j" 18 | 19 | set "VersionForPacker=%AppVersion%" 20 | set "AlphaBetaParam=" 21 | set "AppVersionStrFull=%AppVersionStr%" 22 | 23 | echo. 24 | echo Building version %AppVersionStrFull% for Windows.. 25 | echo. 26 | 27 | set "HomePath=%FullScriptPath%.." 28 | set "SolutionPath=%HomePath%\..\out" 29 | set "UpdateFile=wupdate-win-%AppVersion%" 30 | set "SetupFile=wsetup.%AppVersionStrFull%.exe" 31 | set "PortableFile=wportable.%AppVersionStrFull%.zip" 32 | set "ReleasePath=%HomePath%\..\out\Release" 33 | set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%" 34 | set "SignPath=%HomePath%\..\..\DesktopPrivate\Sign.bat" 35 | set "BinaryName=Wallet" 36 | set "FinalReleasePath=Z:\Projects\backup\wallet" 37 | 38 | if not exist %FinalReleasePath% ( 39 | echo Release path %FinalReleasePath% not found! 40 | exit /b 1 41 | ) 42 | if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ ( 43 | echo Deploy folder for version %AppVersionStr% already exists! 44 | exit /b 1 45 | ) 46 | 47 | cd "%HomePath%" 48 | 49 | call configure.bat 50 | if %errorlevel% neq 0 goto error 51 | 52 | cd "%SolutionPath%" 53 | call cmake --build . --config Release --target Wallet 54 | if %errorlevel% neq 0 goto error 55 | 56 | echo. 57 | echo Version %AppVersionStrFull% build successfull. Preparing.. 58 | echo. 59 | 60 | set "PATH=%PATH%;C:\Program Files\7-Zip" 61 | 62 | cd "%ReleasePath%" 63 | 64 | :sign1 65 | call "%SignPath%" "%BinaryName%.exe" 66 | if %errorlevel% neq 0 ( 67 | timeout /t 3 68 | goto sign1 69 | ) 70 | 71 | iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "/dReleasePath=%ReleasePath%" "%FullScriptPath%setup.iss" 72 | if %errorlevel% neq 0 goto error 73 | if not exist "%SetupFile%" goto error 74 | :sign2 75 | call "%SignPath%" "%SetupFile%" 76 | if %errorlevel% neq 0 ( 77 | timeout /t 3 78 | goto sign2 79 | ) 80 | 81 | call update_packer.exe --version %VersionForPacker% --path %BinaryName%.exe 82 | if %errorlevel% neq 0 goto error 83 | move "%ReleasePath%\packed_update%AppVersion%" "%ReleasePath%\%UpdateFile%" 84 | if %errorlevel% neq 0 goto error 85 | 86 | if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy" 87 | if not exist "%ReleasePath%\deploy\%AppVersionStrMajor%" mkdir "%ReleasePath%\deploy\%AppVersionStrMajor%" 88 | mkdir "%DeployPath%" 89 | mkdir "%DeployPath%\%BinaryName%" 90 | if %errorlevel% neq 0 goto error 91 | 92 | move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\%BinaryName%\" 93 | xcopy "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\" 94 | move "%ReleasePath%\%BinaryName%.exe.pdb" "%DeployPath%\" 95 | move "%ReleasePath%\%SetupFile%" "%DeployPath%\" 96 | move "%ReleasePath%\%UpdateFile%" "%DeployPath%\" 97 | if %errorlevel% neq 0 goto error 98 | 99 | cd "%DeployPath%" 100 | 7z a -mx9 %PortableFile% %BinaryName%\ 101 | if %errorlevel% neq 0 goto error 102 | 103 | move "%DeployPath%\%BinaryName%\%BinaryName%.exe" "%DeployPath%\" 104 | rmdir "%DeployPath%\%BinaryName%" 105 | if %errorlevel% neq 0 goto error 106 | 107 | set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\win" 108 | 109 | echo. 110 | echo Version %AppVersionStrFull% is ready for deploy! 111 | echo. 112 | 113 | if not exist "%DeployPath%\%UpdateFile%" goto error 114 | if not exist "%DeployPath%\%PortableFile%" goto error 115 | if not exist "%DeployPath%\%SetupFile%" goto error 116 | if not exist "%DeployPath%\%BinaryName%.pdb" goto error 117 | md "%FinalDeployPath%" 118 | 119 | xcopy "%DeployPath%\%UpdateFile%" "%FinalDeployPath%\" /Y 120 | xcopy "%DeployPath%\%PortableFile%" "%FinalDeployPath%\" /Y 121 | xcopy "%DeployPath%\%SetupFile%" "%FinalDeployPath%\" /Y 122 | 123 | echo Version %AppVersionStrFull% is ready! 124 | 125 | cd "%FullExecPath%" 126 | exit /b 127 | 128 | :error 129 | ( 130 | set ErrorCode=%errorlevel% 131 | if !ErrorCode! neq 0 ( 132 | echo Error !ErrorCode! 133 | ) else ( 134 | echo Error 666 135 | set ErrorCode=666 136 | ) 137 | cd "%FullExecPath%" 138 | exit /b !ErrorCode! 139 | ) 140 | -------------------------------------------------------------------------------- /Wallet/build/build.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | FullExecPath=$PWD 3 | pushd `dirname $0` > /dev/null 4 | FullScriptPath=`pwd` 5 | popd > /dev/null 6 | 7 | if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then 8 | echo "" 9 | echo "This script is for building the autoupdating version of TON Wallet." 10 | echo "" 11 | echo "For building custom versions please visit the build instructions page at:" 12 | echo "https://github.com/newton-blockchain/wallet-desktop/#build-instructions" 13 | exit 14 | fi 15 | 16 | Error () { 17 | cd $FullExecPath 18 | echo "$1" 19 | exit 1 20 | } 21 | 22 | if [ ! -f "$FullScriptPath/target" ]; then 23 | Error "Build target not found!" 24 | fi 25 | 26 | while IFS='' read -r line || [[ -n "$line" ]]; do 27 | BuildTarget="$line" 28 | done < "$FullScriptPath/target" 29 | 30 | while IFS='' read -r line || [[ -n "$line" ]]; do 31 | set $line 32 | eval $1="$2" 33 | done < "$FullScriptPath/version" 34 | 35 | VersionForPacker="$AppVersion" 36 | AppVersionStrFull="$AppVersionStr" 37 | 38 | echo "" 39 | HomePath="$FullScriptPath/.." 40 | if [ "$BuildTarget" == "linux" ]; then 41 | echo "Building version $AppVersionStrFull for Linux 64bit.." 42 | SetupFile="wsetup.$AppVersionStrFull.tar.xz" 43 | UpdateFile="wupdate-linux-$AppVersion" 44 | ProjectPath="$HomePath/../out" 45 | ReleasePath="$ProjectPath/Release" 46 | BinaryName="Wallet" 47 | elif [ "$BuildTarget" == "linux32" ]; then 48 | echo "Building version $AppVersionStrFull for Linux 32bit.." 49 | SetupFile="wsetup32.$AppVersionStrFull.tar.xz" 50 | UpdateFile="wupdate-linux32-$AppVersion" 51 | ProjectPath="$HomePath/../out" 52 | ReleasePath="$ProjectPath/Release" 53 | BinaryName="Wallet" 54 | elif [ "$BuildTarget" == "mac" ]; then 55 | echo "Building version $AppVersionStrFull for OS X 10.8+.." 56 | if [ "$AC_USERNAME" == "" ]; then 57 | Error "AC_USERNAME not found!" 58 | fi 59 | SetupFile="wsetup.$AppVersionStrFull.dmg" 60 | UpdateFile="wupdate-mac-$AppVersion" 61 | ProjectPath="$HomePath/../out" 62 | ReleasePath="$ProjectPath/Release" 63 | BinaryName="Wallet" 64 | else 65 | Error "Invalid target!" 66 | fi 67 | 68 | if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then 69 | Error "Deploy folder for version $AppVersionStr already exists!" 70 | fi 71 | 72 | DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull" 73 | 74 | if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then 75 | BackupPath="/media/psf/backup/wallet/$AppVersionStrMajor/$AppVersionStrFull/$BuildTarget" 76 | if [ ! -d "/media/psf/backup" ]; then 77 | Error "Backup folder not found!" 78 | fi 79 | 80 | ./configure.sh 81 | 82 | cd $ProjectPath 83 | cmake --build . --config Release --target Wallet -- -j8 84 | cd $ReleasePath 85 | 86 | echo "$BinaryName build complete!" 87 | 88 | if [ ! -f "$ReleasePath/$BinaryName" ]; then 89 | Error "$BinaryName not found!" 90 | fi 91 | 92 | # BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.1[6-9] | wc -l` 93 | # if [ "$BadCount" != "0" ]; then 94 | # Error "Bad GLIBC usages found: $BadCount" 95 | # fi 96 | 97 | # BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.2[0-9] | wc -l` 98 | # if [ "$BadCount" != "0" ]; then 99 | # Error "Bad GLIBC usages found: $BadCount" 100 | # fi 101 | 102 | # BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_4\.[3-9] | wc -l` 103 | # if [ "$BadCount" != "0" ]; then 104 | # Error "Bad GCC usages found: $BadCount" 105 | # fi 106 | 107 | # BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_[5-9]\. | wc -l` 108 | # if [ "$BadCount" != "0" ]; then 109 | # Error "Bad GCC usages found: $BadCount" 110 | # fi 111 | 112 | echo "Stripping the executable.." 113 | strip -s "$ReleasePath/$BinaryName" 114 | echo "Done!" 115 | 116 | echo "Removing RPATH.." 117 | chrpath -d "$ReleasePath/$BinaryName" 118 | echo "Done!" 119 | 120 | echo "Preparing version $AppVersionStrFull, executing update_packer.." 121 | cd "$ReleasePath" 122 | "./update_packer" --version $VersionForPacker --path "$BinaryName" 123 | mv "packed_update$VersionForPacker" "$UpdateFile" 124 | echo "Packer done!" 125 | 126 | if [ ! -d "$ReleasePath/deploy" ]; then 127 | mkdir "$ReleasePath/deploy" 128 | fi 129 | 130 | if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then 131 | mkdir "$ReleasePath/deploy/$AppVersionStrMajor" 132 | fi 133 | 134 | echo "Copying $BinaryName to deploy/$AppVersionStrMajor/$AppVersionStrFull.."; 135 | mkdir "$DeployPath" 136 | mkdir "$DeployPath/$BinaryName" 137 | mv "$ReleasePath/$BinaryName" "$DeployPath/$BinaryName/" 138 | mv "$ReleasePath/$UpdateFile" "$DeployPath/" 139 | cd "$DeployPath" 140 | tar -cJvf "$SetupFile" "$BinaryName/" 141 | 142 | mkdir -p $BackupPath 143 | cp "$SetupFile" "$BackupPath/" 144 | cp "$UpdateFile" "$BackupPath/" 145 | fi 146 | 147 | if [ "$BuildTarget" == "mac" ]; then 148 | BackupPath="$HomePath/../../../Projects/backup/wallet/$AppVersionStrMajor/$AppVersionStrFull/mac" 149 | if [ ! -d "$HomePath/../../../Projects/backup" ]; then 150 | Error "Backup path not found!" 151 | fi 152 | 153 | ./configure.sh 154 | 155 | cd $ProjectPath 156 | cmake --build . --config Release --target Wallet 157 | cd $ReleasePath 158 | 159 | if [ ! -d "$ReleasePath/$BinaryName.app" ]; then 160 | Error "$BinaryName.app not found!" 161 | fi 162 | 163 | if [ ! -d "$ReleasePath/$BinaryName.app.dSYM" ]; then 164 | Error "$BinaryName.app.dSYM not found!" 165 | fi 166 | 167 | echo "Stripping the executable.." 168 | strip "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" 169 | echo "Done!" 170 | 171 | echo "Signing the application.." 172 | codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Resources/mac/Wallet.entitlements" 173 | echo "Done!" 174 | 175 | AppUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" | awk -F " " '{print $2}'` 176 | DsymUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app.dSYM" | awk -F " " '{print $2}'` 177 | if [ "$AppUUID" != "$DsymUUID" ]; then 178 | Error "UUID of binary '$AppUUID' and dSYM '$DsymUUID' differ!" 179 | fi 180 | 181 | if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Resources/Icon.icns" ]; then 182 | Error "Icon.icns not found in Resources!" 183 | fi 184 | 185 | if [ ! -f "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" ]; then 186 | Error "$BinaryName not found in MacOS!" 187 | fi 188 | 189 | if [ ! -d "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" ]; then 190 | Error "$BinaryName signature not found!" 191 | fi 192 | 193 | cd "$ReleasePath" 194 | 195 | cp -f wsetup_template.dmg wsetup.temp.dmg 196 | TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite wsetup.temp.dmg | awk -F "\t" 'END {print $3}'` 197 | cp -R "./$BinaryName.app" "$TempDiskPath/" 198 | bless --folder "$TempDiskPath/" --openfolder "$TempDiskPath/" 199 | hdiutil detach "$TempDiskPath" 200 | hdiutil convert wsetup.temp.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile" 201 | rm wsetup.temp.dmg 202 | 203 | echo "Beginning notarization process." 204 | set +e 205 | xcrun altool --notarize-app --primary-bundle-id "org.ton.wallet.desktop" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" --file "$SetupFile" > request_uuid.txt 206 | set -e 207 | while IFS='' read -r line || [[ -n "$line" ]]; do 208 | Prefix=$(echo $line | cut -d' ' -f 1) 209 | Value=$(echo $line | cut -d' ' -f 3) 210 | if [ "$Prefix" == "RequestUUID" ]; then 211 | RequestUUID=$Value 212 | fi 213 | done < "request_uuid.txt" 214 | if [ "$RequestUUID" == "" ]; then 215 | cat request_uuid.txt 216 | Error "Could not extract Request UUID." 217 | fi 218 | echo "Request UUID: $RequestUUID" 219 | rm request_uuid.txt 220 | 221 | RequestStatus= 222 | LogFile= 223 | while [[ "$RequestStatus" == "" ]]; do 224 | sleep 5 225 | xcrun altool --notarization-info "$RequestUUID" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" > request_result.txt 226 | while IFS='' read -r line || [[ -n "$line" ]]; do 227 | Prefix=$(echo $line | cut -d' ' -f 1) 228 | Value=$(echo $line | cut -d' ' -f 2) 229 | if [ "$Prefix" == "LogFileURL:" ]; then 230 | LogFile=$Value 231 | fi 232 | if [ "$Prefix" == "Status:" ]; then 233 | if [ "$Value" == "in" ]; then 234 | echo "In progress..." 235 | else 236 | RequestStatus=$Value 237 | echo "Status: $RequestStatus" 238 | fi 239 | fi 240 | done < "request_result.txt" 241 | done 242 | if [ "$RequestStatus" != "success" ]; then 243 | echo "Notarization problems, response:" 244 | cat request_result.txt 245 | if [ "$LogFile" != "" ]; then 246 | echo "Requesting log..." 247 | curl $LogFile 248 | fi 249 | Error "Notarization FAILED." 250 | fi 251 | echo "Notarization success!" 252 | rm request_result.txt 253 | 254 | if [ "$LogFile" != "" ]; then 255 | echo "Requesting log..." 256 | curl $LogFile > request_log.txt 257 | fi 258 | 259 | echo "Stable on $ReleasePath/$BinaryName.app..." 260 | xcrun stapler staple "$ReleasePath/$BinaryName.app" 261 | echo "Stable on $ReleasePath/$SetupFile..." 262 | xcrun stapler staple "$ReleasePath/$SetupFile" 263 | 264 | echo "Running update packer..." 265 | cd "$ReleasePath" 266 | "./update_packer" --version $VersionForPacker --path "$BinaryName.app" 267 | mv "packed_update$VersionForPacker" "$UpdateFile" 268 | echo "Packer done!" 269 | 270 | if [ ! -d "$ReleasePath/deploy" ]; then 271 | mkdir "$ReleasePath/deploy" 272 | fi 273 | 274 | if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then 275 | mkdir "$ReleasePath/deploy/$AppVersionStrMajor" 276 | fi 277 | 278 | if [ "$BuildTarget" == "mac" ]; then 279 | echo "Copying $BinaryName.app to deploy/$AppVersionStrMajor/$AppVersionStr.."; 280 | mkdir "$DeployPath" 281 | mkdir "$DeployPath/$BinaryName" 282 | cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/$BinaryName/" 283 | mv "$ReleasePath/$BinaryName.app.dSYM" "$DeployPath/" 284 | rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" 285 | rm "$ReleasePath/$BinaryName.app/Contents/Info.plist" 286 | rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" 287 | mv "$ReleasePath/$UpdateFile" "$DeployPath/" 288 | mv "$ReleasePath/$SetupFile" "$DeployPath/" 289 | 290 | mkdir -p "$BackupPath" 291 | cp "$DeployPath/$UpdateFile" "$BackupPath/" 292 | cp "$DeployPath/$SetupFile" "$BackupPath/" 293 | fi 294 | fi 295 | 296 | echo "Version $AppVersionStrFull is ready!"; 297 | echo -en "\007"; 298 | sleep 1; 299 | echo -en "\007"; 300 | sleep 1; 301 | echo -en "\007"; 302 | 303 | if [ "$BuildTarget" == "mac" ]; then 304 | if [ -f "$ReleasePath/request_log.txt" ]; then 305 | DisplayingLog= 306 | while IFS='' read -r line || [[ -n "$line" ]]; do 307 | if [ "$DisplayingLog" == "1" ]; then 308 | echo $line 309 | else 310 | Prefix=$(echo $line | cut -d' ' -f 1) 311 | Value=$(echo $line | cut -d' ' -f 2) 312 | if [ "$Prefix" == '"issues":' ]; then 313 | if [ "$Value" != "null" ]; then 314 | echo "NB! Notarization log issues:" 315 | echo $line 316 | DisplayingLog=1 317 | else 318 | DisplayingLog=0 319 | fi 320 | fi 321 | fi 322 | done < "$ReleasePath/request_log.txt" 323 | if [ "$DisplayingLog" != "0" ] && [ "$DisplayingLog" != "1" ]; then 324 | echo "NB! Notarization issues not found:" 325 | cat "$ReleasePath/request_log.txt" 326 | else 327 | rm "$ReleasePath/request_log.txt" 328 | fi 329 | else 330 | echo "NB! Notarization log not found :(" 331 | fi 332 | fi 333 | -------------------------------------------------------------------------------- /Wallet/build/deploy.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | FullExecPath=$PWD 3 | pushd `dirname $0` > /dev/null 4 | FullScriptPath=`pwd` 5 | popd > /dev/null 6 | 7 | if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then 8 | echo "" 9 | echo "This script is for building the autoupdating version of TON Wallet." 10 | echo "" 11 | echo "For building custom versions please visit the build instructions page at:" 12 | echo "https://github.com/newton-blockchain/wallet-desktop/#build-instructions" 13 | exit 14 | fi 15 | 16 | Error () { 17 | cd $FullExecPath 18 | echo "$1" 19 | exit 1 20 | } 21 | 22 | DeployTarget="$1" 23 | 24 | if [ ! -f "$FullScriptPath/target" ]; then 25 | Error "Build target not found!" 26 | fi 27 | 28 | while IFS='' read -r line || [[ -n "$line" ]]; do 29 | BuildTarget="$line" 30 | done < "$FullScriptPath/target" 31 | 32 | while IFS='' read -r line || [[ -n "$line" ]]; do 33 | set $line 34 | eval $1="$2" 35 | done < "$FullScriptPath/version" 36 | 37 | AppVersionStrFull="$AppVersionStr" 38 | 39 | echo "" 40 | HomePath="$FullScriptPath/.." 41 | DeployMac="0" 42 | DeployWin="0" 43 | DeployLinux="0" 44 | DeployLinux32="0" 45 | if [ "$DeployTarget" == "mac" ]; then 46 | DeployMac="1" 47 | echo "Deploying version $AppVersionStrFull for OS X 10.12+.." 48 | elif [ "$DeployTarget" == "win" ]; then 49 | DeployWin="1" 50 | echo "Deploying version $AppVersionStrFull for Windows.." 51 | elif [ "$DeployTarget" == "linux" ]; then 52 | DeployLinux="1" 53 | echo "Deploying version $AppVersionStrFull for Linux 64 bit.." 54 | elif [ "$DeployTarget" == "linux32" ]; then 55 | DeployLinux32="1" 56 | echo "Deploying version $AppVersionStrFull for Linux 32 bit.." 57 | else 58 | DeployMac="1" 59 | DeployWin="1" 60 | DeployLinux="1" 61 | echo "Deploying three versions of $AppVersionStrFull: for Windows, OS X 10.12+ and Linux 64 bit.." 62 | fi 63 | if [ "$BuildTarget" == "mac" ]; then 64 | BackupPath="$HOME/Projects/backup/wallet" 65 | elif [ "$BuildTarget" == "linux" ]; then 66 | BackupPath="/media/psf/Home/Projects/backup/wallet" 67 | else 68 | Error "Can't deploy here" 69 | fi 70 | MacDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/mac" 71 | MacUpdateFile="wupdate-mac-$AppVersion" 72 | MacSetupFile="wsetup.$AppVersionStrFull.dmg" 73 | MacRemoteFolder="mac" 74 | WinDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/win" 75 | WinUpdateFile="wupdate-win-$AppVersion" 76 | WinSetupFile="wsetup.$AppVersionStrFull.exe" 77 | WinPortableFile="wportable.$AppVersionStrFull.zip" 78 | WinRemoteFolder="win" 79 | LinuxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/linux" 80 | LinuxUpdateFile="wupdate-linux-$AppVersion" 81 | LinuxSetupFile="wsetup.$AppVersionStrFull.tar.xz" 82 | LinuxRemoteFolder="linux" 83 | Linux32DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/linux32" 84 | Linux32UpdateFile="wupdate-linux32-$AppVersion" 85 | Linux32SetupFile="wsetup32.$AppVersionStrFull.tar.xz" 86 | Linux32RemoteFolder="linux32" 87 | DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull" 88 | 89 | if [ "$DeployMac" == "1" ]; then 90 | if [ ! -f "$MacDeployPath/$MacUpdateFile" ]; then 91 | Error "$MacDeployPath/$MacUpdateFile not found!"; 92 | fi 93 | if [ ! -f "$MacDeployPath/$MacSetupFile" ]; then 94 | Error "$MacDeployPath/$MacSetupFile not found!" 95 | fi 96 | fi 97 | if [ "$DeployWin" == "1" ]; then 98 | if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then 99 | Error "$WinUpdateFile not found!" 100 | fi 101 | if [ "$AlphaVersion" == "0" ]; then 102 | if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then 103 | Error "$WinSetupFile not found!" 104 | fi 105 | fi 106 | if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then 107 | Error "$WinPortableFile not found!" 108 | fi 109 | fi 110 | if [ "$DeployLinux" == "1" ]; then 111 | if [ ! -f "$LinuxDeployPath/$LinuxUpdateFile" ]; then 112 | Error "$LinuxDeployPath/$LinuxUpdateFile not found!" 113 | fi 114 | if [ ! -f "$LinuxDeployPath/$LinuxSetupFile" ]; then 115 | Error "$LinuxDeployPath/$LinuxSetupFile not found!" 116 | fi 117 | fi 118 | if [ "$DeployLinux32" == "1" ]; then 119 | if [ ! -f "$Linux32DeployPath/$Linux32UpdateFile" ]; then 120 | Error "$Linux32DeployPath/$Linux32UpdateFile not found!" 121 | fi 122 | if [ ! -f "$Linux32DeployPath/$Linux32SetupFile" ]; then 123 | Error "$Linux32DeployPath/$Linux32SetupFile not found!" 124 | fi 125 | fi 126 | 127 | declare -a Files 128 | if [ "$DeployMac" == "1" ]; then 129 | Files+=("mac/$MacUpdateFile" "mac/$MacSetupFile") 130 | fi 131 | if [ "$DeployWin" == "1" ]; then 132 | Files+=("win/$WinUpdateFile" "win/$WinPortableFile" "win/$WinSetupFile") 133 | fi 134 | if [ "$DeployLinux" == "1" ]; then 135 | Files+=("linux/$LinuxUpdateFile" "linux/$LinuxSetupFile") 136 | fi 137 | if [ "$DeployLinux32" == "1" ]; then 138 | Files+=("linux32/$Linux32UpdateFile" "linux32/$Linux32SetupFile") 139 | fi 140 | cd $DeployPath 141 | rsync -avR --progress ${Files[@]} "wallet:wallet-updates" 142 | 143 | echo "Version $AppVersionStrFull was deployed!" 144 | cd $FullExecPath 145 | 146 | -------------------------------------------------------------------------------- /Wallet/build/release.py: -------------------------------------------------------------------------------- 1 | import os, sys, requests, pprint, re, json 2 | from uritemplate import URITemplate, expand 3 | from subprocess import call 4 | from os.path import expanduser 5 | 6 | changelog_file = '../../changelog.txt' 7 | token_file = '../../../DesktopPrivate/github-releases-token.txt' 8 | 9 | version = '' 10 | commit = '' 11 | for arg in sys.argv: 12 | if re.match(r'\d+\.\d+', arg): 13 | version = arg 14 | elif re.match(r'^[a-f0-9]{40}$', arg): 15 | commit = arg 16 | 17 | # thanks http://stackoverflow.com/questions/13909900/progress-of-python-requests-post 18 | class upload_in_chunks(object): 19 | def __init__(self, filename, chunksize=1 << 13): 20 | self.filename = filename 21 | self.chunksize = chunksize 22 | self.totalsize = os.path.getsize(filename) 23 | self.readsofar = 0 24 | 25 | def __iter__(self): 26 | with open(self.filename, 'rb') as file: 27 | while True: 28 | data = file.read(self.chunksize) 29 | if not data: 30 | sys.stderr.write("\n") 31 | break 32 | self.readsofar += len(data) 33 | percent = self.readsofar * 1e2 / self.totalsize 34 | sys.stderr.write("\r{percent:3.0f}%".format(percent=percent)) 35 | yield data 36 | 37 | def __len__(self): 38 | return self.totalsize 39 | 40 | class IterableToFileAdapter(object): 41 | def __init__(self, iterable): 42 | self.iterator = iter(iterable) 43 | self.length = len(iterable) 44 | 45 | def read(self, size=-1): # TBD: add buffer for `len(data) > size` case 46 | return next(self.iterator, b'') 47 | 48 | def __len__(self): 49 | return self.length 50 | 51 | def checkResponseCode(result, right_code): 52 | if (result.status_code != right_code): 53 | print('Wrong result code: ' + str(result.status_code) + ', should be ' + str(right_code)) 54 | sys.exit(1) 55 | 56 | pp = pprint.PrettyPrinter(indent=2) 57 | url = 'https://api.github.com/' 58 | 59 | version_parts = version.split('.') 60 | 61 | stable = 1 62 | beta = 0 63 | 64 | if len(version_parts) < 2: 65 | print('Error: expected at least major version ' + version) 66 | sys.exit(1) 67 | if len(version_parts) > 4: 68 | print('Error: bad version passed ' + version) 69 | sys.exit(1) 70 | version_major = version_parts[0] + '.' + version_parts[1] 71 | if len(version_parts) == 2: 72 | version = version_major + '.0' 73 | version_full = version 74 | else: 75 | version = version_major + '.' + version_parts[2] 76 | version_full = version 77 | if len(version_parts) == 4: 78 | if version_parts[3] == 'beta': 79 | beta = 1 80 | stable = 0 81 | version_full = version + '.beta' 82 | else: 83 | print('Error: unexpected version part ' + version_parts[3]) 84 | sys.exit(1) 85 | 86 | access_token = '' 87 | if os.path.isfile(token_file): 88 | with open(token_file) as f: 89 | for line in f: 90 | access_token = line.replace('\n', '') 91 | 92 | if access_token == '': 93 | print('Access token not found!') 94 | sys.exit(1) 95 | 96 | print('Version: ' + version_full); 97 | local_folder = expanduser("~") + '/Projects/backup/wallet/' + version_major + '/' + version_full 98 | 99 | if not os.path.isdir(local_folder): 100 | print('Storage path not found: ' + local_folder) 101 | sys.exit(1) 102 | 103 | local_folder = local_folder + '/' 104 | 105 | files = [] 106 | files.append({ 107 | 'local': 'wsetup.' + version_full + '.exe', 108 | 'remote': 'wsetup.' + version_full + '.exe', 109 | 'backup_folder': 'win', 110 | 'mime': 'application/octet-stream', 111 | 'label': 'Windows: Installer', 112 | }) 113 | files.append({ 114 | 'local': 'wportable.' + version_full + '.zip', 115 | 'remote': 'wportable.' + version_full + '.zip', 116 | 'backup_folder': 'win', 117 | 'mime': 'application/zip', 118 | 'label': 'Windows: Portable', 119 | }) 120 | files.append({ 121 | 'local': 'wsetup.' + version_full + '.dmg', 122 | 'remote': 'wsetup.' + version_full + '.dmg', 123 | 'backup_folder': 'mac', 124 | 'mime': 'application/octet-stream', 125 | 'label': 'macOS and OS X 10.12+: Installer', 126 | }) 127 | files.append({ 128 | 'local': 'wsetup.' + version_full + '.tar.xz', 129 | 'remote': 'wsetup.' + version_full + '.tar.xz', 130 | 'backup_folder': 'linux', 131 | 'mime': 'application/octet-stream', 132 | 'label': 'Linux 64 bit: Binary', 133 | }) 134 | 135 | releasesUrl = url + 'repos/ton-blockchain/wallet-desktop/releases' 136 | 137 | r = requests.get(releasesUrl + '/tags/v' + version) 138 | if r.status_code == 404: 139 | print('Release not found, creating.') 140 | if commit == '': 141 | print('Error: specify the commit.') 142 | sys.exit(1) 143 | if not os.path.isfile(changelog_file): 144 | print('Error: Changelog file not found.') 145 | sys.exit(1) 146 | changelog = '' 147 | started = 0 148 | with open(changelog_file) as f: 149 | for line in f: 150 | if started == 1: 151 | if re.match(r'^\d+\.\d+', line): 152 | break 153 | changelog += line 154 | else: 155 | if re.match(r'^\d+\.\d+', line): 156 | if line[0:len(version) + 1] == version + ' ': 157 | started = 1 158 | elif line[0:len(version_major) + 1] == version_major + ' ': 159 | if version_major + '.0' == version: 160 | started = 1 161 | if started != 1: 162 | print('Error: Changelog not found.') 163 | sys.exit(1) 164 | 165 | changelog = changelog.strip() 166 | print('Changelog: ') 167 | print(changelog) 168 | 169 | r = requests.post(releasesUrl, headers={'Authorization': 'token ' + access_token}, data=json.dumps({ 170 | 'tag_name': 'v' + version, 171 | 'target_commitish': commit, 172 | 'name': 'v ' + version, 173 | 'body': changelog, 174 | 'prerelease': (beta == 1), 175 | })) 176 | checkResponseCode(r, 201) 177 | 178 | # tagname = 'v' + version 179 | # call("git fetch origin".split()) 180 | # if stable == 1: 181 | # call("git push launchpad {}:master".format(tagname).split()) 182 | # else: 183 | # call("git push launchpad {}:beta".format(tagname).split()) 184 | # call("git push --tags launchpad".split()) 185 | 186 | r = requests.get(releasesUrl + '/tags/v' + version) 187 | checkResponseCode(r, 200) 188 | 189 | release_data = r.json() 190 | #pp.pprint(release_data) 191 | 192 | release_id = release_data['id'] 193 | print('Release ID: ' + str(release_id)) 194 | 195 | r = requests.get(releasesUrl + '/' + str(release_id) + '/assets'); 196 | checkResponseCode(r, 200) 197 | 198 | assets = release_data['assets'] 199 | for asset in assets: 200 | name = asset['name'] 201 | found = 0 202 | for file in files: 203 | if file['remote'] == name: 204 | print('Already uploaded: ' + name) 205 | file['already'] = 1 206 | found = 1 207 | break 208 | if found == 0: 209 | print('Warning: strange asset: ' + name) 210 | 211 | for file in files: 212 | if 'already' in file: 213 | continue 214 | file_path = local_folder + file['backup_folder'] + '/' + file['local'] 215 | if not os.path.isfile(file_path): 216 | print('Warning: file not found ' + file['local']) 217 | continue 218 | 219 | upload_url = expand(release_data['upload_url'], {'name': file['remote'], 'label': file['label']}) + '&access_token=' + access_token; 220 | 221 | content = upload_in_chunks(file_path, 10) 222 | 223 | print('Uploading: ' + file['remote'] + ' (' + str(round(len(content) / 10000) / 100.) + ' MB)') 224 | r = requests.post(upload_url, headers={"Content-Type": file['mime']}, data=IterableToFileAdapter(content)) 225 | 226 | checkResponseCode(r, 201) 227 | 228 | print('Success! Removing.') 229 | return_code = call(["rm", file_path]) 230 | if return_code != 0: 231 | print('Bad rm code: ' + str(return_code)) 232 | sys.exit(1) 233 | 234 | sys.exit() 235 | -------------------------------------------------------------------------------- /Wallet/build/release.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | FullExecPath=$PWD 3 | pushd `dirname $0` > /dev/null 4 | FullScriptPath=`pwd` 5 | popd > /dev/null 6 | 7 | Param1="$1" 8 | Param2="$2" 9 | Param3="$3" 10 | Param4="$4" 11 | 12 | if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then 13 | echo "" 14 | echo "This script is for building the offical version of TON Wallet." 15 | echo "" 16 | echo "For building custom versions please visit the build instructions page at:" 17 | echo "https://github.com/ton-blockchain/wallet-desktop/#build-instructions" 18 | exit 19 | fi 20 | 21 | Error () { 22 | cd $FullExecPath 23 | echo "$1" 24 | exit 1 25 | } 26 | 27 | while IFS='' read -r line || [[ -n "$line" ]]; do 28 | set $line 29 | eval $1="$2" 30 | done < "$FullScriptPath/version" 31 | 32 | cd "$FullScriptPath" 33 | python3 release.py $AppVersionStr $Param1 $Param2 $Param3 $Param4 34 | -------------------------------------------------------------------------------- /Wallet/build/set_version.bat: -------------------------------------------------------------------------------- 1 | @echo OFF 2 | 3 | set "FullScriptPath=%~dp0" 4 | 5 | python %FullScriptPath%set_version.py %1 6 | if %errorlevel% neq 0 goto error 7 | 8 | exit /b 9 | 10 | :error 11 | echo FAILED 12 | exit /b 1 13 | -------------------------------------------------------------------------------- /Wallet/build/set_version.py: -------------------------------------------------------------------------------- 1 | # This file is part of TON Wallet Desktop, 2 | # a desktop application for the TON Blockchain project. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | 7 | import sys, os, re, subprocess 8 | 9 | def finish(code): 10 | global executePath 11 | os.chdir(executePath) 12 | sys.exit(code) 13 | 14 | if sys.platform == 'win32' and not 'COMSPEC' in os.environ: 15 | print('[ERROR] COMSPEC environment variable is not set.') 16 | finish(1) 17 | 18 | executePath = os.getcwd() 19 | scriptPath = os.path.dirname(os.path.realpath(__file__)) 20 | 21 | inputVersion = '' 22 | versionOriginal = '' 23 | versionMajor = '' 24 | versionMinor = '' 25 | versionPatch = '' 26 | for arg in sys.argv: 27 | match = re.match(r'^\s*(\d+)\.(\d+)(\.(\d+))?\s*$', arg) 28 | if match: 29 | inputVersion = arg 30 | versionOriginal = inputVersion 31 | versionMajor = match.group(1) 32 | versionMinor = match.group(2) 33 | versionPatch = match.group(4) if match.group(4) else '0' 34 | 35 | if not len(versionMajor): 36 | print("Wrong version parameter") 37 | finish(1) 38 | 39 | def checkVersionPart(part): 40 | cleared = int(part) % 1000 if len(part) > 0 else 0 41 | if str(cleared) != part: 42 | print("Bad version part: " + part) 43 | finish(1) 44 | 45 | checkVersionPart(versionMajor) 46 | checkVersionPart(versionMinor) 47 | checkVersionPart(versionPatch) 48 | 49 | versionFull = str(int(versionMajor) * 1000000 + int(versionMinor) * 1000 + int(versionPatch)) 50 | versionStr = versionMajor + '.' + versionMinor + '.' + versionPatch 51 | versionStrSmall = versionStr if versionPatch != '0' else versionMajor + '.' + versionMinor 52 | 53 | print('Setting version: ' + versionStr + ' stable') 54 | 55 | def replaceInFile(path, replacements): 56 | content = '' 57 | foundReplacements = {} 58 | updated = False 59 | with open(path, 'r') as f: 60 | for line in f: 61 | for replacement in replacements: 62 | if re.search(replacement[0], line): 63 | changed = re.sub(replacement[0], replacement[1], line) 64 | if changed != line: 65 | line = changed 66 | updated = True 67 | foundReplacements[replacement[0]] = True 68 | content = content + line 69 | for replacement in replacements: 70 | if not replacement[0] in foundReplacements: 71 | print('Could not find "' + replacement[0] + '" in "' + path + '".') 72 | finish(1) 73 | if updated: 74 | with open(path, 'w') as f: 75 | f.write(content) 76 | 77 | print('Patching build/version...') 78 | replaceInFile(scriptPath + '/version', [ 79 | [ r'(AppVersion\s+)\d+', r'\g<1>' + versionFull ], 80 | [ r'(AppVersionStrMajor\s+)\d[\d\.]*', r'\g<1>' + versionMajor + '.' + versionMinor ], 81 | [ r'(AppVersionStrSmall\s+)\d[\d\.]*', r'\g<1>' + versionStrSmall ], 82 | [ r'(AppVersionStr\s+)\d[\d\.]*', r'\g<1>' + versionStr ], 83 | [ r'(AppVersionOriginal\s+)\d[\d\.beta]*', r'\g<1>' + versionOriginal ], 84 | ]) 85 | 86 | print('Patching core/version.h...') 87 | replaceInFile(scriptPath + '/../SourceFiles/core/version.h', [ 88 | [ r'(AppVersion\s+=\s+)\d+', r'\g<1>' + versionFull ], 89 | [ r'(AppVersionStr\s+=\s+)[^;]+', r'\g<1>"' + versionStrSmall + '"' ], 90 | ]) 91 | 92 | parts = [versionMajor, versionMinor, versionPatch, '0'] 93 | withcomma = ','.join(parts) 94 | withdot = '.'.join(parts) 95 | rcReplaces = [ 96 | [ r'(FILEVERSION\s+)\d+,\d+,\d+,\d+', r'\g<1>' + withcomma ], 97 | [ r'(PRODUCTVERSION\s+)\d+,\d+,\d+,\d+', r'\g<1>' + withcomma ], 98 | [ r'("FileVersion",\s+)"\d+\.\d+\.\d+\.\d+"', r'\g<1>"' + withdot + '"' ], 99 | [ r'("ProductVersion",\s+)"\d+\.\d+\.\d+\.\d+"', r'\g<1>"' + withdot + '"' ], 100 | ] 101 | 102 | print('Patching Wallet.rc...') 103 | replaceInFile(scriptPath + '/../Resources/win/Wallet.rc', rcReplaces) 104 | -------------------------------------------------------------------------------- /Wallet/build/set_version.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | pushd `dirname $0` > /dev/null 4 | FullScriptPath=`pwd` 5 | popd > /dev/null 6 | 7 | python $FullScriptPath/set_version.py $1 8 | 9 | exit 10 | -------------------------------------------------------------------------------- /Wallet/build/setup.iss: -------------------------------------------------------------------------------- 1 | #define MyAppShortName "TON Wallet" 2 | #define MyAppName "TON Wallet" 3 | #define MyAppPublisher "TON Foundation" 4 | #define MyAppURL "https://ton.org/wallets" 5 | #define MyAppExeName "Wallet.exe" 6 | #define MyAppId "5ED3C1CA-9AA7-4884-B01A-21D3A0CD0FB4" 7 | 8 | [Setup] 9 | ; NOTE: The value of AppId uniquely identifies this application. 10 | ; Do not use the same AppId value in installers for other applications. 11 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 12 | AppId={{{#MyAppId}} 13 | AppName={#MyAppName} 14 | AppVersion={#MyAppVersion} 15 | AppPublisher={#MyAppPublisher} 16 | AppPublisherURL={#MyAppURL} 17 | AppSupportURL={#MyAppURL} 18 | AppUpdatesURL={#MyAppURL} 19 | DefaultDirName={userappdata}\{#MyAppName} 20 | DefaultGroupName={#MyAppName} 21 | AllowNoIcons=yes 22 | OutputDir={#ReleasePath} 23 | OutputBaseFilename=wsetup.{#MyAppVersionFull} 24 | SetupIconFile={#SourcePath}..\Resources\art\icon256.ico 25 | UninstallDisplayIcon={app}\Wallet.exe 26 | Compression=lzma 27 | SolidCompression=yes 28 | DisableStartupPrompt=yes 29 | PrivilegesRequired=lowest 30 | VersionInfoVersion={#MyAppVersion}.0 31 | CloseApplications=force 32 | DisableDirPage=no 33 | DisableProgramGroupPage=no 34 | 35 | [Tasks] 36 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" 37 | Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,6.1 38 | 39 | [Files] 40 | Source: "{#ReleasePath}\Wallet.exe"; DestDir: "{app}"; Flags: ignoreversion 41 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 42 | 43 | [Icons] 44 | Name: "{group}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}" 45 | Name: "{group}\{cm:UninstallProgram,{#MyAppShortName}}"; Filename: "{uninstallexe}" 46 | Name: "{userdesktop}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon 47 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon 48 | 49 | [Run] 50 | Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppShortName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 51 | 52 | [UninstallDelete] 53 | Type: filesandordirs; Name: "{app}\data" 54 | Type: dirifempty; Name: "{app}" 55 | Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\data" 56 | Type: dirifempty; Name: "{userappdata}\{#MyAppName}" 57 | 58 | [Code] 59 | procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); 60 | var ResultCode: Integer; 61 | begin 62 | if CurUninstallStep = usUninstall then 63 | begin 64 | ShellExec('', ExpandConstant('{app}\{#MyAppExeName}'), 'cleanup', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); 65 | end; 66 | end; 67 | -------------------------------------------------------------------------------- /Wallet/build/updates.py: -------------------------------------------------------------------------------- 1 | import os, sys, re, subprocess, datetime, time 2 | 3 | executePath = os.getcwd() 4 | scriptPath = os.path.dirname(os.path.realpath(__file__)) 5 | 6 | filePrefix = 'wallet' 7 | projectName = 'Wallet' 8 | nameInCaption = 'GramWalletDesktop' 9 | bundleId = 'org.ton.wallet.desktop.debug' 10 | 11 | lastCommit = '' 12 | today = '' 13 | nextLast = False 14 | nextDate = False 15 | building = True 16 | composing = False 17 | for arg in sys.argv: 18 | if nextLast: 19 | lastCommit = arg 20 | nextLast = False 21 | elif nextDate: 22 | today = arg 23 | nextDate = False 24 | elif arg == 'send': 25 | building = False 26 | composing = False 27 | elif arg == 'from': 28 | nextLast = True 29 | building = False 30 | composing = True 31 | elif arg == 'date': 32 | nextDate = True 33 | 34 | def finish(code, error = ''): 35 | if error != '': 36 | print('[ERROR] ' + error) 37 | global executePath 38 | os.chdir(executePath) 39 | sys.exit(code) 40 | 41 | if 'AC_USERNAME' not in os.environ: 42 | finish(1, 'AC_USERNAME not found!') 43 | username = os.environ['AC_USERNAME'] 44 | 45 | if today == '': 46 | today = datetime.datetime.now().strftime("%d_%m_%y") 47 | outputFolder = 'updates/' + today 48 | 49 | archive = filePrefix + '_macOS_' + today + '.zip' 50 | 51 | if building: 52 | os.chdir(scriptPath + '/..') 53 | print('Building debug version for OS X 10.12+..') 54 | 55 | if os.path.exists('../out/Debug/' + outputFolder): 56 | finish(1, 'Todays updates version exists.') 57 | 58 | result = subprocess.call('./configure.sh', shell=True) 59 | if result != 0: 60 | finish(1, 'While calling CMake.') 61 | 62 | os.chdir('../out') 63 | result = subprocess.call('xcodebuild -project ' + projectName + '.xcodeproj -alltargets -configuration Debug build', shell=True) 64 | if result != 0: 65 | finish(1, 'While building ' + projectName + '.') 66 | 67 | os.chdir('Debug') 68 | if not os.path.exists(projectName + '.app'): 69 | finish(1, projectName + '.app not found.') 70 | 71 | result = subprocess.call('strip ' + projectName + '.app/Contents/MacOS/' + projectName, shell=True) 72 | 73 | if result != 0: 74 | finish(1, 'While stripping ' + projectName + '.') 75 | 76 | result = subprocess.call('codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" ' + projectName + '.app --entitlements "../../' + projectName + '/Resources/mac/' + projectName + '.entitlements"', shell=True) 77 | if result != 0: 78 | finish(1, 'While signing ' + projectName + '.') 79 | 80 | if not os.path.exists(projectName + '.app/Contents/Resources/Icon.icns'): 81 | finish(1, 'Icon not found.') 82 | elif not os.path.exists(projectName + '.app/Contents/_CodeSignature'): 83 | finish(1, 'Signature not found.') 84 | 85 | if os.path.exists(today): 86 | subprocess.call('rm -rf ' + today, shell=True) 87 | subprocess.call('mkdir -p ' + today, shell=True) 88 | result = subprocess.call('cp -r ' + projectName + '.app ' + today + '/', shell=True) 89 | if result != 0: 90 | finish(1, 'Cloning ' + projectName + '.app to ' + today + '.') 91 | 92 | result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True) 93 | if result != 0: 94 | finish(1, 'Adding ' + projectName + ' to archive.') 95 | 96 | print('Beginning notarization process.') 97 | lines = subprocess.check_output('xcrun altool --notarize-app --primary-bundle-id "' + bundleId + '" --username "' + username + '" --password "@keychain:AC_PASSWORD" --file "' + archive + '"', stderr=subprocess.STDOUT, shell=True) 98 | print('Response received.') 99 | uuid = '' 100 | for line in lines.split('\n'): 101 | parts = line.strip().split(' ') 102 | if len(parts) > 2 and parts[0] == 'RequestUUID': 103 | uuid = parts[2] 104 | if uuid == '': 105 | finish(1, 'Could not extract Request UUID. Response: ' + lines) 106 | print('Request UUID: ' + uuid) 107 | 108 | requestStatus = '' 109 | logUrl = '' 110 | while requestStatus == '': 111 | time.sleep(5) 112 | print('Checking...') 113 | lines = subprocess.check_output('xcrun altool --notarization-info "' + uuid + '" --username "' + username + '" --password "@keychain:AC_PASSWORD"', stderr=subprocess.STDOUT, shell=True) 114 | statusFound = False 115 | for line in lines.split('\n'): 116 | parts = line.strip().split(' ') 117 | if len(parts) > 1: 118 | if parts[0] == 'LogFileURL:': 119 | logUrl = parts[1] 120 | elif parts[0] == 'Status:': 121 | if parts[1] == 'in': 122 | print('In progress.') 123 | statusFound = True 124 | else: 125 | requestStatus = parts[1] 126 | print('Status: ' + requestStatus) 127 | statusFound = True 128 | if not statusFound: 129 | print('Nothing: ' + lines) 130 | if requestStatus != 'success': 131 | print('Notarization problems, response: ' + lines) 132 | if logUrl != '': 133 | print('Requesting log...') 134 | result = subprocess.call('curl ' + logUrl, shell=True) 135 | if result != 0: 136 | finish(1, 'Error calling curl ' + logUrl) 137 | finish(1, 'Notarization failed.') 138 | logLines = '' 139 | if logUrl != '': 140 | print('Requesting log...') 141 | logLines = subprocess.check_output('curl ' + logUrl, shell=True) 142 | result = subprocess.call('xcrun stapler staple ' + projectName + '.app', shell=True) 143 | if result != 0: 144 | finish(1, 'Error calling stapler') 145 | 146 | subprocess.call('rm -rf ' + today + '/' + projectName + '.app', shell=True) 147 | subprocess.call('rm ' + archive, shell=True) 148 | result = subprocess.call('cp -r ' + projectName + '.app ' + today + '/', shell=True) 149 | if result != 0: 150 | finish(1, 'Re-Cloning ' + projectName + '.app to ' + today + '.') 151 | 152 | result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True) 153 | if result != 0: 154 | finish(1, 'Re-Adding ' + projectName + ' to archive.') 155 | print('Re-Archived.') 156 | 157 | subprocess.call('mkdir -p ' + outputFolder, shell=True) 158 | subprocess.call('mv ' + archive + ' ' + outputFolder + '/', shell=True) 159 | subprocess.call('rm -rf ' + today, shell=True) 160 | print('Finished.') 161 | 162 | if logLines != '': 163 | displayingLog = 0 164 | for line in logLines.split('\n'): 165 | if displayingLog == 1: 166 | print(line) 167 | else: 168 | parts = line.strip().split(' ') 169 | if len(parts) > 1 and parts[0] == '"issues":': 170 | if parts[1] != 'null': 171 | print('NB! Notarization log issues:') 172 | print(line) 173 | displayingLog = 1 174 | else: 175 | displayingLog = -1 176 | if displayingLog == 0: 177 | print('NB! Notarization issues not found: ' + logLines) 178 | else: 179 | print('NB! Notarization log not found.') 180 | finish(0) 181 | 182 | commandPath = scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt' 183 | 184 | if composing: 185 | templatePath = scriptPath + '/../../../DesktopPrivate/updates_template.txt' 186 | if not os.path.exists(templatePath): 187 | finish(1, 'Template file "' + templatePath + '" not found.') 188 | 189 | if not re.match(r'^[a-f0-9]{5,40}$', lastCommit): 190 | finish(1, 'Wrong last commit: ' + lastCommit) 191 | 192 | log = subprocess.check_output(['git', 'log', lastCommit+'..HEAD']) 193 | logLines = log.split('\n') 194 | firstCommit = '' 195 | commits = [] 196 | for line in logLines: 197 | if line.startswith('commit '): 198 | commit = line.split(' ')[1] 199 | if not len(firstCommit): 200 | firstCommit = commit 201 | commits.append('') 202 | elif line.startswith(' '): 203 | stripped = line[4:] 204 | if not len(stripped): 205 | continue 206 | elif not len(commits): 207 | print(log) 208 | finish(1, 'Bad git log output.') 209 | if len(commits[len(commits) - 1]): 210 | commits[len(commits) - 1] += '\n' + stripped 211 | else: 212 | commits[len(commits) - 1] = '- ' + stripped 213 | commits.reverse() 214 | if not len(commits): 215 | finish(1, 'No commits since last build :(') 216 | 217 | changelog = '\n'.join(commits) 218 | print('\n\nReady! File: ' + archive + '\nChangelog:\n' + changelog) 219 | with open(templatePath, 'r') as template: 220 | with open(commandPath, 'w') as f: 221 | for line in template: 222 | if line.startswith('//'): 223 | continue 224 | line = line.replace('{path}', scriptPath + '/../../out/Debug/' + outputFolder + '/' + archive) 225 | line = line.replace('{caption}', nameInCaption + ' at ' + today.replace('_', '.') + ':\n\n' + changelog) 226 | f.write(line) 227 | print('\n\nEdit:\n') 228 | print('vi ' + commandPath) 229 | finish(0) 230 | else: 231 | os.chdir(scriptPath + '/..') 232 | 233 | if not os.path.exists(commandPath): 234 | finish(1, 'Command file not found.') 235 | 236 | readingCaption = False 237 | caption = '' 238 | with open(commandPath, 'r') as f: 239 | for line in f: 240 | if readingCaption: 241 | caption = caption + line 242 | elif line.startswith('caption: '): 243 | readingCaption = True 244 | caption = line[len('caption: '):] 245 | if not caption.startswith(nameInCaption + ' at ' + today.replace('_', '.') + ':'): 246 | finish(1, 'Wrong caption start.') 247 | print('\n\nSending! File: ' + archive + '\nChangelog:\n' + caption) 248 | if len(caption) > 1024: 249 | print('Length: ' + str(len(caption))) 250 | print('vi ' + commandPath) 251 | finish(1, 'Too large.') 252 | 253 | if not os.path.exists('../out/Debug/' + outputFolder + '/' + archive): 254 | finish(1, 'Not built yet.') 255 | 256 | subprocess.call(scriptPath + '/../../../tdesktop/out/Debug/Telegram.app/Contents/MacOS/Telegram -sendpath interpret://' + scriptPath + '/../../out/Debug/' + outputFolder + '/command.txt', shell=True) 257 | 258 | finish(0) 259 | -------------------------------------------------------------------------------- /Wallet/build/updates.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | FullExecPath=$PWD 3 | pushd `dirname $0` > /dev/null 4 | FullScriptPath=`pwd` 5 | popd > /dev/null 6 | 7 | python $FullScriptPath/updates.py $1 $2 $3 $4 $5 $6 8 | 9 | exit 10 | -------------------------------------------------------------------------------- /Wallet/build/version: -------------------------------------------------------------------------------- 1 | AppVersion 9008 2 | AppVersionStrMajor 0.9 3 | AppVersionStrSmall 0.9.8 4 | AppVersionStr 0.9.8 5 | AppVersionOriginal 0.9.8 6 | -------------------------------------------------------------------------------- /Wallet/cmake/wallet_options.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of TON Wallet Desktop, 2 | # a desktop application for the TON Blockchain project. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | 7 | if (NOT disable_autoupdate) 8 | target_compile_definitions(Wallet PRIVATE WALLET_AUTOUPDATING_BUILD) 9 | endif() 10 | -------------------------------------------------------------------------------- /Wallet/configure.bat: -------------------------------------------------------------------------------- 1 | @echo OFF 2 | 3 | setlocal enabledelayedexpansion 4 | set "FullScriptPath=%~dp0" 5 | 6 | python %FullScriptPath%configure.py %* 7 | if %errorlevel% neq 0 goto error 8 | 9 | exit /b 10 | 11 | :error 12 | echo FAILED 13 | exit /b 1 14 | -------------------------------------------------------------------------------- /Wallet/configure.py: -------------------------------------------------------------------------------- 1 | # This file is part of TON Wallet Desktop, 2 | # a desktop application for the TON Blockchain project. 3 | # 4 | # For license and copyright information please follow this link: 5 | # https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 6 | 7 | import sys, os, re 8 | 9 | sys.dont_write_bytecode = True 10 | scriptPath = os.path.dirname(os.path.realpath(__file__)) 11 | sys.path.append(scriptPath + '/../cmake') 12 | import run_cmake 13 | 14 | executePath = os.getcwd() 15 | def finish(code): 16 | global executePath 17 | os.chdir(executePath) 18 | sys.exit(code) 19 | 20 | def error(message): 21 | print('[ERROR] ' + message) 22 | finish(1) 23 | 24 | if sys.platform == 'win32' and not 'COMSPEC' in os.environ: 25 | error('COMSPEC environment variable is not set.') 26 | 27 | executePath = os.getcwd() 28 | scriptPath = os.path.dirname(os.path.realpath(__file__)) 29 | scriptName = os.path.basename(scriptPath) 30 | 31 | arguments = sys.argv[1:] 32 | 33 | officialTarget = '' 34 | officialTargetFile = scriptPath + '/build/target' 35 | if os.path.isfile(officialTargetFile): 36 | with open(officialTargetFile, 'r') as f: 37 | for line in f: 38 | officialTarget = line.strip() 39 | 40 | if officialTarget != '': 41 | arguments.append('-DDESKTOP_APP_UPDATER_PUBLIC_KEY_LOC=SourceFiles/core') 42 | arguments.append('-DDESKTOP_APP_UPDATER_PRIVATE_NAME=wallet') 43 | finish(run_cmake.run(scriptName, arguments)) 44 | elif 'linux' in sys.platform: 45 | debugCode = run_cmake.run(scriptName, arguments, "Debug") 46 | finish(debugCode if debugCode else run_cmake.run(scriptName, arguments, "Release")) 47 | else: 48 | finish(run_cmake.run(scriptName, arguments)) 49 | -------------------------------------------------------------------------------- /Wallet/configure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | pushd `dirname $0` > /dev/null 5 | FullScriptPath=`pwd` 6 | popd > /dev/null 7 | 8 | python $FullScriptPath/configure.py "$@" 9 | 10 | exit 11 | -------------------------------------------------------------------------------- /Wallet/create.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | set "FullScriptPath=%~dp0" 4 | set "FullExecPath=%cd%" 5 | 6 | set "Command=%1" 7 | if "%Command%" == "header" ( 8 | call :write_header %2 9 | exit /b %errorlevel% 10 | ) else if "%Command%" == "source" ( 11 | call :write_source %2 12 | exit /b %errorlevel% 13 | ) else if "%Command%" == "" ( 14 | echo This is an utility for fast blank module creation. 15 | echo Please provide module path. 16 | exit /b 17 | ) 18 | 19 | call :write_module %Command% 20 | exit /b %errorlevel% 21 | 22 | :write_module 23 | ( 24 | set "CommandPath=%1" 25 | set "CommandPathUnix=!CommandPath:\=/!" 26 | if "!CommandPathUnix!" == "" ( 27 | echo Provide module path. 28 | exit /b 1 29 | ) 30 | echo Generating module !CommandPathUnix!.. 31 | call create.bat header !CommandPathUnix! 32 | call create.bat source !CommandPathUnix! 33 | exit /b 34 | ) 35 | 36 | :write_header 37 | ( 38 | set "CommandPath=%1" 39 | set "CommandPathUnix=!CommandPath:\=/!" 40 | set "CommandPathWin=!CommandPath:/=\!" 41 | 42 | if "!CommandPathUnix!" == "" ( 43 | echo Provide header path. 44 | exit /b 1 45 | ) else if exist "SourceFiles\!CommandPathWin!.h" ( 46 | echo This header already exists. 47 | exit /b 1 48 | ) 49 | echo Generating header !CommandPathUnix!.h.. 50 | mkdir "SourceFiles\!CommandPathWin!.h" 51 | rmdir "SourceFiles\!CommandPathWin!.h" 52 | 53 | call :write_comment !CommandPathWin!.h 54 | set "header1=#pragma once" 55 | ( 56 | echo !header1! 57 | echo. 58 | )>> "SourceFiles\!CommandPathWin!.h" 59 | exit /b 60 | ) 61 | 62 | :write_source 63 | ( 64 | set "CommandPath=%1" 65 | set "CommandPathUnix=!CommandPath:\=/!" 66 | set "CommandPathWin=!CommandPath:/=\!" 67 | 68 | if "!CommandPathUnix!" == "" ( 69 | echo Provide source path. 70 | exit /b 1 71 | ) else if exist "SourceFiles\!CommandPathWin!.cpp" ( 72 | echo This source already exists. 73 | exit /b 1 74 | ) 75 | echo Generating source !CommandPathUnix!.cpp.. 76 | mkdir "SourceFiles\!CommandPathWin!.cpp" 77 | rmdir "SourceFiles\!CommandPathWin!.cpp" 78 | 79 | call :write_comment !CommandPathWin!.cpp 80 | set "quote=""" 81 | set "quote=!quote:~0,1!" 82 | set "source1=#include !quote!!CommandPathUnix!.h!quote!" 83 | ( 84 | echo !source1! 85 | echo. 86 | )>> "SourceFiles\!CommandPathWin!.cpp" 87 | exit /b 88 | ) 89 | 90 | :write_comment 91 | ( 92 | set "Path=%1" 93 | ( 94 | echo // This file is part of TON Wallet Desktop, 95 | echo // a desktop application for the TON Blockchain project. 96 | echo // 97 | echo // For license and copyright information please follow this link: 98 | echo // https://github.com/ton-blockchain/wallet-desktop/blob/master/LEGAL 99 | echo // 100 | )> "SourceFiles\!Path!" 101 | exit /b 102 | ) 103 | -------------------------------------------------------------------------------- /auto-build/macos-10.15/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MAKE_THREADS_CNT=-j8 4 | MACOSX_DEPLOYMENT_TARGET=10.12 5 | 6 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 7 | brew install automake cmake fdk-aac git lame libass libtool libvorbis libvpx ninja opus sdl shtool texi2html theora wget x264 xvid yasm pkg-config 8 | 9 | sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 10 | 11 | rootPath=`pwd` 12 | 13 | git clone --recursive https://github.com/newton-blockchain/wallet-desktop.git 14 | 15 | cd wallet-desktop/Wallet/ThirdParty/rlottie 16 | git fetch 17 | git checkout master 18 | git pull 19 | 20 | cd $rootPath 21 | 22 | mkdir ThirdParty 23 | cd ThirdParty 24 | 25 | git clone https://github.com/desktop-app/patches.git 26 | cd patches 27 | git checkout 10aeaf6 28 | cd ../ 29 | git clone https://chromium.googlesource.com/external/gyp 30 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 31 | export PATH="$PWD/depot_tools:$PATH" 32 | cd gyp 33 | git checkout 9f2a7bb1 34 | git apply ../patches/gyp.diff 35 | ./setup.py build 36 | sudo ./setup.py install 37 | cd ../.. 38 | 39 | mkdir -p Libraries/macos 40 | cd Libraries/macos 41 | wget http://tukaani.org/xz/xz-5.0.5.tar.gz 42 | tar -xvf xz-5.0.5.tar.gz 43 | rm xz-5.0.5.tar.gz 44 | 45 | LibrariesPath=`pwd` 46 | 47 | git clone https://github.com/desktop-app/patches.git 48 | cd patches 49 | git checkout 10aeaf6 50 | cd .. 51 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 52 | 53 | cd xz-5.0.5 54 | CFLAGS="-mmacosx-version-min=10.12" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos 55 | make $MAKE_THREADS_CNT 56 | sudo make install 57 | cd .. 58 | 59 | git clone https://github.com/desktop-app/zlib.git 60 | cd zlib 61 | CFLAGS="-mmacosx-version-min=10.12 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos 62 | make $MAKE_THREADS_CNT 63 | sudo make install 64 | cd .. 65 | 66 | git clone https://github.com/openssl/openssl openssl_1_1_1 67 | cd openssl_1_1_1 68 | git checkout OpenSSL_1_1_1-stable 69 | ./Configure --prefix=/usr/local/macos darwin64-x86_64-cc -static -mmacosx-version-min=10.12 70 | make build_libs $MAKE_THREADS_CNT 71 | cd .. 72 | 73 | 74 | git clone https://chromium.googlesource.com/crashpad/crashpad.git 75 | cd crashpad 76 | git checkout feb3aa3923 77 | git apply ../patches/crashpad.diff 78 | cd third_party/mini_chromium 79 | git clone https://chromium.googlesource.com/chromium/mini_chromium 80 | cd mini_chromium 81 | git checkout 7c5b0c1ab4 82 | git apply ../../../../patches/mini_chromium.diff 83 | cd ../../gtest 84 | git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest 85 | cd gtest 86 | git checkout d62d6c6556 87 | cd ../../.. 88 | 89 | git apply $rootPath/wallet-desktop/auto-build/macos-10.15/crashpad.patch 90 | 91 | build/gyp_crashpad.py -Dmac_deployment_target=10.10 92 | ninja -C out/Debug 93 | ninja -C out/Release 94 | cd .. 95 | 96 | git clone git://code.qt.io/qt/qt5.git qt5_12_8 97 | cd qt5_12_8 98 | perl init-repository --module-subset=qtbase,qtimageformats 99 | git checkout v5.12.8 100 | git submodule update qtbase 101 | git submodule update qtimageformats 102 | cd qtbase 103 | git apply ../../patches/qtbase_5_12_8.diff 104 | cd .. 105 | 106 | ./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \ 107 | -debug-and-release \ 108 | -force-debug-info \ 109 | -opensource \ 110 | -confirm-license \ 111 | -static \ 112 | -opengl desktop \ 113 | -no-openssl \ 114 | -securetransport \ 115 | -nomake examples \ 116 | -nomake tests \ 117 | -platform macx-clang 118 | 119 | make $MAKE_THREADS_CNT 120 | sudo make install 121 | cd .. 122 | 123 | LibrariesPath=`pwd` 124 | 125 | git clone --single-branch --branch wallets https://github.com/newton-blockchain/ton.git 126 | cd ton 127 | git submodule init 128 | git submodule update third-party/crc32c 129 | mkdir build-debug 130 | cd build-debug 131 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" .. 132 | make $MAKE_THREADS_CNT tonlib 133 | cd .. 134 | mkdir build 135 | cd build 136 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release .. 137 | make $MAKE_THREADS_CNT tonlib 138 | 139 | cd $rootPath/wallet-desktop/Wallet/ 140 | ./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF 141 | 142 | git apply $rootPath/wallet-desktop/auto-build/macos-10.15/wallet.patch 143 | 144 | cd ../out 145 | 146 | xcodebuild -list -project Wallet.xcodeproj 147 | 148 | xcodebuild -scheme ALL_BUILD -configuration Release build 149 | -------------------------------------------------------------------------------- /auto-build/macos-10.15/crashpad.patch: -------------------------------------------------------------------------------- 1 | Index: tools/crashpad_database_util.cc 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 4 | <+>UTF-8 5 | =================================================================== 6 | diff --git a/tools/crashpad_database_util.cc b/tools/crashpad_database_util.cc 7 | --- a/tools/crashpad_database_util.cc (revision feb3aa3923dd72b1ffb6d020d7c2636757f0c203) 8 | +++ b/tools/crashpad_database_util.cc (date 1610629714230) 9 | @@ -540,7 +540,7 @@ 10 | return EXIT_FAILURE; 11 | } 12 | 13 | - for (const base::FilePath new_report_path : options.new_report_paths) { 14 | + for (const base::FilePath& new_report_path : options.new_report_paths) { 15 | scoped_ptr file_reader; 16 | 17 | bool is_stdin = false; 18 | -------------------------------------------------------------------------------- /auto-build/macos-10.15/wallet.patch: -------------------------------------------------------------------------------- 1 | Index: Wallet/lib_base/base/platform/mac/base_info_mac.mm 2 | <+>UTF-8 3 | =================================================================== 4 | diff --git a/Wallet/lib_base/base/platform/mac/base_info_mac.mm b/Wallet/lib_base/base/platform/mac/base_info_mac.mm 5 | --- a/Wallet/lib_base/base/platform/mac/base_info_mac.mm (revision b61b9d29917b06bb383858e261d94712979d2cef) 6 | +++ b/Wallet/lib_base/base/platform/mac/base_info_mac.mm (date 1610636028831) 7 | @@ -43,7 +43,7 @@ 8 | } 9 | QStringList words; 10 | QString word; 11 | - for (const QChar ch : model) { 12 | + for (const QChar& ch : model) { 13 | if (!ch.isLetter()) { 14 | continue; 15 | } 16 | @@ -59,7 +59,7 @@ 17 | words.push_back(word); 18 | } 19 | QString result; 20 | - for (const QString word : words) { 21 | + for (const QString& word : words) { 22 | if (!result.isEmpty() 23 | && word != "Mac" 24 | && word != "Book") { 25 | Index: Wallet/lib_wallet/wallet/wallet_common.cpp 26 | <+>UTF-8 27 | =================================================================== 28 | diff --git a/Wallet/lib_wallet/wallet/wallet_common.cpp b/Wallet/lib_wallet/wallet/wallet_common.cpp 29 | --- a/Wallet/lib_wallet/wallet/wallet_common.cpp (revision a64bf58e272edafd9d77b0f69ae59e88b9186240) 30 | +++ b/Wallet/lib_wallet/wallet/wallet_common.cpp (date 1610636519668) 31 | @@ -42,7 +42,7 @@ 32 | trimmed.append('0'); 33 | } 34 | auto zeros = 0; 35 | - for (const auto ch : trimmed) { 36 | + for (const auto& ch : trimmed) { 37 | if (ch == '0') { 38 | ++zeros; 39 | } else { 40 | Index: Wallet/lib_storage/storage/cache/storage_cache_cleaner.cpp 41 | <+>UTF-8 42 | =================================================================== 43 | diff --git a/Wallet/lib_storage/storage/cache/storage_cache_cleaner.cpp b/Wallet/lib_storage/storage/cache/storage_cache_cleaner.cpp 44 | --- a/Wallet/lib_storage/storage/cache/storage_cache_cleaner.cpp (revision 57027c7d6c071f0d958576a530c7c0411d8d4274) 45 | +++ b/Wallet/lib_storage/storage/cache/storage_cache_cleaner.cpp (date 1610636171343) 46 | @@ -53,7 +53,7 @@ 47 | void CleanerObject::start() { 48 | const auto entries = QDir(_base).entryList( 49 | QDir::Dirs | QDir::NoDotAndDotDot); 50 | - for (const auto entry : entries) { 51 | + for (const auto& entry : entries) { 52 | _queue.push_back(entry); 53 | } 54 | if (const auto version = ReadVersionValue(_base)) { 55 | Index: Wallet/lib_storage/storage/cache/storage_cache_database_object.cpp 56 | <+>UTF-8 57 | =================================================================== 58 | diff --git a/Wallet/lib_storage/storage/cache/storage_cache_database_object.cpp b/Wallet/lib_storage/storage/cache/storage_cache_database_object.cpp 59 | --- a/Wallet/lib_storage/storage/cache/storage_cache_database_object.cpp (revision 57027c7d6c071f0d958576a530c7c0411d8d4274) 60 | +++ b/Wallet/lib_storage/storage/cache/storage_cache_database_object.cpp (date 1610636182578) 61 | @@ -1319,7 +1319,7 @@ 62 | const auto entries = QDir(_base).entryList( 63 | QDir::Dirs | QDir::NoDotAndDotDot); 64 | auto versions = base::flat_set(); 65 | - for (const auto entry : entries) { 66 | + for (const auto& entry : entries) { 67 | versions.insert(entry.toInt()); 68 | } 69 | auto result = Version(); 70 | Index: Wallet/codegen/codegen/style/generator.cpp 71 | <+>UTF-8 72 | =================================================================== 73 | diff --git a/Wallet/codegen/codegen/style/generator.cpp b/Wallet/codegen/codegen/style/generator.cpp 74 | --- a/Wallet/codegen/codegen/style/generator.cpp (revision f6431b149b199238b5bd8f315c656780c1e3bcd1) 75 | +++ b/Wallet/codegen/codegen/style/generator.cpp (date 1610636028831) 76 | @@ -387,7 +387,7 @@ 77 | } else if (includes.isEmpty()) { 78 | return true; 79 | } 80 | - for (const auto base : includes) { 81 | + for (const auto& base : includes) { 82 | header_->include("styles/" + base + ".h"); 83 | } 84 | header_->newline(); 85 | @@ -1214,7 +1214,7 @@ 86 | << png3x.width() << "x" << png3x.height(); 87 | return result; 88 | } 89 | - for (const auto modifierName : modifiers) { 90 | + for (const auto& modifierName : modifiers) { 91 | if (const auto modifier = GetModifier(modifierName)) { 92 | modifier(png1x); 93 | modifier(png2x); 94 | Index: Wallet/lib_ui/ui/widgets/menu.cpp 95 | <+>UTF-8 96 | =================================================================== 97 | diff --git a/Wallet/lib_ui/ui/widgets/menu.cpp b/Wallet/lib_ui/ui/widgets/menu.cpp 98 | --- a/Wallet/lib_ui/ui/widgets/menu.cpp (revision 9086052985c02fed7c7f6990ab9462c2e9ec8f14) 99 | +++ b/Wallet/lib_ui/ui/widgets/menu.cpp (date 1610636449650) 100 | @@ -19,7 +19,7 @@ 101 | auto result = TextWithEntities(); 102 | result.text.reserve(text.size()); 103 | auto afterAmpersand = false; 104 | - for (const auto ch : text) { 105 | + for (const auto& ch : text) { 106 | if (afterAmpersand) { 107 | afterAmpersand = false; 108 | if (ch == '&') { 109 | -------------------------------------------------------------------------------- /auto-build/ubuntu-18.04/compile.sh: -------------------------------------------------------------------------------- 1 | apt install python2.7 python2.7-minimal libpython2.7-minimal libpython2.7-stdlib -y 2 | update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 3 | 4 | apt-get install software-properties-common -y && \ 5 | apt-get install git libexif-dev liblzma-dev libz-dev libssl-dev \ 6 | libgtk2.0-dev libice-dev libsm-dev libicu-dev libdrm-dev dh-autoreconf \ 7 | autoconf automake build-essential libxml2-dev libass-dev libfreetype6-dev \ 8 | libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ 9 | libvorbis-dev libenchant-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev \ 10 | libxcb-xfixes0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libatspi2.0-dev \ 11 | libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \ 12 | libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev libegl1-mesa-dev \ 13 | libx11-xcb-dev libffi-dev libncurses5-dev pkg-config texi2html bison yasm \ 14 | zlib1g-dev xutils-dev chrpath gperf -y && \ 15 | add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ 16 | apt-get update && \ 17 | apt-get install gcc-8 g++-8 -y && \ 18 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 && \ 19 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60 && \ 20 | update-alternatives --config gcc && \ 21 | add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y 22 | 23 | MAKE_THREADS_CNT=-j8 24 | 25 | git clone --recursive https://github.com/newton-blockchain/wallet-desktop.git 26 | cd wallet-desktop 27 | git submodule update --remote Wallet/lib_wallet 28 | cd .. 29 | 30 | mkdir Libraries 31 | cd Libraries 32 | 33 | git clone https://github.com/Kitware/CMake cmake 34 | cd cmake 35 | git checkout v3.16.0 36 | ./bootstrap 37 | make $MAKE_THREADS_CNT 38 | make install 39 | cd .. 40 | 41 | git clone https://github.com/desktop-app/patches.git 42 | cd patches 43 | git checkout 10aeaf6 44 | cd ../ 45 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 46 | 47 | git clone https://github.com/openssl/openssl openssl_1_1_1 48 | cd openssl_1_1_1 49 | git checkout OpenSSL_1_1_1-stable 50 | ./config --prefix=/usr/local/desktop-app/openssl-1.1.1 51 | make $MAKE_THREADS_CNT 52 | make install 53 | cd .. 54 | 55 | git clone https://github.com/xkbcommon/libxkbcommon.git 56 | cd libxkbcommon 57 | git checkout xkbcommon-0.8.4 58 | ./autogen.sh --disable-x11 59 | make $MAKE_THREADS_CNT 60 | make install 61 | 62 | cd .. 63 | 64 | git clone https://github.com/google/googletest 65 | cd googletest 66 | mkdir build 67 | cd build 68 | cmake .. 69 | make 70 | cp lib/*.a /usr/lib 71 | 72 | cd ../.. 73 | 74 | git clone git://code.qt.io/qt/qt5.git qt_5_12_8 75 | cd qt_5_12_8 76 | perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg 77 | git checkout v5.12.8 78 | git submodule update qtbase 79 | git submodule update qtwayland 80 | git submodule update qtimageformats 81 | git submodule update qtsvg 82 | cd qtbase 83 | git apply ../../patches/qtbase_5_12_8.diff 84 | cd src/plugins/platforminputcontexts 85 | git clone https://github.com/desktop-app/fcitx.git 86 | git clone https://github.com/desktop-app/hime.git 87 | git clone https://github.com/desktop-app/nimf.git 88 | cd ../../../.. 89 | 90 | OPENSSL_DIR=/usr/local/desktop-app/openssl-1.1.1 91 | ./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \ 92 | -release \ 93 | -force-debug-info \ 94 | -opensource \ 95 | -confirm-license \ 96 | -qt-zlib \ 97 | -qt-libpng \ 98 | -qt-libjpeg \ 99 | -qt-harfbuzz \ 100 | -qt-pcre \ 101 | -qt-xcb \ 102 | -system-freetype \ 103 | -fontconfig \ 104 | -no-gtk \ 105 | -static \ 106 | -dbus-runtime \ 107 | -openssl-linked \ 108 | -I "$OPENSSL_DIR/include" OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a -ldl -lpthread" \ 109 | -nomake examples \ 110 | -nomake tests 111 | 112 | make $MAKE_THREADS_CNT 113 | make install 114 | cd .. 115 | 116 | git clone https://chromium.googlesource.com/external/gyp 117 | cd gyp 118 | git checkout 9f2a7bb1 119 | git apply ../patches/gyp.diff 120 | cd .. 121 | 122 | git clone https://chromium.googlesource.com/breakpad/breakpad 123 | cd breakpad 124 | git checkout bc8fb886 125 | git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss 126 | cd src/third_party/lss 127 | git checkout a91633d1 128 | cd ../../.. 129 | ./configure 130 | 131 | cp -R ../googletest/googletest src/testing/ 132 | cp -R ../googletest/googlemock src/testing/ 133 | 134 | cp src/tools/mac/symupload/minidump_upload.m src/tools/linux/symupload/ 135 | 136 | make $MAKE_THREADS_CNT 137 | make install 138 | cd src/tools 139 | ../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake 140 | cd ../../out/Default 141 | cmake . 142 | make $MAKE_THREADS_CNT dump_syms 143 | cd ../../.. 144 | 145 | git clone --single-branch --branch wallets https://github.com/newton-blockchain/ton.git 146 | cd ton 147 | git submodule init 148 | git submodule update third-party/crc32c 149 | mkdir build-debug 150 | cd build-debug 151 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a -DTON_ARCH=`uname -m | sed --expression='s/_/-/g'` .. 152 | make $MAKE_THREADS_CNT tonlib 153 | cd .. 154 | mkdir build 155 | cd build 156 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a -DTON_ARCH=`uname -m | sed --expression='s/_/-/g'` -DCMAKE_BUILD_TYPE=Release .. 157 | make $MAKE_THREADS_CNT tonlib 158 | 159 | cd ../../.. 160 | 161 | cd wallet-desktop 162 | 163 | #temporary dirty workaround 164 | sed -i '238d' cmake/external/qt/CMakeLists.txt 165 | sed -i '238d' cmake/external/qt/CMakeLists.txt 166 | sed -i '238d' cmake/external/qt/CMakeLists.txt 167 | sed -i '242d' cmake/external/qt/CMakeLists.txt 168 | 169 | cd Wallet 170 | 171 | ./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF 172 | 173 | cd ../out/Release 174 | 175 | make $MAKE_THREADS_CNT 176 | 177 | cd bin 178 | strip ./Wallet 179 | -------------------------------------------------------------------------------- /auto-build/windows/compile.bat: -------------------------------------------------------------------------------- 1 | REM Execute this batch file in "x86 Native Tools Command Prompt for VS 2019" console 2 | REM If you have a Professional or Community edition then update the path below C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise 3 | 4 | set root=%cd% 5 | 6 | mkdir ThirdParty 7 | mkdir Libraries 8 | 9 | cd ThirdParty 10 | curl -o strawberry.zip -LO https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit-portable.zip 11 | unzip -q strawberry.zip -d Strawberry 12 | del strawberry.zip 13 | 14 | curl -o install.msi https://www.python.org/ftp/python/2.7.8/python-2.7.8.amd64.msi 15 | msiexec /i install.msi /quiet /qn /norestart TARGETDIR="%cd%\Python27" 16 | del install.msi 17 | 18 | curl -o cmake.zip -LO https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4-win64-x64.zip 19 | unzip -q cmake.zip -d cmake 20 | del cmake.zip 21 | 22 | curl -o nasm.zip https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip 23 | unzip -q nasm.zip -d NASM 24 | del nasm.zip 25 | 26 | curl -o yasm.zip http://www.tortall.net/projects/yasm/releases/vsyasm-1.3.0-win64.zip 27 | unzip -q yasm.zip -d yasm 28 | del yasm.zip 29 | 30 | curl -o ninja.zip -LO https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip 31 | unzip -q ninja.zip -d Ninja 32 | del ninja.zip 33 | 34 | curl -o jom.zip http://www.mirrorservice.org/sites/download.qt-project.org/official_releases/jom/jom_1_1_3.zip 35 | unzip -q jom.zip -d jom 36 | del jom.zip 37 | 38 | git clone https://github.com/desktop-app/patches.git 39 | cd patches 40 | git checkout 10aeaf6 41 | cd .. 42 | git clone https://chromium.googlesource.com/external/gyp 43 | cd gyp 44 | git checkout 9f2a7bb1 45 | git apply ../patches/gyp.diff 46 | cd ..\.. 47 | 48 | SET PATH=%cd%\ThirdParty\Strawberry\perl\bin;%cd%\ThirdParty\NASM\nasm-2.15.05;%cd%\ThirdParty\Python27;%cd%\ThirdParty\jom;%cd%\ThirdParty\cmake\cmake-3.19.4-win64-x64\bin;%cd%\ThirdParty\yasm;%cd%\ThirdParty\gyp;%cd%\ThirdParty\Ninja;%PATH% 49 | 50 | cd Libraries 51 | SET LibrariesPath=%cd% 52 | 53 | SET GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise 54 | SET GYP_MSVS_VERSION=2019 55 | 56 | git clone https://github.com/desktop-app/patches.git 57 | cd patches 58 | git checkout 10aeaf6 59 | cd .. 60 | 61 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 range-v3 62 | 63 | git clone https://github.com/openssl/openssl.git openssl_1_1_1 64 | cd openssl_1_1_1 65 | git checkout OpenSSL_1_1_1i 66 | 67 | perl Configure no-shared debug-VC-WIN32 68 | nmake 69 | mkdir out32.dbg 70 | move libcrypto.lib out32.dbg 71 | move libssl.lib out32.dbg 72 | move ossl_static.pdb out32.dbg\ossl_static 73 | nmake clean 74 | move out32.dbg\ossl_static out32.dbg\ossl_static.pdb 75 | 76 | perl Configure no-shared VC-WIN32 77 | nmake 78 | mkdir out32 79 | move libcrypto.lib out32 80 | move libssl.lib out32 81 | move ossl_static.pdb out32 82 | cd .. 83 | 84 | 85 | git clone https://github.com/desktop-app/zlib.git 86 | cd zlib\contrib\vstudio\vc14 87 | msbuild zlibstat.vcxproj /property:Configuration=Debug /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 88 | msbuild zlibstat.vcxproj /property:Configuration=ReleaseWithoutAsm /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 89 | cd ..\..\..\.. 90 | 91 | 92 | git clone https://github.com/desktop-app/lzma.git 93 | cd lzma\C\Util\LzmaLib 94 | msbuild LzmaLib.sln /property:Configuration=Debug /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 95 | msbuild LzmaLib.sln /property:Configuration=Release /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 96 | cd ..\..\..\.. 97 | 98 | 99 | git clone https://github.com/google/breakpad 100 | cd breakpad 101 | git checkout a1dbcdcb43 102 | git apply ../patches/breakpad.diff 103 | cd src 104 | git clone https://github.com/google/googletest testing 105 | cd client\windows 106 | call gyp --no-circular-check breakpad_client.gyp --format=ninja 107 | cd ..\.. 108 | ninja -C out/Debug common crash_generation_client exception_handler 109 | ninja -C out/Release common crash_generation_client exception_handler 110 | cd tools\windows\dump_syms 111 | call gyp dump_syms.gyp 112 | msbuild dump_syms.vcxproj /property:Configuration=Debug /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 113 | msbuild dump_syms.vcxproj /property:Configuration=Release /p:PlatformToolset=v142 /p:platform=x86 /p:WindowsTargetPlatformVersion=10.0.19041.0 114 | cd ..\..\..\..\.. 115 | 116 | 117 | git clone git://code.qt.io/qt/qt5.git qt_5_12_8 118 | cd qt_5_12_8 119 | perl init-repository --module-subset=qtbase,qtimageformats 120 | git checkout v5.12.8 121 | git submodule update --init qtbase 122 | git submodule update --init qtimageformats 123 | 124 | 125 | call configure -prefix "%LibrariesPath%\Qt-5.12.8" -debug-and-release -force-debug-info -opensource -confirm-license -static -static-runtime -I "%LibrariesPath%\openssl_1_1_1\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%LibrariesPath%\openssl_1_1_1\out32.dbg\libssl.lib %LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" OPENSSL_LIBS_RELEASE="%LibrariesPath%\openssl_1_1_1\out32\libssl.lib %LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" -mp -nomake examples -nomake tests -platform win32-msvc 126 | 127 | call jom -j4 128 | 129 | call jom -j4 install 130 | 131 | cd .. 132 | 133 | git clone --single-branch --branch wallets --recursive https://github.com/newton-blockchain/ton.git 134 | cd ton 135 | git submodule init 136 | git submodule update third-party/crc32c 137 | mkdir build-debug 138 | cd build-debug 139 | cmake -A Win32 -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%LibrariesPath%\openssl_1_1_1\include -DOPENSSL_CRYPTO_LIBRARY=%LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=%LibrariesPath%\zlib -DZLIB_LIBRARY=%LibrariesPath%\zlib\contrib\vstudio\vc14\x86\ZlibStatDebug\zlibstat.lib -DCMAKE_CXX_FLAGS_DEBUG="/DZLIB_WINAPI /DNDEBUG /MTd /Zi /Od /Ob0" -DCMAKE_C_FLAGS_DEBUG="/DNDEBUG /MTd /Zi /Od /Ob0" -DCMAKE_EXE_LINKER_FLAGS="/SAFESEH:NO Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" .. 140 | cmake --build . --target tonlib --config Debug 141 | 142 | cd .. 143 | mkdir build 144 | cd build 145 | cmake -A Win32 -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%LibrariesPath%\openssl_1_1_1\include -DOPENSSL_CRYPTO_LIBRARY=%LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=%LibrariesPath%\zlib -DZLIB_LIBRARY=%LibrariesPath%\zlib\contrib\vstudio\vc14\x86\ZlibStatReleaseWithoutAsm\zlibstat.lib -DCMAKE_CXX_FLAGS_RELEASE="/DZLIB_WINAPI /MT /Ob2" -DCMAKE_C_FLAGS_RELEASE="/MT /Ob2" -DCMAKE_EXE_LINKER_FLAGS="/SAFESEH:NO Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" .. 146 | cmake --build . --target tonlib --config Release 147 | 148 | cd %LibrariesPath%\.. 149 | git clone --recursive https://github.com/newton-blockchain/wallet-desktop.git 150 | 151 | cd wallet-desktop\Wallet 152 | 153 | call configure.bat -D DESKTOP_APP_USE_PACKAGED=OFF 154 | 155 | cd lib_storage 156 | copy %root%\lib_storage.patch . 157 | git apply lib_storage.patch 158 | cd .. 159 | 160 | cd ThirdParty\variant 161 | copy %root%\variant.patch . 162 | git apply variant.patch 163 | 164 | rem free up disc space, git actions windows server 2019 has 14GB limit 165 | rm -rf %root%\ThirdParty\Strawberry 166 | rm -rf %root%\Libraries\openssl_1_1_1\test 167 | 168 | cd %root%\wallet-desktop\out 169 | 170 | msbuild Wallet.sln /property:Configuration=Debug /p:platform=win32 /p:PlatformToolset=v142 /p:WindowsTargetPlatformVersion=10.0.19041.0 /p:Zc=preprocessor 171 | 172 | dir Debug 173 | -------------------------------------------------------------------------------- /auto-build/windows/lib_storage.patch: -------------------------------------------------------------------------------- 1 | diff --git a/storage/cache/storage_cache_binlog_reader.h b/storage/cache/storage_cache_binlog_reader.h 2 | index b6ab7fb..d37c163 100644 3 | --- a/storage/cache/storage_cache_binlog_reader.h 4 | +++ b/storage/cache/storage_cache_binlog_reader.h 5 | @@ -127,17 +127,7 @@ struct BinlogReaderRecursive { 6 | template 7 | inline void BinlogReaderRecursive::CheckSettings( 8 | const Settings &settings) { 9 | - static_assert(GoodForEncryption); 10 | - if constexpr (MultiRecord::Is) { 11 | - using Head = Record; 12 | - using Part = typename Record::Part; 13 | - static_assert(GoodForEncryption); 14 | - Assert(settings.readBlockSize 15 | - >= (sizeof(Head) 16 | - + settings.maxBundledRecords * sizeof(Part))); 17 | - } else { 18 | - Assert(settings.readBlockSize >= sizeof(Record)); 19 | - } 20 | + 21 | } 22 | 23 | template 24 | @@ -153,7 +143,7 @@ inline size_type BinlogReaderRecursive::ReadRecordSize( 25 | } 26 | if constexpr (MultiRecord::Is) { 27 | using Head = Record; 28 | - using Part = typename Record::Part; 29 | + // using Part = typename Record::Part; 30 | 31 | if (data.size() < sizeof(Head)) { 32 | return kRecordSizeUnknown; 33 | @@ -161,7 +151,7 @@ inline size_type BinlogReaderRecursive::ReadRecordSize( 34 | const auto head = reinterpret_cast(data.data()); 35 | const auto count = head->validateCount(); 36 | return (count >= 0 && count <= partsLimit) 37 | - ? (sizeof(Head) + count * sizeof(Part)) 38 | + ? (sizeof(Head) + count * 16) 39 | : kRecordSizeInvalid; 40 | } else { 41 | return sizeof(Record); 42 | -------------------------------------------------------------------------------- /auto-build/windows/variant.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/mapbox/variant.hpp b/include/mapbox/variant.hpp 2 | index fb1b609..508434d 100644 3 | --- a/include/mapbox/variant.hpp 4 | +++ b/include/mapbox/variant.hpp 5 | @@ -180,7 +180,7 @@ struct enable_if_type 6 | template 7 | struct result_of_unary_visit 8 | { 9 | - using type = typename std::result_of::type; 10 | + using type = typename std::invoke_result::type; 11 | }; 12 | 13 | template 14 | @@ -192,7 +192,7 @@ struct result_of_unary_visit 16 | struct result_of_binary_visit 17 | { 18 | - using type = typename std::result_of::type; 19 | + using type = typename std::invoke_result::type; 20 | }; 21 | 22 | template 23 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | 0.9.8 (30.04.20) 2 | 3 | - Copy wallet address to clipboard on click. 4 | - Support restricted wallets. 5 | 6 | 0.9.7 (11.04.20) 7 | 8 | - Update blockchain library. 9 | 10 | 0.9.6 (07.04.20) 11 | 12 | - Use encrypted transaction comments. 13 | 14 | 0.9.5 (24.03.20) 15 | 16 | - Update config for testnet2 in tonlib. 17 | 18 | 0.9.4 (15.11.19) 19 | 20 | - State explicitly that addresses are for Test Grams only. 21 | - Fix crash when sending 0 grams. 22 | - Migrate to testnet2. 23 | 24 | 0.9.3 (04.11.19) 25 | 26 | - Allow resizing the main window. 27 | - Bug fixes. 28 | 29 | 0.9.2 (01.11.19) 30 | 31 | - Floating dates in transaction history. 32 | - Bug fixes. 33 | 34 | 0.9.1 (31.10.19) 35 | 36 | - Initial release. 37 | -------------------------------------------------------------------------------- /docs/building-cmake.md: -------------------------------------------------------------------------------- 1 | ## Build instructions for GYP/CMake under Ubuntu 18.04 2 | 3 | Please refer to auto-build script [compile.sh](../auto-build/ubuntu-18.04/compile.sh). 4 | 5 | For future references we left below the original instructions from ton-blockchain repository for Ubuntu 14.04. 6 | 7 | ## Build instructions for GYP/CMake under Ubuntu 14.04 8 | 9 | ### Prepare folder 10 | 11 | Choose an empty folder for the future build, for example **/home/user/Projects**. It will be named ***BuildPath*** in the rest of this document. 12 | 13 | ### Install software and required packages 14 | 15 | You will need GCC 8 installed. To install them and all the required dependencies run 16 | 17 | sudo apt-get install software-properties-common -y && \ 18 | sudo apt-get install git libexif-dev liblzma-dev libz-dev libssl-dev \ 19 | libgtk2.0-dev libice-dev libsm-dev libicu-dev libdrm-dev dh-autoreconf \ 20 | autoconf automake build-essential libxml2-dev libass-dev libfreetype6-dev \ 21 | libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev \ 22 | libvorbis-dev libenchant-dev libxcb1-dev libxcb-image0-dev libxcb-shm0-dev \ 23 | libxcb-xfixes0-dev libxcb-keysyms1-dev libxcb-icccm4-dev libatspi2.0-dev \ 24 | libxcb-render-util0-dev libxcb-util0-dev libxcb-xkb-dev libxrender-dev \ 25 | libasound-dev libpulse-dev libxcb-sync0-dev libxcb-randr0-dev libegl1-mesa-dev \ 26 | libx11-xcb-dev libffi-dev libncurses5-dev pkg-config texi2html bison yasm \ 27 | zlib1g-dev xutils-dev python-xcbgen chrpath gperf -y --force-yes && \ 28 | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ 29 | sudo apt-get update && \ 30 | sudo apt-get install gcc-8 g++-8 -y && \ 31 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 && \ 32 | sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60 && \ 33 | sudo update-alternatives --config gcc && \ 34 | sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test -y 35 | 36 | You can set the multithreaded make parameter by running 37 | 38 | MAKE_THREADS_CNT=-j8 39 | 40 | ### Clone source code and prepare libraries and cmake 41 | 42 | Go to ***BuildPath*** and run 43 | 44 | git clone --recursive https://github.com/ton-blockchain/wallet-desktop.git 45 | 46 | mkdir Libraries 47 | cd Libraries 48 | 49 | git clone https://github.com/Kitware/CMake cmake 50 | cd cmake 51 | git checkout v3.16.0 52 | ./bootstrap 53 | make $MAKE_THREADS_CNT 54 | sudo make install 55 | cd .. 56 | 57 | git clone https://github.com/desktop-app/patches.git 58 | cd patches 59 | git checkout 10aeaf6 60 | cd ../ 61 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 62 | 63 | git clone https://github.com/openssl/openssl openssl_1_1_1 64 | cd openssl_1_1_1 65 | git checkout OpenSSL_1_1_1-stable 66 | ./config --prefix=/usr/local/desktop-app/openssl-1.1.1 67 | make $MAKE_THREADS_CNT 68 | sudo make install 69 | cd .. 70 | 71 | git clone https://github.com/xkbcommon/libxkbcommon.git 72 | cd libxkbcommon 73 | git checkout xkbcommon-0.8.4 74 | ./autogen.sh --disable-x11 75 | make $MAKE_THREADS_CNT 76 | sudo make install 77 | cd .. 78 | 79 | git clone git://code.qt.io/qt/qt5.git qt_5_12_8 80 | cd qt_5_12_8 81 | perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg 82 | git checkout v5.12.8 83 | git submodule update qtbase 84 | git submodule update qtwayland 85 | git submodule update qtimageformats 86 | git submodule update qtsvg 87 | cd qtbase 88 | git apply ../../patches/qtbase_5_12_8.diff 89 | cd src/plugins/platforminputcontexts 90 | git clone https://github.com/desktop-app/fcitx.git 91 | git clone https://github.com/desktop-app/hime.git 92 | git clone https://github.com/desktop-app/nimf.git 93 | cd ../../../.. 94 | 95 | OPENSSL_DIR=/usr/local/desktop-app/openssl-1.1.1 96 | ./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \ 97 | -release \ 98 | -force-debug-info \ 99 | -opensource \ 100 | -confirm-license \ 101 | -qt-zlib \ 102 | -qt-libpng \ 103 | -qt-libjpeg \ 104 | -qt-harfbuzz \ 105 | -qt-pcre \ 106 | -qt-xcb \ 107 | -system-freetype \ 108 | -fontconfig \ 109 | -no-gtk \ 110 | -static \ 111 | -dbus-runtime \ 112 | -openssl-linked \ 113 | -I "$OPENSSL_DIR/include" OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a -ldl -lpthread" \ 114 | -nomake examples \ 115 | -nomake tests 116 | 117 | make $MAKE_THREADS_CNT 118 | sudo make install 119 | cd .. 120 | 121 | git clone https://chromium.googlesource.com/external/gyp 122 | cd gyp 123 | git checkout 9f2a7bb1 124 | git apply ../patches/gyp.diff 125 | cd .. 126 | 127 | git clone https://chromium.googlesource.com/breakpad/breakpad 128 | cd breakpad 129 | git checkout bc8fb886 130 | git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss 131 | cd src/third_party/lss 132 | git checkout a91633d1 133 | cd ../../.. 134 | ./configure 135 | make $MAKE_THREADS_CNT 136 | sudo make install 137 | cd src/tools 138 | ../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake 139 | cd ../../out/Default 140 | cmake . 141 | make $MAKE_THREADS_CNT dump_syms 142 | cd ../../.. 143 | 144 | git clone https://github.com/ton-blockchain/ton.git 145 | cd ton 146 | git checkout eecf05ca 147 | git submodule init 148 | git submodule update third-party/crc32c 149 | mkdir build-debug 150 | cd build-debug 151 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a -DTON_ARCH=`uname -m | sed --expression='s/_/-/g'` .. 152 | make $MAKE_THREADS_CNT tonlib 153 | cd .. 154 | mkdir build 155 | cd build 156 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=/usr/local/desktop-app/openssl-1.1.1/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/desktop-app/openssl-1.1.1/lib/libcrypto.a -DTON_ARCH=`uname -m | sed --expression='s/_/-/g'` -DCMAKE_BUILD_TYPE=Release .. 157 | make $MAKE_THREADS_CNT tonlib 158 | cd ../.. 159 | 160 | ### Building the project 161 | 162 | Go to ***BuildPath*/wallet-desktop/Wallet** and run 163 | 164 | ./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF 165 | 166 | To make Debug version go to ***BuildPath*/wallet-desktop/out/Debug** and run 167 | 168 | make $MAKE_THREADS_CNT 169 | 170 | To make Release version go to ***BuildPath*/wallet-desktop/out/Release** and run 171 | 172 | make $MAKE_THREADS_CNT 173 | 174 | You can debug your builds from Qt Creator, just open ***BuildPath*/wallet-desktop/CMakeLists.txt**, configure to a separate directory with correct options and launch with debug. 175 | -------------------------------------------------------------------------------- /docs/building-msvc.md: -------------------------------------------------------------------------------- 1 | # Build instructions for Visual Studio 2019 2 | 3 | - [Prepare folder](#prepare-folder) 4 | - [Install third party software](#install-third-party-software) 5 | - [Clone source code and prepare libraries](#clone-source-code-and-prepare-libraries) 6 | - [Build the project](#build-the-project) 7 | 8 | ## Automatic build 9 | You can try an auto-build script [compile.bat](../auto-build/windows10/compile.bat). 10 | Launch **x86 Native Tools Command Prompt for VS 2019.bat** console and execute compile.bat. 11 | 12 | ## Prepare folder 13 | 14 | Choose an empty folder for the future build, for example **D:\\Projects**. It will be named ***BuildPath*** in the rest of this document. Create two folders there, ***BuildPath*\\ThirdParty** and ***BuildPath*\\Libraries**. 15 | 16 | All commands (if not stated otherwise) will be launched from **x86 Native Tools Command Prompt for VS 2019.bat** (should be in **Start Menu > Visual Studio 2019** menu folder). Pay attention not to use any other Command Prompt. 17 | 18 | ## Install third party software 19 | 20 | * Download **Strawberry Perl** installer from [http://strawberryperl.com/](http://strawberryperl.com/) and install to ***BuildPath*\\ThirdParty\\Strawberry** 21 | * Download **NASM** installer from [http://www.nasm.us](http://www.nasm.us) and install to ***BuildPath*\\ThirdParty\\NASM** 22 | * Download **Yasm** executable from [http://yasm.tortall.net/Download.html](http://yasm.tortall.net/Download.html), rename to *yasm.exe* and put to ***BuildPath*\\ThirdParty\\yasm** 23 | * Download **jom** archive from [http://download.qt.io/official_releases/jom/jom.zip](http://download.qt.io/official_releases/jom/jom.zip) and unpack to ***BuildPath*\\ThirdParty\\jom** 24 | * Download **Python 2.7** installer from [https://www.python.org/downloads/](https://www.python.org/downloads/) and install to ***BuildPath*\\ThirdParty\\Python27** 25 | * Download **CMake** installer from [https://cmake.org/download/](https://cmake.org/download/) and install to ***BuildPath*\\ThirdParty\\cmake** 26 | * Download **Ninja** executable from [https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip](https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip) and unpack to ***BuildPath*\\ThirdParty\\Ninja** 27 | 28 | Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** and run 29 | 30 | cd ThirdParty 31 | git clone https://github.com/desktop-app/patches.git 32 | cd patches 33 | git checkout 10aeaf6 34 | cd ../ 35 | git clone https://chromium.googlesource.com/external/gyp 36 | cd gyp 37 | git checkout 9f2a7bb1 38 | git apply ../patches/gyp.diff 39 | cd ..\.. 40 | 41 | Add **GYP** and **Ninja** to your PATH: 42 | 43 | * Open **Control Panel** -> **System** -> **Advanced system settings** 44 | * Press **Environment Variables...** 45 | * Select **Path** 46 | * Press **Edit** 47 | * Add ***BuildPath*\\ThirdParty\\gyp** value 48 | * Add ***BuildPath*\\ThirdParty\\Ninja** value 49 | 50 | ## Clone source code and prepare libraries 51 | 52 | Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath*** and run 53 | 54 | SET PATH=%cd%\ThirdParty\Strawberry\perl\bin;%cd%\ThirdParty\Python27;%cd%\ThirdParty\NASM;%cd%\ThirdParty\jom;%cd%\ThirdParty\cmake\bin;%cd%\ThirdParty\yasm;%PATH% 55 | 56 | git clone --recursive https://github.com/newton-blockchain/wallet-desktop.git 57 | 58 | mkdir Libraries 59 | cd Libraries 60 | 61 | SET LibrariesPath=%cd% 62 | set GYP_MSVS_OVERRIDE_PATH=\Microsoft Visual Studio\2019\Professional 63 | 64 | git clone https://github.com/desktop-app/patches.git 65 | cd patches 66 | git checkout 10aeaf6 67 | cd .. 68 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 range-v3 69 | 70 | git clone https://github.com/openssl/openssl.git openssl_1_1_1 71 | cd openssl_1_1_1 72 | git checkout OpenSSL_1_1_1-stable 73 | perl Configure no-shared debug-VC-WIN32 74 | nmake 75 | mkdir out32.dbg 76 | move libcrypto.lib out32.dbg 77 | move libssl.lib out32.dbg 78 | move ossl_static.pdb out32.dbg\ossl_static 79 | nmake clean 80 | move out32.dbg\ossl_static out32.dbg\ossl_static.pdb 81 | perl Configure no-shared VC-WIN32 82 | nmake 83 | mkdir out32 84 | move libcrypto.lib out32 85 | move libssl.lib out32 86 | move ossl_static.pdb out32 87 | cd .. 88 | 89 | git clone https://github.com/desktop-app/zlib.git 90 | cd zlib\contrib\vstudio\vc14 91 | msbuild zlibstat.vcxproj /property:Configuration=Debug 92 | msbuild zlibstat.vcxproj /property:Configuration=ReleaseWithoutAsm 93 | cd ..\..\..\.. 94 | 95 | git clone https://github.com/desktop-app/lzma.git 96 | cd lzma\C\Util\LzmaLib 97 | msbuild LzmaLib.sln /property:Configuration=Debug 98 | msbuild LzmaLib.sln /property:Configuration=Release 99 | cd ..\..\..\.. 100 | 101 | git clone https://github.com/google/breakpad 102 | cd breakpad 103 | git checkout a1dbcdcb43 104 | git apply ../patches/breakpad.diff 105 | cd src 106 | git clone https://github.com/google/googletest testing 107 | cd client\windows 108 | gyp --no-circular-check breakpad_client.gyp --format=ninja 109 | cd ..\.. 110 | ninja -C out/Debug common crash_generation_client exception_handler 111 | ninja -C out/Release common crash_generation_client exception_handler 112 | cd tools\windows\dump_syms 113 | gyp dump_syms.gyp 114 | msbuild dump_syms.vcxproj /property:Configuration=Release 115 | # If above command fails with error "fatal error C1083: Cannot open include file: 'dia2.h': No such file or directory" 116 | # try to open dump_syms.vcxproj with Visual Studio 2019 and on start it will ask whether you want to Retarget Projects - click OK and reexecute the command. 117 | cd ..\..\..\..\.. 118 | 119 | git clone git://code.qt.io/qt/qt5.git qt_5_12_8 120 | cd qt_5_12_8 121 | perl init-repository --module-subset=qtbase,qtimageformats 122 | git checkout v5.12.8 123 | git submodule update --init qtbase 124 | git submodule update --init qtimageformats 125 | cd qtbase 126 | git apply ../../patches/qtbase_5_12_8.diff 127 | cd .. 128 | 129 | configure -prefix "%LibrariesPath%\Qt-5.12.8" -debug-and-release -force-debug-info -opensource -confirm-license -static -static-runtime -I "%LibrariesPath%\openssl_1_1_1\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%LibrariesPath%\openssl_1_1_1\out32.dbg\libssl.lib %LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" OPENSSL_LIBS_RELEASE="%LibrariesPath%\openssl_1_1_1\out32\libssl.lib %LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" -mp -nomake examples -nomake tests -platform win32-msvc 130 | 131 | jom -j4 132 | jom -j4 install 133 | cd .. 134 | 135 | git clone https://github.com/newton-blockchain/ton.git 136 | cd ton 137 | git submodule init 138 | git submodule update third-party/crc32c 139 | mkdir build-debug 140 | cd build-debug 141 | cmake -A Win32 -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%LibrariesPath%\openssl_1_1_1\include -DOPENSSL_CRYPTO_LIBRARY=%LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=%LibrariesPath%\zlib -DZLIB_LIBRARY=%LibrariesPath%\zlib\contrib\vstudio\vc14\x86\ZlibStatDebug\zlibstat.lib -DCMAKE_CXX_FLAGS_DEBUG="/DZLIB_WINAPI /DNDEBUG /MTd /Zi /Od /Ob0" -DCMAKE_C_FLAGS_DEBUG="/DNDEBUG /MTd /Zi /Od /Ob0" -DCMAKE_EXE_LINKER_FLAGS="/SAFESEH:NO Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" .. 142 | cmake --build . --target tonlib --config Debug 143 | cd .. 144 | mkdir build 145 | cd build 146 | cmake -A Win32 -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=%LibrariesPath%\openssl_1_1_1\include -DOPENSSL_CRYPTO_LIBRARY=%LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=%LibrariesPath%\zlib -DZLIB_LIBRARY=%LibrariesPath%\zlib\contrib\vstudio\vc14\x86\ZlibStatReleaseWithoutAsm\zlibstat.lib -DCMAKE_CXX_FLAGS_RELEASE="/DZLIB_WINAPI /MT /Ob2" -DCMAKE_C_FLAGS_RELEASE="/MT /Ob2" -DCMAKE_EXE_LINKER_FLAGS="/SAFESEH:NO Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" .. 147 | cmake --build . --target tonlib --config Release 148 | cd ../.. 149 | 150 | ## Build the project 151 | 152 | Go to ***BuildPath*\\wallet-desktop\\Wallet** and run 153 | 154 | configure.bat -D DESKTOP_APP_USE_PACKAGED=OFF 155 | 156 | * Open ***BuildPath*\\wallet-desktop\\out\\Wallet.sln** in Visual Studio 2019 157 | * Select Wallet project and press Build > Build Wallet (Debug and Release configurations) 158 | * The result Wallet.exe will be located in ***BuildPath*\\wallet-desktop\\out\\Debug** (and **Release**) 159 | -------------------------------------------------------------------------------- /docs/building-xcode.md: -------------------------------------------------------------------------------- 1 | ## Automatic build 2 | You can try an auto-build script for macOS 10.15 [compile.sh](../auto-build/macos-10.15/compile.sh). 3 | 4 | The latest compiled TON Wallet can also be downloaded from our [Git actions](https://github.com/newton-blockchain/wallet-desktop/actions/workflows/macos-wallet-compile.yml). 5 | Do not forget to apply following commands after you have extracted the artifact: 6 | ```console 7 | sudo chmod -R 777 Wallet.app 8 | sudo xattr -dr com.apple.quarantine Wallet.app 9 | ``` 10 | 11 | For future references we left below the original instructions from ton-blockchain repository for MacOS 10.1. 12 | 13 | ## Build instructions for Xcode 10.1 14 | 15 | ### Prepare folder 16 | 17 | Choose a folder for the future build, for example **/Users/user/Projects**. It will be named ***BuildPath*** in the rest of this document. All commands will be launched from Terminal. 18 | 19 | ### Download libraries 20 | 21 | Download [**xz-5.0.5**](http://tukaani.org/xz/xz-5.0.5.tar.gz) and unpack to ***BuildPath*/Libraries/macos/xz-5.0.5** 22 | 23 | ### Clone source code and prepare libraries 24 | 25 | Go to ***BuildPath*** and run 26 | 27 | MAKE_THREADS_CNT=-j8 28 | MACOSX_DEPLOYMENT_TARGET=10.12 29 | 30 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 31 | brew install automake cmake fdk-aac git lame libass libtool libvorbis libvpx ninja opus sdl shtool texi2html theora wget x264 xvid yasm pkg-config 32 | 33 | sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 34 | 35 | git clone --recursive https://github.com/ton-blockchain/wallet-desktop.git 36 | 37 | mkdir ThirdParty 38 | cd ThirdParty 39 | 40 | git clone https://github.com/desktop-app/patches.git 41 | cd patches 42 | git checkout 10aeaf6 43 | cd ../ 44 | git clone https://chromium.googlesource.com/external/gyp 45 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 46 | export PATH="$PWD/depot_tools:$PATH" 47 | cd gyp 48 | git checkout 9f2a7bb1 49 | git apply ../patches/gyp.diff 50 | ./setup.py build 51 | sudo ./setup.py install 52 | cd ../.. 53 | 54 | cd Libraries/macos 55 | LibrariesPath=`pwd` 56 | 57 | git clone https://github.com/desktop-app/patches.git 58 | cd patches 59 | git checkout 10aeaf6 60 | cd .. 61 | git clone --branch 0.10.0 https://github.com/ericniebler/range-v3 62 | 63 | cd xz-5.0.5 64 | CFLAGS="-mmacosx-version-min=10.12" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos 65 | make $MAKE_THREADS_CNT 66 | sudo make install 67 | cd .. 68 | 69 | git clone https://github.com/desktop-app/zlib.git 70 | cd zlib 71 | CFLAGS="-mmacosx-version-min=10.12 -Werror=unguarded-availability-new" LDFLAGS="-mmacosx-version-min=10.12" ./configure --prefix=/usr/local/macos 72 | make $MAKE_THREADS_CNT 73 | sudo make install 74 | cd .. 75 | 76 | git clone https://github.com/openssl/openssl openssl_1_1_1 77 | cd openssl_1_1_1 78 | git checkout OpenSSL_1_1_1-stable 79 | ./Configure --prefix=/usr/local/macos darwin64-x86_64-cc -static -mmacosx-version-min=10.12 80 | make build_libs $MAKE_THREADS_CNT 81 | cd .. 82 | 83 | git clone https://chromium.googlesource.com/crashpad/crashpad.git 84 | cd crashpad 85 | git checkout feb3aa3923 86 | git apply ../../patches/crashpad.diff 87 | cd third_party/mini_chromium 88 | git clone https://chromium.googlesource.com/chromium/mini_chromium 89 | cd mini_chromium 90 | git checkout 7c5b0c1ab4 91 | git apply ../../../../../patches/mini_chromium.diff 92 | cd ../../gtest 93 | git clone https://chromium.googlesource.com/external/github.com/google/googletest gtest 94 | cd gtest 95 | git checkout d62d6c6556 96 | cd ../../.. 97 | 98 | build/gyp_crashpad.py -Dmac_deployment_target=10.10 99 | ninja -C out/Debug 100 | ninja -C out/Release 101 | cd .. 102 | 103 | git clone git://code.qt.io/qt/qt5.git qt5_12_8 104 | cd qt5_12_8 105 | perl init-repository --module-subset=qtbase,qtimageformats 106 | git checkout v5.12.8 107 | git submodule update qtbase 108 | git submodule update qtimageformats 109 | cd qtbase 110 | git apply ../../patches/qtbase_5_12_8.diff 111 | cd .. 112 | 113 | ./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \ 114 | -debug-and-release \ 115 | -force-debug-info \ 116 | -opensource \ 117 | -confirm-license \ 118 | -static \ 119 | -opengl desktop \ 120 | -no-openssl \ 121 | -securetransport \ 122 | -nomake examples \ 123 | -nomake tests \ 124 | -platform macx-clang 125 | 126 | make $MAKE_THREADS_CNT 127 | sudo make install 128 | cd .. 129 | 130 | LibrariesPath=`pwd` 131 | 132 | git clone https://github.com/ton-blockchain/ton.git 133 | cd ton 134 | git checkout eecf05ca 135 | git submodule init 136 | git submodule update third-party/crc32c 137 | mkdir build-debug 138 | cd build-debug 139 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" .. 140 | make $MAKE_THREADS_CNT tonlib 141 | cd .. 142 | mkdir build 143 | cd build 144 | cmake -DTON_USE_ROCKSDB=OFF -DTON_USE_ABSEIL=OFF -DTON_ARCH= -DTON_ONLY_TONLIB=ON -DOPENSSL_FOUND=1 -DOPENSSL_INCLUDE_DIR=$LibrariesPath/openssl_1_1_1/include -DOPENSSL_CRYPTO_LIBRARY=$LibrariesPath/openssl_1_1_1/libcrypto.a -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIR=$LibrariesPath/zlib -DZLIB_LIBRARY=/usr/local/macos/lib/libz.a -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release .. 145 | make $MAKE_THREADS_CNT tonlib 146 | cd ../.. 147 | 148 | ### Building the project 149 | 150 | Go to ***BuildPath*/wallet-desktop/Wallet** and run 151 | 152 | ./configure.sh -D DESKTOP_APP_USE_PACKAGED=OFF 153 | 154 | Then launch Xcode, open ***BuildPath*/wallet-desktop/out/Wallet.xcodeproj** and build for Debug / Release. 155 | --------------------------------------------------------------------------------