mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-04-27 11:04:45 +00:00
Merge remote-tracking branch 'origin/main' into CW-909-monero-background-sync-investigation
This commit is contained in:
commit
af5e3c477a
122 changed files with 2115 additions and 1493 deletions
.dockerignore
.github/workflows
Dockerfileassets
build-guide-linux.mdbuild-guide-win.mdcw_bitcoin/lib
cw_bitcoin_cash/lib/src
cw_core/lib
cw_evm/lib
cw_nano/lib
cw_polygon/lib
cw_solana/lib
cw_tron/lib
docs
howto-build-android.mdhowto-build-ios.mdhowto-build-macos.mdhowto-build-windows.mdios
lib
bitcoin
bitcoin_cash
buy
core
di.dartentities
default_settings_migration.darthash_wallet_identifier.dartprovider_types.dartwallet_edit_page_arguments.dartwallet_group.dartwallet_manager.dart
ethereum
exchange
main.dartnano
polygon
reactions
solana
src
screens
dashboard
new_wallet
send
settings
wallet
wallet_list
widgets
store/dashboard
tron
utils
view_model
linux
res/values
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
*
|
|
@ -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: |
|
||||
|
|
2
.github/workflows/pr_test_build_android.yml
vendored
2
.github/workflows/pr_test_build_android.yml
vendored
|
@ -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: |
|
||||
|
|
2
.github/workflows/pr_test_build_linux.yml
vendored
2
.github/workflows/pr_test_build_linux.yml
vendored
|
@ -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: |
|
||||
|
|
|
@ -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
|
BIN
assets/images/kryptonim_dark.png
Normal file
BIN
assets/images/kryptonim_dark.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 20 KiB |
BIN
assets/images/kryptonim_light.png
Normal file
BIN
assets/images/kryptonim_light.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 19 KiB |
|
@ -1,3 +1,3 @@
|
|||
Ledger fixes
|
||||
UI enhancements
|
||||
UI/UX enhancements
|
||||
Stability improvements
|
||||
Bug fixes
|
|
@ -1,5 +1,3 @@
|
|||
Zano enhancements
|
||||
Ethereum enhancements
|
||||
Ledger fixes
|
||||
UI enhancements
|
||||
UI/UX enhancements
|
||||
Stability improvements
|
||||
Bug fixes
|
|
@ -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.
|
|
@ -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.
|
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ?? '';
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ class EVMChainNewWalletCredentials extends WalletCredentials {
|
|||
required super.name,
|
||||
super.walletInfo,
|
||||
super.password,
|
||||
super.parentAddress,
|
||||
this.mnemonic,
|
||||
super.passphrase,
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
60
docs/builds/ANDROID.md
Normal file
60
docs/builds/ANDROID.md
Normal file
|
@ -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>
|
143
docs/builds/IOS.md
Normal file
143
docs/builds/IOS.md
Normal file
|
@ -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
|
||||
```
|
96
docs/builds/LINUX.md
Normal file
96
docs/builds/LINUX.md
Normal file
|
@ -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
|
||||
```
|
135
docs/builds/MACOS.md
Normal file
135
docs/builds/MACOS.md
Normal file
|
@ -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
|
||||
```
|
92
docs/builds/WINDOWS.md
Normal file
92
docs/builds/WINDOWS.md
Normal file
|
@ -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.
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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.
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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}]';
|
||||
}
|
||||
|
|
|
@ -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 = [
|
||||
|
|
222
lib/buy/kryptonim/kryptonim.dart
Normal file
222
lib/buy/kryptonim/kryptonim.dart
Normal file
|
@ -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 ?? '';
|
||||
}
|
||||
}
|
|
@ -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';
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
18
lib/di.dart
18
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(
|
||||
|
|
|
@ -401,6 +401,13 @@ Future<void> defaultSettingsMigration(
|
|||
enabled: false,
|
||||
);
|
||||
break;
|
||||
case 48:
|
||||
_changeExchangeProviderAvailability(
|
||||
sharedPreferences,
|
||||
providerName: "SwapTrade",
|
||||
enabled: true,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
21
lib/entities/hash_wallet_identifier.dart
Normal file
21
lib/entities/hash_wallet_identifier.dart
Normal file
|
@ -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();
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
secureStorage: secureStorage,
|
||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||
havenSeedStore: havenSeedStore,
|
||||
initialMigrationVersion: 47,
|
||||
initialMigrationVersion: 48,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -150,7 +150,6 @@ class WalletGroupsDisplayBody extends StatelessWidget {
|
|||
arguments: NewWalletArguments(
|
||||
type: walletGroupsDisplayViewModel.type,
|
||||
mnemonic: mnemonic,
|
||||
parentAddress: walletGroupsDisplayViewModel.parentAddress,
|
||||
isChildWallet: true,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
|||
editingWallet: wallet,
|
||||
isWalletGroup: true,
|
||||
groupName: groupName,
|
||||
parentAddress: group.parentAddress,
|
||||
walletGroupKey: group.groupKey,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
202
lib/src/widgets/adaptable_page_view.dart
Normal file
202
lib/src/widgets/adaptable_page_view.dart
Normal file
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 = '',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -67,7 +67,6 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
|
|||
availableModes = [WalletRestoreMode.seed];
|
||||
break;
|
||||
}
|
||||
isButtonEnabled = !hasSeedLanguageSelector && !hasBlockchainHeightLanguageSelector;
|
||||
walletCreationService.changeWalletType(type: type);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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": "رفض",
|
||||
|
|
|
@ -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": "Уволнение",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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": "नकार देना",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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": "Հեռացնել",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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": "却下する",
|
||||
|
|
|
@ -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": "해고하다",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue