diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..f59ec20aa --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/.github/workflows/automated_integration_test.yml b/.github/workflows/automated_integration_test.yml index 0869db8ea..539513111 100644 --- a/.github/workflows/automated_integration_test.yml +++ b/.github/workflows/automated_integration_test.yml @@ -223,6 +223,10 @@ jobs: echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart echo "const wowneroTestWalletReceiveAddress = '${{ secrets.WOWNERO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart echo "const moneroTestWalletBlockHeight = '${{ secrets.MONERO_TEST_WALLET_BLOCK_HEIGHT }}';" >> lib/.secrets.g.dart + # end of test secrets + echo "const chainflipApiKey = '${{ secrets.CHAINFLIP_API_KEY }}';" >> lib/.secrets.g.dart + echo "const chainflipAffiliateFee = '${{ secrets.CHAINFLIP_AFFILIATE_FEE }}';" >> lib/.secrets.g.dart + echo "const walletGroupSalt = '${{ secrets.WALLET_GROUP_SALT }}';" >> lib/.secrets.g.dart - name: Rename app run: | diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml index 25fb144e3..762144ac1 100644 --- a/.github/workflows/pr_test_build_android.yml +++ b/.github/workflows/pr_test_build_android.yml @@ -172,6 +172,8 @@ jobs: # end of test secrets echo "const chainflipApiKey = '${{ secrets.CHAINFLIP_API_KEY }}';" >> lib/.secrets.g.dart echo "const chainflipAffiliateFee = '${{ secrets.CHAINFLIP_AFFILIATE_FEE }}';" >> lib/.secrets.g.dart + echo "const kryptonimApiKey = '${{ secrets.KRYPTONIM_API_KEY }}';" >> lib/.secrets.g.dart + echo "const walletGroupSalt = '${{ secrets.WALLET_GROUP_SALT }}';" >> lib/.secrets.g.dart - name: prepare monero_c and cache run: | diff --git a/.github/workflows/pr_test_build_linux.yml b/.github/workflows/pr_test_build_linux.yml index a9d8085b6..c5cb26dd9 100644 --- a/.github/workflows/pr_test_build_linux.yml +++ b/.github/workflows/pr_test_build_linux.yml @@ -168,6 +168,8 @@ jobs: # end of test secrets echo "const chainflipApiKey = '${{ secrets.CHAINFLIP_API_KEY }}';" >> lib/.secrets.g.dart echo "const chainflipAffiliateFee = '${{ secrets.CHAINFLIP_AFFILIATE_FEE }}';" >> lib/.secrets.g.dart + echo "const kryptonimApiKey = '${{ secrets.KRYPTONIM_API_KEY }}';" >> lib/.secrets.g.dart + echo "const walletGroupSalt = '${{ secrets.WALLET_GROUP_SALT }}';" >> lib/.secrets.g.dart - name: prepare monero_c and cache run: | diff --git a/scripts/linux/Dockerfile.linux b/Dockerfile similarity index 62% rename from scripts/linux/Dockerfile.linux rename to Dockerfile index b41873cf5..dae174a61 100644 --- a/scripts/linux/Dockerfile.linux +++ b/Dockerfile @@ -1,83 +1,87 @@ # Usage: -# docker build . -f Dockerfile.linux -t ghcr.io/cake-tech/cake_wallet:main-linux +# docker build . -f Dockerfile -t ghcr.io/cake-tech/cake_wallet:main-linux # docker push ghcr.io/cake-tech/cake_wallet:main-linux -FROM --platform=linux/amd64 docker.io/debian:12 - -LABEL org.opencontainers.image.source=https://github.com/cake-tech/cake_wallet - -ENV GOLANG_VERSION=1.23.4 -# comes from https://developer.android.com/studio/#command-tools -ENV ANDROID_SDK_TOOLS_VERSION=11076708 -# https://developer.android.com/studio/releases/build-tools -ENV ANDROID_PLATFORM_VERSION=34 -ENV ANDROID_BUILD_TOOLS_VERSION=34.0.0 - -ENV FLUTTER_VERSION=3.24.0 - -# If we ever need to migrate the home directory... -RUN sed -i 's|^root:[^:]*:[^:]*:[^:]*:[^:]*:/root:|root:x:0:0:root:/root:|' /etc/passwd -# mkdir -p /root && rm -rf /root && cp -a /root /root -ENV HOME=/root # Heavily inspired by cirrusci images # https://github.com/cirruslabs/docker-images-android/blob/master/sdk/tools/Dockerfile # https://github.com/cirruslabs/docker-images-android/blob/master/sdk/34/Dockerfile # https://github.com/cirruslabs/docker-images-android/blob/master/sdk/34-ndk/Dockerfile # https://github.com/cirruslabs/docker-images-flutter/blob/master/sdk/Dockerfile +FROM --platform=linux/amd64 docker.io/debian:12 + +LABEL org.opencontainers.image.source=https://github.com/cake-tech/cake_wallet + +# Set necessary environment variables +# Set Go version to latest known-working version +ENV GOLANG_VERSION=1.23.4 + +# Pin Flutter version to latest known-working version +ENV FLUTTER_VERSION=3.24.4 + +# Pin Android Studio, platform, and build tools versions to latest known-working version +# Comes from https://developer.android.com/studio/#command-tools +ENV ANDROID_SDK_TOOLS_VERSION=11076708 +# Comes from https://developer.android.com/studio/releases/build-tools +ENV ANDROID_PLATFORM_VERSION=34 +ENV ANDROID_BUILD_TOOLS_VERSION=34.0.0 + +# If we ever need to migrate the home directory... +RUN sed -i 's|^root:[^:]*:[^:]*:[^:]*:[^:]*:/root:|root:x:0:0:root:/root:|' /etc/passwd +# mkdir -p /root && rm -rf /root && cp -a /root /root +ENV HOME=/root ENV ANDROID_HOME=/opt/android-sdk-linux \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 \ LANGUAGE=en_US:en +# Set Android SDK paths ENV ANDROID_SDK_ROOT=$ANDROID_HOME \ PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator +# Upgrade base image +RUN apt-get update \ + && apt-get upgrade -y + +# Install all build dependencies RUN set -o xtrace \ && cd /opt \ - && apt-get update \ - && apt-get upgrade -y \ - && apt-get install -y jq \ - && apt-get install -y default-jdk \ - && apt-get install -y sudo wget zip unzip git openssh-client curl bc software-properties-common build-essential ruby-full ruby-bundler libstdc++6 libpulse0 libglu1-mesa locales lcov libsqlite3-dev --no-install-recommends \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + # Core dependencies + bc build-essential curl default-jdk git jq lcov libglu1-mesa libpulse0 libsqlite3-dev libstdc++6 locales openssh-client ruby-bundler ruby-full software-properties-common sudo unzip wget zip \ # for x86 emulators - && apt-get install -y libxtst6 libnss3-dev libnspr4 libxss1 libatk-bridge2.0-0 libgtk-3-0 libgdk-pixbuf2.0-0 \ - && apt-get install -y -qq xxd \ - && apt-get install -y lftp \ - && apt-get install -qq -y sqlite3 libsqlite3-dev \ - # linux desktop dependencies - && apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev \ + libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libnss3-dev libsqlite3-dev libxtst6 libxss1 lftp sqlite3 xxd \ + # Linux desktop dependencies + clang cmake libgtk-3-dev ninja-build pkg-config \ # monero_c dependencies - && apt-get install -y ccache build-essential autoconf libtool gperf llvm \ + autoconf automake build-essential ccache gperf libtool llvm \ # extra stuff for KVM - && apt-get install -y udev qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils \ - # for linux tests - && apt-get install -y xvfb network-manager ffmpeg x11-utils \ - # for aarch64-linux-gnu - && apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ - && rm -rf /var/lib/apt/lists/* \ + bridge-utils libvirt-clients libvirt-daemon-system qemu-kvm udev \ + # Linux test dependencies + ffmpeg network-manager x11-utils xvfb psmisc \ + # aarch64-linux-gnu dependencies + g++-aarch64-linux-gnu gcc-aarch64-linux-gnu \ + && apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && sh -c 'echo "en_US.UTF-8 UTF-8" > /etc/locale.gen' \ && locale-gen \ && update-locale LANG=en_US.UTF-8 -# install nodejs for actions -RUN apt-get update && \ - apt-get install -y curl && \ - curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ - apt-get install -y nodejs && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz &&\ - rm -rf /usr/local/go &&\ - tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz +# Install nodejs for Github Actions +RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ + apt-get install -y --no-install-recommends nodejs && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# Install Go ENV PATH=${PATH}:/usr/local/go/bin:${HOME}/go/bin ENV GOROOT=/usr/local/go ENV GOPATH=${HOME}/go -RUN go install golang.org/x/mobile/cmd/gomobile@latest -RUN gomobile init +RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz &&\ + rm -rf /usr/local/go &&\ + tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz && \ + go install golang.org/x/mobile/cmd/gomobile@latest && \ + gomobile init +# Install Android SDK commandline tools and emulator RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip -O android-sdk-tools.zip \ && mkdir -p ${ANDROID_HOME}/cmdline-tools/ \ && unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}/cmdline-tools/ \ @@ -94,10 +98,10 @@ RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-${AN && git config --global user.email "czarek@cakewallet.com" \ && git config --global user.name "CakeWallet CI" -# emulator is not available on linux/arm64 (https://issuetracker.google.com/issues/227219818) +# Handle emulator not being available on linux/arm64 (https://issuetracker.google.com/issues/227219818) RUN if [ $(uname -m) == "x86_64" ]; then sdkmanager emulator ; fi -# Extra dependencies to not download them for cake wallet build +# Pre-install extra Android SDK dependencies in order to not have to download them for each build RUN yes | sdkmanager \ "platforms;android-$ANDROID_PLATFORM_VERSION" \ "build-tools;$ANDROID_BUILD_TOOLS_VERSION" \ @@ -107,26 +111,26 @@ RUN yes | sdkmanager \ "build-tools;33.0.0" \ "build-tools;35.0.0" +# Install extra NDK dependency for sp_scanner ENV ANDROID_NDK_VERSION=27.2.12479018 - -# Extra ndk dependency for sp_scanner RUN yes | sdkmanager "ndk;$ANDROID_NDK_VERSION" \ "ndk;27.0.12077973" -# https://github.com/ReactiveCircus/android-emulator-runner dependencies for tests +# Install dependencies for tests +# Comes from https://github.com/ReactiveCircus/android-emulator-runner RUN yes | sdkmanager "system-images;android-29;default;x86" \ "system-images;android-29;default;x86_64" \ "system-images;android-31;default;x86_64" \ "platforms;android-29" -# fake the KVM status so android emulator doesn't complain (that much) +# Fake the KVM status so the Android emulator doesn't complain (that much) RUN (addgroup kvm || true) && \ adduser root kvm && \ mkdir -p /etc/udev/rules.d/ && \ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | tee /etc/udev/rules.d/99-kvm4all.rules +# Install rustup, rust toolchains, and cargo-ndk ENV PATH=${HOME}/.cargo/bin:${PATH} - RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ cargo install cargo-ndk && \ for target in aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android x86_64-unknown-linux-gnu; \ @@ -134,17 +138,16 @@ RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ rustup target add --toolchain stable $target; \ done - +# Download and install Flutter ENV HOME=${HOME} ENV FLUTTER_HOME=${HOME}/sdks/flutter/${FLUTTER_VERSION} ENV FLUTTER_ROOT=$FLUTTER_HOME - ENV PATH=${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin -RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} - -RUN yes | flutter doctor --android-licenses \ +RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} \ + && yes | flutter doctor --android-licenses \ && flutter doctor \ && chown -R root:root ${FLUTTER_HOME} +# Download and pre-cache necessary Flutter artifacts to speed up builds RUN flutter precache diff --git a/assets/images/kryptonim_dark.png b/assets/images/kryptonim_dark.png new file mode 100644 index 000000000..646d550ba Binary files /dev/null and b/assets/images/kryptonim_dark.png differ diff --git a/assets/images/kryptonim_light.png b/assets/images/kryptonim_light.png new file mode 100644 index 000000000..85e64a3f2 Binary files /dev/null and b/assets/images/kryptonim_light.png differ diff --git a/assets/text/Monerocom_Release_Notes.txt b/assets/text/Monerocom_Release_Notes.txt index 011435baa..d1f91139b 100644 --- a/assets/text/Monerocom_Release_Notes.txt +++ b/assets/text/Monerocom_Release_Notes.txt @@ -1,3 +1,3 @@ -Ledger fixes -UI enhancements +UI/UX enhancements +Stability improvements Bug fixes \ No newline at end of file diff --git a/assets/text/Release_Notes.txt b/assets/text/Release_Notes.txt index ca69e0b98..d1f91139b 100644 --- a/assets/text/Release_Notes.txt +++ b/assets/text/Release_Notes.txt @@ -1,5 +1,3 @@ -Zano enhancements -Ethereum enhancements -Ledger fixes -UI enhancements +UI/UX enhancements +Stability improvements Bug fixes \ No newline at end of file diff --git a/build-guide-linux.md b/build-guide-linux.md deleted file mode 100644 index df5f0f601..000000000 --- a/build-guide-linux.md +++ /dev/null @@ -1,176 +0,0 @@ -# Building CakeWallet for Linux - -## Requirements and Setup - -The following are the system requirements to build CakeWallet for your Linux device. - -``` -Ubuntu >= 16.04 -Flutter 3.10.x -``` - -## Building CakeWallet on Linux - -These steps will help you configure and execute a build of CakeWallet from its source code. - -### 1. Installing Package Dependencies - -CakeWallet requires some packages to be installed on your build system. You may easily install them on your build system with the following command: - -`$ sudo apt install build-essential cmake pkg-config git curl autoconf libtool` - -> [!WARNING] -> -> ### Check gcc version -> -> It is needed to use gcc 10 or 9 to successfully link dependencies with flutter.\ -> To check what gcc version you are using: -> -> ```bash -> $ gcc --version -> $ g++ --version -> ``` -> -> If you are using gcc version newer than 10, then you need to downgrade to version 10.4.0: -> -> ```bash -> $ sudo apt install gcc-10 g++-10 -> $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 -> $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 -> ``` - -> [!NOTE] -> -> Alternatively, you can use the [nix-shell](https://nixos.org/) with the `gcc10.nix` file\ -> present on `scripts/linux` like so: -> ```bash -> $ nix-shell gcc10.nix -> ``` -> This will get you in a nix environment with all the required dependencies that you can use to build the software from,\ -> and it works in any linux distro. - -### 2. Installing Flutter - -Need to install flutter. For this please check section [How to install flutter on Linux](https://docs.flutter.dev/get-started/install/linux). - -### 3. Verify Installations - -Verify that the Flutter has been correctly installed on your system with the following command: - -`$ flutter doctor` - -The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. - -``` -Doctor summary (to see all details, run flutter doctor -v): -[✓] Flutter (Channel stable, 3.10.x, on Linux, locale en_US.UTF-8) -``` - -### 4. Acquiring the CakeWallet Source Code - -Download CakeWallet source code - -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch linux/password-direct-input` - -Proceed into the source code before proceeding with the next steps: - -`$ cd cake_wallet/scripts/linux/` - -To configure some project properties run: - -`$ ./cakewallet.sh` - -Build the Monero libraries and their dependencies: - -`$ ./build_all.sh` - -Now the dependencies need to be copied into the CakeWallet project with this command: - -`$ ./setup.sh` - -It is now time to change back to the base directory of the CakeWallet source code: - -`$ cd ../../` - -Install Flutter package dependencies with this command: - -`$ flutter pub get` - -> #### If you will get an error like: -> -> ``` -> The plugin `cw_shared_external` requires your app to be migrated to the Android embedding v2. Follow the steps on the migration doc above and re-run -> this command. -> ``` -> -> Then need to config Android project settings. For this open `scripts/android` (`$ cd scripts/android`) directory and run followed commands: -> -> ``` -> $ source ./app_env.sh cakewallet -> $ ./app_config.sh -> $ cd ../.. -> ``` -> -> Then re-configure Linux project again. For this open `scripts/linux` (`$cd scripts/linux`) directory and run: -> `$ ./cakewallet.sh` -> and back to project root directory: -> `$ cd ../..` -> and fetch dependencies again -> `$ flutter pub get` - -Your CakeWallet binary will be built with some specific keys for iterate with 3rd party services. You may generate these secret keys placeholders with the following command: - -`$ dart run tool/generate_new_secrets.dart` - -We will generate mobx models for the project. - -`$ ./model_generator.sh` - -Then we need to generate localization files. - -`$ dart run tool/generate_localization.dart` - -### 5. Build! - -`$ flutter build linux --release` - -Path to executable file will be: - -`build/linux/x64/release/bundle/cake_wallet` - -> ### Troubleshooting -> -> If you got an error while building the application with `$ flutter build linux --release` command, add `-v` argument to the command (`$ flutter build linux -v --release`) to get details.\ -> If you got in flutter build logs: undefined reference to `hid_free_enumeration`, or another error with undefined reference to `hid_*`, then rebuild monero lib without hidapi lib. Check does exists `libhidapi-dev` in your scope and remove it from your scope for build without it. - -# Flatpak - -For package the built application into flatpak you need firstly to install `flatpak` and `flatpak-builder`: - -`$ sudo apt install flatpak flatpak-builder` - -Then need to [add flathub](https://flatpak.org/setup/Ubuntu) (or just `$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo`). Then need to install freedesktop runtime and sdk: - -`$ flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08` - -To build with using of `flatpak-build` directory run next: - -`$ flatpak-builder --force-clean flatpak-build com.cakewallet.CakeWallet.yml` - -And then export bundle: - -`$ flatpak build-export export flatpak-build` - -`$ flatpak build-bundle export cake_wallet.flatpak com.cakewallet.CakeWallet` - -Result file: `cake_wallet.flatpak` should be generated in the current directory. - -For install generated flatpak file use: - -`$ flatpak --user install cake_wallet.flatpak` - -For run the installed application run: - -`$ flatpak run com.cakewallet.CakeWallet` - -Copyright (c) 2023 Cake Technologies LLC. diff --git a/build-guide-win.md b/build-guide-win.md deleted file mode 100644 index 8cfd02c4c..000000000 --- a/build-guide-win.md +++ /dev/null @@ -1,38 +0,0 @@ -# Building CakeWallet for Windows - -## Requirements and Setup - -The following are the system requirements to build CakeWallet for your Windows PC. - -``` -Windows 10 or later (64-bit), x86-64 based -Flutter 3 or above -``` - -## Building CakeWallet on Windows - -These steps will help you configure and execute a build of CakeWallet from its source code. - -### 1. Installing Package Dependencies - -For build CakeWallet windows application from sources you will be needed to have: -> [Install Flutter]Follow installation guide (https://docs.flutter.dev/get-started/install/windows) and install do not miss to dev tools (install https://docs.flutter.dev/get-started/install/windows/desktop#development-tools) which are required for windows desktop development (need to install Git for Windows and Visual Studio 2022). Then install `Desktop development with C++` packages via GUI Visual Studio 2022, or Visual Studio Build Tools 2022 including: `C++ Build Tools core features`, `C++ 2022 Redistributable Update`, `C++ core desktop features`, `MVC v143 - VS 2022 C++ x64/x86 build tools`, `C++ CMake tools for Windows`, `Testing tools core features - Build Tools`, `C++ AddressSanitizer`. -> [Install WSL] for building monero dependencies need to install Windows WSL (https://learn.microsoft.com/en-us/windows/wsl/install) and required packages for WSL (Ubuntu): -`$ sudo apt update ` -`$ sudo apt build-essential cmake gcc-mingw-w64 g++-mingw-w64 autoconf libtool pkg-config` - -### 2. Pull CakeWallet source code - -You can download CakeWallet source code from our [GitHub repository](github.com/cake-tech/cake_wallet) via git by following next command: -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch MrCyjaneK-cyjan-monerodart` -OR you can download it as [Zip archive](https://github.com/cake-tech/cake_wallet/archive/refs/heads/MrCyjaneK-cyjan-monerodart.zip) - -### 3. Build Monero, Monero_c and their dependencies - -For use monero in the application need to build Monero wrapper - Monero_C which will be used by monero.dart package. For that need to run shell (bash - typically same named utility should be available after WSL is enabled in your system) with previously installed WSL, then change current directory to the application project directory with your used shell and then change current directory to `scripts/windows`: `$ cd scripts/windows`. Run build script: `$ ./build_all.sh`. - -### 4. Configure and build CakeWallet application - -To configure the application open directory where you have downloaded or unarchived CakeWallet sources and run `cakewallet.bat`. -Or if you used WSL and have active shell session you can run `$ ./cakewallet.sh` script in `scripts/windows` which will run `cakewallet.bat` in WSL. -After execution of `cakewallet.bat` you should to get `Cake Wallet.zip` in project root directory which will contains `CakeWallet.exe` file and another needed files for run the application. Now you can extract files from `Cake Wallet.zip` archive and run the application. diff --git a/cw_bitcoin/lib/bitcoin_wallet_creation_credentials.dart b/cw_bitcoin/lib/bitcoin_wallet_creation_credentials.dart index a1b1418b8..177d61e87 100644 --- a/cw_bitcoin/lib/bitcoin_wallet_creation_credentials.dart +++ b/cw_bitcoin/lib/bitcoin_wallet_creation_credentials.dart @@ -11,13 +11,11 @@ class BitcoinNewWalletCredentials extends WalletCredentials { String? derivationPath, String? passphrase, this.mnemonic, - String? parentAddress, }) : super( name: name, walletInfo: walletInfo, password: password, passphrase: passphrase, - parentAddress: parentAddress, ); final String? mnemonic; diff --git a/cw_bitcoin/lib/electrum_wallet.dart b/cw_bitcoin/lib/electrum_wallet.dart index db8c94d38..8b2cb41d5 100644 --- a/cw_bitcoin/lib/electrum_wallet.dart +++ b/cw_bitcoin/lib/electrum_wallet.dart @@ -646,8 +646,8 @@ abstract class ElectrumWalletBase }).toList(); final unconfirmedCoins = availableInputs.where((utx) => utx.confirmations == 0).toList(); - // sort the unconfirmed coins so that mweb coins are first: - availableInputs.sort((a, b) => a.bitcoinAddressRecord.type == SegwitAddresType.mweb ? -1 : 1); + // sort the unconfirmed coins so that mweb coins are last: + availableInputs.sort((a, b) => a.bitcoinAddressRecord.type == SegwitAddresType.mweb ? 1 : -1); for (int i = 0; i < availableInputs.length; i++) { final utx = availableInputs[i]; diff --git a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet_creation_credentials.dart b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet_creation_credentials.dart index af93cdbf8..90004a485 100644 --- a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet_creation_credentials.dart +++ b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet_creation_credentials.dart @@ -8,13 +8,11 @@ class BitcoinCashNewWalletCredentials extends WalletCredentials { String? password, String? passphrase, this.mnemonic, - String? parentAddress, }) : super( name: name, walletInfo: walletInfo, password: password, passphrase: passphrase, - parentAddress: parentAddress ); final String? mnemonic; } diff --git a/cw_core/lib/wallet_credentials.dart b/cw_core/lib/wallet_credentials.dart index 55c24bf37..30ae2546c 100644 --- a/cw_core/lib/wallet_credentials.dart +++ b/cw_core/lib/wallet_credentials.dart @@ -10,7 +10,6 @@ abstract class WalletCredentials { this.passphrase, this.derivationInfo, this.hardwareWalletType, - this.parentAddress, }) { if (this.walletInfo != null && derivationInfo != null) { this.walletInfo!.derivationInfo = derivationInfo; @@ -19,7 +18,6 @@ abstract class WalletCredentials { final String name; final int? height; - String? parentAddress; int? seedPhraseLength; String? password; String? passphrase; diff --git a/cw_core/lib/wallet_info.dart b/cw_core/lib/wallet_info.dart index bd035e30a..d62e61941 100644 --- a/cw_core/lib/wallet_info.dart +++ b/cw_core/lib/wallet_info.dart @@ -81,6 +81,8 @@ class WalletInfo extends HiveObject { this.derivationInfo, this.hardwareWalletType, this.parentAddress, + this.hashedWalletIdentifier, + this.isNonSeedWallet, ) : _yatLastUsedAddressController = StreamController<String>.broadcast(); factory WalletInfo.external({ @@ -99,6 +101,8 @@ class WalletInfo extends HiveObject { DerivationInfo? derivationInfo, HardwareWalletType? hardwareWalletType, String? parentAddress, + String? hashedWalletIdentifier, + bool? isNonSeedWallet, }) { return WalletInfo( id, @@ -116,6 +120,8 @@ class WalletInfo extends HiveObject { derivationInfo, hardwareWalletType, parentAddress, + hashedWalletIdentifier, + isNonSeedWallet ?? false, ); } @@ -196,8 +202,11 @@ class WalletInfo extends HiveObject { @HiveField(24) List<String>? manualAddresses; - + @HiveField(25) + String? hashedWalletIdentifier; + @HiveField(26, defaultValue: false) + bool isNonSeedWallet; String get yatLastUsedAddress => yatLastUsedAddressRaw ?? ''; diff --git a/cw_evm/lib/evm_chain_wallet_creation_credentials.dart b/cw_evm/lib/evm_chain_wallet_creation_credentials.dart index 5075e6289..d9595a243 100644 --- a/cw_evm/lib/evm_chain_wallet_creation_credentials.dart +++ b/cw_evm/lib/evm_chain_wallet_creation_credentials.dart @@ -7,7 +7,6 @@ class EVMChainNewWalletCredentials extends WalletCredentials { required super.name, super.walletInfo, super.password, - super.parentAddress, this.mnemonic, super.passphrase, }); diff --git a/cw_nano/lib/nano_wallet_creation_credentials.dart b/cw_nano/lib/nano_wallet_creation_credentials.dart index 59789aec7..8eb6dc2d2 100644 --- a/cw_nano/lib/nano_wallet_creation_credentials.dart +++ b/cw_nano/lib/nano_wallet_creation_credentials.dart @@ -8,13 +8,11 @@ class NanoNewWalletCredentials extends WalletCredentials { String? password, DerivationType? derivationType, this.mnemonic, - String? parentAddress, String? passphrase, }) : super( name: name, password: password, walletInfo: walletInfo, - parentAddress: parentAddress, passphrase: passphrase, ); diff --git a/cw_polygon/lib/polygon_wallet.dart b/cw_polygon/lib/polygon_wallet.dart index f9aff16c3..4db24b32a 100644 --- a/cw_polygon/lib/polygon_wallet.dart +++ b/cw_polygon/lib/polygon_wallet.dart @@ -121,7 +121,7 @@ class PolygonWallet extends EVMChainWallet { if (!hasKeysFile) rethrow; } - final balance = EVMChainERC20Balance.fromJSON(data?['balance'] as String) ?? + final balance = EVMChainERC20Balance.fromJSON(data?['balance'] as String?) ?? EVMChainERC20Balance(BigInt.zero); final WalletKeysData keysData; diff --git a/cw_solana/lib/solana_wallet.dart b/cw_solana/lib/solana_wallet.dart index da455649d..cbcf62feb 100644 --- a/cw_solana/lib/solana_wallet.dart +++ b/cw_solana/lib/solana_wallet.dart @@ -407,7 +407,7 @@ abstract class SolanaWalletBase if (!hasKeysFile) rethrow; } - final balance = SolanaBalance.fromJSON(data?['balance'] as String) ?? SolanaBalance(0.0); + final balance = SolanaBalance.fromJSON(data?['balance'] as String?) ?? SolanaBalance(0.0); final WalletKeysData keysData; // Migrate wallet from the old scheme to then new .keys file scheme diff --git a/cw_solana/lib/solana_wallet_creation_credentials.dart b/cw_solana/lib/solana_wallet_creation_credentials.dart index 121ef2b44..309c41cf3 100644 --- a/cw_solana/lib/solana_wallet_creation_credentials.dart +++ b/cw_solana/lib/solana_wallet_creation_credentials.dart @@ -6,14 +6,12 @@ class SolanaNewWalletCredentials extends WalletCredentials { required String name, WalletInfo? walletInfo, String? password, - String? parentAddress, this.mnemonic, String? passphrase, }) : super( name: name, walletInfo: walletInfo, password: password, - parentAddress: parentAddress, passphrase: passphrase, ); final String? mnemonic; diff --git a/cw_tron/lib/tron_wallet.dart b/cw_tron/lib/tron_wallet.dart index 92f169279..36da979e1 100644 --- a/cw_tron/lib/tron_wallet.dart +++ b/cw_tron/lib/tron_wallet.dart @@ -144,7 +144,7 @@ abstract class TronWalletBase if (!hasKeysFile) rethrow; } - final balance = TronBalance.fromJSON(data?['balance'] as String) ?? TronBalance(BigInt.zero); + final balance = TronBalance.fromJSON(data?['balance'] as String?) ?? TronBalance(BigInt.zero); final WalletKeysData keysData; // Migrate wallet from the old scheme to then new .keys file scheme diff --git a/cw_tron/lib/tron_wallet_creation_credentials.dart b/cw_tron/lib/tron_wallet_creation_credentials.dart index fd9066acd..402cff2ff 100644 --- a/cw_tron/lib/tron_wallet_creation_credentials.dart +++ b/cw_tron/lib/tron_wallet_creation_credentials.dart @@ -7,13 +7,11 @@ class TronNewWalletCredentials extends WalletCredentials { WalletInfo? walletInfo, String? password, this.mnemonic, - String? parentAddress, String? passphrase, }) : super( name: name, walletInfo: walletInfo, password: password, - parentAddress: parentAddress, passphrase: passphrase, ); diff --git a/how_to_add_new_wallet_type.md b/docs/NEW_WALLET_TYPES.md similarity index 100% rename from how_to_add_new_wallet_type.md rename to docs/NEW_WALLET_TYPES.md diff --git a/SECURITY.md b/docs/SECURITY.md similarity index 100% rename from SECURITY.md rename to docs/SECURITY.md diff --git a/docs/builds/ANDROID.md b/docs/builds/ANDROID.md new file mode 100644 index 000000000..61d04185e --- /dev/null +++ b/docs/builds/ANDROID.md @@ -0,0 +1,60 @@ +# Building Cake Wallet for Android + +## Requirements and Setup + +As we use Docker with a custom Dockerfile to build Cake Wallet, the only dependency for building Cake on your local host is the Docker Engine. + +You can find the latest instructions for installing Docker on your given OS on the official website: + +- <https://docs.docker.com/engine/install/> + +NOTE: If building on a Mac with an M-series CPU (arm64), you may encounter segmentation faults when building. If you do, simply retry the build. + +## Building Cake Wallet or Monero.com + +### Using the pre-built builder image + +In order to build the latest version of Cake Wallet, simply run the following: + +```bash +git clone --branch main https://github.com/cake-tech/cake_wallet.git +# NOTE: Replace `main` with the latest release tag available at https://github.com/cake-tech/cake_wallet/releases/latest. +cd cake_wallet +# docker build -t ghcr.io/cake-tech/cake_wallet:main-linux . # Uncomment to build the docker image yourself instead of pulling it from the registry +docker run -v$(pwd):$(pwd) -w $(pwd) -i --rm ghcr.io/cake-tech/cake_wallet:main-linux bash -x << EOF +set -x -e +pushd scripts/android + source ./app_env.sh cakewallet + # source ./app_env.sh monero.com # Uncomment this line to build monero.com + ./app_config.sh + ./build_monero_all.sh + ./build_mwebd.sh --dont-install +popd +pushd android/app + [[ -f key.jks ]] || keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass hunter1 -keypass hunter1 +popd +flutter clean +./model_generator.sh +dart run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=hunter1 keyPassword=hunter1 +dart run tool/generate_localization.dart +dart run tool/generate_new_secrets.dart +flutter build apk --release --split-per-abi +EOF +``` + +You should see the command complete with similar output: + +```bash +Running Gradle task 'assembleRelease'... 519.1s +✓ Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (56.3MB) +✓ Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (55.8MB) +✓ Built build/app/outputs/flutter-apk/app-x86_64-release.apk (56.4MB) +``` + +Final builds can be found in `build/app/outputs/flutter-apk/` as seen above. + +## Signing builds + +While properly signing builds is outside of the scope of this guide (very few users want or need to run their own built APKs), to learn more about how to sign APKs you can check out the Zeus team's fantastic guide: + +- <https://github.com/ZeusLN/zeus/blob/master/docs/ReproducibleBuilds.md#signing-apks> diff --git a/docs/builds/IOS.md b/docs/builds/IOS.md new file mode 100644 index 000000000..dd75bfed7 --- /dev/null +++ b/docs/builds/IOS.md @@ -0,0 +1,143 @@ +# Building Cake Wallet for iOS + +## Requirements and Setup + +The following are the system requirements to build Cake Wallet for your iOS device. + +```txt +macOS 15.3.1 +Xcode 16.2 +Flutter 3.24.4 +``` + +NOTE: Newer versions of macOS and Xcode may also work, but have not been confirmed to work by the Cake team. + +### 1. Installing dependencies + +For installing dependency tools you can use brew [Install brew](https://brew.sh). + +You may easily install them on your build system with the following command: + +```zsh +brew install automake ccache cmake cocoapods go libtool pkgconfig xz +sudo softwareupdate --install-rosetta --agree-to-license +``` + +### 2. Installing Xcode + +Download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. + +Run the following to properly initialize Xcode: + +```zsh +sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer +sudo xcodebuild -runFirstLaunch +``` + +To enable iOS build support for Xcode, perform the following: + +1. Open Xcode +2. Navigate to settings +3. Open Components tab +4. Click "Get" next to iOS 18.2 (or any other version that is showing up as default) + +### 3. Installing Flutter + +Install Flutter, specifically version `3.24.4` by following the [official docs](https://docs.flutter.dev/get-started/install/macos/desktop?tab=download). + +NOTE: as `3.24.4` is not the latest version, you'll need to download it from <https://docs.flutter.dev/release/archive> instead of the link in the docs above. + +### 4. Installing Rust + +Install Rust from the [rustup.rs](https://rustup.rs/) website. + +```zsh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### 5. Verify Flutter and Xcode installation + +Verify that Flutter and Xcode have been correctly installed on your system with the following command: + +`flutter doctor` + +The output of this command should appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. + +```zsh +Doctor summary (to see all details, run flutter doctor -v): +[✓] Flutter (Channel stable, 3.24.4, on macOS 15.x.x) +[✓] Xcode - develop for iOS and macOS (Xcode 16.2) +``` + +### 6. Acquiring the Cake Wallet source code + +Download the latest release tag of Cake Wallet and enter the source code directory: + +```zsh +git clone https://github.com/cake-tech/cake_wallet.git --branch main +cd cake_wallet/scripts/ios/ +``` + +NOTE: Replace `main` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>. + +### 7. Setup and build Cake Wallet from source + +We need to generate project settings like app name, app icon, package name, etc, including what specific variant of the app we want to build. + +To build Cake Wallet from source, run the following: + +```zsh +source ./app_env.sh cakewallet +``` + +For Monero.com, instead do: + +```zsh +source ./app_env.sh monero.com +``` + +Build the necessary libraries and their dependencies: + +```zsh +./build_monero_all.sh +./build_mwebd.sh +``` + +NOTE: This step will take quite a while, so be sure you grab a cup of coffee or a good book! + +Then run the configuration script to setup app name, app icon, etc: + +```zsh +./app_config.sh +``` + +### 8. Prepare Flutter + +Change back to the root directory of the Cake Wallet source code and install Flutter package dependencies: + +```zsh +cd ../../ +flutter pub get +``` + +Generate secrets as placeholders for official API keys etc. along with localization files and mobx models: + +```zsh +dart run tool/generate_new_secrets.dart +dart run tool/generate_localization.dart +./model_generator.sh +``` + +### 9. Build + +```zsh +flutter build ios --release --no-codesign +``` + +Then you can open `ios/Runner.xcworkspace` with Xcode to archive the application. + +If you want to run on a connected device, simply run: + +```zsh +flutter run +``` diff --git a/docs/builds/LINUX.md b/docs/builds/LINUX.md new file mode 100644 index 000000000..cd8466e6d --- /dev/null +++ b/docs/builds/LINUX.md @@ -0,0 +1,96 @@ +# Building Cake Wallet for Linux + +## Requirements and Setup + +As we use Docker with a custom Dockerfile to build Cake Wallet, the only dependency for building Cake on your local host is the Docker Engine. + +You can find the latest instructions for installing Docker on your given OS on the official website: + +- <https://docs.docker.com/engine/install/> + +NOTE: If building on a Mac with an M-series CPU (arm64), you may encounter segmentation faults when building. If you do, simply retry the build. + +## Building Cake Wallet or Monero.com + +### Using the pre-built builder image + +In order to build the latest version of Cake Wallet, simply run the following: + +```bash +git clone --branch main https://github.com/cake-tech/cake_wallet.git +# NOTE: Replace `main` with the latest release tag available at https://github.com/cake-tech/cake_wallet/releases/latest. +cd cake_wallet +# docker build -t ghcr.io/cake-tech/cake_wallet:main-linux . # Uncomment to build the docker image yourself instead of pulling it from the registry +docker run -v$(pwd):$(pwd) -w $(pwd) -i --rm ghcr.io/cake-tech/cake_wallet:main-linux bash -x << EOF +set -x -e +pushd scripts + ./gen_android_manifest.sh +popd +pushd scripts/linux + source ./app_env.sh cakewallet + # source ./app_env.sh monero.com # Uncomment this line to build monero.com + ./app_config.sh + ./build_monero_all.sh +popd +flutter clean +./model_generator.sh +dart run tool/generate_localization.dart +dart run tool/generate_new_secrets.dart +flutter build linux +EOF +``` + +You should see the command complete with similar output: + +```bash ++ dart run tool/generate_localization.dart ++ dart run tool/generate_new_secrets.dart ++ flutter build linux + +Building Linux application... +✓ Built build/linux/x64/release/bundle/cake_wallet +``` + +Final builds can be found in `build/linux/x64/release/bundle/` as seen above. + + +## Flatpak (optional) + +To package the built binaries as a flatpak, you need first to install `flatpak` and `flatpak-builder`: + +```bash +sudo apt install flatpak flatpak-builder +``` + +Add the necessary Flathub: + +```bash +flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +``` + +Then need to install freedesktop runtime and sdk: + +```bash +flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08 +``` + +Next, build the flatpak bundle: + +```bash +flatpak-builder --force-clean flatpak-build com.cakewallet.CakeWallet.yml +``` + +And then export bundle: + +```bash +flatpak build-export export flatpak-build +flatpak build-bundle export cake_wallet.flatpak com.cakewallet.CakeWallet +``` + +The Flatpak file, `cake_wallet.flatpak`, should be generated in the current directory. + +To install the newly built Flatpak, run: + +```bash +flatpak --user install cake_wallet.flatpak +``` diff --git a/docs/builds/MACOS.md b/docs/builds/MACOS.md new file mode 100644 index 000000000..af3d8c1df --- /dev/null +++ b/docs/builds/MACOS.md @@ -0,0 +1,135 @@ +# Building Cake Wallet for macOS + +## Requirements and Setup + +The following are the system requirements to build Cake Wallet for your macOS device. + +```txt +macOS 15.3.1 +Xcode 16.2 +Flutter 3.24.4 +``` + +### 1. Installing dependencies + +For installing dependency tools you can use brew [Install brew](https://brew.sh). + +You may easily install them on your build system with the following command: + +```zsh +brew install autoconf automake binutils ccache cmake cocoapods go libtool pigz pkg-config +sudo softwareupdate --install-rosetta --agree-to-license +``` + +### 2. Installing Xcode + +Download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. + +Run the following to properly initialize Xcode: + +```zsh +sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer +sudo xcodebuild -runFirstLaunch +``` + +### 3. Installing Flutter + +Install Flutter, specifically version `3.24.4` by following the [official docs](https://docs.flutter.dev/get-started/install/macos/desktop?tab=download). + +NOTE: as `3.24.4` is not the latest version, you'll need to download it from <https://docs.flutter.dev/release/archive> instead of the link in the docs above. + +### 4. Installing Rust + +Install Rust from the [rustup.rs](https://rustup.rs/) website. + +```zsh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### 5. Verify Flutter and Xcode installation + +Verify that Flutter and Xcode have been correctly installed on your system with the following command: + +`flutter doctor` + +The output of this command should appear like this, indicating successful installations. If there are problems with your installation of Flutter or Xcode, they **must** be corrected before proceeding. + +```zsh +Doctor summary (to see all details, run flutter doctor -v): +[✓] Flutter (Channel stable, 3.24.4, on macOS 15.x.x) +... +[✓] Xcode - develop for iOS and macOS (Xcode 16.2) +... +``` + +### 6. Acquiring the Cake Wallet source code + +Download the latest release tag of Cake Wallet and enter the source code directory: + +```zsh +git clone https://github.com/cake-tech/cake_wallet.git --branch main +cd cake_wallet/scripts/macos/ +``` + +NOTE: Replace `main` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>. + +### 7. Setup and build Cake Wallet from source + +We need to generate project settings like app name, app icon, package name, etc, including what specific variant of the app we want to build. + +To build Cake Wallet from source, run the following: + +```zsh +source ./app_env.sh cakewallet +``` + +For Monero.com, instead do: + +```zsh +source ./app_env.sh monero.com +``` + +Build the necessary libraries and their dependencies: + +```zsh +./build_monero_all.sh +``` + +NOTE: This step will take quite a while, so be sure you grab a cup of coffee or a good book! + +Then run the configuration script to setup app name, app icon, etc: + +```zsh +./app_config.sh +``` + +### 8. Prepare Flutter + +Change back to the root directory of the Cake Wallet source code and install Flutter package dependencies: + +```zsh +cd ../../ +flutter pub get +``` + +Generate secrets as placeholders for official API keys etc. along with localization files and mobx models: + +```zsh +dart run tool/generate_new_secrets.dart +dart run tool/generate_localization.dart +./model_generator.sh +``` + +### 9. Build + +```zsh +flutter build macos --release +``` + +Then you can open `macos/Runner.xcworkspace` with Xcode to archive the application. + +If you want to run on a connected device, simply run: + +```zsh +flutter run +``` diff --git a/docs/builds/WINDOWS.md b/docs/builds/WINDOWS.md new file mode 100644 index 000000000..1b5d7a0e8 --- /dev/null +++ b/docs/builds/WINDOWS.md @@ -0,0 +1,92 @@ +# Building Cake Wallet for Windows + +## Requirements and Setup + +The following are the system requirements to build Cake Wallet for your Windows PC. + +```txt +Windows 10 or later (64-bit), x86-64 based +Flutter 3.24.4 +``` + +### 1. Installing Flutter + +Install Flutter, specifically version `3.24.4` by following the [official docs](https://docs.flutter.dev/get-started/install/windows). + +In order for Flutter to function, you'll also need to enable Developer Mode: + +Start Menu > search for "Run" > type `ms-settings:developers`, and turn on Developer Mode. + +NOTE: as `3.24.4` is not the latest version, you'll need to download it from <https://docs.flutter.dev/release/archive> instead of the link in the docs above. + +### 2. Install Development Tools + +Install Git for Windows and Visual Studio 2022: + +1. Follow the [Development Tools](https://docs.flutter.dev/get-started/install/windows/desktop#development-tools) installation instructions + 1. NOTE: Be sure to install the `Desktop Development with C++` workload in Visual Studio as outlined in the docs. +2. Add `git` to your path by going to Start Menu > search "environment" > Environment Variables > double-click Path > Add `C:\Program Files\Git\bin\` on a new line. + +Lastly, you'll need to install Nuget separately: + +1. Download the exe from <https://dist.nuget.org/win-x86-commandline/latest/nuget.exe> +2. Create a new directory, `C:\Program Files\Nuget\` +3. Move or copy the `nuget.exe` binary you just downloaded into the newly created directory above. +4. Add `nuget` to your path by going to Start Menu > search "environment" > Environment Variables > double-click Path > Add `C:\Program Files\Nuget\` on a new line. + +### 3. Installing WSL (Windows Subsystem for Linux) + +For building Monero dependencies, it is required to install Windows [WSL](https://learn.microsoft.com/en-us/windows/wsl) and required packages for WSL (Ubuntu). + +1. Open a Powershell window by going to the Start Menu and searching for "Powershell" +2. Install WSL with the command `wsl --install` +3. Install the necessary Ubuntu dependencies + +```powershell +wsl --install +wsl sudo apt update +wsl sudo apt install -y autoconf build-essential ccache cmake curl gcc gcc-mingw-w64-x86-64 git g++ g++-mingw-w64-x86-64 gperf lbzip2 libtool make pkg-config pigz +``` + +### 4. Installing Rust + +Install Rust and other Rust-related dependencies using [rustup.rs](https://rustup.rs/#) by running the following command: + +```bash +wsl curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### 5. Acquiring the Cake Wallet source code + +Download the latest release tag of Cake Wallet and enter the source code directory: + +```powershell +git clone https://github.com/cake-tech/cake_wallet.git --branch main +cd cake_wallet +``` + +NOTE: Replace `main` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>. + +### 6. Build Monero, monero_c, and dependencies + +To use Monero in Cake Wallet, you must build the Monero_C wrapper which will be used by monero.dart package. + +Run the following in a WSL terminal window (set the Git username and email as desired): + +```powershell +wsl +git config --global user.email "builds@cakewallet.com" +git config --global user.name "builds" +./build_all.sh +``` + +### 7. Configure and build Cake Wallet application + +To configure the application, run the following: + +```powershell +exit +.\cakewallet.bat +``` + +After running the script above, you should get `Cake Wallet.zip` in the project's root directory which will contain `CakeWallet.exe` and other needed files for running the application. Now you can extract files from `Cake Wallet.zip` archive and run the application. diff --git a/howto-build-android.md b/howto-build-android.md deleted file mode 100644 index 5afecfba3..000000000 --- a/howto-build-android.md +++ /dev/null @@ -1,149 +0,0 @@ -# Building Cake Wallet for Android - -## Requirements and Setup - -The following are the system requirements to build Cake Wallet for your Android device. - -``` -Ubuntu >= 20.04 -Android SDK 29 or higher (better to have the latest one 33) -Android NDK 17c -Flutter 3.24.4 -``` - -### 1. Installing Package Dependencies - -CakeWallet cannot be built without the following packages installed on your system. - -- curl - -- unzip - -- automake - -- build-essential - -- file - -- pkg-config - -- git - -- python - -- libtool - -- libtinfo5 - -- cmake - -- openjdk-8-jre-headless - -- clang - -You may easily install them on your build system with the following command: - -`$ sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless clang` - -### 2. Installing Android Studio and Android toolchain - -You may download and install the latest version of Android Studio [here](https://developer.android.com/studio#downloads). After installing, start Android Studio, and go through the "Setup Wizard." This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Cake Wallet. **Be sure you are installing SDK version 28 or later when stepping through the wizard** - -### 3. Installing Flutter - -Install Flutter with version `3.24.4`. For this please check section [Install Flutter manually](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually). - -### 4. Installing rustup - -Install rustup from the [rustup.rs](https://rustup.rs/) website. - -### 5. Verify Installations - -Verify that the Android toolchain, Flutter, and Android Studio have been correctly installed on your system with the following command: - -`$ flutter doctor` - -The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. -``` -Doctor summary (to see all details, run flutter doctor -v): -[✓] Flutter (Channel stable, 3.24.4, on Linux, locale en_US.UTF-8) -[✓] Android toolchain - develop for Android devices (Android SDK version 29 or higher) -[✓] Android Studio (version 4.0 or higher) -``` - -### 6. Generate a secure keystore for Android - -`$ keytool -genkey -v -keystore $HOME/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key` - -You will be prompted to create two passwords. First you will be prompted for the "store password", followed by a "key password" towards the end of the creation process. **TAKE NOTE OF THESE PASSWORDS!** You will need them in later steps. - -### 7. Acquiring the Cake Wallet Source Code - -Create the directory that will be use to store the Cake Wallet source... - -``` -$ sudo mkdir -p /opt/android -$ sudo chown $USER /opt/android -$ cd /opt/android -``` - -..and download the source code into that directory. - -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch main` - -Proceed into the source code before proceeding with the next steps: - -`$ cd cake_wallet/scripts/android/` - -### 8. Installing Android NDK - -`$ ./install_ndk.sh` - -### 9. Execute Build & Setup Commands for Cak eWallet - -We need to generate project settings like app name, app icon, package name, etc. For this need to setup environment variables and configure project files. - -Please pick what app you want to build: cakewallet or monero.com. - -`$ source ./app_env.sh <cakewallet OR monero.com>` -(it should be like `$ source ./app_env.sh cakewallet` or `$ source ./app_env.sh monero.com`) - -Then run configuration script for setup app name, app icon and etc: - -`$ ./app_config.sh` - -Build the Monero libraries and their dependencies: - -`$ ./build_all.sh` - -It is now time to change back to the base directory of the Cake Wallet source code: - -`$ cd ../../` - -Install Flutter package dependencies with this command: - -`$ flutter pub get` - -Your Cake Wallet binary will be built with cryptographic salts, which are used for secure encryption of your data. You may generate these secret salts with the following command: - -`$ dart run tool/generate_new_secrets.dart` - -Next, we must generate key properties based on the secure keystore you generated for Android (in step 5). **MODIFY THE FOLLOWING COMMAND** with the "store password" and "key password" you assigned when creating your keystore (in step 5). - -`$ dart run tool/generate_android_key_properties.dart keyAlias=key storeFile=$HOME/key.jks storePassword=<store password> keyPassword=<key password>` - -**REMINDER:** The *above* command will **not** succeed unless you replaced the `storePassword` and `keyPassword` variables with the correct passwords for your keystore. - -Then we need to generate localization files. - -`$ dart run tool/generate_localization.dart` - -Finally build mobx models for the app: - -`$ ./model_generator.sh` - -### 10. Build! - -`$ flutter build apk --release` - -Copyright (c) 2024 Cake Labs LLC diff --git a/howto-build-ios.md b/howto-build-ios.md deleted file mode 100644 index 753e17e93..000000000 --- a/howto-build-ios.md +++ /dev/null @@ -1,101 +0,0 @@ -# Building Cake Wallet for iOS - -## Requirements and Setup - -The following are the system requirements to build Cake Wallet for your iOS device. - -``` -macOS >= 14.0 -Xcode 15.3 -Flutter 3.24.4 -``` - -### 1. Installing Package Dependencies - -Cake Wallet cannot be built without the following packages installed on your build system. - -For installing dependency tools you can use brew [Install brew](https://brew.sh). - -You may easily install them on your build system with the following command: - -`$ brew install cmake xz cocoapods` - -### 2. Installing Xcode - -You may download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. - -### 3. Installing Flutter - -Need to install flutter with version `3.24.4`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download). - -### 4. Installing rustup - -Install rustup from the [rustup.rs](https://rustup.rs/) website. - -### 5. Verify Installations - -Verify that the Flutter and Xcode have been correctly installed on your system with the following command: - -`$ flutter doctor` - -The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. -``` -Doctor summary (to see all details, run flutter doctor -v): -[✓] Flutter (Channel stable, 3.24.4, on macOS 14.x.x) -[✓] Xcode - develop for iOS and macOS (Xcode 15.3) -``` - -### 6. Acquiring the CakeWallet source code - -Download the source code. - -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch main` - -Proceed into the source code before proceeding with the next steps: - -`$ cd cake_wallet/scripts/ios/` - -### 7. Execute Build & Setup Commands for Cake Wallet - -We need to generate project settings like app name, app icon, package name, etc. For this, we need to setup environment variables and configure project files. - -Please pick what app you want to build: cakewallet or monero.com. - -`$ source ./app_env.sh <cakewallet OR monero.com>` -(it should be like `$ source ./app_env.sh cakewallet` or `$ source ./app_env.sh monero.com`) - -Then run configuration script for setup app name, app icon and etc: - -`$ ./app_config.sh` - -Build the Monero libraries and their dependencies: - -`$ ./build_monero_all.sh` - -It is now time to change back to the base directory of the Cake Wallet source code: - -`$ cd ../../` - -Install Flutter package dependencies with this command: - -`$ flutter pub get` - -Your Cake Wallet binary will be built with cryptographic salts, which are used for secure encryption of your data. You may generate these secret salts with the following command: - -`$ dart run tool/generate_new_secrets.dart` - -Then we need to generate localization files and mobx models. - -`$ ./configure_cake_wallet.sh ios` - -### 8. Build! - -`$ flutter build ios --release` - -Then you can open `ios/Runner.xcworkspace` with Xcode and you can archive the application. - -Or if you want to run to connected device: - -`$ flutter run --release` - -Copyright (c) 2024 Cake Labs LLC diff --git a/howto-build-macos.md b/howto-build-macos.md deleted file mode 100644 index a497e1ffa..000000000 --- a/howto-build-macos.md +++ /dev/null @@ -1,112 +0,0 @@ -# Building Cake Wallet for macOS - -## Requirements and Setup - -The following are the system requirements to build Cake Wallet for your macOS device. - -``` -macOS >= 14.0 -Xcode 15.3 -Flutter 3.24.4 -``` - -### 1. Installing Package Dependencies - -Cake Wallet cannot be built without the following packages installed on your build system. - -For installing dependency tools you can use brew [Install brew](https://brew.sh). - -You may easily install them on your build system with the following command: - -`$ brew install cmake xz automake autoconf libtool boost@1.76 zmq cocoapods` - -`$ brew link boost@1.76` - -### 2. Installing Xcode - -You may download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. - -### 3. Installing Flutter - -Need to install flutter with version `3.24.4`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/desktop?tab=download). - -### 4. Installing rustup - -Install rustup from the [rustup.rs](https://rustup.rs/) website. - -### 5. Verify Installations - -Verify that Flutter and Xcode have been correctly installed on your system with the following command: - -`$ flutter doctor` - -The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. -``` -Doctor summary (to see all details, run flutter doctor -v): -[✓] Flutter (Channel stable, 3.24.4, on macOS 14.x.x) -[✓] Xcode - develop for iOS and macOS (Xcode 15.3) -``` - -### 6. Acquiring the Cake Wallet source code - -Download the source code. - -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch main` - -Proceed into the source code before proceeding with the next steps: - -`$ cd cake_wallet/scripts/macos/` - -### 7. Execute Build & Setup Commands for Cake Wallet - -We need to generate project settings like app name, app icon, package name, etc. For this need to setup environment variables and configure project files. - -Please pick what app you want to build: cakewallet or monero.com. - -`$ source ./app_env.sh <cakewallet OR monero.com>` -(it should be like `$ source ./app_env.sh cakewallet` or `$ source ./app_env.sh monero.com`) - -Then run configuration script for setup app name, app icon and etc: - -`$ ./app_config.sh` - -Build the Monero libraries and their dependencies: - -`$ ./build_monero_all.sh` - -If you be needed to build universal monero lib, then it will require additional steps. Steps for build universal monero lib on mac with Apple Silicon (arm64): - -- Need to install Rosetta: `$ softwareupdate --install-rosetta` -- Need to install [Brew](https://brew.sh/) with rosetta: `$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` (or take another way to install brew, but be use that you have installed it into /usr/local as it's using for x86_64 macs) -- Install dependencies for build monero wallet lib for x86_64 with brew: `$ arch -x86_64 /usr/local/bin/brew install automake autoconf libtool openssl boost@1.76 zmq` and link installed boost@1.76 for x86_64 `$ arch -x86_64 /usr/local/bin/brew link boost@1.76` -- Run building script with additional argument: `$ ./build_monero_all.sh universal` - -If you will be needed to build monero wallet lib only for x86_64 on arm64 mac, then you need use steps above, but run build script with rosetta without arguments: `$ arch -x86_64 ./build_monero_all.sh`. - -It is now time to change back to the base directory of the Cake Wallet source code: - -`$ cd ../../` - -Install Flutter package dependencies with this command: - -`$ flutter pub get` - -Your Cake Wallet binary will be built with cryptographic salts, which are used for secure encryption of your data. You may generate these secret salts with the following command: - -`$ dart run tool/generate_new_secrets.dart` - -Then we need to generate localization files and mobx models. - -`$ ./configure_cake_wallet.sh macos` - -### 8. Build! - -`$ flutter build macos --release` - -Then you can open `macos/Runner.xcworkspace` with Xcode and you can to archive the application. - -Or if you want to run to connected device: - -`$ flutter run --release` - -Copyright (c) 2024 Cake Labs LLC diff --git a/howto-build-windows.md b/howto-build-windows.md deleted file mode 100644 index 3ebecaa61..000000000 --- a/howto-build-windows.md +++ /dev/null @@ -1,57 +0,0 @@ -# Building Cake Wallet for Windows - -## Requirements and Setup - -The following are the system requirements to build CakeWallet for your Windows PC. - -``` -Windows 10 or later (64-bit), x86-64 based -Flutter 3.24.4 -``` - -### 1. Installing Flutter - -Install Flutter with version `3.24.4`. Follow the Flutter [installation guide](https://docs.flutter.dev/get-started/install/windows). - -### 2. Install Development Tools - -Install Git for Windows and Visual Studio 2022. Follow the [Development Tools](https://docs.flutter.dev/get-started/install/windows/desktop#development-tools) installation instructions. - -Then install `Desktop development with C++` packages via Visual Studio 2022, or Visual Studio Build Tools 2022 including: -- `C++ Build Tools core features` -- `C++ 2022 Redistributable Update` -- `C++ core desktop features` -- `MVC v143 - VS 2022 C++ x64/x86 build tools` -- `C++ CMake tools for Windows` -- `Testing tools core features - Build Tools` -- `C++ AddressSanitizer`. - -### 3. Installing rustup - -Install rustup from the [rustup.rs](https://rustup.rs/#) website. Download and run the 64-bit rustup-init.exe - -### 4. Installing WSL (Windows Subsystem for Linux) - -For building monero dependencies, it is required to install Windows WSL (https://learn.microsoft.com/en-us/windows/wsl/install) and required packages for WSL (Ubuntu): -`$ sudo apt update ` -`$ sudo apt build-essential cmake gcc-mingw-w64 g++-mingw-w64 autoconf libtool pkg-config` - -### 5. Pull Cake Wallet source code - -You can download CakeWallet source code from our [GitHub repository](github.com/cake-tech/cake_wallet) via git: -`$ git clone https://github.com/cake-tech/cake_wallet.git --branch MrCyjaneK-cyjan-monerodart` -OR you can download it as [Zip archive](https://github.com/cake-tech/cake_wallet/archive/refs/heads/MrCyjaneK-cyjan-monerodart.zip) - -### 6. Build Monero, monero_c and their dependencies - -To use Monero in Cake Wallet, you must build the Monero_C wrapper which will be used by monero.dart package. - -For that you need to run the shell (bash - typically same named utility should be available after WSL is enabled in your system) with the previously installed WSL install, then change current directory to the application project directory with your shell then change current directory to `scripts/windows`: `$ cd scripts/windows`. Run build script: `$ ./build_all.sh`. - -### 7. Configure and build Cake Wallet application - -To configure the application, open the directory where you have downloaded or unarchived Cake Wallet sources and run `cakewallet.bat`. -Or if you used WSL and have active shell session you can run `$ ./cakewallet.sh` script in `scripts/windows` which will run `cakewallet.bat` in WSL. -After execution of `cakewallet.bat` you should to get `Cake Wallet.zip` in project root directory which will contain `CakeWallet.exe` file and another needed files for run the application. Now you can extract files from `Cake Wallet.zip` archive and run the application. - -Copyright (c) 2024 Cake Labs LLC. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9e2a8507a..120194ee0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -240,7 +240,7 @@ SPEC CHECKSUMS: connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d CryptoSwift: 967f37cea5a3294d9cce358f78861652155be483 cw_haven: b3e54e1fbe7b8e6fda57a93206bc38f8e89b898a - cw_mweb: 87af74f9659fed0c1a2cbfb44413f1070e79e3ae + cw_mweb: 22cd01dfb8ad2d39b15332006f22046aaa8352a3 cw_shared_external: 2972d872b8917603478117c9957dfca611845a92 device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 diff --git a/ios/Runner/InfoBase.plist b/ios/Runner/InfoBase.plist index 7860a25e2..03f0197e6 100644 --- a/ios/Runner/InfoBase.plist +++ b/ios/Runner/InfoBase.plist @@ -2,6 +2,8 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>CADisableMinimumFrameDurationOnPhone</key> + <true/> <key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDisplayName</key> diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index 6c65e4a63..04da1edc9 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -34,7 +34,6 @@ class CWBitcoin extends Bitcoin { String? password, String? passphrase, String? mnemonic, - String? parentAddress, }) => BitcoinNewWalletCredentials( name: name, @@ -42,7 +41,6 @@ class CWBitcoin extends Bitcoin { password: password, passphrase: passphrase, mnemonic: mnemonic, - parentAddress: parentAddress, ); @override diff --git a/lib/bitcoin_cash/cw_bitcoin_cash.dart b/lib/bitcoin_cash/cw_bitcoin_cash.dart index b74448703..be0323bfa 100644 --- a/lib/bitcoin_cash/cw_bitcoin_cash.dart +++ b/lib/bitcoin_cash/cw_bitcoin_cash.dart @@ -17,14 +17,12 @@ class CWBitcoinCash extends BitcoinCash { String? password, String? passphrase, String? mnemonic, - String? parentAddress, }) => BitcoinCashNewWalletCredentials( name: name, walletInfo: walletInfo, password: password, passphrase: passphrase, - parentAddress: parentAddress, mnemonic: mnemonic, ); diff --git a/lib/buy/buy_provider.dart b/lib/buy/buy_provider.dart index 8e79e16b8..ea2bcae8f 100644 --- a/lib/buy/buy_provider.dart +++ b/lib/buy/buy_provider.dart @@ -49,7 +49,7 @@ abstract class BuyProvider { throw UnimplementedError(); Future<List<PaymentMethod>> getAvailablePaymentTypes( - String fiatCurrency, String cryptoCurrency, bool isBuyAction) async => + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async => []; Future<List<Quote>?> fetchQuote( diff --git a/lib/buy/buy_quote.dart b/lib/buy/buy_quote.dart index 72ab7bd7d..1805b7e1a 100644 --- a/lib/buy/buy_quote.dart +++ b/lib/buy/buy_quote.dart @@ -16,7 +16,7 @@ extension RecommendationTitle on ProviderRecommendation { case ProviderRecommendation.lowKyc: return 'LOW KYC'; case ProviderRecommendation.successRate: - return 'SUCCESS RATE'; + return 'HIGHEST SUCCESS RATE'; } } } @@ -289,6 +289,29 @@ class Quote extends SelectableOption { ); } + factory Quote.fromKryptonimJson( + Map<String, dynamic> json, bool isBuyAction, PaymentType paymentType) { + final fees = json['fees'] as Map<String, dynamic>; + final rate = _toDouble(json['rate']) ?? 0.0; + final limits = json['limits'] as Map<String, dynamic>; + final minLimit = _toDouble(limits['min_amount']) ?? 0.0; + final maxLimit = _toDouble(limits['max_amount']) ?? double.infinity; + final convertedAmount = _toDouble(json['converted_amount']) ?? 0.0; + final amount = _toDouble(json['amount']) ?? 0.0; + final calculatedRate = amount / convertedAmount; + return Quote( + rate: calculatedRate, + feeAmount: _toDouble(fees['totalFee']) ?? 0.0, + networkFee: _toDouble(fees['network_fee']) ?? 0.0, + transactionFee: _toDouble(fees['operation_fee']) ?? 0.0, + payout: _toDouble(json['amount']) ?? 0.0, + paymentType: paymentType, + recommendations: [], + provider: ProvidersHelper.getProviderByType(ProviderType.kriptonim)!, + isBuyAction: isBuyAction, + limits: Limits(min: minLimit, max: maxLimit)); + } + static double? _toDouble(dynamic value) { if (value is int) { return value.toDouble(); @@ -299,4 +322,7 @@ class Quote extends SelectableOption { } return null; } + + @override + String toString() => 'Quote: rate: $rate, feeAmount: $feeAmount, networkFee: $networkFee, transactionFee: $transactionFee, payout: $payout, paymentType: $paymentType, provider: $provider, quoteId: $quoteId, recommendations: $recommendations, isBuyAction: $isBuyAction, rampId: $rampId, rampName: $rampName, rampIconPath: $rampIconPath, [limits: min: ${limits?.min}, max: ${limits?.max}]'; } diff --git a/lib/buy/dfx/dfx_buy_provider.dart b/lib/buy/dfx/dfx_buy_provider.dart index eba48632b..ac50665f0 100644 --- a/lib/buy/dfx/dfx_buy_provider.dart +++ b/lib/buy/dfx/dfx_buy_provider.dart @@ -168,7 +168,7 @@ class DFXBuyProvider extends BuyProvider { } Future<List<PaymentMethod>> getAvailablePaymentTypes( - String fiatCurrency, String cryptoCurrency, bool isBuyAction) async { + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { final List<PaymentMethod> paymentMethods = []; if (isBuyAction) { @@ -190,7 +190,7 @@ class DFXBuyProvider extends BuyProvider { }); } } else { - final assetCredentials = await fetchAssetCredential(cryptoCurrency); + final assetCredentials = await fetchAssetCredential(cryptoCurrency.title); if (assetCredentials.isNotEmpty) { if (assetCredentials['sellable'] == true) { final availablePaymentTypes = [ diff --git a/lib/buy/kryptonim/kryptonim.dart b/lib/buy/kryptonim/kryptonim.dart new file mode 100644 index 000000000..c439fa2f7 --- /dev/null +++ b/lib/buy/kryptonim/kryptonim.dart @@ -0,0 +1,222 @@ +import 'dart:convert'; + +import 'package:cake_wallet/.secrets.g.dart' as secrets; +import 'package:cake_wallet/buy/buy_provider.dart'; +import 'package:cake_wallet/buy/buy_quote.dart'; +import 'package:cake_wallet/buy/payment_method.dart'; +import 'package:cake_wallet/entities/fiat_currency.dart'; +import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; +import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:flutter/material.dart'; +import 'dart:developer'; +import 'package:http/http.dart' as http; +import 'package:url_launcher/url_launcher.dart'; + +class KryptonimBuyProvider extends BuyProvider { + KryptonimBuyProvider({required WalletBase wallet, bool isTestEnvironment = false}) + : super(wallet: wallet, isTestEnvironment: isTestEnvironment, ledgerVM: null); + + static const _isProduction = true; + + static const _baseUrl = _isProduction ? 'app.kryptonim.com' : 'intg-api.kryptonim.com'; + static const _baseWidgetUrl = _isProduction ? 'buy.kryptonim.com' : 'intg.kryptonim.com'; + static const _quotePath = '/v2/ramp/buy/quotes'; + static const _merchantId = 'a70fe053'; + + static String get _kryptonimApiKey => secrets.kryptonimApiKey; + + @override + String get title => 'Kryptonim'; + + @override + String get providerDescription => 'Kryptonim Buy Provider'; + + @override + String get lightIcon => 'assets/images/kryptonim_light.png'; + + @override + String get darkIcon => 'assets/images/kryptonim_dark.png'; + + @override + bool get isAggregator => false; + + Future<Map<String, dynamic>> getExchangeRates( + {required CryptoCurrency cryptoCurrency, + required String fiatCurrency, + required double amount}) async { + final url = Uri.https(_baseUrl, _quotePath, {'m': _merchantId}); + + final headers = { + 'accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': _kryptonimApiKey, + }; + + final body = jsonEncode({ + 'amount': amount, + 'currency': fiatCurrency, + 'converted_currency': cryptoCurrency.title, + 'blockchain': _normalizeBlockChain(cryptoCurrency), + 'quote_currency': fiatCurrency, + }); + + try { + final response = await http.post(url, headers: headers, body: body); + + if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 401) { + return jsonDecode(response.body) as Map<String, dynamic>; + } else { + return {}; + } + } catch (e) { + return {}; + } + } + + @override + Future<List<PaymentMethod>> getAvailablePaymentTypes( + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { + + final data = await getExchangeRates( + cryptoCurrency: cryptoCurrency, + fiatCurrency: fiatCurrency, + amount: 100.0, + ); + + if (data.isEmpty || !data.containsKey('data')) return []; + + final paymentMethods = (data['data'] as List<dynamic>) + .map((e) => PaymentMethod.fromKryptonimJson(e as Map<String, dynamic>)) + .toList(); + + return paymentMethods; + } + + @override + Future<List<Quote>?> fetchQuote({ + required CryptoCurrency cryptoCurrency, + required FiatCurrency fiatCurrency, + required double amount, + required bool isBuyAction, + required String walletAddress, + PaymentType? paymentType, + String? countryCode, + }) async { + log('Kryptonim: Fetching quote: ${isBuyAction ? cryptoCurrency : fiatCurrency} -> ${isBuyAction ? fiatCurrency : cryptoCurrency}, amount: $amount'); + + final data = await getExchangeRates( + cryptoCurrency: cryptoCurrency, + fiatCurrency: fiatCurrency.toString(), + amount: amount, + ); + + if (!data.containsKey('data') || (data['data'] as List).isEmpty) { + return null; + } + + final quotesList = data['data'] as List<dynamic>; + + Map<String, dynamic>? selectedPaymentMethod; + + if (paymentType == PaymentType.all || paymentType == null) { + selectedPaymentMethod = quotesList.first as Map<String, dynamic>; + } else { + for (var quote in quotesList) { + final quotePaymentType = PaymentMethod.getPaymentTypeId(quote['payment_method'] as String?); + if (quotePaymentType == paymentType) { + selectedPaymentMethod = quote as Map<String, dynamic>; + break; + } + } + } + + if (selectedPaymentMethod == null) { + return null; + } + + final selectedPaymentType = + PaymentMethod.getPaymentTypeId(selectedPaymentMethod['payment_method'] as String?); + final quote = Quote.fromKryptonimJson(selectedPaymentMethod, isBuyAction, selectedPaymentType); + + quote.setFiatCurrency = fiatCurrency; + quote.setCryptoCurrency = cryptoCurrency; + + return [quote]; + } + + @override + Future<void>? launchProvider( + {required BuildContext context, + required Quote quote, + required double amount, + required bool isBuyAction, + required String cryptoCurrencyAddress, + String? countryCode}) async { + final params = { + 'amount': amount.toInt().toString(), + 'currency': quote.fiatCurrency.name, + 'convertedCurrency': quote.cryptoCurrency.title, + 'blockchain': _normalizeBlockChain(quote.cryptoCurrency), + 'address': cryptoCurrencyAddress, + 'paymentMethod': normalizePaymentMethod(quote.paymentType), + }; + + final uri = Uri.https(_baseWidgetUrl, '/redirect-form', params); + + try { + if (await canLaunchUrl(uri)) { + await launchUrl(uri, mode: LaunchMode.externalApplication); + } else { + throw Exception('Could not launch URL'); + } + } catch (e) { + await showPopUp<void>( + context: context, + builder: (BuildContext context) { + return AlertWithOneAction( + alertTitle: "Kryptonim", + alertContent: "Payment provider is unavailable: $e", + buttonText: "OK", + buttonAction: () => Navigator.of(context).pop(), + ); + }, + ); + } + } + + String normalizePaymentMethod(PaymentType paymentType) { + switch (paymentType) { + case PaymentType.bankTransfer: + return 'bank'; + case PaymentType.creditCard: + case PaymentType.debitCard: + return 'card'; + default: + return paymentType.name.toLowerCase(); + } + } + + String _normalizeBlockChain(CryptoCurrency cur) { + String? blockchain = switch (cur.tag) { + 'ETH' => 'Ethereum', + 'POL' => 'Polygon', + 'AVAXC' => 'Avalanche', + 'SOL' => 'Solana', + _ => null, + }; + + if (blockchain == null) { + blockchain = switch (cur) { + CryptoCurrency.btc => 'Bitcoin', + CryptoCurrency.ltc => 'Litecoin', + CryptoCurrency.eth => 'Ethereum', + CryptoCurrency.maticpoly => 'Matic', + _ => null, + }; + } + + return blockchain ?? cur.fullName ?? ''; + } +} diff --git a/lib/buy/meld/meld_buy_provider.dart b/lib/buy/meld/meld_buy_provider.dart index a9759aab8..81ad35a40 100644 --- a/lib/buy/meld/meld_buy_provider.dart +++ b/lib/buy/meld/meld_buy_provider.dart @@ -53,7 +53,7 @@ class MeldBuyProvider extends BuyProvider { @override Future<List<PaymentMethod>> getAvailablePaymentTypes( - String fiatCurrency, String cryptoCurrency, bool isBuyAction) async { + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { final params = {'fiatCurrencies': fiatCurrency, 'statuses': 'LIVE,RECENTLY_ADDED,BUILDING'}; final path = '$_providersProperties$_paymentMethodsPath'; diff --git a/lib/buy/moonpay/moonpay_provider.dart b/lib/buy/moonpay/moonpay_provider.dart index 959d38a57..10148dd30 100644 --- a/lib/buy/moonpay/moonpay_provider.dart +++ b/lib/buy/moonpay/moonpay_provider.dart @@ -126,11 +126,12 @@ class MoonPayProvider extends BuyProvider { } Future<List<PaymentMethod>> getAvailablePaymentTypes( - String fiatCurrency, String cryptoCurrency, bool isBuyAction) async { + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { final List<PaymentMethod> paymentMethods = []; if (isBuyAction) { - final fiatBuyCredentials = await fetchFiatCredentials(fiatCurrency, cryptoCurrency, null); + final fiatBuyCredentials = + await fetchFiatCredentials(fiatCurrency, cryptoCurrency.title, null); if (fiatBuyCredentials.isNotEmpty) { final paymentMethod = fiatBuyCredentials['paymentMethod'] as String?; paymentMethods.add(PaymentMethod.fromMoonPayJson( @@ -168,8 +169,7 @@ class MoonPayProvider extends BuyProvider { final params = { 'baseCurrencyCode': baseCurrencyCode, - 'baseCurrencyAmount': amount.toString(), - 'amount': amount.toString(), + 'baseCurrencyAmount': amount.toStringAsFixed(2), 'paymentMethod': paymentMethod, 'areFeesIncluded': 'false', 'apiKey': _apiKey @@ -224,7 +224,6 @@ class MoonPayProvider extends BuyProvider { required bool isBuyAction, required String cryptoCurrencyAddress, String? countryCode}) async { - final Map<String, String> params = { 'theme': themeToMoonPayTheme(_settingsStore.currentTheme), 'language': _settingsStore.languageCode, @@ -232,7 +231,7 @@ class MoonPayProvider extends BuyProvider { ? '#${Palette.blueCraiola.value.toRadixString(16).substring(2, 8)}' : '#${Palette.moderateSlateBlue.value.toRadixString(16).substring(2, 8)}', 'baseCurrencyCode': isBuyAction ? quote.fiatCurrency.name : quote.cryptoCurrency.name, - 'baseCurrencyAmount': amount.toString(), + 'baseCurrencyAmount': amount.toStringAsFixed(2), 'walletAddress': cryptoCurrencyAddress, 'lockAmount': 'false', 'showAllCurrencies': 'false', @@ -247,19 +246,17 @@ class MoonPayProvider extends BuyProvider { if (!isBuyAction) params['quoteCurrencyCode'] = quote.cryptoCurrency.name; try { - { - final uri = await requestMoonPayUrl( - walletAddress: cryptoCurrencyAddress, - settingsStore: _settingsStore, - isBuyAction: isBuyAction, - amount: amount.toString(), - params: params); + final uri = await requestMoonPayUrl( + walletAddress: cryptoCurrencyAddress, + settingsStore: _settingsStore, + isBuyAction: isBuyAction, + amount: amount.toString(), + params: params); - if (await canLaunchUrl(uri)) { - await launchUrl(uri, mode: LaunchMode.externalApplication); - } else { - throw Exception('Could not launch URL'); - } + if (await canLaunchUrl(uri)) { + await launchUrl(uri, mode: LaunchMode.externalApplication); + } else { + throw Exception('Could not launch URL'); } } catch (e) { if (context.mounted) { diff --git a/lib/buy/onramper/onramper_buy_provider.dart b/lib/buy/onramper/onramper_buy_provider.dart index f229cb833..5480ab2cd 100644 --- a/lib/buy/onramper/onramper_buy_provider.dart +++ b/lib/buy/onramper/onramper_buy_provider.dart @@ -48,7 +48,7 @@ class OnRamperBuyProvider extends BuyProvider { bool get isAggregator => true; Future<List<PaymentMethod>> getAvailablePaymentTypes( - String fiatCurrency, String cryptoCurrency, bool isBuyAction) async { + String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { final params = { 'fiatCurrency': fiatCurrency, 'type': isBuyAction ? 'buy' : 'sell', diff --git a/lib/buy/payment_method.dart b/lib/buy/payment_method.dart index cf85c441b..14b119aa0 100644 --- a/lib/buy/payment_method.dart +++ b/lib/buy/payment_method.dart @@ -218,6 +218,15 @@ class PaymentMethod extends SelectableOption { customDescription: json['description'] as String?); } + factory PaymentMethod.fromKryptonimJson(Map<String, dynamic> json) { + final type = PaymentMethod.getPaymentTypeId(json['payment_method'] as String?); + return PaymentMethod( + paymentMethodType: type, + customTitle: json['payment_method'] as String? ?? 'Unknown', + customIconPath: 'assets/images/card.png', + ); + } + static PaymentType getPaymentTypeId(String? type) { switch (type?.toLowerCase()) { case 'banktransfer': diff --git a/lib/core/new_wallet_arguments.dart b/lib/core/new_wallet_arguments.dart index 2581c57bb..9e2ef9df4 100644 --- a/lib/core/new_wallet_arguments.dart +++ b/lib/core/new_wallet_arguments.dart @@ -3,12 +3,10 @@ import 'package:cw_core/wallet_type.dart'; class NewWalletArguments { final WalletType type; final String? mnemonic; - final String? parentAddress; final bool isChildWallet; NewWalletArguments({ required this.type, - this.parentAddress, this.mnemonic, this.isChildWallet = false, }); diff --git a/lib/di.dart b/lib/di.dart index f7bbb42d5..f3fbda2e6 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -258,6 +258,7 @@ import 'package:get_it/get_it.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'buy/kryptonim/kryptonim.dart'; import 'buy/meld/meld_buy_provider.dart'; import 'src/screens/buy/buy_sell_page.dart'; import 'cake_pay/cake_pay_payment_credantials.dart'; @@ -395,11 +396,10 @@ Future<void> setup({ getIt.registerFactory<NewWalletTypeViewModel>(() => NewWalletTypeViewModel(_walletInfoSource)); getIt.registerFactory<WalletManager>( - () { - final instance = WalletManager(_walletInfoSource, getIt.get<SharedPreferences>()); - instance.updateWalletGroups(); - return instance; - }, + () => WalletManager( + _walletInfoSource, + getIt.get<SharedPreferences>(), + ), ); getIt.registerFactoryParam<WalletGroupsDisplayViewModel, WalletType, void>( @@ -741,7 +741,7 @@ Future<void> setup({ getIt.get<ContactListViewModel>(), _transactionDescriptionBox, getIt.get<AppStore>().wallet!.isHardwareWallet ? getIt.get<LedgerViewModel>() : null, - coinTypeToSpendFrom: coinTypeToSpendFrom ?? UnspentCoinType.any, + coinTypeToSpendFrom: coinTypeToSpendFrom ?? UnspentCoinType.nonMweb, getIt.get<UnspentCoinsListViewModel>(param1: coinTypeToSpendFrom), ), ); @@ -805,7 +805,7 @@ Future<void> setup({ editingWallet: arguments.editingWallet, isWalletGroup: arguments.isWalletGroup, groupName: arguments.groupName, - parentAddress: arguments.parentAddress, + walletGroupKey: arguments.walletGroupKey, ), ); }); @@ -1018,6 +1018,10 @@ Future<void> setup({ wallet: getIt.get<AppStore>().wallet!, )); + getIt.registerFactory<KryptonimBuyProvider>(() => KryptonimBuyProvider( + wallet: getIt.get<AppStore>().wallet!, + )); + getIt.registerFactoryParam<WebViewPage, String, Uri>((title, uri) => WebViewPage(title, uri)); getIt.registerFactory(() => ExchangeViewModel( diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index a02b40d44..e57d71174 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -401,6 +401,13 @@ Future<void> defaultSettingsMigration( enabled: false, ); break; + case 48: + _changeExchangeProviderAvailability( + sharedPreferences, + providerName: "SwapTrade", + enabled: true, + ); + break; default: break; } diff --git a/lib/entities/hash_wallet_identifier.dart b/lib/entities/hash_wallet_identifier.dart new file mode 100644 index 000000000..8e593ec79 --- /dev/null +++ b/lib/entities/hash_wallet_identifier.dart @@ -0,0 +1,21 @@ +import 'dart:convert'; + +import 'package:cake_wallet/.secrets.g.dart' as secrets; +import 'package:cw_core/wallet_base.dart'; +import 'package:hashlib/hashlib.dart'; + +String createHashedWalletIdentifier(WalletBase wallet) { + if (wallet.seed == null) return ''; + + final salt = secrets.walletGroupSalt; + final combined = '$salt.${wallet.seed}'; + + // Convert to UTF-8 bytes. + final bytes = utf8.encode(combined); + + // Perform SHA-256 hash. + final digest = sha256.convert(bytes); + + // Return the hex string representation of the hash. + return digest.toString(); +} diff --git a/lib/entities/provider_types.dart b/lib/entities/provider_types.dart index c65ac267b..5888970b0 100644 --- a/lib/entities/provider_types.dart +++ b/lib/entities/provider_types.dart @@ -1,5 +1,6 @@ import 'package:cake_wallet/buy/buy_provider.dart'; import 'package:cake_wallet/buy/dfx/dfx_buy_provider.dart'; +import 'package:cake_wallet/buy/kryptonim/kryptonim.dart'; import 'package:cake_wallet/buy/meld/meld_buy_provider.dart'; import 'package:cake_wallet/buy/moonpay/moonpay_provider.dart'; import 'package:cake_wallet/buy/onramper/onramper_buy_provider.dart'; @@ -8,7 +9,7 @@ import 'package:cake_wallet/di.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:http/http.dart'; -enum ProviderType { robinhood, dfx, onramper, moonpay, meld } +enum ProviderType { robinhood, dfx, onramper, moonpay, meld, kriptonim } extension ProviderTypeName on ProviderType { String get title { @@ -23,6 +24,8 @@ extension ProviderTypeName on ProviderType { return 'MoonPay'; case ProviderType.meld: return 'Meld'; + case ProviderType.kriptonim: + return 'Kriptonim'; } } @@ -38,6 +41,8 @@ extension ProviderTypeName on ProviderType { return 'moonpay_provider'; case ProviderType.meld: return 'meld_provider'; + case ProviderType.kriptonim: + return 'kriptonim_provider'; } } } @@ -59,6 +64,7 @@ class ProvidersHelper { ProviderType.dfx, ProviderType.robinhood, ProviderType.moonpay, + ProviderType.kriptonim ]; case WalletType.litecoin: case WalletType.bitcoinCash: @@ -66,13 +72,15 @@ class ProvidersHelper { return [ ProviderType.onramper, ProviderType.robinhood, - ProviderType.moonpay + ProviderType.moonpay, + ProviderType.kriptonim ]; case WalletType.tron: return [ ProviderType.onramper, ProviderType.robinhood, ProviderType.moonpay, + ProviderType.kriptonim ]; case WalletType.none: case WalletType.haven: @@ -127,6 +135,8 @@ class ProvidersHelper { return getIt.get<MoonPayProvider>(); case ProviderType.meld: return getIt.get<MeldBuyProvider>(); + case ProviderType.kriptonim: + return getIt.get<KryptonimBuyProvider>(); default: return null; } diff --git a/lib/entities/wallet_edit_page_arguments.dart b/lib/entities/wallet_edit_page_arguments.dart index 260471f7e..6217195dc 100644 --- a/lib/entities/wallet_edit_page_arguments.dart +++ b/lib/entities/wallet_edit_page_arguments.dart @@ -10,7 +10,7 @@ class WalletEditPageArguments { this.isWalletGroup = false, this.walletListViewModel, this.groupName = '', - this.parentAddress = '', + this.walletGroupKey = '', this.walletEditViewModel, this.walletNewVM, this.authService, @@ -19,7 +19,7 @@ class WalletEditPageArguments { final WalletListItem editingWallet; final bool isWalletGroup; final String groupName; - final String parentAddress; + final String walletGroupKey; final WalletListViewModel? walletListViewModel; final WalletEditViewModel? walletEditViewModel; diff --git a/lib/entities/wallet_group.dart b/lib/entities/wallet_group.dart index 9845aea65..ab94f3eb3 100644 --- a/lib/entities/wallet_group.dart +++ b/lib/entities/wallet_group.dart @@ -1,13 +1,14 @@ import 'package:cw_core/wallet_info.dart'; class WalletGroup { - WalletGroup(this.parentAddress) : wallets = []; + WalletGroup(this.groupKey) : wallets = []; - /// Main identifier for each group, compulsory. - final String parentAddress; + /// Primary identifier for the group. Previously was `parentAddress`. + /// Now we store either the wallet's hash OR fallback to parentAddress/address. + final String groupKey; - /// Child wallets that share the same parent address within this group - List<WalletInfo> wallets; + /// Child wallets that share the same group key + final List<WalletInfo> wallets; /// Custom name for the group, editable for multi-child wallet groups String? groupName; diff --git a/lib/entities/wallet_manager.dart b/lib/entities/wallet_manager.dart index 29c873dae..8bcabcaf2 100644 --- a/lib/entities/wallet_manager.dart +++ b/lib/entities/wallet_manager.dart @@ -1,70 +1,61 @@ +import 'package:cake_wallet/entities/hash_wallet_identifier.dart'; import 'package:cake_wallet/entities/wallet_group.dart'; +import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:hive/hive.dart'; import 'package:shared_preferences/shared_preferences.dart'; class WalletManager { - WalletManager( - this._walletInfoSource, - this._sharedPreferences, - ); + WalletManager(this._walletInfoSource, this._sharedPreferences); final Box<WalletInfo> _walletInfoSource; final SharedPreferences _sharedPreferences; final List<WalletGroup> walletGroups = []; - /// Categorize wallets into groups based on their parentAddress. - /// - /// Update the lead wallet for each group and clean up empty groups - /// i.e remove group if there's no lead wallet (i.e, no wallets left) void updateWalletGroups() { walletGroups.clear(); - for (var walletInfo in _walletInfoSource.values) { - final group = _getOrCreateGroup(_resolveParentAddress(walletInfo)); + for (final walletInfo in _walletInfoSource.values) { + final groupKey = _resolveGroupKey(walletInfo); + final group = _getOrCreateGroup(groupKey); group.wallets.add(walletInfo); } - walletGroups.removeWhere((group) => group.wallets.isEmpty); - + walletGroups.removeWhere((g) => g.wallets.isEmpty); _loadCustomGroupNames(); } - /// Function to determine the correct parentAddress for a wallet. - /// - /// If it's a parent wallet (parentAddress is null), - /// use its own address as parentAddress. - String _resolveParentAddress(WalletInfo walletInfo) { + String _resolveGroupKey(WalletInfo walletInfo) { + if (walletInfo.hashedWalletIdentifier != null && + walletInfo.hashedWalletIdentifier!.isNotEmpty) { + return walletInfo.hashedWalletIdentifier!; + } + + // Fallback to old logic return walletInfo.parentAddress ?? walletInfo.address; } - /// Check if a group with the parentAddress already exists, - /// If no group exists, create a new one. - /// - WalletGroup _getOrCreateGroup(String parentAddress) { + WalletGroup _getOrCreateGroup(String groupKey) { return walletGroups.firstWhere( - (group) => group.parentAddress == parentAddress, + (g) => g.groupKey == groupKey, orElse: () { - final newGroup = WalletGroup(parentAddress); + final newGroup = WalletGroup(groupKey); walletGroups.add(newGroup); return newGroup; }, ); } - /// Add a new wallet and update lead wallet after adding. void addWallet(WalletInfo walletInfo) { - final group = _getOrCreateGroup(_resolveParentAddress(walletInfo)); + final groupKey = _resolveGroupKey(walletInfo); + final group = _getOrCreateGroup(groupKey); group.wallets.add(walletInfo); } - /// Removes a wallet from a group i.e when it's deleted. - /// - /// Update lead wallet after removing, - /// Remove the group if it's empty (i.e., no lead wallet). void removeWallet(WalletInfo walletInfo) { - final group = _getOrCreateGroup(_resolveParentAddress(walletInfo)); + final groupKey = _resolveGroupKey(walletInfo); + final group = _getOrCreateGroup(groupKey); group.wallets.remove(walletInfo); if (group.wallets.isEmpty) { @@ -72,39 +63,99 @@ class WalletManager { } } - /// Returns all the child wallets within a group. - /// - /// If the group is not found, returns an empty group with no wallets. - List<WalletInfo> getWalletsInGroup(String parentAddress) { + List<WalletInfo> getWalletsInGroup(String groupKey) { return walletGroups .firstWhere( - (group) => group.parentAddress == parentAddress, - orElse: () => WalletGroup(parentAddress), + (g) => g.groupKey == groupKey, + orElse: () => WalletGroup(groupKey), ) .wallets; } - /// Iterate through all groups and load their custom names from storage void _loadCustomGroupNames() { for (var group in walletGroups) { - final groupName = _sharedPreferences.getString('wallet_group_name_${group.parentAddress}'); + final key = 'wallet_group_name_${group.groupKey}'; + final groupName = _sharedPreferences.getString(key); if (groupName != null && group.wallets.length > 1) { - group.groupName = groupName; // Restore custom name + group.groupName = groupName; } } } - /// Save custom name for a group - void _saveCustomGroupName(String parentAddress, String name) { - _sharedPreferences.setString('wallet_group_name_$parentAddress', name); + void _saveCustomGroupName(String groupKey, String name) { + _sharedPreferences.setString('wallet_group_name_$groupKey', name); } - // Set custom group name and persist it - void setGroupName(String parentAddress, String name) { - if (parentAddress.isEmpty || name.isEmpty) return; + void setGroupName(String groupKey, String name) { + if (groupKey.isEmpty || name.isEmpty) return; - final group = walletGroups.firstWhere((group) => group.parentAddress == parentAddress); + final group = walletGroups.firstWhere((g) => g.groupKey == groupKey); group.setCustomName(name); - _saveCustomGroupName(parentAddress, name); // Persist the custom name + _saveCustomGroupName(groupKey, name); + } + + // --------------------------------------------------------------------------- + // This performs a Group-Based Lazy Migration: + // If the user opens a wallet in an old group, + // we migrate ALL wallets that share its old group key to a new hash. + // --------------------------------------------------------------------------- + + /// When a user opens a wallet, check if it has a real hash. + /// If not, migrate the ENTIRE old group so they keep the same group name + /// and end up with the same new hash (preserving grouping). + Future<void> ensureGroupHasHashedIdentifier(WalletBase openedWallet) async { + WalletInfo walletInfo = openedWallet.walletInfo; + + // If the openedWallet already has an hash, then there is nothing to do + if (walletInfo.hashedWalletIdentifier != null && + walletInfo.hashedWalletIdentifier!.isNotEmpty) { + updateWalletGroups(); // Still skeptical of calling this here. Looking for a better spot. + return; + } + + // Identify the old group key for this wallet + final oldGroupKey = _resolveGroupKey(walletInfo); // parentAddress fallback + + // Find all wallets that share this old group key (i.e the old group) + final oldGroupWallets = _walletInfoSource.values.where((w) { + final key = w.hashedWalletIdentifier != null && w.hashedWalletIdentifier!.isNotEmpty + ? w.hashedWalletIdentifier + : (w.parentAddress ?? w.address); + return key == oldGroupKey; + }).toList(); + + if (oldGroupWallets.isEmpty) { + // This shouldn't happen, but just in case it does, we return. + return; + } + + // Next, we determine the new group hash for these wallets + // Since they share the same seed, we can assign that group hash + // to all the wallets to preserve grouping. + final newGroupHash = createHashedWalletIdentifier(openedWallet); + + // Migrate the old group name from oldGroupKey(i.e parentAddress) to newGroupHash + await _migrateGroupName(oldGroupKey, newGroupHash); + + // Then we assign this new hash to each wallet in that old group and save them + for (final wallet in oldGroupWallets) { + wallet.hashedWalletIdentifier = newGroupHash; + await wallet.save(); + } + + // Finally, we rebuild the groups so that these wallets are now in the new group + updateWalletGroups(); + } + + /// Copy an old group name to the new group key, then remove the old key. + Future<void> _migrateGroupName(String oldGroupKey, String newGroupKey) async { + final oldNameKey = 'wallet_group_name_$oldGroupKey'; + final newNameKey = 'wallet_group_name_$newGroupKey'; + + final oldGroupName = _sharedPreferences.getString(oldNameKey); + if (oldGroupName != null) { + await _sharedPreferences.setString(newNameKey, oldGroupName); + await _sharedPreferences.remove(oldNameKey); + } } } diff --git a/lib/ethereum/cw_ethereum.dart b/lib/ethereum/cw_ethereum.dart index dc91e4fc2..40c7a0f77 100644 --- a/lib/ethereum/cw_ethereum.dart +++ b/lib/ethereum/cw_ethereum.dart @@ -11,7 +11,6 @@ class CWEthereum extends Ethereum { WalletCredentials createEthereumNewWalletCredentials({ required String name, String? mnemonic, - String? parentAddress, WalletInfo? walletInfo, String? password, String? passphrase, @@ -20,7 +19,6 @@ class CWEthereum extends Ethereum { name: name, walletInfo: walletInfo, password: password, - parentAddress: parentAddress, mnemonic: mnemonic, passphrase: passphrase, ); diff --git a/lib/exchange/provider/swaptrade_exchange_provider.dart b/lib/exchange/provider/swaptrade_exchange_provider.dart index 9553c9559..d3f64b712 100644 --- a/lib/exchange/provider/swaptrade_exchange_provider.dart +++ b/lib/exchange/provider/swaptrade_exchange_provider.dart @@ -26,9 +26,11 @@ class SwapTradeExchangeProvider extends ExchangeProvider { CryptoCurrency.ltc, CryptoCurrency.ada, CryptoCurrency.bch, - CryptoCurrency.usdt, + CryptoCurrency.usdterc20, + CryptoCurrency.usdttrc20, CryptoCurrency.bnb, CryptoCurrency.xmr, + CryptoCurrency.zec, ].contains(element)) .toList()) ]; @@ -39,6 +41,7 @@ class SwapTradeExchangeProvider extends ExchangeProvider { static const getRate = '/api/swap/get-rate'; static const getCoins = '/api/swap/get-coins'; static const createOrder = '/api/swap/create-order'; + static const order = '/api/swap/order'; @override String get title => 'SwapTrade'; @@ -108,6 +111,7 @@ class SwapTradeExchangeProvider extends ExchangeProvider { final body = <String, String>{ 'coin_send': _normalizeCurrency(from), 'coin_receive': _normalizeCurrency(to), + 'amount': amount.toString(), 'ref': 'cake', }; @@ -120,7 +124,7 @@ class SwapTradeExchangeProvider extends ExchangeProvider { final data = responseBody['data'] as Map<String, dynamic>; double rate = double.parse(data['price'].toString()); - return rate; + return rate > 0 ? isFixedRateMode ? amount / rate : rate / amount : 0.0; } catch (e) { printV("error fetching rate: ${e.toString()}"); return 0.0; @@ -138,18 +142,16 @@ class SwapTradeExchangeProvider extends ExchangeProvider { final params = <String, dynamic>{}; var body = <String, dynamic>{ 'coin_send': _normalizeCurrency(request.fromCurrency), + 'coin_send_network': _networkFor(request.fromCurrency), 'coin_receive': _normalizeCurrency(request.toCurrency), + 'coin_receive_network': _networkFor(request.toCurrency), 'amount_send': request.fromAmount, 'recipient': request.toAddress, 'ref': 'cake', 'markup': markup, + 'refund_address': request.refundAddress, }; - String? fromNetwork = _networkFor(request.fromCurrency); - String? toNetwork = _networkFor(request.toCurrency); - if (fromNetwork != null) body['coin_send_network'] = fromNetwork; - if (toNetwork != null) body['coin_receive_network'] = toNetwork; - final uri = Uri.https(apiAuthority, createOrder, params); final response = await post(uri, body: body, headers: headers); final responseBody = json.decode(response.body) as Map<String, dynamic>; @@ -193,7 +195,7 @@ class SwapTradeExchangeProvider extends ExchangeProvider { 'order_id': id, }; - final uri = Uri.https(apiAuthority, createOrder, params); + final uri = Uri.https(apiAuthority, order, params); final response = await post(uri, body: body, headers: headers); final responseBody = json.decode(response.body) as Map<String, dynamic>; @@ -211,10 +213,14 @@ class SwapTradeExchangeProvider extends ExchangeProvider { final toCurrency = responseData['coin_receive'] as String; final to = CryptoCurrency.fromString(toCurrency); final inputAddress = responseData['server_address'] as String; + final payoutAddress = responseData['recipient'] as String; final status = responseData['status'] as String; final state = TradeState.deserialize(raw: status); final response_id = responseData['order_id'] as String; final expectedSendAmount = responseData['amount_send'] as String; + final expectedReceiveAmount = responseData['amount_receive'] as String; + final memo = responseData['memo'] as String?; + final createdAt = responseData['created_at'] as String?; return Trade( id: response_id, @@ -223,7 +229,11 @@ class SwapTradeExchangeProvider extends ExchangeProvider { provider: description, inputAddress: inputAddress, amount: expectedSendAmount, + payoutAddress: payoutAddress, state: state, + receiveAmount: expectedReceiveAmount, + memo: memo, + createdAt: DateTime.tryParse(createdAt ?? ''), ); } catch (e) { printV("error getting trade: ${e.toString()}"); @@ -242,14 +252,14 @@ class SwapTradeExchangeProvider extends ExchangeProvider { } } - String? _networkFor(CryptoCurrency currency) { - switch (currency) { - case CryptoCurrency.usdt: - return "USDT_ERC20"; - case CryptoCurrency.bnb: - return "BNB_BSC"; - default: - return null; - } + String _networkFor(CryptoCurrency currency) { + final network = switch (currency) { + CryptoCurrency.eth => 'ETH', + CryptoCurrency.bnb => 'BNB_BSC', + CryptoCurrency.usdterc20 => 'USDT_ERC20', + CryptoCurrency.usdttrc20 => 'TRX_USDT_S2UZ', + _ => '', + }; + return network; } } diff --git a/lib/exchange/trade_state.dart b/lib/exchange/trade_state.dart index 6d2472a11..7bce8c7e7 100644 --- a/lib/exchange/trade_state.dart +++ b/lib/exchange/trade_state.dart @@ -131,6 +131,8 @@ class TradeState extends EnumerableItem<String> with Serializable<String> { case 'success': case 'done': return success; + case 'expired': + return expired; default: throw Exception('Unexpected token: $raw in TradeState deserialize'); } diff --git a/lib/main.dart b/lib/main.dart index 666cb4617..126791d3e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -216,7 +216,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async { secureStorage: secureStorage, anonpayInvoiceInfo: anonpayInvoiceInfo, havenSeedStore: havenSeedStore, - initialMigrationVersion: 47, + initialMigrationVersion: 48, ); } diff --git a/lib/nano/cw_nano.dart b/lib/nano/cw_nano.dart index 9a2243d00..463e19d65 100644 --- a/lib/nano/cw_nano.dart +++ b/lib/nano/cw_nano.dart @@ -94,14 +94,12 @@ class CWNano extends Nano { WalletInfo? walletInfo, String? password, String? mnemonic, - String? parentAddress, String? passphrase, }) => NanoNewWalletCredentials( name: name, password: password, mnemonic: mnemonic, - parentAddress: parentAddress, walletInfo: walletInfo, passphrase: passphrase, ); diff --git a/lib/polygon/cw_polygon.dart b/lib/polygon/cw_polygon.dart index b8f78e9e2..ec98137c5 100644 --- a/lib/polygon/cw_polygon.dart +++ b/lib/polygon/cw_polygon.dart @@ -11,7 +11,6 @@ class CWPolygon extends Polygon { WalletCredentials createPolygonNewWalletCredentials({ required String name, String? mnemonic, - String? parentAddress, WalletInfo? walletInfo, String? password, String? passphrase, @@ -21,7 +20,6 @@ class CWPolygon extends Polygon { walletInfo: walletInfo, password: password, mnemonic: mnemonic, - parentAddress: parentAddress, passphrase: passphrase, ); diff --git a/lib/reactions/on_current_wallet_change.dart b/lib/reactions/on_current_wallet_change.dart index 3840b042e..a6475571d 100644 --- a/lib/reactions/on_current_wallet_change.dart +++ b/lib/reactions/on_current_wallet_change.dart @@ -1,6 +1,8 @@ +import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart'; import 'package:cake_wallet/entities/fiat_api_mode.dart'; import 'package:cake_wallet/entities/update_haven_rate.dart'; +import 'package:cake_wallet/entities/wallet_manager.dart'; import 'package:cake_wallet/ethereum/ethereum.dart'; import 'package:cake_wallet/polygon/polygon.dart'; import 'package:cake_wallet/solana/solana.dart'; @@ -59,6 +61,8 @@ void startCurrentWalletChangeReaction( return; } + await getIt.get<WalletManager>().ensureGroupHasHashedIdentifier(wallet); + final node = settingsStore.getCurrentNode(wallet.type); startWalletSyncStatusChangeReaction(wallet, fiatConversionStore); diff --git a/lib/solana/cw_solana.dart b/lib/solana/cw_solana.dart index d8257396f..f0df5fba1 100644 --- a/lib/solana/cw_solana.dart +++ b/lib/solana/cw_solana.dart @@ -11,7 +11,6 @@ class CWSolana extends Solana { WalletCredentials createSolanaNewWalletCredentials({ required String name, String? mnemonic, - String? parentAddress, WalletInfo? walletInfo, String? password, String? passphrase, @@ -21,7 +20,6 @@ class CWSolana extends Solana { walletInfo: walletInfo, password: password, mnemonic: mnemonic, - parentAddress: parentAddress, passphrase: passphrase, ); diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index f219409da..cf1f6fa17 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -187,7 +187,6 @@ class _DashboardPageView extends BasePage { int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0; ObservableList<Widget> pages = ObservableList<Widget>(); bool _isEffectsInstalled = false; - StreamSubscription<bool>? _onInactiveSub; @override Widget body(BuildContext context) { @@ -275,7 +274,7 @@ class _DashboardPageView extends BasePage { } void _setEffects(BuildContext context) async { - if (_isEffectsInstalled) { + if (_isEffectsInstalled || !context.mounted) { return; } if (dashboardViewModel.shouldShowMarketPlaceInDashboard) { @@ -305,11 +304,9 @@ class _DashboardPageView extends BasePage { _showHavenPopup(context); var needToPresentYat = false; - var isInactive = false; - _onInactiveSub = rootKey.currentState?.isInactive.listen( + rootKey.currentState?.isInactive.listen( (inactive) { - isInactive = inactive; if (needToPresentYat) { Future<void>.delayed(Duration(milliseconds: 500)).then( diff --git a/lib/src/screens/new_wallet/wallet_group_display_page.dart b/lib/src/screens/new_wallet/wallet_group_display_page.dart index 549449a68..cd64353e2 100644 --- a/lib/src/screens/new_wallet/wallet_group_display_page.dart +++ b/lib/src/screens/new_wallet/wallet_group_display_page.dart @@ -150,7 +150,6 @@ class WalletGroupsDisplayBody extends StatelessWidget { arguments: NewWalletArguments( type: walletGroupsDisplayViewModel.type, mnemonic: mnemonic, - parentAddress: walletGroupsDisplayViewModel.parentAddress, isChildWallet: true, ), ); diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index d3c741c0c..7e7080d0f 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -14,14 +14,17 @@ import 'package:cake_wallet/src/screens/connect_device/connect_device_page.dart' import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart'; import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart'; import 'package:cake_wallet/src/screens/send/widgets/send_card.dart'; +import 'package:cake_wallet/src/widgets/adaptable_page_view.dart'; import 'package:cake_wallet/src/widgets/add_template_button.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; +import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/template_tile.dart'; import 'package:cake_wallet/src/widgets/trail_button.dart'; +import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/seed_widget_theme.dart'; import 'package:cake_wallet/themes/extensions/send_page_theme.dart'; import 'package:cake_wallet/themes/theme_base.dart'; @@ -38,6 +41,7 @@ import 'package:cake_wallet/view_model/send/send_view_model_state.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:keyboard_actions/keyboard_actions.dart'; import 'package:mobx/mobx.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -93,7 +97,7 @@ class SendPage extends BasePage { return MergeSemantics( child: SizedBox( height: isMobileView ? 37 : 45, - width: isMobileView ? 37 : 45, + width: isMobileView ? 47: 45, child: ButtonTheme( minWidth: double.minPositive, child: Semantics( @@ -114,18 +118,6 @@ class SendPage extends BasePage { @override AppBarStyle get appBarStyle => AppBarStyle.transparent; - double _sendCardHeight(BuildContext context) { - double initialHeight = 480; - if (sendViewModel.hasCoinControl) { - initialHeight += 55; - } - - if (!responsiveLayoutUtil.shouldRenderMobileUI) { - return initialHeight - 66; - } - return initialHeight; - } - @override void onClose(BuildContext context) { sendViewModel.onClose(); @@ -174,285 +166,316 @@ class SendPage extends BasePage { Widget body(BuildContext context) { _setEffects(context); - return GestureDetector( - onLongPress: () => - sendViewModel.balanceViewModel.isReversing = !sendViewModel.balanceViewModel.isReversing, - onLongPressUp: () => - sendViewModel.balanceViewModel.isReversing = !sendViewModel.balanceViewModel.isReversing, - child: Form( - key: _formKey, - child: ScrollableWithBottomSection( - contentPadding: EdgeInsets.only(bottom: 24), - content: FocusTraversalGroup( - policy: OrderedTraversalPolicy(), - child: Column( - children: <Widget>[ - Container( - height: _sendCardHeight(context), - child: Observer( - builder: (_) { - return PageView.builder( - scrollDirection: Axis.horizontal, - controller: controller, - itemCount: sendViewModel.outputs.length, - itemBuilder: (context, index) { - final output = sendViewModel.outputs[index]; + return Observer(builder: (_) { + List<Widget> sendCards = []; + List<KeyboardActionsItem> keyboardActions = []; + for (var output in sendViewModel.outputs) { + var cryptoAmountFocus = FocusNode(); + var fiatAmountFocus = FocusNode(); + sendCards.add(SendCard( + currentTheme: currentTheme, + key: output.key, + output: output, + sendViewModel: sendViewModel, + initialPaymentRequest: initialPaymentRequest, + cryptoAmountFocus: cryptoAmountFocus, + fiatAmountFocus: fiatAmountFocus, + )); + keyboardActions.add(KeyboardActionsItem( + focusNode: cryptoAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])); + keyboardActions.add(KeyboardActionsItem( + focusNode: fiatAmountFocus, toolbarButtons: [(_) => KeyboardDoneButton()])); + } + return Stack( + children: [ + KeyboardActions( + config: KeyboardActionsConfig( + keyboardActionsPlatform: KeyboardActionsPlatform.ALL, + keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor, + nextFocus: false, + actions: keyboardActions, + ), + child: Container( + height: 0, + color: Colors.transparent, + ), + ), + GestureDetector( + onLongPress: () => sendViewModel.balanceViewModel.isReversing = + !sendViewModel.balanceViewModel.isReversing, + onLongPressUp: () => sendViewModel.balanceViewModel.isReversing = + !sendViewModel.balanceViewModel.isReversing, + child: Form( + key: _formKey, + child: ScrollableWithBottomSection( + contentPadding: EdgeInsets.only(bottom: 24), + content: FocusTraversalGroup( + policy: OrderedTraversalPolicy(), + child: Column( + children: <Widget>[ + PageViewHeightAdaptable( + controller: controller, + children: sendCards, + ), + SizedBox(height: 10), + Padding( + padding: EdgeInsets.only(left: 24, right: 24, bottom: 10), + child: Container( + height: 10, + child: Observer( + builder: (_) { + final count = sendViewModel.outputs.length; - return SendCard( - key: output.key, - output: output, - sendViewModel: sendViewModel, - initialPaymentRequest: initialPaymentRequest, + return count > 1 + ? Semantics( + label: 'Page Indicator', + hint: 'Swipe to change receiver', + excludeSemantics: true, + child: SmoothPageIndicator( + controller: controller, + count: count, + effect: ScrollingDotsEffect( + spacing: 6.0, + radius: 6.0, + dotWidth: 6.0, + dotHeight: 6.0, + dotColor: Theme.of(context) + .extension<SendPageTheme>()! + .indicatorDotColor, + activeDotColor: Theme.of(context) + .extension<SendPageTheme>()! + .templateBackgroundColor), + )) + : Offstage(); + }, + ), + ), + ), + Container( + height: 40, + width: double.infinity, + padding: EdgeInsets.only(left: 24), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Observer( + builder: (_) { + final templates = sendViewModel.templates; + final itemCount = templates.length; + + return Row( + children: <Widget>[ + AddTemplateButton( + key: ValueKey('send_page_add_template_button_key'), + onTap: () => + Navigator.of(context).pushNamed(Routes.sendTemplate), + currentTemplatesLength: templates.length, + ), + ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: itemCount, + itemBuilder: (context, index) { + final template = templates[index]; + return TemplateTile( + key: UniqueKey(), + to: template.name, + hasMultipleRecipients: + template.additionalRecipients != null && + template.additionalRecipients!.length > 1, + amount: template.isCurrencySelected + ? template.amount + : template.amountFiat, + from: template.isCurrencySelected + ? template.cryptoCurrency + : template.fiatCurrency, + onTap: () async { + sendViewModel.state = IsExecutingState(); + if (template.additionalRecipients?.isNotEmpty ?? + false) { + sendViewModel.clearOutputs(); + + for (int i = 0; + i < template.additionalRecipients!.length; + i++) { + Output output; + try { + output = sendViewModel.outputs[i]; + } catch (e) { + sendViewModel.addOutput(); + output = sendViewModel.outputs[i]; + } + + await _setInputsFromTemplate( + context, + output: output, + template: template.additionalRecipients![i], + ); + } + } else { + final output = _defineCurrentOutput(); + await _setInputsFromTemplate( + context, + output: output, + template: template, + ); + } + sendViewModel.state = InitialExecutionState(); + }, + onRemove: () { + showPopUp<void>( + context: context, + builder: (dialogContext) { + return AlertWithTwoActions( + alertTitle: S.of(context).template, + alertContent: + S.of(context).confirm_delete_template, + rightButtonText: S.of(context).delete, + leftButtonText: S.of(context).cancel, + actionRightButton: () { + Navigator.of(dialogContext).pop(); + sendViewModel.sendTemplateViewModel + .removeTemplate(template: template); + }, + actionLeftButton: () => + Navigator.of(dialogContext).pop()); + }, + ); + }, + ); + }, + ), + ], ); - }); - }, - )), - Padding( - padding: EdgeInsets.only(left: 24, right: 24, bottom: 10), - child: Container( - height: 10, - child: Observer( - builder: (_) { - final count = sendViewModel.outputs.length; - - return count > 1 - ? Semantics( - label: 'Page Indicator', - hint: 'Swipe to change receiver', - excludeSemantics: true, - child: SmoothPageIndicator( - controller: controller, - count: count, - effect: ScrollingDotsEffect( - spacing: 6.0, - radius: 6.0, - dotWidth: 6.0, - dotHeight: 6.0, - dotColor: Theme.of(context) - .extension<SendPageTheme>()! - .indicatorDotColor, - activeDotColor: Theme.of(context) - .extension<SendPageTheme>()! - .templateBackgroundColor), - )) - : Offstage(); - }, - ), + }, + ), + ), + ), + ], ), ), - Container( - height: 40, - width: double.infinity, - padding: EdgeInsets.only(left: 24), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Observer( + bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24), + bottomSection: Column( + children: [ + if (sendViewModel.hasCurrecyChanger) + Observer( + builder: (_) => Padding( + padding: EdgeInsets.only(bottom: 12), + child: PrimaryButton( + key: ValueKey('send_page_change_asset_button_key'), + onPressed: () => presentCurrencyPicker(context), + text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})', + color: Colors.transparent, + textColor: + Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor, + ), + ), + ), + if (sendViewModel.sendTemplateViewModel.hasMultiRecipient) + Padding( + padding: EdgeInsets.only(bottom: 12), + child: PrimaryButton( + key: ValueKey('send_page_add_receiver_button_key'), + onPressed: () { + sendViewModel.addOutput(); + Future.delayed(const Duration(milliseconds: 250), () { + controller.jumpToPage(sendViewModel.outputs.length - 1); + }); + }, + text: S.of(context).add_receiver, + color: Colors.transparent, + textColor: + Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor, + isDottedBorder: true, + borderColor: Theme.of(context) + .extension<SendPageTheme>()! + .templateDottedBorderColor, + )), + Observer( builder: (_) { - final templates = sendViewModel.templates; - final itemCount = templates.length; + return LoadingPrimaryButton( + key: ValueKey('send_page_send_button_key'), + onPressed: () async { + if (sendViewModel.state is IsExecutingState) return; + if (_formKey.currentState != null && + !_formKey.currentState!.validate()) { + if (sendViewModel.outputs.length > 1) { + showErrorValidationAlert(context); + } - return Row( - children: <Widget>[ - AddTemplateButton( - key: ValueKey('send_page_add_template_button_key'), - onTap: () => Navigator.of(context).pushNamed(Routes.sendTemplate), - currentTemplatesLength: templates.length, - ), - ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: itemCount, - itemBuilder: (context, index) { - final template = templates[index]; - return TemplateTile( - key: UniqueKey(), - to: template.name, - hasMultipleRecipients: template.additionalRecipients != null && - template.additionalRecipients!.length > 1, - amount: template.isCurrencySelected - ? template.amount - : template.amountFiat, - from: template.isCurrencySelected - ? template.cryptoCurrency - : template.fiatCurrency, - onTap: () async { - sendViewModel.state = IsExecutingState(); - if (template.additionalRecipients?.isNotEmpty ?? false) { - sendViewModel.clearOutputs(); + return; + } - for (int i = 0; - i < template.additionalRecipients!.length; - i++) { - Output output; - try { - output = sendViewModel.outputs[i]; - } catch (e) { - sendViewModel.addOutput(); - output = sendViewModel.outputs[i]; - } + final notValidItems = sendViewModel.outputs + .where( + (item) => item.address.isEmpty || item.cryptoAmount.isEmpty) + .toList(); - await _setInputsFromTemplate( - context, - output: output, - template: template.additionalRecipients![i], - ); - } - } else { - final output = _defineCurrentOutput(); - await _setInputsFromTemplate( - context, - output: output, - template: template, - ); - } - sendViewModel.state = InitialExecutionState(); - }, - onRemove: () { - showPopUp<void>( - context: context, - builder: (dialogContext) { - return AlertWithTwoActions( - alertTitle: S.of(context).template, - alertContent: S.of(context).confirm_delete_template, - rightButtonText: S.of(context).delete, - leftButtonText: S.of(context).cancel, - actionRightButton: () { - Navigator.of(dialogContext).pop(); - sendViewModel.sendTemplateViewModel - .removeTemplate(template: template); - }, - actionLeftButton: () => - Navigator.of(dialogContext).pop()); + if (notValidItems.isNotEmpty) { + showErrorValidationAlert(context); + return; + } + + if (sendViewModel.wallet.isHardwareWallet) { + if (!sendViewModel.ledgerViewModel!.isConnected) { + await Navigator.of(context).pushNamed(Routes.connectDevices, + arguments: ConnectDevicePageParams( + walletType: sendViewModel.walletType, + onConnectDevice: (BuildContext context, _) { + sendViewModel.ledgerViewModel! + .setLedger(sendViewModel.wallet); + Navigator.of(context).pop(); }, - ); - }, - ); + )); + } else { + sendViewModel.ledgerViewModel!.setLedger(sendViewModel.wallet); + } + } + + if (sendViewModel.wallet.type == WalletType.monero) { + int amount = 0; + for (var item in sendViewModel.outputs) { + amount += item.formattedCryptoAmount; + } + if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { + await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, + arguments: 'export-outputs'); + await Future.delayed( + Duration(seconds: 1)); // wait for monero to refresh the state + } + if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { + return; + } + } + + final check = sendViewModel.shouldDisplayTotp(); + authService.authenticateAction( + context, + conditionToDetermineIfToUse2FA: check, + onAuthSuccess: (value) async { + if (value) { + await sendViewModel.createTransaction(); + } }, - ), - ], + ); + }, + text: S.of(context).send, + color: Theme.of(context).primaryColor, + textColor: Colors.white, + isLoading: sendViewModel.state is IsExecutingState || + sendViewModel.state is TransactionCommitting || + sendViewModel.state is IsAwaitingDeviceResponseState, + isDisabled: !sendViewModel.isReadyForSend, ); }, - ), - ), - ), - ], - ), + ) + ], + )), ), - bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24), - bottomSection: Column( - children: [ - if (sendViewModel.hasCurrecyChanger) - Observer( - builder: (_) => Padding( - padding: EdgeInsets.only(bottom: 12), - child: PrimaryButton( - key: ValueKey('send_page_change_asset_button_key'), - onPressed: () => presentCurrencyPicker(context), - text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})', - color: Colors.transparent, - textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor, - ), - ), - ), - if (sendViewModel.sendTemplateViewModel.hasMultiRecipient) - Padding( - padding: EdgeInsets.only(bottom: 12), - child: PrimaryButton( - key: ValueKey('send_page_add_receiver_button_key'), - onPressed: () { - sendViewModel.addOutput(); - Future.delayed(const Duration(milliseconds: 250), () { - controller.jumpToPage(sendViewModel.outputs.length - 1); - }); - }, - text: S.of(context).add_receiver, - color: Colors.transparent, - textColor: Theme.of(context).extension<SeedWidgetTheme>()!.hintTextColor, - isDottedBorder: true, - borderColor: - Theme.of(context).extension<SendPageTheme>()!.templateDottedBorderColor, - )), - Observer( - builder: (_) { - return LoadingPrimaryButton( - key: ValueKey('send_page_send_button_key'), - onPressed: () async { - if (sendViewModel.state is IsExecutingState) return; - if (_formKey.currentState != null && !_formKey.currentState!.validate()) { - if (sendViewModel.outputs.length > 1) { - showErrorValidationAlert(context); - } - - return; - } - - final notValidItems = sendViewModel.outputs - .where((item) => item.address.isEmpty || item.cryptoAmount.isEmpty) - .toList(); - - if (notValidItems.isNotEmpty) { - showErrorValidationAlert(context); - return; - } - - if (sendViewModel.wallet.isHardwareWallet) { - if (!sendViewModel.ledgerViewModel!.isConnected) { - await Navigator.of(context).pushNamed( - Routes.connectDevices, - arguments: ConnectDevicePageParams( - walletType: sendViewModel.walletType, - onConnectDevice: (BuildContext context, _) { - sendViewModel.ledgerViewModel! - .setLedger(sendViewModel.wallet); - Navigator.of(context).pop(); - }, - )); - } else { - sendViewModel.ledgerViewModel! - .setLedger(sendViewModel.wallet); - } - } - - if (sendViewModel.wallet.type == WalletType.monero) { - int amount = 0; - for (var item in sendViewModel.outputs) { - amount += item.formattedCryptoAmount; - } - if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { - await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: 'export-outputs'); - await Future.delayed(Duration(seconds: 1)); // wait for monero to refresh the state - } - if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { - return; - } - } - - final check = sendViewModel.shouldDisplayTotp(); - authService.authenticateAction( - context, - conditionToDetermineIfToUse2FA: check, - onAuthSuccess: (value) async { - if (value) { - await sendViewModel.createTransaction(); - } - }, - ); - }, - text: S.of(context).send, - color: Theme.of(context).primaryColor, - textColor: Colors.white, - isLoading: sendViewModel.state is IsExecutingState || - sendViewModel.state is TransactionCommitting || - sendViewModel.state is IsAwaitingDeviceResponseState, - isDisabled: !sendViewModel.isReadyForSend, - ); - }, - ) - ], - )), - ), - ); + ), + ], + ); + }); } BuildContext? dialogContext; @@ -525,13 +548,12 @@ class SendPage extends BasePage { if (state is TransactionCommitted) { WidgetsBinding.instance.addPostFrameCallback((_) async { - if (!context.mounted) { return; } - final successMessage = S.of(context).send_success( - sendViewModel.selectedCryptoCurrency.toString()); + final successMessage = + S.of(context).send_success(sendViewModel.selectedCryptoCurrency.toString()); final waitMessage = sendViewModel.walletType == WalletType.solana ? '. ${S.of(context).waitFewSecondForTxUpdate}' @@ -539,10 +561,8 @@ class SendPage extends BasePage { String alertContent = "$successMessage$waitMessage"; - await Navigator.of(context).pushNamed( - Routes.transactionSuccessPage, - arguments: alertContent - ); + await Navigator.of(context) + .pushNamed(Routes.transactionSuccessPage, arguments: alertContent); newContactAddress = newContactAddress ?? sendViewModel.newContactAddress(); if (newContactAddress?.address != null && isRegularElectrumAddress(newContactAddress!.address)) { @@ -562,7 +582,7 @@ class SendPage extends BasePage { leftButtonText: S.of(_dialogContext).ignor, alertLeftActionButtonKey: ValueKey('send_page_sent_dialog_ignore_button_key'), alertRightActionButtonKey: - ValueKey('send_page_sent_dialog_add_contact_button_key'), + ValueKey('send_page_sent_dialog_add_contact_button_key'), actionRightButton: () { Navigator.of(_dialogContext).pop(); RequestReviewHandler.requestReview(); diff --git a/lib/src/screens/send/widgets/send_card.dart b/lib/src/screens/send/widgets/send_card.dart index 24cbd2061..f1cac5c9f 100644 --- a/lib/src/screens/send/widgets/send_card.dart +++ b/lib/src/screens/send/widgets/send_card.dart @@ -1,6 +1,7 @@ import 'package:cake_wallet/entities/priority_for_wallet_type.dart'; import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart'; import 'package:cake_wallet/src/widgets/picker.dart'; +import 'package:cake_wallet/src/widgets/standard_checkbox.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; @@ -12,6 +13,7 @@ import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_core/unspent_coin_type.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -24,40 +26,58 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/themes/extensions/send_page_theme.dart'; +import '../../../../themes/extensions/cake_text_theme.dart'; +import '../../../../themes/theme_base.dart'; + class SendCard extends StatefulWidget { SendCard({ Key? key, required this.output, required this.sendViewModel, + required this.currentTheme, this.initialPaymentRequest, + this.cryptoAmountFocus, + this.fiatAmountFocus, }) : super(key: key); final Output output; final SendViewModel sendViewModel; final PaymentRequest? initialPaymentRequest; + final FocusNode? cryptoAmountFocus; + final FocusNode? fiatAmountFocus; + final ThemeBase currentTheme; + @override SendCardState createState() => SendCardState( output: output, sendViewModel: sendViewModel, initialPaymentRequest: initialPaymentRequest, + currentTheme: currentTheme + // cryptoAmountFocus: cryptoAmountFocus ?? FocusNode(), + // fiatAmountFocus: fiatAmountFocus ?? FocusNode(), + // cryptoAmountFocus: FocusNode(), + // fiatAmountFocus: FocusNode(), ); } class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<SendCard> { - SendCardState({required this.output, required this.sendViewModel, this.initialPaymentRequest}) - : addressController = TextEditingController(), + SendCardState({ + required this.output, + required this.sendViewModel, + this.initialPaymentRequest, + required this.currentTheme, + }) : addressController = TextEditingController(), cryptoAmountController = TextEditingController(), fiatAmountController = TextEditingController(), noteController = TextEditingController(), extractedAddressController = TextEditingController(), - cryptoAmountFocus = FocusNode(), - fiatAmountFocus = FocusNode(), addressFocusNode = FocusNode(); static const prefixIconWidth = 34.0; static const prefixIconHeight = 34.0; + final ThemeBase currentTheme; final Output output; final SendViewModel sendViewModel; final PaymentRequest? initialPaymentRequest; @@ -67,8 +87,6 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S final TextEditingController fiatAmountController; final TextEditingController noteController; final TextEditingController extractedAddressController; - final FocusNode cryptoAmountFocus; - final FocusNode fiatAmountFocus; final FocusNode addressFocusNode; bool _effectsInstalled = false; @@ -101,310 +119,336 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S super.build(context); _setEffects(context); - return Stack( - children: [ - KeyboardActions( - config: KeyboardActionsConfig( - keyboardActionsPlatform: KeyboardActionsPlatform.IOS, - keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor, - nextFocus: false, - actions: [ - KeyboardActionsItem( - focusNode: cryptoAmountFocus, - toolbarButtons: [(_) => KeyboardDoneButton()], + // return Stack( + // children: [ + // return KeyboardActions( + // config: KeyboardActionsConfig( + // keyboardActionsPlatform: KeyboardActionsPlatform.IOS, + // keyboardBarColor: Theme.of(context).extension<KeyboardTheme>()!.keyboardBarColor, + // nextFocus: false, + // actions: [ + // KeyboardActionsItem( + // focusNode: cryptoAmountFocus, + // toolbarButtons: [(_) => KeyboardDoneButton()], + // ), + // KeyboardActionsItem( + // focusNode: fiatAmountFocus, + // toolbarButtons: [(_) => KeyboardDoneButton()], + // ) + // ], + // ), + // // child: Container( + // // height: 0, + // // color: Colors.transparent, + // // ), child: + // child: SizedBox( + // height: 100, + // width: 100, + // child: Text('Send Card'), + // ), + // ); + return Container( + decoration: responsiveLayoutUtil.shouldRenderMobileUI + ? BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), + gradient: LinearGradient( + colors: [ + Theme.of(context).extension<SendPageTheme>()!.firstGradientColor, + Theme.of(context).extension<SendPageTheme>()!.secondGradientColor, + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, ), - KeyboardActionsItem( - focusNode: fiatAmountFocus, - toolbarButtons: [(_) => KeyboardDoneButton()], - ) - ], - ), - child: Container( - height: 0, - color: Colors.transparent, - ), + ) + : null, + child: Padding( + padding: EdgeInsets.fromLTRB( + 24, + responsiveLayoutUtil.shouldRenderMobileUI ? 110 : 55, + 24, + responsiveLayoutUtil.shouldRenderMobileUI ? 32 : 0, ), - Container( - decoration: responsiveLayoutUtil.shouldRenderMobileUI - ? BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), - gradient: LinearGradient( - colors: [ - Theme.of(context).extension<SendPageTheme>()!.firstGradientColor, - Theme.of(context).extension<SendPageTheme>()!.secondGradientColor, - ], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ) - : null, - child: Padding( - padding: EdgeInsets.fromLTRB( - 24, - responsiveLayoutUtil.shouldRenderMobileUI ? 110 : 55, - 24, - responsiveLayoutUtil.shouldRenderMobileUI ? 32 : 0, - ), - child: SingleChildScrollView( - child: Observer( - builder: (_) => Column( - mainAxisSize: MainAxisSize.min, - children: <Widget>[ - Observer(builder: (_) { - final validator = output.isParsedAddress - ? sendViewModel.textValidator - : sendViewModel.addressValidator; + child: Observer( + builder: (_) => Column( + mainAxisSize: MainAxisSize.min, + children: <Widget>[ + Observer(builder: (_) { + final validator = output.isParsedAddress + ? sendViewModel.textValidator + : sendViewModel.addressValidator; - return AddressTextField( - addressKey: ValueKey('send_page_address_textfield_key'), - focusNode: addressFocusNode, - controller: addressController, - onURIScanned: (uri) { - final paymentRequest = PaymentRequest.fromUri(uri); - addressController.text = paymentRequest.address; - cryptoAmountController.text = paymentRequest.amount; - noteController.text = paymentRequest.note; - }, - options: [ - AddressTextFieldOption.paste, - AddressTextFieldOption.qrCode, - AddressTextFieldOption.addressBook - ], - buttonColor: - Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor, + return AddressTextField( + addressKey: ValueKey('send_page_address_textfield_key'), + focusNode: addressFocusNode, + controller: addressController, + onURIScanned: (uri) { + final paymentRequest = PaymentRequest.fromUri(uri); + addressController.text = paymentRequest.address; + cryptoAmountController.text = paymentRequest.amount; + noteController.text = paymentRequest.note; + }, + options: [ + AddressTextFieldOption.paste, + AddressTextFieldOption.qrCode, + AddressTextFieldOption.addressBook + ], + buttonColor: Theme.of(context).extension<SendPageTheme>()!.textFieldButtonColor, + borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor, + textStyle: + TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), + hintStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), + onPushPasteButton: (context) async { + output.resetParsedAddress(); + await output.fetchParsedAddress(context); + }, + onPushAddressBookButton: (context) async { + output.resetParsedAddress(); + }, + onSelectedContact: (contact) { + output.loadContact(contact); + }, + validator: validator, + selectedCurrency: sendViewModel.selectedCryptoCurrency, + ); + }), + if (output.isParsedAddress) + Padding( + padding: const EdgeInsets.only(top: 20), + child: BaseTextFormField( + controller: extractedAddressController, + readOnly: true, borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor, textStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), - hintStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, - color: - Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), - onPushPasteButton: (context) async { - output.resetParsedAddress(); - await output.fetchParsedAddress(context); - }, - onPushAddressBookButton: (context) async { - output.resetParsedAddress(); - }, - onSelectedContact: (contact) { - output.loadContact(contact); - }, - validator: validator, - selectedCurrency: sendViewModel.selectedCryptoCurrency, - ); - }), - if (output.isParsedAddress) - Padding( - padding: const EdgeInsets.only(top: 20), - child: BaseTextFormField( - controller: extractedAddressController, - readOnly: true, - borderColor: Theme.of(context) - .extension<SendPageTheme>()! - .textFieldBorderColor, - textStyle: TextStyle( - fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), - validator: sendViewModel.addressValidator)), - CurrencyAmountTextField( - currencyPickerButtonKey: ValueKey('send_page_currency_picker_button_key'), - amountTextfieldKey: ValueKey('send_page_amount_textfield_key'), - sendAllButtonKey: ValueKey('send_page_send_all_button_key'), - currencyAmountTextFieldWidgetKey: - ValueKey('send_page_crypto_currency_amount_textfield_widget_key'), - selectedCurrency: sendViewModel.selectedCryptoCurrency.title, - amountFocusNode: cryptoAmountFocus, - amountController: cryptoAmountController, - isAmountEditable: true, - onTapPicker: () => _presentPicker(context), - isPickerEnable: sendViewModel.hasMultipleTokens, - tag: sendViewModel.selectedCryptoCurrency.tag, - allAmountButton: - !sendViewModel.isBatchSending && sendViewModel.shouldDisplaySendALL, - currencyValueValidator: output.sendAll - ? sendViewModel.allAmountValidator - : sendViewModel.amountValidator, - allAmountCallback: () async => output.setSendAll(sendViewModel.balance)), - Divider( - height: 1, - color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), - Observer( - builder: (_) => Padding( - padding: EdgeInsets.only(top: 10), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: <Widget>[ - Expanded( - child: Text( - S.of(context).available_balance + ':', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Theme.of(context) - .extension<SendPageTheme>()! - .textFieldHintColor), - ), - ), - Text( - sendViewModel.balance, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Theme.of(context) - .extension<SendPageTheme>()! - .textFieldHintColor), - ) - ], + validator: sendViewModel.addressValidator)), + CurrencyAmountTextField( + currencyPickerButtonKey: ValueKey('send_page_currency_picker_button_key'), + amountTextfieldKey: ValueKey('send_page_amount_textfield_key'), + sendAllButtonKey: ValueKey('send_page_send_all_button_key'), + currencyAmountTextFieldWidgetKey: + ValueKey('send_page_crypto_currency_amount_textfield_widget_key'), + selectedCurrency: sendViewModel.selectedCryptoCurrency.title, + amountFocusNode: widget.cryptoAmountFocus, + amountController: cryptoAmountController, + isAmountEditable: true, + onTapPicker: () => _presentPicker(context), + isPickerEnable: sendViewModel.hasMultipleTokens, + tag: sendViewModel.selectedCryptoCurrency.tag, + allAmountButton: + !sendViewModel.isBatchSending && sendViewModel.shouldDisplaySendALL, + currencyValueValidator: output.sendAll + ? sendViewModel.allAmountValidator + : sendViewModel.amountValidator, + allAmountCallback: () async => output.setSendAll(sendViewModel.balance)), + Divider( + height: 1, + color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), + Observer( + builder: (_) => Padding( + padding: EdgeInsets.only(top: 10), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: <Widget>[ + Expanded( + child: Text( + S.of(context).available_balance + ':', + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: + Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), ), ), - ), - if (!sendViewModel.isFiatDisabled) - CurrencyAmountTextField( - amountTextfieldKey: ValueKey('send_page_fiat_amount_textfield_key'), - currencyAmountTextFieldWidgetKey: - ValueKey('send_page_fiat_currency_amount_textfield_widget_key'), - selectedCurrency: sendViewModel.fiat.title, - amountFocusNode: fiatAmountFocus, - amountController: fiatAmountController, - hintText: '0.00', - isAmountEditable: true, - allAmountButton: false), - Divider( - height: 1, - color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), - Padding( - padding: EdgeInsets.only(top: 20), - child: BaseTextFormField( - key: ValueKey('send_page_note_textfield_key'), - controller: noteController, - keyboardType: TextInputType.multiline, - maxLines: null, - borderColor: - Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor, - textStyle: TextStyle( - fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), - hintText: S.of(context).note_optional, - placeholderTextStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500, + Text( + sendViewModel.balance, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), - ), - ), - if (sendViewModel.hasFees) - Observer( - builder: (_) => GestureDetector( - key: ValueKey('send_page_select_fee_priority_button_key'), - onTap: sendViewModel.hasFeesPriority - ? () => pickTransactionPriority(context) - : () {}, - child: Container( - padding: EdgeInsets.only(top: 24), + ) + ], + ), + ), + ), + if (!sendViewModel.isFiatDisabled) + CurrencyAmountTextField( + amountTextfieldKey: ValueKey('send_page_fiat_amount_textfield_key'), + currencyAmountTextFieldWidgetKey: + ValueKey('send_page_fiat_currency_amount_textfield_widget_key'), + selectedCurrency: sendViewModel.fiat.title, + amountFocusNode: widget.fiatAmountFocus, + amountController: fiatAmountController, + hintText: '0.00', + isAmountEditable: true, + allAmountButton: false), + Divider( + height: 1, + color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), + Padding( + padding: EdgeInsets.only(top: 20), + child: BaseTextFormField( + key: ValueKey('send_page_note_textfield_key'), + controller: noteController, + keyboardType: TextInputType.multiline, + maxLines: null, + borderColor: Theme.of(context).extension<SendPageTheme>()!.textFieldBorderColor, + textStyle: + TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), + hintText: S.of(context).note_optional, + placeholderTextStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context).extension<SendPageTheme>()!.textFieldHintColor), + ), + ), + if (sendViewModel.hasFees) + Observer( + builder: (_) => GestureDetector( + key: ValueKey('send_page_select_fee_priority_button_key'), + onTap: sendViewModel.hasFeesPriority + ? () => pickTransactionPriority(context) + : () {}, + child: Container( + padding: EdgeInsets.only(top: 24), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: <Widget>[ + Text( + S.of(context).send_estimated_fee, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.w500, color: Colors.white), + ), + Container( child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ - Text( - S.of(context).send_estimated_fee, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w500, - color: Colors.white), - ), - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: <Widget>[ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - output.estimatedFee.toString() + - ' ' + - sendViewModel.currency.toString(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Colors.white, - ), - ), - Padding( - padding: EdgeInsets.only(top: 5), - child: sendViewModel.isFiatDisabled - ? const SizedBox(height: 14) - : Text( - output.estimatedFeeFiatAmount + - ' ' + - sendViewModel.fiat.title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Theme.of(context) - .extension<SendPageTheme>()! - .textFieldHintColor, - ), - ), - ), - ], + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + output.estimatedFee.toString() + + ' ' + + sendViewModel.currency.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Colors.white, ), - Padding( - padding: EdgeInsets.only(top: 2, left: 5), - child: Icon( - Icons.arrow_forward_ios, - size: 12, - color: Colors.white, - ), - ) - ], + ), + Padding( + padding: EdgeInsets.only(top: 5), + child: sendViewModel.isFiatDisabled + ? const SizedBox(height: 14) + : Text( + output.estimatedFeeFiatAmount + + ' ' + + sendViewModel.fiat.title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Theme.of(context) + .extension<SendPageTheme>()! + .textFieldHintColor, + ), + ), + ), + ], + ), + Padding( + padding: EdgeInsets.only(top: 2, left: 5), + child: Icon( + Icons.arrow_forward_ios, + size: 12, + color: Colors.white, ), ) ], ), - ), - ), + ) + ], ), - if (sendViewModel.hasCoinControl) - Padding( - padding: EdgeInsets.only(top: 6), - child: GestureDetector( - key: ValueKey('send_page_unspent_coin_button_key'), - onTap: () => Navigator.of(context).pushNamed( - Routes.unspentCoinsList, - arguments: widget.sendViewModel.coinTypeToSpendFrom, - ), - child: Container( - color: Colors.transparent, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - S.of(context).coin_control, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - Icon( - Icons.arrow_forward_ios, - size: 12, - color: Colors.white, - ), - ], - ), - ), - ), - ), - ], + ), + ), ), - ), - ), + if (sendViewModel.hasCoinControl) + Padding( + padding: EdgeInsets.only(top: 6), + child: GestureDetector( + key: ValueKey('send_page_unspent_coin_button_key'), + onTap: () => Navigator.of(context).pushNamed( + Routes.unspentCoinsList, + arguments: widget.sendViewModel.coinTypeToSpendFrom, + ), + child: Container( + color: Colors.transparent, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + S.of(context).coin_control, + style: TextStyle( + fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white), + ), + Icon( + Icons.arrow_forward_ios, + size: 12, + color: Colors.white, + ), + ], + ), + ), + ), + ), + if (sendViewModel.currency == CryptoCurrency.ltc) + Observer( + builder: (_) => Padding( + padding: EdgeInsets.only(top: 14), + child: GestureDetector( + key: ValueKey('send_page_unspent_coin_button_key'), + onTap: () { + bool value = + widget.sendViewModel.coinTypeToSpendFrom == UnspentCoinType.any; + sendViewModel.setAllowMwebCoins(!value); + }, + child: Container( + color: Colors.transparent, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + StandardCheckbox( + caption: S.of(context).litecoin_mweb_allow_coins, + captionColor: Colors.white, + borderColor: currentTheme.type == ThemeType.bright + ? Colors.white + : Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, + iconColor: currentTheme.type == ThemeType.bright + ? Colors.white + : Theme.of(context).primaryColor, + value: + widget.sendViewModel.coinTypeToSpendFrom == UnspentCoinType.any, + onChanged: (bool? value) { + sendViewModel.setAllowMwebCoins(value ?? false); + }, + ), + ], + ), + ), + ), + ), + ), + ], ), - ) - ], + ), + ), ); } diff --git a/lib/src/screens/settings/privacy_page.dart b/lib/src/screens/settings/privacy_page.dart index 8652c4af6..238e58eab 100644 --- a/lib/src/screens/settings/privacy_page.dart +++ b/lib/src/screens/settings/privacy_page.dart @@ -73,7 +73,7 @@ class PrivacyPage extends BasePage { _privacySettingsViewModel.setIsAppSecure(value); }), SettingsSwitcherCell( - title: S.current.disable_trade_option, + title: S.current.disable_exchange_option, value: _privacySettingsViewModel.disableTradeOption, onValueChange: (BuildContext _, bool value) { _privacySettingsViewModel.setDisableTradeOption(value); diff --git a/lib/src/screens/settings/widgets/settings_switcher_cell.dart b/lib/src/screens/settings/widgets/settings_switcher_cell.dart index bc3421ead..6173cb34d 100644 --- a/lib/src/screens/settings/widgets/settings_switcher_cell.dart +++ b/lib/src/screens/settings/widgets/settings_switcher_cell.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/src/widgets/standard_switch.dart'; import 'package:flutter/material.dart'; @@ -30,7 +29,13 @@ class SettingsSwitcherCell extends StandardListRow { height: 56, padding: EdgeInsets.only(left: 12, right: 12), child: TextButton( - onPressed: () => onValueChange?.call(context, !value), + onPressed: () { + if (onTap != null) { + onTap!.call(context); + } else { + onValueChange?.call(context, !value); + } + }, style: ButtonStyle( //backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor), shape: MaterialStateProperty.all( @@ -45,7 +50,7 @@ class SettingsSwitcherCell extends StandardListRow { children: <Widget>[ if (leading != null) leading, buildCenter(context, hasLeftOffset: leading != null), - if (trailing != null) trailing, + trailing, ], ), ), diff --git a/lib/src/screens/wallet/wallet_edit_page.dart b/lib/src/screens/wallet/wallet_edit_page.dart index 340091a1e..9e62284de 100644 --- a/lib/src/screens/wallet/wallet_edit_page.dart +++ b/lib/src/screens/wallet/wallet_edit_page.dart @@ -112,7 +112,7 @@ class WalletEditPage extends BasePage { pageArguments.editingWallet, password: password, isWalletGroup: pageArguments.isWalletGroup, - groupParentAddress: pageArguments.parentAddress, + walletGroupKey: pageArguments.walletGroupKey, ); }, callback: (bool isAuthenticatedSuccessfully, @@ -128,7 +128,7 @@ class WalletEditPage extends BasePage { await walletEditViewModel.changeName( pageArguments.editingWallet, isWalletGroup: pageArguments.isWalletGroup, - groupParentAddress: pageArguments.parentAddress, + walletGroupKey: pageArguments.walletGroupKey, ); confirmed = true; } diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index 681ca4d8a..569dce958 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -227,7 +227,7 @@ class WalletListBodyState extends State<WalletListBody> { editingWallet: wallet, isWalletGroup: true, groupName: groupName, - parentAddress: group.parentAddress, + walletGroupKey: group.groupKey, ), ); }, diff --git a/lib/src/widgets/adaptable_page_view.dart b/lib/src/widgets/adaptable_page_view.dart new file mode 100644 index 000000000..c6800ae22 --- /dev/null +++ b/lib/src/widgets/adaptable_page_view.dart @@ -0,0 +1,202 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; + +const _firstLayoutMaxHeight = 10000.0; + +class PageViewHeightAdaptable extends StatefulWidget { + const PageViewHeightAdaptable({ + super.key, + required this.controller, + required this.children, + }) : assert(children.length > 0, 'children must not be empty'); + + final PageController controller; + final List<Widget> children; + + @override + State<PageViewHeightAdaptable> createState() => _PageViewHeightAdaptableState(); +} + +class _PageViewHeightAdaptableState extends State<PageViewHeightAdaptable> { + final _sizes = <int, Size>{}; + + @override + void didUpdateWidget(PageViewHeightAdaptable oldWidget) { + super.didUpdateWidget(oldWidget); + + _sizes.clear(); + } + + @override + Widget build(BuildContext context) { + return ListenableBuilder( + listenable: widget.controller, + builder: (context, child) => _SizingContainer( + sizes: _sizes, + page: widget.controller.hasClients ? widget.controller.page ?? 0 : 0, + child: child!, + ), + child: LayoutBuilder( + builder: (context, constraints) => PageView( + controller: widget.controller, + children: [ + for (final (i, child) in widget.children.indexed) + Stack( + alignment: Alignment.topCenter, + clipBehavior: Clip.hardEdge, + children: [ + SizedBox.fromSize(size: _sizes[i]), + Positioned( + left: 0, + top: 0, + right: 0, + child: _SizeAware( + child: child, + // don't setState, we'll use it in the layout phase + onSizeLaidOut: (size) { + _sizes[i] = size; + }, + ), + ), + ], + ), + ], + ), + ), + ); + } +} + +typedef _OnSizeLaidOutCallback = void Function(Size); + +class _SizingContainer extends SingleChildRenderObjectWidget { + const _SizingContainer({ + super.child, + required this.sizes, + required this.page, + }); + + final Map<int, Size> sizes; + final double page; + + @override + _RenderSizingContainer createRenderObject(BuildContext context) { + return _RenderSizingContainer( + sizes: sizes, + page: page, + ); + } + + @override + void updateRenderObject( + BuildContext context, + _RenderSizingContainer renderObject, + ) { + renderObject + ..sizes = sizes + ..page = page; + } +} + +class _RenderSizingContainer extends RenderProxyBox { + _RenderSizingContainer({ + RenderBox? child, + required Map<int, Size> sizes, + required double page, + }) : _sizes = sizes, + _page = page, + super(child); + + Map<int, Size> _sizes; + Map<int, Size> get sizes => _sizes; + set sizes(Map<int, Size> value) { + if (_sizes == value) return; + _sizes = value; + markNeedsLayout(); + } + + double _page; + double get page => _page; + set page(double value) { + if (_page == value) return; + _page = value; + markNeedsLayout(); + } + + @override + void performLayout() { + if (child case final child?) { + child.layout( + constraints.copyWith( + minWidth: constraints.maxWidth, + minHeight: 0, + maxHeight: constraints.hasBoundedHeight ? null : _firstLayoutMaxHeight, + ), + parentUsesSize: true, + ); + + final a = sizes[page.floor()]!; + final b = sizes[page.ceil()]!; + + final height = lerpDouble(a.height, b.height, page - page.floor()); + + child.layout( + constraints.copyWith(minHeight: height, maxHeight: height), + parentUsesSize: true, + ); + size = child.size; + } else { + size = computeSizeForNoChild(constraints); + } + } +} + +class _SizeAware extends SingleChildRenderObjectWidget { + const _SizeAware({ + required Widget child, + required this.onSizeLaidOut, + }) : super(child: child); + + final _OnSizeLaidOutCallback onSizeLaidOut; + + @override + _RenderSizeAware createRenderObject(BuildContext context) { + return _RenderSizeAware( + onSizeLaidOut: onSizeLaidOut, + ); + } + + @override + void updateRenderObject(BuildContext context, _RenderSizeAware renderObject) { + renderObject.onSizeLaidOut = onSizeLaidOut; + } +} + +class _RenderSizeAware extends RenderProxyBox { + _RenderSizeAware({ + RenderBox? child, + required _OnSizeLaidOutCallback onSizeLaidOut, + }) : _onSizeLaidOut = onSizeLaidOut, + super(child); + + _OnSizeLaidOutCallback? _onSizeLaidOut; + _OnSizeLaidOutCallback get onSizeLaidOut => _onSizeLaidOut!; + set onSizeLaidOut(_OnSizeLaidOutCallback value) { + if (_onSizeLaidOut == value) return; + _onSizeLaidOut = value; + markNeedsLayout(); + } + + @override + void performLayout() { + super.performLayout(); + + onSizeLaidOut( + getDryLayout( + constraints.copyWith(maxHeight: double.infinity), + ), + ); + } +} \ No newline at end of file diff --git a/lib/src/widgets/standard_checkbox.dart b/lib/src/widgets/standard_checkbox.dart index d61b84d1d..2b06ff1c6 100644 --- a/lib/src/widgets/standard_checkbox.dart +++ b/lib/src/widgets/standard_checkbox.dart @@ -9,6 +9,7 @@ class StandardCheckbox extends StatelessWidget { this.gradientBackground = false, this.borderColor, this.iconColor, + this.captionColor, required this.onChanged}); final bool value; @@ -16,6 +17,7 @@ class StandardCheckbox extends StatelessWidget { final bool gradientBackground; final Color? borderColor; final Color? iconColor; + final Color? captionColor; final Function(bool) onChanged; @override @@ -68,7 +70,7 @@ class StandardCheckbox extends StatelessWidget { fontSize: 16.0, fontFamily: 'Lato', fontWeight: FontWeight.normal, - color: Theme.of(context).extension<CakeTextTheme>()!.titleColor, + color: captionColor ?? Theme.of(context).extension<CakeTextTheme>()!.titleColor, decoration: TextDecoration.none, ), ), diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart index a2c6e3646..6a98329d6 100644 --- a/lib/store/dashboard/trade_filter_store.dart +++ b/lib/store/dashboard/trade_filter_store.dart @@ -19,7 +19,8 @@ abstract class TradeFilterStoreBase with Store { displayChainflip = true, displayThorChain = true, displayLetsExchange = true, - displayStealthEx = true; + displayStealthEx = true, + displaySwapTrade = true; @observable bool displayXMRTO; @@ -54,6 +55,9 @@ abstract class TradeFilterStoreBase with Store { @observable bool displayStealthEx; + @observable + bool displaySwapTrade; + @computed bool get displayAllTrades => displayChangeNow && @@ -64,7 +68,8 @@ abstract class TradeFilterStoreBase with Store { displayChainflip && displayThorChain && displayLetsExchange && - displayStealthEx; + displayStealthEx && + displaySwapTrade; @action void toggleDisplayExchange(ExchangeProviderDescription provider) { @@ -102,6 +107,8 @@ abstract class TradeFilterStoreBase with Store { case ExchangeProviderDescription.stealthEx: displayStealthEx = !displayStealthEx; break; + case ExchangeProviderDescription.swapTrade: + displaySwapTrade = !displaySwapTrade; case ExchangeProviderDescription.all: if (displayAllTrades) { displayChangeNow = false; @@ -115,6 +122,7 @@ abstract class TradeFilterStoreBase with Store { displayThorChain = false; displayLetsExchange = false; displayStealthEx = false; + displaySwapTrade = false; } else { displayChangeNow = true; displaySideShift = true; @@ -127,6 +135,7 @@ abstract class TradeFilterStoreBase with Store { displayThorChain = true; displayLetsExchange = true; displayStealthEx = true; + displaySwapTrade = true; } break; } @@ -158,7 +167,8 @@ abstract class TradeFilterStoreBase with Store { item.trade.provider == ExchangeProviderDescription.thorChain) || (displayLetsExchange && item.trade.provider == ExchangeProviderDescription.letsExchange) || - (displayStealthEx && item.trade.provider == ExchangeProviderDescription.stealthEx)) + (displayStealthEx && item.trade.provider == ExchangeProviderDescription.stealthEx) || + (displaySwapTrade && item.trade.provider == ExchangeProviderDescription.swapTrade)) .toList() : _trades; } diff --git a/lib/tron/cw_tron.dart b/lib/tron/cw_tron.dart index bf2fac590..2726e873d 100644 --- a/lib/tron/cw_tron.dart +++ b/lib/tron/cw_tron.dart @@ -14,16 +14,15 @@ class CWTron extends Tron { WalletInfo? walletInfo, String? password, String? mnemonic, - String? parentAddress, String? passphrase, }) => TronNewWalletCredentials( - name: name, - walletInfo: walletInfo, - password: password, - mnemonic: mnemonic, - passphrase: passphrase, - parentAddress: parentAddress); + name: name, + walletInfo: walletInfo, + password: password, + mnemonic: mnemonic, + passphrase: passphrase, + ); @override WalletCredentials createTronRestoreWalletFromSeedCredentials({ diff --git a/lib/utils/exception_handler.dart b/lib/utils/exception_handler.dart index 17e6daed3..547ffa571 100644 --- a/lib/utils/exception_handler.dart +++ b/lib/utils/exception_handler.dart @@ -217,6 +217,7 @@ class ExceptionHandler { "invalid signature", "invalid password", "NetworkImage._loadAsync", + "SSLV3_ALERT_BAD_RECORD_MAC", // Temporary ignored, More context: Flutter secure storage reads the values as null some times // probably when the device was locked and then opened on Cake // this is solved by a restart of the app diff --git a/lib/view_model/buy/buy_sell_view_model.dart b/lib/view_model/buy/buy_sell_view_model.dart index 508d68a82..436f66905 100644 --- a/lib/view_model/buy/buy_sell_view_model.dart +++ b/lib/view_model/buy/buy_sell_view_model.dart @@ -351,7 +351,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S paymentMethodState = PaymentMethodLoading(); selectedPaymentMethod = null; final result = await Future.wait(providerList.map((element) => element - .getAvailablePaymentTypes(fiatCurrency.title, cryptoCurrency.title, isBuyAction) + .getAvailablePaymentTypes(fiatCurrency.title, cryptoCurrency, isBuyAction) .timeout( Duration(seconds: 10), onTimeout: () => [], @@ -415,6 +415,17 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S return true; }).toList(); + final List<Quote> successRateQuotes = validQuotes.where((element) => + element.provider is OnRamperBuyProvider && + element.recommendations.contains(ProviderRecommendation.successRate) + ).toList(); + + for (final quote in successRateQuotes) { + if (!uniqueProviderQuotes.contains(quote)) { + uniqueProviderQuotes.add(quote); + } + } + sortedRecommendedQuotes.addAll(uniqueProviderQuotes); sortedQuotes = ObservableList.of( diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index fa4800c8a..90ee45182 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -152,6 +152,11 @@ abstract class DashboardViewModelBase with Store { caption: ExchangeProviderDescription.stealthEx.title, onChanged: () => tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)), + FilterItem( + value: () => tradeFilterStore.displaySwapTrade, + caption: ExchangeProviderDescription.swapTrade.title, + onChanged: () => tradeFilterStore + .toggleDisplayExchange(ExchangeProviderDescription.swapTrade)), ] }, subname = '', diff --git a/lib/view_model/restore_from_backup_view_model.dart b/lib/view_model/restore_from_backup_view_model.dart index 247e6d43d..f9894b592 100644 --- a/lib/view_model/restore_from_backup_view_model.dart +++ b/lib/view_model/restore_from_backup_view_model.dart @@ -13,13 +13,12 @@ import 'package:cake_wallet/store/authentication_store.dart'; part 'restore_from_backup_view_model.g.dart'; -class RestoreFromBackupViewModel = RestoreFromBackupViewModelBase - with _$RestoreFromBackupViewModel; +class RestoreFromBackupViewModel = RestoreFromBackupViewModelBase with _$RestoreFromBackupViewModel; abstract class RestoreFromBackupViewModelBase with Store { RestoreFromBackupViewModelBase(this.backupService) - : state = InitialExecutionState(), - filePath = ''; + : state = InitialExecutionState(), + filePath = ''; final BackupService backupService; @@ -45,8 +44,14 @@ abstract class RestoreFromBackupViewModelBase with Store { final file = File(filePath); final data = await file.readAsBytes(); + await backupService.importBackup(data, password); - await initializeAppAtRoot(reInitializing: true); + + try { + await initializeAppAtRoot(reInitializing: true); + } catch (e, s) { + throw Exception('failed_app_initialization: $e $s'); + } final store = getIt.get<AppStore>(); ReactionDisposer? reaction; @@ -63,11 +68,25 @@ abstract class RestoreFromBackupViewModelBase with Store { state = ExecutedSuccessfullyState(); } catch (e, s) { - var msg = e.toString(); + var msg = e.toString().toLowerCase(); - if (msg.toLowerCase().contains("message authentication code (mac)")) { + // can't use a switch here because of .contains() / not an exact match + bool shouldBeMadeAware = false; + if (msg.contains("message authentication code (mac)")) { msg = 'Incorrect backup password'; + } else if (msg.contains("faileddecryption")) { + msg = 'Failed to decrypt backup file, please check you entered the right password'; + } else if (msg.contains("failed_to_decode")) { + msg = 'Failed to decode backup file, please try again'; + shouldBeMadeAware = true; + } else if (msg.contains("failed_app_initialization")) { + msg = 'Failed to initialize app, please try again'; + shouldBeMadeAware = true; } else { + shouldBeMadeAware = true; + } + + if (shouldBeMadeAware) { await ExceptionHandler.onError(FlutterErrorDetails( exception: e, stack: s, diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 998521ede..3dce212af 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -77,7 +77,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor this.transactionDescriptionBox, this.ledgerViewModel, this.unspentCoinsListViewModel, { - this.coinTypeToSpendFrom = UnspentCoinType.any, + this.coinTypeToSpendFrom = UnspentCoinType.nonMweb, }) : state = InitialExecutionState(), currencies = appStore.wallet!.balance.keys.toList(), selectedCryptoCurrency = appStore.wallet!.currency, @@ -112,7 +112,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor ObservableList<Output> outputs; - final UnspentCoinType coinTypeToSpendFrom; + @observable + UnspentCoinType coinTypeToSpendFrom; bool get showAddressBookPopup => _settingsStore.showAddressBookPopupEnabled; @@ -135,6 +136,13 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor addOutput(); } + @action + void setAllowMwebCoins(bool allow) { + if (wallet.type == WalletType.litecoin) { + coinTypeToSpendFrom = allow ? UnspentCoinType.any : UnspentCoinType.nonMweb; + } + } + @computed bool get isBatchSending => outputs.length > 1; diff --git a/lib/view_model/wallet_creation_vm.dart b/lib/view_model/wallet_creation_vm.dart index 66903b1da..6d6938f74 100644 --- a/lib/view_model/wallet_creation_vm.dart +++ b/lib/view_model/wallet_creation_vm.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/core/wallet_creation_service.dart'; import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/entities/background_tasks.dart'; import 'package:cake_wallet/entities/generate_name.dart'; +import 'package:cake_wallet/entities/hash_wallet_identifier.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/nano/nano.dart'; import 'package:cake_wallet/store/app_store.dart'; @@ -103,13 +104,16 @@ abstract class WalletCreationVMBase with Store { showIntroCakePayCard: (!walletCreationService.typeExists(type)) && type != WalletType.haven, derivationInfo: credentials.derivationInfo ?? getDefaultCreateDerivation(), hardwareWalletType: credentials.hardwareWalletType, - parentAddress: credentials.parentAddress, ); credentials.walletInfo = walletInfo; final wallet = restoreWallet != null ? await processFromRestoredWallet(credentials, restoreWallet) : await process(credentials); + + final isNonSeedWallet = isRecovery ? wallet.seed == null : false; + walletInfo.isNonSeedWallet = isNonSeedWallet; + walletInfo.hashedWalletIdentifier = createHashedWalletIdentifier(wallet); walletInfo.address = wallet.walletAddresses.address; await _walletInfoSource.add(walletInfo); await _appStore.changeCurrentWallet(wallet); diff --git a/lib/view_model/wallet_groups_display_view_model.dart b/lib/view_model/wallet_groups_display_view_model.dart index e22cf63a5..3877bb521 100644 --- a/lib/view_model/wallet_groups_display_view_model.dart +++ b/lib/view_model/wallet_groups_display_view_model.dart @@ -47,8 +47,6 @@ abstract class WalletGroupsDisplayViewModelBase with Store { @observable WalletInfo? selectedSingleWallet; - @observable - String? parentAddress; @observable bool isFetchingMnemonic; @@ -77,9 +75,6 @@ abstract class WalletGroupsDisplayViewModelBase with Store { walletToUse.name, ); - parentAddress = - isGroupSelected ? selectedWalletGroup!.parentAddress : selectedSingleWallet!.address; - return wallet.seed; } catch (e) { return null; @@ -130,11 +125,14 @@ abstract class WalletGroupsDisplayViewModelBase with Store { // Check that selected wallet type is not present already in group bool isSameTypeAsSelectedWallet = wallet.type == type; + bool isNonSeedWallet = wallet.isNonSeedWallet; + // Exclude if any of these conditions are true return isNonBIP39Wallet || isNanoDerivationType || isElectrumDerivationType || - isSameTypeAsSelectedWallet; + isSameTypeAsSelectedWallet || + isNonSeedWallet; }); if (shouldExcludeGroup) continue; diff --git a/lib/view_model/wallet_list/wallet_edit_view_model.dart b/lib/view_model/wallet_list/wallet_edit_view_model.dart index 343f160db..5379f1679 100644 --- a/lib/view_model/wallet_list/wallet_edit_view_model.dart +++ b/lib/view_model/wallet_list/wallet_edit_view_model.dart @@ -40,7 +40,7 @@ abstract class WalletEditViewModelBase with Store { Future<void> changeName( WalletListItem walletItem, { String? password, - String? groupParentAddress, + String? walletGroupKey, bool isWalletGroup = false, }) async { state = WalletEditRenamePending(); @@ -48,7 +48,7 @@ abstract class WalletEditViewModelBase with Store { if (isWalletGroup) { _walletManager.updateWalletGroups(); - _walletManager.setGroupName(groupParentAddress!, newName); + _walletManager.setGroupName(walletGroupKey!, newName); } else { await _walletLoadingService.renameWallet( walletItem.type, diff --git a/lib/view_model/wallet_new_vm.dart b/lib/view_model/wallet_new_vm.dart index aa933eadc..0cd730028 100644 --- a/lib/view_model/wallet_new_vm.dart +++ b/lib/view_model/wallet_new_vm.dart @@ -109,7 +109,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { password: walletPassword, passphrase: passphrase, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, ); case WalletType.haven: return haven!.createHavenNewWalletCredentials( @@ -119,7 +118,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { name: name, password: walletPassword, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, passphrase: passphrase, ); case WalletType.bitcoinCash: @@ -128,7 +126,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { password: walletPassword, passphrase: passphrase, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, ); case WalletType.nano: case WalletType.banano: @@ -136,7 +133,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { name: name, password: walletPassword, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, passphrase: passphrase, ); case WalletType.polygon: @@ -144,7 +140,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { name: name, password: walletPassword, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, passphrase: passphrase, ); case WalletType.solana: @@ -152,7 +147,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { name: name, password: walletPassword, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, passphrase: passphrase, ); case WalletType.tron: @@ -160,7 +154,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { name: name, password: walletPassword, mnemonic: newWalletArguments!.mnemonic, - parentAddress: newWalletArguments!.parentAddress, passphrase: passphrase, ); case WalletType.wownero: diff --git a/lib/view_model/wallet_restore_view_model.dart b/lib/view_model/wallet_restore_view_model.dart index 8a497a605..3e5220447 100644 --- a/lib/view_model/wallet_restore_view_model.dart +++ b/lib/view_model/wallet_restore_view_model.dart @@ -67,7 +67,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { availableModes = [WalletRestoreMode.seed]; break; } - isButtonEnabled = !hasSeedLanguageSelector && !hasBlockchainHeightLanguageSelector; walletCreationService.changeWalletType(type: type); } diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 0b6f32fd6..a87e938f3 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -119,9 +119,6 @@ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/monero_c/release/monero/${ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/monero_c/release/wownero/${LIB_TRIPLET}_libwallet2_api_c.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" RENAME "wownero_libwallet2_api_c.so" COMPONENT Runtime) -install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/monero_c/release/zano/${LIB_TRIPLET}_libwallet2_api_c.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" RENAME "zano_libwallet2_api_c.so" - COMPONENT Runtime) - install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) diff --git a/res/values/strings_ar.arb b/res/values/strings_ar.arb index 2a78edd10..b67cc174a 100644 --- a/res/values/strings_ar.arb +++ b/res/values/strings_ar.arb @@ -229,6 +229,7 @@ "disable_buy": "تعطيل إجراء الشراء", "disable_cake_2fa": "تعطيل 2 عامل المصادقة", "disable_exchange": "تعطيل التبادل", + "disable_exchange_option": "تعطيل خيار التبادل", "disable_fee_api_warning": "من خلال إيقاف تشغيل هذا ، قد تكون معدلات الرسوم غير دقيقة في بعض الحالات ، لذلك قد ينتهي بك الأمر إلى دفع مبالغ زائدة أو دفع رسوم المعاملات الخاصة بك", "disable_fiat": "تعطيل fiat", "disable_sell": "قم بتعطيل إجراء البيع", @@ -396,6 +397,7 @@ "light_theme": "فاتح", "litecoin_enable_mweb_sync": "تمكين MWEB المسح الضوئي", "litecoin_mweb": "mweb", + "litecoin_mweb_allow_coins": "السماح للعملات المعدنية MWEB", "litecoin_mweb_always_scan": "اضبط MWEB دائمًا على المسح الضوئي", "litecoin_mweb_description": "MWEB هو بروتوكول جديد يجلب معاملات أسرع وأرخص وأكثر خصوصية إلى Litecoin", "litecoin_mweb_dismiss": "رفض", diff --git a/res/values/strings_bg.arb b/res/values/strings_bg.arb index b09b8a746..0225a1797 100644 --- a/res/values/strings_bg.arb +++ b/res/values/strings_bg.arb @@ -229,6 +229,7 @@ "disable_buy": "Деактивирайте действието за покупка", "disable_cake_2fa": "Деактивирайте Cake 2FA", "disable_exchange": "Деактивиране на борса", + "disable_exchange_option": "Опция за деактивиране на обмен", "disable_fee_api_warning": "Като изключите това, таксите могат да бъдат неточни в някои случаи, така че може да се препланите или да не плащате таксите за вашите транзакции", "disable_fiat": "Деактивиране на fiat", "disable_sell": "Деактивирайте действието за продажба", @@ -396,6 +397,7 @@ "light_theme": "Светло", "litecoin_enable_mweb_sync": "Активирайте сканирането на MWeb", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Позволете на MWeb монети", "litecoin_mweb_always_scan": "Задайте MWeb винаги сканиране", "litecoin_mweb_description": "MWeb е нов протокол, който носи по -бърз, по -евтин и повече частни транзакции на Litecoin", "litecoin_mweb_dismiss": "Уволнение", diff --git a/res/values/strings_cs.arb b/res/values/strings_cs.arb index faf6d6d4d..8e2b0d0d1 100644 --- a/res/values/strings_cs.arb +++ b/res/values/strings_cs.arb @@ -229,6 +229,7 @@ "disable_buy": "Zakázat akci nákupu", "disable_cake_2fa": "Zakázat Cake 2FA", "disable_exchange": "Zakázat směnárny", + "disable_exchange_option": "Zakázat možnost výměny", "disable_fee_api_warning": "Tímto vypnutím by sazby poplatků mohly být v některých případech nepřesné, takže byste mohli skončit přepláváním nebo nedoplatkem poplatků za vaše transakce", "disable_fiat": "Zakázat fiat", "disable_sell": "Zakázat akci prodeje", @@ -396,6 +397,7 @@ "light_theme": "Světlý", "litecoin_enable_mweb_sync": "Povolit skenování MWeb", "litecoin_mweb": "MWeb", + "litecoin_mweb_allow_coins": "Povolte mweb mince", "litecoin_mweb_always_scan": "Nastavit MWeb vždy skenování", "litecoin_mweb_description": "MWEB je nový protokol, který do Litecoin přináší rychlejší, levnější a více soukromých transakcí", "litecoin_mweb_dismiss": "Propustit", diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 68dfd71e2..a6377a815 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -229,6 +229,7 @@ "disable_buy": "Kaufaktion deaktivieren", "disable_cake_2fa": "Cake 2FA deaktivieren", "disable_exchange": "Exchange deaktivieren", + "disable_exchange_option": "Deaktivieren Sie die Exchange -Option", "disable_fee_api_warning": "Wenn dies ausgeschaltet wird, sind die Gebührenquoten in einigen Fällen möglicherweise ungenau, sodass Sie die Gebühren für Ihre Transaktionen möglicherweise überbezahlt oder unterzahlt", "disable_fiat": "Fiat deaktivieren", "disable_sell": "Verkaufsaktion deaktivieren", @@ -396,6 +397,7 @@ "light_theme": "Hell", "litecoin_enable_mweb_sync": "Aktivieren Sie das MWEB-Scannen", "litecoin_mweb": "MWeb", + "litecoin_mweb_allow_coins": "MWEB -Münzen zulassen", "litecoin_mweb_always_scan": "Setzen Sie MWeb immer scannen", "litecoin_mweb_description": "MWWB ist ein neues Protokoll, das schnellere, billigere und privatere Transaktionen zu Litecoin bringt", "litecoin_mweb_dismiss": "Zurückweisen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index d7806a983..1d2383181 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -229,6 +229,7 @@ "disable_buy": "Disable buy action", "disable_cake_2fa": "Disable Cake 2FA", "disable_exchange": "Disable exchange", + "disable_exchange_option": "Disable Exchange option", "disable_fee_api_warning": "By turning this off, the fee rates might be inaccurate in some cases, so you might end up overpaying or underpaying the fees for your transactions", "disable_fiat": "Disable fiat", "disable_sell": "Disable sell action", @@ -396,6 +397,7 @@ "light_theme": "Light", "litecoin_enable_mweb_sync": "Enable MWEB scanning", "litecoin_mweb": "MWEB", + "litecoin_mweb_allow_coins": "Allow MWEB coins", "litecoin_mweb_always_scan": "Set MWEB always scanning", "litecoin_mweb_description": "MWEB is a new protocol that brings faster, cheaper, and more private transactions to Litecoin", "litecoin_mweb_dismiss": "Dismiss", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 64da3790c..d3bb6d350 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -229,6 +229,7 @@ "disable_buy": "Desactivar acción de compra", "disable_cake_2fa": "Desactivar 2FA", "disable_exchange": "Deshabilitar intercambio", + "disable_exchange_option": "Deshabilitar la opción de intercambio", "disable_fee_api_warning": "Al apagar esto, las tasas de tarifas pueden ser inexactas en algunos casos, por lo que puede terminar pagando en exceso o pagando menos las tarifas por sus transacciones", "disable_fiat": "Deshabilitar fiat", "disable_sell": "Desactivar acción de venta", @@ -396,6 +397,7 @@ "light_theme": "Ligero", "litecoin_enable_mweb_sync": "Habilitar el escaneo mweb", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Permitir monedas mweb", "litecoin_mweb_always_scan": "Establecer mweb siempre escaneo", "litecoin_mweb_description": "Mweb es un nuevo protocolo que trae transacciones más rápidas, más baratas y más privadas a Litecoin", "litecoin_mweb_dismiss": "Despedir", diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 15ba11c7d..9c8a6674f 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -229,6 +229,7 @@ "disable_buy": "Désactiver l'action d'achat", "disable_cake_2fa": "Désactiver Cake 2FA", "disable_exchange": "Désactiver l'échange", + "disable_exchange_option": "Désactiver l'option d'échange", "disable_fee_api_warning": "En désactivant cela, les taux de frais peuvent être inexacts dans certains cas, vous pourriez donc finir par payer trop ou sous-paiement les frais pour vos transactions", "disable_fiat": "Désactiver les montants en fiat", "disable_sell": "Désactiver l'action de vente", @@ -396,6 +397,7 @@ "light_theme": "Clair", "litecoin_enable_mweb_sync": "Activer la numérisation MWEB", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Autoriser les pièces MWeb", "litecoin_mweb_always_scan": "Définir MWEB Score Scanning", "litecoin_mweb_description": "MWEB est un nouveau protocole qui apporte des transactions plus rapides, moins chères et plus privées à Litecoin", "litecoin_mweb_dismiss": "Rejeter", diff --git a/res/values/strings_ha.arb b/res/values/strings_ha.arb index 1419626b0..5f6d724ca 100644 --- a/res/values/strings_ha.arb +++ b/res/values/strings_ha.arb @@ -229,6 +229,7 @@ "disable_buy": "Kashe alama", "disable_cake_2fa": "Musaki Cake 2FA", "disable_exchange": "Kashe musanya", + "disable_exchange_option": "Musaki zaɓi Canji", "disable_fee_api_warning": "Ta hanyar juya wannan kashe, kudaden da zai iya zama ba daidai ba a wasu halaye, saboda haka zaku iya ƙare da overpaying ko a ƙarƙashin kudaden don ma'amaloli", "disable_fiat": "Dakatar da fiat", "disable_sell": "Kashe karbuwa", @@ -396,6 +397,7 @@ "light_theme": "Haske", "litecoin_enable_mweb_sync": "Kunna binciken Mweb", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Bada izinin Coins na Mweb", "litecoin_mweb_always_scan": "Saita Mweb koyaushe", "litecoin_mweb_description": "Mweb shine sabon tsarin yarjejeniya da ya kawo da sauri, mai rahusa, da kuma ma'amaloli masu zaman kansu zuwa Litecoin", "litecoin_mweb_dismiss": "Tuɓe \\ sallama", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index f9eda8a8f..844df046f 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -229,6 +229,7 @@ "disable_buy": "खरीद कार्रवाई अक्षम करें", "disable_cake_2fa": "केक 2FA अक्षम करें", "disable_exchange": "एक्सचेंज अक्षम करें", + "disable_exchange_option": "विनिमय विकल्प अक्षम करें", "disable_fee_api_warning": "इसे बंद करने से, कुछ मामलों में शुल्क दरें गलत हो सकती हैं, इसलिए आप अपने लेनदेन के लिए फीस को कम कर सकते हैं या कम कर सकते हैं", "disable_fiat": "िएट को अक्षम करें", "disable_sell": "बेचने की कार्रवाई अक्षम करें", @@ -396,6 +397,7 @@ "light_theme": "रोशनी", "litecoin_enable_mweb_sync": "MWEB स्कैनिंग सक्षम करें", "litecoin_mweb": "मावली", + "litecoin_mweb_allow_coins": "MWEB सिक्कों की अनुमति दें", "litecoin_mweb_always_scan": "MWEB हमेशा स्कैनिंग सेट करें", "litecoin_mweb_description": "MWEB एक नया प्रोटोकॉल है जो लिटकोइन के लिए तेजी से, सस्ता और अधिक निजी लेनदेन लाता है", "litecoin_mweb_dismiss": "नकार देना", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index d080a61c6..1369d67cc 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -229,6 +229,7 @@ "disable_buy": "Onemogući kupnju", "disable_cake_2fa": "Onemogući Cake 2FA", "disable_exchange": "Onemogući exchange", + "disable_exchange_option": "Onemogući opciju razmjene", "disable_fee_api_warning": "Isključivanjem ovoga, stope naknade u nekim bi slučajevima mogle biti netočne, tako da biste mogli preplatiti ili predati naknadu za vaše transakcije", "disable_fiat": "Isključi, fiat", "disable_sell": "Onemogući akciju prodaje", @@ -396,6 +397,7 @@ "light_theme": "Svijetla", "litecoin_enable_mweb_sync": "Omogućite MWEB skeniranje", "litecoin_mweb": "MWeb", + "litecoin_mweb_allow_coins": "Dopustite MWeb kovanice", "litecoin_mweb_always_scan": "Postavite MWeb uvijek skeniranje", "litecoin_mweb_description": "MWEB je novi protokol koji u Litecoin donosi brže, jeftinije i privatnije transakcije", "litecoin_mweb_dismiss": "Odbaciti", diff --git a/res/values/strings_hy.arb b/res/values/strings_hy.arb index 270c94215..b88033c2b 100644 --- a/res/values/strings_hy.arb +++ b/res/values/strings_hy.arb @@ -229,6 +229,7 @@ "disable_buy": "Անջատել գնում գործողությունը", "disable_cake_2fa": "Անջատել Cake 2FA", "disable_exchange": "Անջատել փոխանակումը", + "disable_exchange_option": "Անջատեք փոխանակման տարբերակը", "disable_fee_api_warning": "Դրանից անջատելով, վճարների տեմպերը որոշ դեպքերում կարող են անճիշտ լինել, այնպես որ դուք կարող եք վերջ տալ ձեր գործարքների համար վճարների գերավճարների կամ գերավճարների վրա", "disable_fiat": "Անջատել ֆիատ", "disable_sell": "Անջատել վաճառք գործողությունը", @@ -396,6 +397,7 @@ "light_theme": "Լուսավոր", "litecoin_enable_mweb_sync": "Միացնել MWEB սկան", "litecoin_mweb": "Մուեբ", + "litecoin_mweb_allow_coins": "Թույլ տվեք MWeb մետաղադրամներ", "litecoin_mweb_always_scan": "Սահմանեք Mweb Միշտ սկանավորում", "litecoin_mweb_description": "Mweb- ը նոր արձանագրություն է, որը բերում է ավելի արագ, ավելի էժան եւ ավելի մասնավոր գործարքներ դեպի LITECOIN", "litecoin_mweb_dismiss": "Հեռացնել", diff --git a/res/values/strings_id.arb b/res/values/strings_id.arb index 9ecc2f0ed..b006f9ced 100644 --- a/res/values/strings_id.arb +++ b/res/values/strings_id.arb @@ -229,6 +229,7 @@ "disable_buy": "Nonaktifkan tindakan beli", "disable_cake_2fa": "Nonaktifkan Kue 2FA", "disable_exchange": "Nonaktifkan pertukaran", + "disable_exchange_option": "Nonaktifkan opsi pertukaran", "disable_fee_api_warning": "Dengan mematikan ini, tarif biaya mungkin tidak akurat dalam beberapa kasus, jadi Anda mungkin akan membayar lebih atau membayar biaya untuk transaksi Anda", "disable_fiat": "Nonaktifkan fiat", "disable_sell": "Nonaktifkan aksi jual", @@ -396,6 +397,7 @@ "light_theme": "Terang", "litecoin_enable_mweb_sync": "Aktifkan pemindaian MWEB", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Izinkan koin mWeb", "litecoin_mweb_always_scan": "Atur mWeb selalu memindai", "litecoin_mweb_description": "MWEB adalah protokol baru yang membawa transaksi yang lebih cepat, lebih murah, dan lebih pribadi ke Litecoin", "litecoin_mweb_dismiss": "Membubarkan", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index f174ef134..15779aa55 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -229,6 +229,7 @@ "disable_buy": "Disabilita l'azione di acquisto", "disable_cake_2fa": "Disabilita Cake 2FA", "disable_exchange": "Disabilita scambio", + "disable_exchange_option": "Disabilita l'opzione di scambio", "disable_fee_api_warning": "Disattivando quest'opzione, i tassi delle commissioni potrebbero essere inaccurati in alcuni casi, quindi potresti finire per pagare troppo o troppo poco le commissioni per le tue transazioni", "disable_fiat": "Disabilita fiat", "disable_sell": "Disabilita l'azione di vendita", @@ -396,6 +397,7 @@ "light_theme": "Chiaro", "litecoin_enable_mweb_sync": "Abilita la scansione MWeb", "litecoin_mweb": "MWeb", + "litecoin_mweb_allow_coins": "Consenti monete mWeb", "litecoin_mweb_always_scan": "Imposta MWeb per scansionare sempre", "litecoin_mweb_description": "MWeb è un nuovo protocollo che porta transazioni più veloci, più economiche e più private a Litecoin", "litecoin_mweb_dismiss": "Chiudi", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index e83907c91..ac79df8f1 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -229,6 +229,7 @@ "disable_buy": "購入アクションを無効にする", "disable_cake_2fa": "Cake 2FA を無効にする", "disable_exchange": "交換を無効にする", + "disable_exchange_option": "交換オプションを無効にします", "disable_fee_api_warning": "これをオフにすることで、料金金利は場合によっては不正確になる可能性があるため、取引の費用が過払いまたは不足している可能性があります", "disable_fiat": "フィアットを無効にする", "disable_sell": "販売アクションを無効にする", @@ -397,6 +398,7 @@ "light_theme": "光", "litecoin_enable_mweb_sync": "MWEBスキャンを有効にします", "litecoin_mweb": "mweb", + "litecoin_mweb_allow_coins": "MWEBコインを許可します", "litecoin_mweb_always_scan": "MWEBを常にスキャンします", "litecoin_mweb_description": "MWEBは、Litecoinにより速く、より安価で、よりプライベートなトランザクションをもたらす新しいプロトコルです", "litecoin_mweb_dismiss": "却下する", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 0150e7b3c..ec47d1404 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -229,6 +229,7 @@ "disable_buy": "구매 행동 비활성화", "disable_cake_2fa": "케이크 2FA 비활성화", "disable_exchange": "교환 비활성화", + "disable_exchange_option": "교환 옵션을 비활성화합니다", "disable_fee_api_warning": "이것을 끄면 경우에 따라 수수료가 부정확 할 수 있으므로 거래 수수료를 초과 지불하거나 지불 할 수 있습니다.", "disable_fiat": "법정화폐 비활성화", "disable_sell": "판매 조치 비활성화", @@ -396,6 +397,7 @@ "light_theme": "빛", "litecoin_enable_mweb_sync": "mweb 스캔을 활성화합니다", "litecoin_mweb": "mweb", + "litecoin_mweb_allow_coins": "mweb 코인을 허용하십시오", "litecoin_mweb_always_scan": "mweb는 항상 스캔을 설정합니다", "litecoin_mweb_description": "MWEB는 Litecoin에 더 빠르고 저렴하며 개인 거래를 제공하는 새로운 프로토콜입니다.", "litecoin_mweb_dismiss": "해고하다", diff --git a/res/values/strings_my.arb b/res/values/strings_my.arb index 6b5ee65c7..a0c8069fb 100644 --- a/res/values/strings_my.arb +++ b/res/values/strings_my.arb @@ -229,6 +229,7 @@ "disable_buy": "ဝယ်ယူမှု လုပ်ဆောင်ချက်ကို ပိတ်ပါ။", "disable_cake_2fa": "ကိတ်မုန့် 2FA ကို ပိတ်ပါ။", "disable_exchange": "လဲလှယ်မှုကို ပိတ်ပါ။", + "disable_exchange_option": "ငွေလဲရွေး option ကိုပိတ်ပါ", "disable_fee_api_warning": "ဤအရာကိုဖွင့်ခြင်းအားဖြင့်အချို့သောကိစ္စရပ်များတွင်အခကြေးငွေနှုန်းထားများသည်တိကျမှုရှိနိုင်သည်,", "disable_fiat": "Fiat ကိုပိတ်ပါ။", "disable_sell": "ရောင်းချခြင်းလုပ်ဆောင်ချက်ကို ပိတ်ပါ။", @@ -396,6 +397,7 @@ "light_theme": "အလင်း", "litecoin_enable_mweb_sync": "mweb scanning ဖွင့်ပါ", "litecoin_mweb": "မင်္ဂလာပါ", + "litecoin_mweb_allow_coins": "mweb ဒင်္ဂါးများကိုခွင့်ပြုပါ", "litecoin_mweb_always_scan": "Mweb အမြဲစကင်ဖတ်စစ်ဆေးပါ", "litecoin_mweb_description": "Mweb သည် Protocol အသစ်ဖြစ်ပြီး LitCoin သို့ပိုမိုဈေးချိုသာသော, စျေးသက်သက်သာသာသုံးခြင်းနှင့်ပိုမိုများပြားသောပုဂ္ဂလိကငွေပို့ဆောင်မှုများကိုဖြစ်ပေါ်စေသည်", "litecoin_mweb_dismiss": "ထုတ်ပစ်", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 24bea5cfe..13615676e 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -229,6 +229,7 @@ "disable_buy": "Koopactie uitschakelen", "disable_cake_2fa": "Taart 2FA uitschakelen", "disable_exchange": "Uitwisseling uitschakelen", + "disable_exchange_option": "Schakel Exchange -optie uit", "disable_fee_api_warning": "Door dit uit te schakelen, kunnen de tarieven in sommige gevallen onnauwkeurig zijn, dus u kunt de vergoedingen voor uw transacties te veel betalen of te weinig betalen", "disable_fiat": "Schakel Fiat uit", "disable_sell": "Verkoopactie uitschakelen", @@ -396,6 +397,7 @@ "light_theme": "Licht", "litecoin_enable_mweb_sync": "MWEB -scanning inschakelen", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Sta mweb munten toe", "litecoin_mweb_always_scan": "Stel mweb altijd op scannen", "litecoin_mweb_description": "MWEB is een nieuw protocol dat snellere, goedkopere en meer privé -transacties naar Litecoin brengt", "litecoin_mweb_dismiss": "Afwijzen", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index f849bb37b..b582ce3c4 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -229,6 +229,7 @@ "disable_buy": "Wyłącz akcję kupna", "disable_cake_2fa": "Wyłącz Cake 2FA", "disable_exchange": "Wyłącz wymianę", + "disable_exchange_option": "Wyłącz opcję wymiany", "disable_fee_api_warning": "Wyłączając to, stawki opłaty mogą być w niektórych przypadkach niedokładne, więc możesz skończyć się przepłaceniem lub wynagrodzeniem opłat za transakcje", "disable_fiat": "Wyłącz waluty FIAT", "disable_sell": "Wyłącz akcję sprzedaży", @@ -396,6 +397,7 @@ "light_theme": "Jasny", "litecoin_enable_mweb_sync": "Włącz skanowanie MWEB", "litecoin_mweb": "MWEB", + "litecoin_mweb_allow_coins": "Zezwalaj na monety MWEB", "litecoin_mweb_always_scan": "Ustaw MWEB zawsze skanowanie", "litecoin_mweb_description": "MWEB to nowy protokół, który przynosi szybciej, tańsze i bardziej prywatne transakcje do Litecoin", "litecoin_mweb_dismiss": "Odrzucać", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index a5ac640e4..cf7415dce 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -229,6 +229,7 @@ "disable_buy": "Desativar ação de compra", "disable_cake_2fa": "Desabilitar o Cake 2FA", "disable_exchange": "Desativar troca", + "disable_exchange_option": "Desativar opção de troca", "disable_fee_api_warning": "Ao desativar isso, as taxas de taxas podem ser imprecisas em alguns casos, para que você possa acabar pagando demais ou pagando as taxas por suas transações", "disable_fiat": "Desativar fiat", "disable_sell": "Desativar ação de venda", @@ -396,6 +397,7 @@ "light_theme": "Luz", "litecoin_enable_mweb_sync": "Ativar digitalização do MWEB", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Permitir moedas MWEB", "litecoin_mweb_always_scan": "Definir mweb sempre digitalizando", "litecoin_mweb_description": "MWEB é um novo protocolo que traz transações mais rápidas, baratas e mais privadas para o Litecoin", "litecoin_mweb_dismiss": "Liberar", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index f8c6f2cef..28e72625f 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -229,6 +229,7 @@ "disable_buy": "Отключить действие покупки", "disable_cake_2fa": "Отключить торт 2FA", "disable_exchange": "Отключить обмен", + "disable_exchange_option": "Отключить вариант обмена", "disable_fee_api_warning": "Выключив это, в некоторых случаях ставки платы могут быть неточными, так что вы можете в конечном итоге переплачивать или недоплачивать сборы за ваши транзакции", "disable_fiat": "Отключить фиат", "disable_sell": "Отключить действие продажи", @@ -396,6 +397,7 @@ "light_theme": "Светлая", "litecoin_enable_mweb_sync": "Включить MWEB сканирование", "litecoin_mweb": "Мвеб", + "litecoin_mweb_allow_coins": "Разрешить монеты MWEB", "litecoin_mweb_always_scan": "Установить MWEB всегда сканирование", "litecoin_mweb_description": "MWEB - это новый протокол, который приносит быстрее, дешевле и более частные транзакции в Litecoin", "litecoin_mweb_dismiss": "Увольнять", diff --git a/res/values/strings_th.arb b/res/values/strings_th.arb index 49af9b089..f9538bee6 100644 --- a/res/values/strings_th.arb +++ b/res/values/strings_th.arb @@ -229,6 +229,7 @@ "disable_buy": "ปิดการใช้งานการซื้อ", "disable_cake_2fa": "ปิดการใช้งานเค้ก 2FA", "disable_exchange": "ปิดใช้งานการแลกเปลี่ยน", + "disable_exchange_option": "ปิดการใช้งานตัวเลือกการแลกเปลี่ยน", "disable_fee_api_warning": "โดยการปิดสิ่งนี้อัตราค่าธรรมเนียมอาจไม่ถูกต้องในบางกรณีดังนั้นคุณอาจจบลงด้วยการจ่ายเงินมากเกินไปหรือจ่ายค่าธรรมเนียมสำหรับการทำธุรกรรมของคุณมากเกินไป", "disable_fiat": "ปิดใช้งานสกุลเงินตรา", "disable_sell": "ปิดการใช้งานการขาย", @@ -396,6 +397,7 @@ "light_theme": "สว่าง", "litecoin_enable_mweb_sync": "เปิดใช้งานการสแกน MWEB", "litecoin_mweb": "mweb", + "litecoin_mweb_allow_coins": "อนุญาตให้เหรียญ MWEB", "litecoin_mweb_always_scan": "ตั้งค่าการสแกน MWEB เสมอ", "litecoin_mweb_description": "MWEB เป็นโปรโตคอลใหม่ที่นำการทำธุรกรรมที่เร็วกว่าราคาถูกกว่าและเป็นส่วนตัวมากขึ้นไปยัง Litecoin", "litecoin_mweb_dismiss": "อนุญาตให้ออกไป", diff --git a/res/values/strings_tl.arb b/res/values/strings_tl.arb index 98689c570..7f39864ef 100644 --- a/res/values/strings_tl.arb +++ b/res/values/strings_tl.arb @@ -229,6 +229,7 @@ "disable_buy": "Huwag paganahin ang pagkilos ng pagbili", "disable_cake_2fa": "Huwag paganahin ang Cake 2FA", "disable_exchange": "Huwag paganahin ang palitan", + "disable_exchange_option": "Huwag paganahin ang pagpipilian sa palitan", "disable_fee_api_warning": "Sa pamamagitan ng pag -off nito, ang mga rate ng bayad ay maaaring hindi tumpak sa ilang mga kaso, kaya maaari mong tapusin ang labis na bayad o pagsuporta sa mga bayarin para sa iyong mga transaksyon", "disable_fiat": "Huwag paganahin ang fiat", "disable_sell": "Huwag paganahin ang pagkilos ng pagbebenta", @@ -396,6 +397,7 @@ "light_theme": "Light", "litecoin_enable_mweb_sync": "Paganahin ang pag -scan ng MWeb", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Payagan ang mga barya ng MWEB", "litecoin_mweb_always_scan": "Itakda ang MWeb na laging nag -scan", "litecoin_mweb_description": "Ang MWeb ay isang bagong protocol na nagdadala ng mas mabilis, mas mura, at mas maraming pribadong mga transaksyon sa Litecoin", "litecoin_mweb_dismiss": "Tanggalin", diff --git a/res/values/strings_tr.arb b/res/values/strings_tr.arb index e777823ec..2e686817b 100644 --- a/res/values/strings_tr.arb +++ b/res/values/strings_tr.arb @@ -229,6 +229,7 @@ "disable_buy": "Satın alma işlemini devre dışı bırak", "disable_cake_2fa": "Cake 2FA'yı Devre Dışı Bırak", "disable_exchange": "Borsayı devre dışı bırak", + "disable_exchange_option": "Değişim seçeneğini devre dışı bırak", "disable_fee_api_warning": "Bunu kapatarak, ücret oranları bazı durumlarda yanlış olabilir, bu nedenle işlemleriniz için ücretleri fazla ödeyebilir veya az ödeyebilirsiniz.", "disable_fiat": "İtibari paraları devre dışı bırak", "disable_sell": "Satış işlemini devre dışı bırak", @@ -396,6 +397,7 @@ "light_theme": "Aydınlık", "litecoin_enable_mweb_sync": "MWEB taramasını etkinleştir", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "MWEB Coins'e izin ver", "litecoin_mweb_always_scan": "MWEB'i her zaman taramayı ayarlayın", "litecoin_mweb_description": "MWEB, Litecoin'e daha hızlı, daha ucuz ve daha fazla özel işlem getiren yeni bir protokoldür", "litecoin_mweb_dismiss": "Azletmek", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index b52c0299c..3e97e6080 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -229,6 +229,7 @@ "disable_buy": "Вимкнути дію покупки", "disable_cake_2fa": "Вимкнути Cake 2FA", "disable_exchange": "Вимкнути можливість обміну", + "disable_exchange_option": "Вимкнути варіант обміну", "disable_fee_api_warning": "Вимкнувши це, ставки плати в деяких випадках можуть бути неточними, тому ви можете переплатити або недооплатити плату за свої транзакції", "disable_fiat": "Вимкнути фиат", "disable_sell": "Вимкнути дію продажу", @@ -396,6 +397,7 @@ "light_theme": "Світла", "litecoin_enable_mweb_sync": "Увімкнути сканування MWEB", "litecoin_mweb": "Мвеб", + "litecoin_mweb_allow_coins": "Дозволити монети MWEB", "litecoin_mweb_always_scan": "Встановити mweb завжди сканувати", "litecoin_mweb_description": "MWEB - це новий протокол, який приносить швидкі, дешевші та більш приватні транзакції Litecoin", "litecoin_mweb_dismiss": "Звільнити", diff --git a/res/values/strings_ur.arb b/res/values/strings_ur.arb index ba2197579..7a75f6a4a 100644 --- a/res/values/strings_ur.arb +++ b/res/values/strings_ur.arb @@ -229,6 +229,7 @@ "disable_buy": "خرید ایکشن کو غیر فعال کریں۔", "disable_cake_2fa": "کیک 2FA کو غیر فعال کریں۔", "disable_exchange": "تبادلے کو غیر فعال کریں۔", + "disable_exchange_option": "ایکسچینج آپشن کو غیر فعال کریں", "disable_fee_api_warning": "اس کو بند کرنے سے ، کچھ معاملات میں فیس کی شرح غلط ہوسکتی ہے ، لہذا آپ اپنے لین دین کے لئے فیسوں کو زیادہ ادائیگی یا ادائیگی ختم کرسکتے ہیں۔", "disable_fiat": "فیاٹ کو غیر فعال کریں۔", "disable_sell": "فروخت کی کارروائی کو غیر فعال کریں۔", @@ -396,6 +397,7 @@ "light_theme": "روشنی", "litecoin_enable_mweb_sync": "MWEB اسکیننگ کو فعال کریں", "litecoin_mweb": "MWEB", + "litecoin_mweb_allow_coins": "MWEB سکے کی اجازت دیں", "litecoin_mweb_always_scan": "MWEB ہمیشہ اسکیننگ سیٹ کریں", "litecoin_mweb_description": "MWEB ایک نیا پروٹوکول ہے جو لیٹیکوئن میں تیز ، سستا اور زیادہ نجی لین دین لاتا ہے", "litecoin_mweb_dismiss": "خارج", diff --git a/res/values/strings_vi.arb b/res/values/strings_vi.arb index 779b7d81f..b7bff9ed4 100644 --- a/res/values/strings_vi.arb +++ b/res/values/strings_vi.arb @@ -228,6 +228,7 @@ "disable_buy": "Vô hiệu hóa chức năng mua", "disable_cake_2fa": "Vô hiệu hóa 2FA Cake", "disable_exchange": "Vô hiệu hóa chức năng trao đổi", + "disable_exchange_option": "Tắt tùy chọn trao đổi", "disable_fee_api_warning": "Khi tắt chức năng này, tỉ lệ phí có thể không chính xác trong một số trường hợp, dẫn đến bạn trả quá hoặc không đủ phí cho giao dịch của mình.", "disable_fiat": "Vô hiệu hóa tiền tệ fiat", "disable_sell": "Vô hiệu hóa chức năng bán", @@ -395,6 +396,7 @@ "light_theme": "Chủ đề sáng", "litecoin_enable_mweb_sync": "Bật quét MWEB", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Cho phép tiền xu MWEB", "litecoin_mweb_always_scan": "Đặt MWEB luôn quét", "litecoin_mweb_description": "MWEB là một giao thức mới mang lại các giao dịch nhanh hơn, rẻ hơn và riêng tư hơn cho Litecoin", "litecoin_mweb_dismiss": "Miễn nhiệm", diff --git a/res/values/strings_yo.arb b/res/values/strings_yo.arb index 550a98b54..42f539135 100644 --- a/res/values/strings_yo.arb +++ b/res/values/strings_yo.arb @@ -229,6 +229,7 @@ "disable_buy": "Ko iṣọrọ ọja", "disable_cake_2fa": "Ko 2FA Cake sii", "disable_exchange": "Pa ilé pàṣípààrọ̀", + "disable_exchange_option": "Mu aṣayan paṣipaarọ", "disable_fee_api_warning": "Nipa yiyi eyi kuro, awọn oṣuwọn owo naa le jẹ aiṣe deede ni awọn ọrọ kan, nitorinaa o le pari apọju tabi awọn idiyele ti o ni agbara fun awọn iṣowo rẹ", "disable_fiat": "Pa owó tí ìjọba pàṣẹ wa lò", "disable_sell": "Ko iṣọrọ iṣọrọ", @@ -397,6 +398,7 @@ "light_theme": "Funfun bí eérú", "litecoin_enable_mweb_sync": "Mu mweb ọlọjẹ", "litecoin_mweb": "Mweb", + "litecoin_mweb_allow_coins": "Gba awọn owo Mweb gba", "litecoin_mweb_always_scan": "Ṣeto mweb nigbagbogbo n ṣayẹwo", "litecoin_mweb_description": "Mweb jẹ ilana ilana tuntun ti o mu iyara wa yiyara, din owo, ati awọn iṣowo ikọkọ diẹ sii si Livcoin", "litecoin_mweb_dismiss": "Tuka", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 415f38d22..c4b047962 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -229,6 +229,7 @@ "disable_buy": "禁用购买操作", "disable_cake_2fa": "禁用蛋糕 2FA", "disable_exchange": "禁用交换", + "disable_exchange_option": "禁用交换选项", "disable_fee_api_warning": "通过将其关闭,在某些情况下,收费率可能不准确,因此您最终可能会超额付款或支付交易费用", "disable_fiat": "禁用法令", "disable_sell": "禁用卖出操作", @@ -396,6 +397,7 @@ "light_theme": "艳丽", "litecoin_enable_mweb_sync": "启用MWEB扫描", "litecoin_mweb": "MWEB", + "litecoin_mweb_allow_coins": "允许MWEB硬币", "litecoin_mweb_always_scan": "设置MWEB总是扫描", "litecoin_mweb_description": "MWEB是一项新协议,它将更快,更便宜和更多的私人交易带给Litecoin", "litecoin_mweb_dismiss": "解雇", diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 8b1d46264..9419ae1c6 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.20.2" -MONERO_COM_BUILD_NUMBER=114 +MONERO_COM_VERSION="1.20.3" +MONERO_COM_BUILD_NUMBER=115 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_SCHEME="monero.com" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.23.2" -CAKEWALLET_BUILD_NUMBER=247 +CAKEWALLET_VERSION="4.23.3" +CAKEWALLET_BUILD_NUMBER=248 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_SCHEME="cakewallet" diff --git a/scripts/android/install_ndk.sh b/scripts/android/install_ndk.sh index ea131eb39..d6799dbd8 100755 --- a/scripts/android/install_ndk.sh +++ b/scripts/android/install_ndk.sh @@ -6,9 +6,9 @@ TOOLCHAIN_A32_DIR=${TOOLCHAIN_DIR}_aarch TOOLCHAIN_A64_DIR=${TOOLCHAIN_DIR}_aarch64 TOOLCHAIN_x86_DIR=${TOOLCHAIN_DIR}_i686 TOOLCHAIN_x86_64_DIR=${TOOLCHAIN_DIR}_x86_64 -ANDROID_NDK_SHA256="3f541adbd0330a9205ba12697f6d04ec90752c53d6b622101a2a8a856e816589" +ANDROID_NDK_SHA256="7a1302d9bfbc37d46be90b2285f4737508ffe08a346cf2424c5c6a744de2db22" - curl https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip -o ${ANDROID_NDK_ZIP} + curl https://dl.google.com/android/repository/android-ndk-r27c-linux.zip -o ${ANDROID_NDK_ZIP} echo $ANDROID_NDK_SHA256 $ANDROID_NDK_ZIP | sha256sum -c || exit 1 unzip $ANDROID_NDK_ZIP -d $WORKDIR diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index c6d3778f3..491b7d06a 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.20.2" -MONERO_COM_BUILD_NUMBER=112 +MONERO_COM_VERSION="1.20.3" +MONERO_COM_BUILD_NUMBER=113 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.23.2" -CAKEWALLET_BUILD_NUMBER=298 +CAKEWALLET_VERSION="4.23.3" +CAKEWALLET_BUILD_NUMBER=301 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" diff --git a/scripts/linux/app_env.sh b/scripts/linux/app_env.sh index 325d2b335..91ab2cdeb 100755 --- a/scripts/linux/app_env.sh +++ b/scripts/linux/app_env.sh @@ -14,8 +14,8 @@ if [ -n "$1" ]; then fi CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.13.2" -CAKEWALLET_BUILD_NUMBER=47 +CAKEWALLET_VERSION="1.13.3" +CAKEWALLET_BUILD_NUMBER=48 if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then echo "Wrong app type." diff --git a/scripts/linux/build_monero_all.sh b/scripts/linux/build_monero_all.sh index 7113d88ef..7948d87a1 100755 --- a/scripts/linux/build_monero_all.sh +++ b/scripts/linux/build_monero_all.sh @@ -7,7 +7,7 @@ cd "$(dirname "$0")" ../prepare_moneroc.sh -for COIN in monero wownero zano; +for COIN in monero wownero; do pushd ../monero_c for target in x86_64-linux-gnu # aarch64-linux-gnu diff --git a/scripts/macos/app_env.sh b/scripts/macos/app_env.sh index f554d4d01..234d07c66 100755 --- a/scripts/macos/app_env.sh +++ b/scripts/macos/app_env.sh @@ -16,13 +16,13 @@ if [ -n "$1" ]; then fi MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.10.2" -MONERO_COM_BUILD_NUMBER=44 +MONERO_COM_VERSION="1.10.3" +MONERO_COM_BUILD_NUMBER=45 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.16.2" -CAKEWALLET_BUILD_NUMBER=105 +CAKEWALLET_VERSION="1.16.3" +CAKEWALLET_BUILD_NUMBER=106 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then diff --git a/scripts/windows/build_exe_installer.iss b/scripts/windows/build_exe_installer.iss index b2dd60130..3fb0cd1aa 100644 --- a/scripts/windows/build_exe_installer.iss +++ b/scripts/windows/build_exe_installer.iss @@ -1,5 +1,5 @@ #define MyAppName "Cake Wallet" -#define MyAppVersion "0.4.2" +#define MyAppVersion "0.4.3" #define MyAppPublisher "Cake Labs LLC" #define MyAppURL "https://cakewallet.com/" #define MyAppExeName "CakeWallet.exe" diff --git a/tool/configure.dart b/tool/configure.dart index d0878020d..8157cb040 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -160,7 +160,7 @@ abstract class Bitcoin { String? passphrase, }); WalletCredentials createBitcoinRestoreWalletFromWIFCredentials({required String name, required String password, required String wif, WalletInfo? walletInfo}); - WalletCredentials createBitcoinNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? passphrase, String? mnemonic, String? parentAddress}); + WalletCredentials createBitcoinNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? passphrase, String? mnemonic}); WalletCredentials createBitcoinHardwareWalletCredentials({required String name, required HardwareAccountData accountData, WalletInfo? walletInfo}); List<String> getWordList(); Map<String, String> getWalletKeys(Object wallet); @@ -884,7 +884,7 @@ import 'package:eth_sig_util/util/utils.dart'; abstract class Ethereum { List<String> getEthereumWordList(String language); WalletService createEthereumWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); - WalletCredentials createEthereumNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase}); + WalletCredentials createEthereumNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? passphrase}); WalletCredentials createEthereumRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase}); WalletCredentials createEthereumRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); WalletCredentials createEthereumHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo}); @@ -991,7 +991,7 @@ import 'package:eth_sig_util/util/utils.dart'; abstract class Polygon { List<String> getPolygonWordList(String language); WalletService createPolygonWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); - WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase}); + WalletCredentials createPolygonNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? passphrase}); WalletCredentials createPolygonRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase}); WalletCredentials createPolygonRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); WalletCredentials createPolygonHardwareWalletCredentials({required String name, required HardwareAccountData hwAccountData, WalletInfo? walletInfo}); @@ -1079,7 +1079,7 @@ abstract class BitcoinCash { Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource, bool isDirect); WalletCredentials createBitcoinCashNewWalletCredentials( - {required String name, WalletInfo? walletInfo, String? password, String? passphrase, String? mnemonic, String? parentAddress}); + {required String name, WalletInfo? walletInfo, String? password, String? passphrase, String? mnemonic}); WalletCredentials createBitcoinCashRestoreWalletFromSeedCredentials( {required String name, required String mnemonic, required String password, String? passphrase}); @@ -1163,7 +1163,6 @@ abstract class Nano { required String name, String? password, String? mnemonic, - String? parentAddress, WalletInfo? walletInfo, String? passphrase, }); @@ -1283,7 +1282,7 @@ abstract class Solana { List<String> getSolanaWordList(String language); WalletService createSolanaWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); WalletCredentials createSolanaNewWalletCredentials( - {required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase}); + {required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? passphrase}); WalletCredentials createSolanaRestoreWalletFromSeedCredentials( {required String name, required String mnemonic, required String password, String? passphrase}); WalletCredentials createSolanaRestoreWalletFromPrivateKey( @@ -1371,7 +1370,7 @@ import 'package:cw_tron/default_tron_tokens.dart'; abstract class Tron { List<String> getTronWordList(String language); WalletService createTronWalletService(Box<WalletInfo> walletInfoSource, bool isDirect); - WalletCredentials createTronNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? parentAddress, String? passphrase}); + WalletCredentials createTronNewWalletCredentials({required String name, WalletInfo? walletInfo, String? password, String? mnemonic, String? passphrase}); WalletCredentials createTronRestoreWalletFromSeedCredentials({required String name, required String mnemonic, required String password, String? passphrase}); WalletCredentials createTronRestoreWalletFromPrivateKey({required String name, required String privateKey, required String password}); String getAddress(WalletBase wallet); diff --git a/tool/utils/secret_key.dart b/tool/utils/secret_key.dart index 48614900a..a8ebcc8cc 100644 --- a/tool/utils/secret_key.dart +++ b/tool/utils/secret_key.dart @@ -77,6 +77,8 @@ class SecretKey { SecretKey('moneroTestWalletBlockHeight', () => ''), SecretKey('chainflipApiKey', () => ''), SecretKey('chainflipAffiliateFee', () => ''), + SecretKey('kryptonimApiKey', () => ''), + SecretKey('walletGroupSalt', () => hex.encode(encrypt.Key.fromSecureRandom(16).bytes)), ]; static final evmChainsSecrets = [ @@ -88,6 +90,7 @@ class SecretKey { static final solanaSecrets = [ SecretKey('ankrApiKey', () => ''), + SecretKey('nowNodesApiKey', () => ''), SecretKey('chainStackApiKey', () => ''), ];