mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +00:00
commit
9f0f94b29b
366 changed files with 18243 additions and 6356 deletions
22
.gitignore
vendored
22
.gitignore
vendored
|
@ -101,21 +101,7 @@ pubspec.yaml
|
||||||
# FVM Version Cache
|
# FVM Version Cache
|
||||||
.fvm/
|
.fvm/
|
||||||
|
|
||||||
android/app/src/main/jniLibs/arm64-v8a/libwownero_wallet2_api_c.so
|
scripts/linux/build/libsecret/subprojects/gi-docgen/.meson-subproject-wrap-hash.txt
|
||||||
android/app/src/main/jniLibs/arm64-v8a/libmonero_wallet2_api_c.so
|
|
||||||
android/app/src/main/jniLibs/armeabi-v7a/libmonero_wallet2_api_c.so
|
crypto_plugins/cs_monero/built_outputs
|
||||||
android/app/src/main/jniLibs/armeabi-v7a/libwownero_wallet2_api_c.so
|
crypto_plugins/cs_monero/build
|
||||||
android/app/src/main/jniLibs/x86_64/libmonero_wallet2_api_c.so
|
|
||||||
android/app/src/main/jniLibs/x86_64/libwownero_wallet2_api_c.so
|
|
||||||
macos/monero_wallet2_api_c.dylib
|
|
||||||
macos/wownero_wallet2_api_c.dylib
|
|
||||||
/macos/monero_libwallet2_api_c.dylib
|
|
||||||
/macos/wownero_libwallet2_api_c.dylib
|
|
||||||
/ios/monero_libwallet2_api_c.dylib
|
|
||||||
/ios/wownero_libwallet2_api_c.dylib
|
|
||||||
/android/app/src/main/jniLibs/arm64-v8a/libmonero_libwallet2_api_c.so
|
|
||||||
/android/app/src/main/jniLibs/armeabi-v7a/libmonero_libwallet2_api_c.so
|
|
||||||
/android/app/src/main/jniLibs/x86_64/libmonero_libwallet2_api_c.so
|
|
||||||
/android/app/src/main/jniLibs/arm64-v8a/libwownero_libwallet2_api_c.so
|
|
||||||
/android/app/src/main/jniLibs/armeabi-v7a/libwownero_libwallet2_api_c.so
|
|
||||||
/android/app/src/main/jniLibs/x86_64/libwownero_libwallet2_api_c.so
|
|
||||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,9 +1,6 @@
|
||||||
[submodule "crypto_plugins/flutter_libepiccash"]
|
[submodule "crypto_plugins/flutter_libepiccash"]
|
||||||
path = crypto_plugins/flutter_libepiccash
|
path = crypto_plugins/flutter_libepiccash
|
||||||
url = https://github.com/cypherstack/flutter_libepiccash.git
|
url = https://github.com/cypherstack/flutter_libepiccash.git
|
||||||
[submodule "crypto_plugins/flutter_libmonero"]
|
|
||||||
path = crypto_plugins/flutter_libmonero
|
|
||||||
url = https://github.com/cypherstack/flutter_libmonero.git
|
|
||||||
[submodule "crypto_plugins/flutter_liblelantus"]
|
[submodule "crypto_plugins/flutter_liblelantus"]
|
||||||
path = crypto_plugins/flutter_liblelantus
|
path = crypto_plugins/flutter_liblelantus
|
||||||
url = https://github.com/cypherstack/flutter_liblelantus.git
|
url = https://github.com/cypherstack/flutter_liblelantus.git
|
||||||
|
|
|
@ -1,16 +1,3 @@
|
||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.8.0'
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
@ -18,12 +5,12 @@ allprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.buildDir = '../build'
|
rootProject.buildDir = "../build"
|
||||||
subprojects {
|
subprojects {
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
subprojects {
|
subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(":app")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("clean", Delete) {
|
tasks.register("clean", Delete) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G
|
||||||
android.enableR8=true
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
|
@ -1,6 +1,5 @@
|
||||||
#Fri Jun 23 08:50:38 CEST 2017
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
def properties = new Properties()
|
|
||||||
|
|
||||||
assert localPropertiesFile.exists()
|
repositories {
|
||||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
plugins {
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
id "com.android.application" version '8.6.0' apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
asset_sources/svg/campfire/churn.svg
Normal file
3
asset_sources/svg/campfire/churn.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M9.77444 13.4823C9.60687 13.4092 9.43072 13.3749 9.25027 13.3749H3.75081C2.99076 13.3749 2.37594 13.9897 2.37594 14.7497C2.37594 15.5098 2.99076 16.1246 3.75081 16.1246H5.93126L1.40279 20.6531C0.865736 21.1901 0.865736 22.0602 1.40279 22.5972C1.93985 23.1343 2.80988 23.1343 3.34694 22.5972L7.8754 18.0709V20.2492C7.8754 21.0092 8.49023 21.6241 9.25027 21.6241C10.0103 21.6241 10.6251 21.0092 10.6251 20.2492V14.7497C10.6251 14.5708 10.5887 14.3926 10.5192 14.2247C10.3802 13.8861 10.1139 13.6198 9.77444 13.4823ZM14.2256 10.5177C14.3931 10.5908 14.5693 10.6251 14.7497 10.6251H20.2492C21.0092 10.6251 21.6241 10.0103 21.6241 9.25027C21.6241 8.49023 21.0092 7.8754 20.2492 7.8754H18.0687L22.5972 3.34694C23.1343 2.80988 23.1343 1.93985 22.5972 1.40279C22.0606 0.866166 21.1905 0.865306 20.6531 1.40279L16.1246 5.93341V3.75081C16.1246 2.99076 15.5098 2.37594 14.7497 2.37594C13.9897 2.37594 13.3749 2.99076 13.3749 3.75081V9.25027C13.3749 9.42917 13.4113 9.60739 13.4807 9.7753C13.6198 10.1139 13.8861 10.3802 14.2256 10.5177ZM9.25027 2.37594C8.4898 2.37594 7.8754 2.99076 7.8754 3.75081V5.93126L3.34823 1.40387C2.81117 0.86681 1.94114 0.86681 1.40408 1.40387C0.867025 1.94092 0.867025 2.81096 1.40408 3.34801L5.93341 7.8754H3.75081C2.99076 7.8754 2.37594 8.4898 2.37594 9.25027C2.37594 10.0107 2.99076 10.6251 3.75081 10.6251H9.25027C9.42917 10.6251 9.60739 10.5887 9.7753 10.5192C10.1139 10.3802 10.3802 10.1139 10.5177 9.77444C10.5908 9.60687 10.6251 9.43072 10.6251 9.25027V3.75081C10.6251 2.99076 10.0107 2.37594 9.25027 2.37594ZM18.0709 16.1246H20.2492C21.0092 16.1246 21.6241 15.5098 21.6241 14.7497C21.6241 13.9897 21.0092 13.3749 20.2492 13.3749H14.7497C14.5708 13.3749 14.3926 13.4113 14.2247 13.4806C13.8879 13.6199 13.6198 13.8879 13.4806 14.2247C13.4092 14.3931 13.3749 14.5693 13.3749 14.7497V20.2492C13.3749 21.0092 13.9897 21.6241 14.7497 21.6241C15.5098 21.6241 16.1246 21.0092 16.1246 20.2492V18.0687L20.6531 22.5972C21.1901 23.1343 22.0602 23.1343 22.5972 22.5972C23.1338 22.0606 23.1347 21.1905 22.5972 20.6531L18.0709 16.1246Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
3
asset_sources/svg/stack_duo/churn.svg
Normal file
3
asset_sources/svg/stack_duo/churn.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M9.77444 13.4823C9.60687 13.4092 9.43072 13.3749 9.25027 13.3749H3.75081C2.99076 13.3749 2.37594 13.9897 2.37594 14.7497C2.37594 15.5098 2.99076 16.1246 3.75081 16.1246H5.93126L1.40279 20.6531C0.865736 21.1901 0.865736 22.0602 1.40279 22.5972C1.93985 23.1343 2.80988 23.1343 3.34694 22.5972L7.8754 18.0709V20.2492C7.8754 21.0092 8.49023 21.6241 9.25027 21.6241C10.0103 21.6241 10.6251 21.0092 10.6251 20.2492V14.7497C10.6251 14.5708 10.5887 14.3926 10.5192 14.2247C10.3802 13.8861 10.1139 13.6198 9.77444 13.4823ZM14.2256 10.5177C14.3931 10.5908 14.5693 10.6251 14.7497 10.6251H20.2492C21.0092 10.6251 21.6241 10.0103 21.6241 9.25027C21.6241 8.49023 21.0092 7.8754 20.2492 7.8754H18.0687L22.5972 3.34694C23.1343 2.80988 23.1343 1.93985 22.5972 1.40279C22.0606 0.866166 21.1905 0.865306 20.6531 1.40279L16.1246 5.93341V3.75081C16.1246 2.99076 15.5098 2.37594 14.7497 2.37594C13.9897 2.37594 13.3749 2.99076 13.3749 3.75081V9.25027C13.3749 9.42917 13.4113 9.60739 13.4807 9.7753C13.6198 10.1139 13.8861 10.3802 14.2256 10.5177ZM9.25027 2.37594C8.4898 2.37594 7.8754 2.99076 7.8754 3.75081V5.93126L3.34823 1.40387C2.81117 0.86681 1.94114 0.86681 1.40408 1.40387C0.867025 1.94092 0.867025 2.81096 1.40408 3.34801L5.93341 7.8754H3.75081C2.99076 7.8754 2.37594 8.4898 2.37594 9.25027C2.37594 10.0107 2.99076 10.6251 3.75081 10.6251H9.25027C9.42917 10.6251 9.60739 10.5887 9.7753 10.5192C10.1139 10.3802 10.3802 10.1139 10.5177 9.77444C10.5908 9.60687 10.6251 9.43072 10.6251 9.25027V3.75081C10.6251 2.99076 10.0107 2.37594 9.25027 2.37594ZM18.0709 16.1246H20.2492C21.0092 16.1246 21.6241 15.5098 21.6241 14.7497C21.6241 13.9897 21.0092 13.3749 20.2492 13.3749H14.7497C14.5708 13.3749 14.3926 13.4113 14.2247 13.4806C13.8879 13.6199 13.6198 13.8879 13.4806 14.2247C13.4092 14.3931 13.3749 14.5693 13.3749 14.7497V20.2492C13.3749 21.0092 13.9897 21.6241 14.7497 21.6241C15.5098 21.6241 16.1246 21.0092 16.1246 20.2492V18.0687L20.6531 22.5972C21.1901 23.1343 22.0602 23.1343 22.5972 22.5972C23.1338 22.0606 23.1347 21.1905 22.5972 20.6531L18.0709 16.1246Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
3
asset_sources/svg/stack_wallet/churn.svg
Normal file
3
asset_sources/svg/stack_wallet/churn.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M9.77444 13.4823C9.60687 13.4092 9.43072 13.3749 9.25027 13.3749H3.75081C2.99076 13.3749 2.37594 13.9897 2.37594 14.7497C2.37594 15.5098 2.99076 16.1246 3.75081 16.1246H5.93126L1.40279 20.6531C0.865736 21.1901 0.865736 22.0602 1.40279 22.5972C1.93985 23.1343 2.80988 23.1343 3.34694 22.5972L7.8754 18.0709V20.2492C7.8754 21.0092 8.49023 21.6241 9.25027 21.6241C10.0103 21.6241 10.6251 21.0092 10.6251 20.2492V14.7497C10.6251 14.5708 10.5887 14.3926 10.5192 14.2247C10.3802 13.8861 10.1139 13.6198 9.77444 13.4823ZM14.2256 10.5177C14.3931 10.5908 14.5693 10.6251 14.7497 10.6251H20.2492C21.0092 10.6251 21.6241 10.0103 21.6241 9.25027C21.6241 8.49023 21.0092 7.8754 20.2492 7.8754H18.0687L22.5972 3.34694C23.1343 2.80988 23.1343 1.93985 22.5972 1.40279C22.0606 0.866166 21.1905 0.865306 20.6531 1.40279L16.1246 5.93341V3.75081C16.1246 2.99076 15.5098 2.37594 14.7497 2.37594C13.9897 2.37594 13.3749 2.99076 13.3749 3.75081V9.25027C13.3749 9.42917 13.4113 9.60739 13.4807 9.7753C13.6198 10.1139 13.8861 10.3802 14.2256 10.5177ZM9.25027 2.37594C8.4898 2.37594 7.8754 2.99076 7.8754 3.75081V5.93126L3.34823 1.40387C2.81117 0.86681 1.94114 0.86681 1.40408 1.40387C0.867025 1.94092 0.867025 2.81096 1.40408 3.34801L5.93341 7.8754H3.75081C2.99076 7.8754 2.37594 8.4898 2.37594 9.25027C2.37594 10.0107 2.99076 10.6251 3.75081 10.6251H9.25027C9.42917 10.6251 9.60739 10.5887 9.7753 10.5192C10.1139 10.3802 10.3802 10.1139 10.5177 9.77444C10.5908 9.60687 10.6251 9.43072 10.6251 9.25027V3.75081C10.6251 2.99076 10.0107 2.37594 9.25027 2.37594ZM18.0709 16.1246H20.2492C21.0092 16.1246 21.6241 15.5098 21.6241 14.7497C21.6241 13.9897 21.0092 13.3749 20.2492 13.3749H14.7497C14.5708 13.3749 14.3926 13.4113 14.2247 13.4806C13.8879 13.6199 13.6198 13.8879 13.4806 14.2247C13.4092 14.3931 13.3749 14.5693 13.3749 14.7497V20.2492C13.3749 21.0092 13.9897 21.6241 14.7497 21.6241C15.5098 21.6241 16.1246 21.0092 16.1246 20.2492V18.0687L20.6531 22.5972C21.1901 23.1343 22.0602 23.1343 22.5972 22.5972C23.1338 22.0606 23.1347 21.1905 22.5972 20.6531L18.0709 16.1246Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/gif/monero-chan-dance.gif
Normal file
BIN
assets/gif/monero-chan-dance.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 MiB |
|
@ -1 +1 @@
|
||||||
Subproject commit 19c76409e55f1bfed58855eb767574604376edb6
|
Subproject commit 0bb1b1ced6e0d3c66e383698f89825754c692986
|
|
@ -1 +1 @@
|
||||||
Subproject commit b654bf4488357c8a104900e11f9468d54a39f22b
|
Subproject commit 5b08645a5b5d30955f4bde2a624ff89ef516e452
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 982f5ab19fe0dd3dd3f6be2c46f8dff13d49027c
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit d539de2348bdbb87bac341dcaa6a0755f21d48e2
|
Subproject commit 2451deab817b456ad93d5579c0d0687cb681392a
|
|
@ -13,12 +13,12 @@ Here you will find instructions on how to install the necessary tools for buildi
|
||||||
The following instructions are for building and running on a Linux host. Alternatively, see the [Mac](#mac-host) and/or [Windows](#windows-host) section. This entire section (except for the Android Studio section) needs to be completed in WSL if building on a Windows host.
|
The following instructions are for building and running on a Linux host. Alternatively, see the [Mac](#mac-host) and/or [Windows](#windows-host) section. This entire section (except for the Android Studio section) needs to be completed in WSL if building on a Windows host.
|
||||||
|
|
||||||
### Flutter
|
### Flutter
|
||||||
Install Flutter 3.22.1 by [following their guide](https://docs.flutter.dev/get-started/install/linux/desktop?tab=download#install-the-flutter-sdk). You can also clone https://github.com/flutter/flutter, check out the `3.22.1` tag, and add its `flutter/bin` folder to your PATH as in
|
Install Flutter 3.24.3 by [following their guide](https://docs.flutter.dev/get-started/install/linux/desktop?tab=download#install-the-flutter-sdk). You can also clone https://github.com/flutter/flutter, check out the `3.24.3` tag, and add its `flutter/bin` folder to your PATH as in
|
||||||
```sh
|
```sh
|
||||||
FLUTTER_DIR="$HOME/development/flutter"
|
FLUTTER_DIR="$HOME/development/flutter"
|
||||||
git clone https://github.com/flutter/flutter.git "$FLUTTER_DIR"
|
git clone https://github.com/flutter/flutter.git "$FLUTTER_DIR"
|
||||||
cd "$FLUTTER_DIR"
|
cd "$FLUTTER_DIR"
|
||||||
git checkout 3.22.1
|
git checkout 3.24.3
|
||||||
echo 'export PATH="$PATH:'"$FLUTTER_DIR"'/bin"' >> "$HOME/.profile"
|
echo 'export PATH="$PATH:'"$FLUTTER_DIR"'/bin"' >> "$HOME/.profile"
|
||||||
source "$HOME/.profile"
|
source "$HOME/.profile"
|
||||||
flutter precache
|
flutter precache
|
||||||
|
@ -53,14 +53,33 @@ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-
|
||||||
### Build dependencies
|
### Build dependencies
|
||||||
Install basic dependencies
|
Install basic dependencies
|
||||||
```
|
```
|
||||||
sudo apt-get install libssl-dev curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm python3-distutils g++ gcc gperf
|
sudo apt-get install libssl-dev curl unzip automake build-essential file pkg-config git python3 libtool libtinfo6 cmake libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm g++ gcc gperf libopencv-dev python3-typogrify xsltproc valac gobject-introspection meson
|
||||||
```
|
```
|
||||||
|
|
||||||
Install [Rust](https://www.rust-lang.org/tools/install) with command:
|
For Ubuntu 20.04,
|
||||||
|
```
|
||||||
|
sudo apt-get install vapigen
|
||||||
|
pip3 install --upgrade meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
For Ubuntu 24.04,
|
||||||
|
```
|
||||||
|
sudo apt install pipx libgcrypt20-dev libglib2.0-dev libsecret-1-dev
|
||||||
|
pipx install meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Install `libtinfo5` (required by [monero_c](https://github.com/MrCyjaneK/monero_c), should be dropped in the future):
|
||||||
|
```
|
||||||
|
wget http://mirrors.kernel.org/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb -O libtinfo5.deb \
|
||||||
|
&& apt install ./libtinfo5.deb \
|
||||||
|
&& rm libtinfo5.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
Install [Rust](https://www.rust-lang.org/tools/install) via [rustup.rs](https://rustup.rs), the required Rust toolchains, and `cargo-ndk 2.12.7` with command:
|
||||||
```
|
```
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
rustup install 1.67.1 1.72.0 1.73.0
|
rustup install 1.67.1 1.71.0 1.72.0 1.73.0
|
||||||
rustup default 1.67.1
|
rustup default 1.67.1
|
||||||
cargo install cargo-ndk --version 2.12.7 --locked
|
cargo install cargo-ndk --version 2.12.7 --locked
|
||||||
```
|
```
|
||||||
|
@ -77,6 +96,7 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
|
||||||
pip3 install --upgrade meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1
|
pip3 install --upgrade meson==0.64.1 markdown==3.4.1 markupsafe==2.1.1 jinja2==3.1.2 pygments==2.13.0 toml==0.10.2 typogrify==2.0.7 tomli==2.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Clone the repository and initialize submodules
|
||||||
After installing the prerequisites listed above, download the code and init the submodules
|
After installing the prerequisites listed above, download the code and init the submodules
|
||||||
```
|
```
|
||||||
git clone https://github.com/cypherstack/stack_wallet.git
|
git clone https://github.com/cypherstack/stack_wallet.git
|
||||||
|
@ -92,17 +112,15 @@ cd scripts/linux
|
||||||
cd ../..
|
cd ../..
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build coinlib
|
### Build secp256k1
|
||||||
Coinlib's native secp256k1 library must be built prior to running Stack Wallet. It can be built from within the root `stack_wallet` folder on a...
|
Coinlib requires a secp256k1 library to be built prior to running Stack Wallet. It can be built from within the root `stack_wallet` folder on a...
|
||||||
- Linux host for Linux targets: `dart run coinlib:build_linux`, or
|
- Linux host for Linux targets: `dart run coinlib:build_linux` (requires [Docker](https://docs.docker.com/engine/install/ubuntu/) or [`podman`](https://podman.io/docs/installation))
|
||||||
- Linux host for Windows targets: `dart run coinlib:build_windows_crosscompile`
|
- Linux host for Windows targets: `dart run coinlib:build_windows_crosscompile`
|
||||||
- Windows host: `dart run coinlib:build_windows`
|
- Windows host: `dart run coinlib:build_windows`
|
||||||
- WSL2 host: `dart run coinlib:build_wsl`
|
- WSL2 host: `dart run coinlib:build_wsl`
|
||||||
- macOS host: `dart run coinlib:build_macos`
|
- macOS host: `dart run coinlib:build_macos`
|
||||||
|
|
||||||
To build coinlib on Linux, you will need `docker` (see [installation instructions](https://docs.docker.com/engine/install/ubuntu/)) or [`podman`](https://podman.io/docs/installation) (`sudo apt-get -y install podman`)
|
or by using `scripts/linux/build_secp256k1.sh` or `scripts/windows/build_secp256k1.bat`.
|
||||||
|
|
||||||
For Windows targets, you can use a `secp256k1.dll` produced by any of the three middle options if the first attempt doesn't succeed.
|
|
||||||
|
|
||||||
### Run prebuild script
|
### Run prebuild script
|
||||||
|
|
||||||
|
@ -117,7 +135,7 @@ or manually by creating the files referenced in that script with the specified c
|
||||||
|
|
||||||
### Build plugins
|
### Build plugins
|
||||||
#### Build script: `build_app.sh`
|
#### Build script: `build_app.sh`
|
||||||
The `build_app.sh` script is use to build applications Stack Wallet. View the script's help message with `./build_app.sh -h` for more information on its usage.
|
The `build_app.sh` script is used to build the Stack Wallet and its family of applications. View the script's help message with `./build_app.sh -h` for more information on its usage.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
@ -144,7 +162,7 @@ cd scripts
|
||||||
cd scripts
|
cd scripts
|
||||||
./build_app.sh -a stack_wallet -p linux
|
./build_app.sh -a stack_wallet -p linux
|
||||||
```
|
```
|
||||||
|
<!--
|
||||||
##### Remove system packages (may be needed for building flutter_libmonero)
|
##### Remove system packages (may be needed for building flutter_libmonero)
|
||||||
[`flutter_libmonero`](https://github.com/cypherstack/flutter_libmonero) may have issues building due to conflicts with system packages: if so, follow this section.
|
[`flutter_libmonero`](https://github.com/cypherstack/flutter_libmonero) may have issues building due to conflicts with system packages: if so, follow this section.
|
||||||
|
|
||||||
|
@ -156,13 +174,19 @@ for example to find which pre-installed packages you may need to remove with `su
|
||||||
```
|
```
|
||||||
sudo apt-get remove '^libboost.*-dev.*'
|
sudo apt-get remove '^libboost.*-dev.*'
|
||||||
```
|
```
|
||||||
<!-- TODO: configure compiler to prefer built over system libraries. Should already use them? -->
|
TODO: configure compiler to prefer built over system libraries. Should already use them? -->
|
||||||
|
|
||||||
#### Building plugins and configure for Windows
|
#### Building plugins and configure for Windows
|
||||||
|
Install dependencies like MXE:
|
||||||
```
|
```
|
||||||
cd scripts
|
cd scripts/windows
|
||||||
./deps.sh
|
./deps.sh
|
||||||
./build_app.sh -a stack_wallet -p windows
|
```
|
||||||
|
|
||||||
|
and use `scripts/build_app.sh` to build plugins:
|
||||||
|
```
|
||||||
|
cd ..
|
||||||
|
./build_app.sh -a stack_wallet -p windows -v 2.1.0 -b 210
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running
|
### Running
|
||||||
|
@ -209,7 +233,7 @@ Download and install [Rust](https://www.rust-lang.org/tools/install). [Rustup](
|
||||||
```
|
```
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
rustup install 1.67.1 1.72.0 1.73.0
|
rustup install 1.67.1 1.71.0 1.72.0 1.73.0
|
||||||
rustup default 1.67.1
|
rustup default 1.67.1
|
||||||
cargo install cargo-ndk --version 2.12.7 --locked
|
cargo install cargo-ndk --version 2.12.7 --locked
|
||||||
cargo install cbindgen cargo-lipo
|
cargo install cbindgen cargo-lipo
|
||||||
|
@ -219,7 +243,7 @@ rustup target add aarch64-apple-ios aarch64-apple-darwin
|
||||||
Optionally download [Android Studio](https://developer.android.com/studio) as an IDE and activate its Dart and Flutter plugins. VS Code may work as an alternative, but this is not recommended.
|
Optionally download [Android Studio](https://developer.android.com/studio) as an IDE and activate its Dart and Flutter plugins. VS Code may work as an alternative, but this is not recommended.
|
||||||
|
|
||||||
### Flutter
|
### Flutter
|
||||||
Install [Flutter](https://docs.flutter.dev/get-started/install) 3.22.1 on your Mac host by following [these instructions](https://docs.flutter.dev/get-started/install/macos). Run `flutter doctor` in a terminal to confirm its installation.
|
Install [Flutter](https://docs.flutter.dev/get-started/install) 3.24.3 on your Mac host by following [these instructions](https://docs.flutter.dev/get-started/install/macos). Run `flutter doctor` in a terminal to confirm its installation.
|
||||||
|
|
||||||
### Build plugins and configure
|
### Build plugins and configure
|
||||||
#### Building plugins for iOS
|
#### Building plugins for iOS
|
||||||
|
@ -272,16 +296,11 @@ Install the following libraries:
|
||||||
sudo apt-get install libgtk2.0-dev
|
sudo apt-get install libgtk2.0-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
You will also need to install MXE on the WSL2 Ubuntu 20.04 host and can do so by running `stack_wallet/scripts/windows/deps.sh`:
|
|
||||||
```
|
|
||||||
./stack_wallet/scripts/windows/deps.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
The WSL2 host may optionally be navigated to the `stack_wallet` repository on the Windows host in order to build the plugins in-place and skip the next section in which you copy the `dll`s from WSL2 to Windows. Then build windows `dll` libraries by running the following script on the WSL2 Ubuntu 20.04 host:
|
The WSL2 host may optionally be navigated to the `stack_wallet` repository on the Windows host in order to build the plugins in-place and skip the next section in which you copy the `dll`s from WSL2 to Windows. Then build windows `dll` libraries by running the following script on the WSL2 Ubuntu 20.04 host:
|
||||||
|
|
||||||
- `stack_wallet/scripts/windows/build_all.sh`
|
- `stack_wallet/scripts/windows/build_all.sh`
|
||||||
|
|
||||||
Copy the resulting `dll`s to their respective positions on the Windows host:
|
If the DLLs were built on the WSL filesystem instead of on Windows, copy the resulting `dll`s to their respective positions on the Windows host:
|
||||||
|
|
||||||
- `stack_wallet/crypto_plugins/flutter_libepiccash/scripts/windows/build/libepic_cash_wallet.dll`
|
- `stack_wallet/crypto_plugins/flutter_libepiccash/scripts/windows/build/libepic_cash_wallet.dll`
|
||||||
- `stack_wallet/crypto_plugins/flutter_liblelantus/scripts/windows/build/libmobileliblelantus.dll`
|
- `stack_wallet/crypto_plugins/flutter_liblelantus/scripts/windows/build/libmobileliblelantus.dll`
|
||||||
|
@ -294,13 +313,13 @@ Copy the resulting `dll`s to their respective positions on the Windows host:
|
||||||
Frostdart will be built by the Windows host later.
|
Frostdart will be built by the Windows host later.
|
||||||
|
|
||||||
### Install Flutter on Windows host
|
### Install Flutter on Windows host
|
||||||
Install Flutter 3.22.1 on your Windows host (not in WSL2) by [following their guide](https://docs.flutter.dev/get-started/install/windows/desktop?tab=download#install-the-flutter-sdk) or by cloning https://github.com/flutter/flutter, checking out the `3.22.1` tag, and adding its `flutter/bin` folder to your PATH as in
|
Install Flutter 3.24.3 on your Windows host (not in WSL2) by [following their guide](https://docs.flutter.dev/get-started/install/windows/desktop?tab=download#install-the-flutter-sdk) or by cloning https://github.com/flutter/flutter, checking out the `3.24.3` tag, and adding its `flutter/bin` folder to your PATH as in
|
||||||
```bat
|
```bat
|
||||||
@echo off
|
@echo off
|
||||||
set "FLUTTER_DIR=%USERPROFILE%\development\flutter"
|
set "FLUTTER_DIR=%USERPROFILE%\development\flutter"
|
||||||
git clone https://github.com/flutter/flutter.git "%FLUTTER_DIR%"
|
git clone https://github.com/flutter/flutter.git "%FLUTTER_DIR%"
|
||||||
cd /d "%FLUTTER_DIR%"
|
cd /d "%FLUTTER_DIR%"
|
||||||
git checkout 3.22.1
|
git checkout 3.24.3
|
||||||
setx PATH "%PATH%;%FLUTTER_DIR%\bin"
|
setx PATH "%PATH%;%FLUTTER_DIR%\bin"
|
||||||
echo Flutter setup completed. Please restart your command prompt.
|
echo Flutter setup completed. Please restart your command prompt.
|
||||||
```
|
```
|
||||||
|
@ -310,7 +329,7 @@ Run `flutter doctor` in PowerShell to confirm its installation.
|
||||||
### Rust
|
### Rust
|
||||||
Install [Rust](https://www.rust-lang.org/tools/install) on the Windows host (not in WSL2). Download the installer from [rustup.rs](https://rustup.rs), make sure it works on the commandline (you may need to open a new terminal), and install the following versions:
|
Install [Rust](https://www.rust-lang.org/tools/install) on the Windows host (not in WSL2). Download the installer from [rustup.rs](https://rustup.rs), make sure it works on the commandline (you may need to open a new terminal), and install the following versions:
|
||||||
```
|
```
|
||||||
rustup install 1.67.1 1.72.0 1.73.0
|
rustup install 1.67.1 1.71.0 1.72.0 1.73.0
|
||||||
rustup default 1.67.1
|
rustup default 1.67.1
|
||||||
cargo install cargo-ndk --version 2.12.7 --locked
|
cargo install cargo-ndk --version 2.12.7 --locked
|
||||||
```
|
```
|
||||||
|
|
1
ios/MoneroWallet.framework/.gitignore
vendored
1
ios/MoneroWallet.framework/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
MoneroWallet
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-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>BuildMachineOSBuild</key>
|
|
||||||
<string>23E224</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>MoneroWallet</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.cypherstack.MoneroWallet</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>MoneroWallet</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>???</string>
|
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
|
||||||
<array>
|
|
||||||
<string>iPhoneOS</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>DTCompiler</key>
|
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
||||||
<key>DTPlatformBuild</key>
|
|
||||||
<string>21E210</string>
|
|
||||||
<key>DTPlatformName</key>
|
|
||||||
<string>iphoneos</string>
|
|
||||||
<key>DTPlatformVersion</key>
|
|
||||||
<string>17.4</string>
|
|
||||||
<key>DTSDKBuild</key>
|
|
||||||
<string>21E210</string>
|
|
||||||
<key>DTSDKName</key>
|
|
||||||
<string>iphoneos17.4</string>
|
|
||||||
<key>DTXcode</key>
|
|
||||||
<string>1530</string>
|
|
||||||
<key>DTXcodeBuild</key>
|
|
||||||
<string>15E204a</string>
|
|
||||||
<key>MinimumOSVersion</key>
|
|
||||||
<string>16.0</string>
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>1</integer>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -3,12 +3,14 @@ PODS:
|
||||||
- Flutter
|
- Flutter
|
||||||
- MTBBarcodeScanner
|
- MTBBarcodeScanner
|
||||||
- SwiftProtobuf
|
- SwiftProtobuf
|
||||||
- coinlib_flutter (0.3.2):
|
- coinlib_flutter (0.5.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
|
- cs_monero_flutter_libs (0.0.1):
|
||||||
|
- Flutter
|
||||||
- device_info_plus (0.0.1):
|
- device_info_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- devicelocale (0.0.1):
|
- devicelocale (0.0.1):
|
||||||
|
@ -50,8 +52,6 @@ PODS:
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_libepiccash (0.0.1):
|
- flutter_libepiccash (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_libmonero (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- flutter_libsparkmobile (0.0.1):
|
- flutter_libsparkmobile (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_local_notifications (0.0.1):
|
- flutter_local_notifications (0.0.1):
|
||||||
|
@ -67,15 +67,16 @@ PODS:
|
||||||
- Flutter
|
- Flutter
|
||||||
- lelantus (0.0.1):
|
- lelantus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- local_auth (0.0.1):
|
- local_auth_darwin (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- MTBBarcodeScanner (5.0.11)
|
- MTBBarcodeScanner (5.0.11)
|
||||||
- package_info_plus (0.4.5):
|
- package_info_plus (0.4.5):
|
||||||
- Flutter
|
- Flutter
|
||||||
- path_provider_foundation (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- permission_handler_apple (9.1.1):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift (5.0.0)
|
- ReachabilitySwift (5.0.0)
|
||||||
- SDWebImage (5.13.2):
|
- SDWebImage (5.13.2):
|
||||||
|
@ -83,18 +84,21 @@ PODS:
|
||||||
- SDWebImage/Core (5.13.2)
|
- SDWebImage/Core (5.13.2)
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- sqlite3 (3.46.0):
|
- "sqlite3 (3.46.0+1)":
|
||||||
- sqlite3/common (= 3.46.0)
|
- "sqlite3/common (= 3.46.0+1)"
|
||||||
- sqlite3/common (3.46.0)
|
- "sqlite3/common (3.46.0+1)"
|
||||||
- sqlite3/fts5 (3.46.0):
|
- "sqlite3/dbstatvtab (3.46.0+1)":
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/perf-threadsafe (3.46.0):
|
- "sqlite3/fts5 (3.46.0+1)":
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3/rtree (3.46.0):
|
- "sqlite3/perf-threadsafe (3.46.0+1)":
|
||||||
|
- sqlite3/common
|
||||||
|
- "sqlite3/rtree (3.46.0+1)":
|
||||||
- sqlite3/common
|
- sqlite3/common
|
||||||
- sqlite3_flutter_libs (0.0.1):
|
- sqlite3_flutter_libs (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- sqlite3 (~> 3.46.0)
|
- "sqlite3 (~> 3.46.0+1)"
|
||||||
|
- sqlite3/dbstatvtab
|
||||||
- sqlite3/fts5
|
- sqlite3/fts5
|
||||||
- sqlite3/perf-threadsafe
|
- sqlite3/perf-threadsafe
|
||||||
- sqlite3/rtree
|
- sqlite3/rtree
|
||||||
|
@ -106,19 +110,19 @@ PODS:
|
||||||
- Flutter
|
- Flutter
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- wakelock (0.0.1):
|
- wakelock_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`)
|
- barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`)
|
||||||
- coinlib_flutter (from `.symlinks/plugins/coinlib_flutter/darwin`)
|
- coinlib_flutter (from `.symlinks/plugins/coinlib_flutter/darwin`)
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
|
- cs_monero_flutter_libs (from `.symlinks/plugins/cs_monero_flutter_libs/ios`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
|
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
|
||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_libepiccash (from `.symlinks/plugins/flutter_libepiccash/ios`)
|
- flutter_libepiccash (from `.symlinks/plugins/flutter_libepiccash/ios`)
|
||||||
- flutter_libmonero (from `.symlinks/plugins/flutter_libmonero/ios`)
|
|
||||||
- flutter_libsparkmobile (from `.symlinks/plugins/flutter_libsparkmobile/ios`)
|
- flutter_libsparkmobile (from `.symlinks/plugins/flutter_libsparkmobile/ios`)
|
||||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||||
|
@ -127,7 +131,7 @@ DEPENDENCIES:
|
||||||
- integration_test (from `.symlinks/plugins/integration_test/ios`)
|
- integration_test (from `.symlinks/plugins/integration_test/ios`)
|
||||||
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
|
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
|
||||||
- lelantus (from `.symlinks/plugins/lelantus/ios`)
|
- lelantus (from `.symlinks/plugins/lelantus/ios`)
|
||||||
- local_auth (from `.symlinks/plugins/local_auth/ios`)
|
- local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`)
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
@ -136,7 +140,7 @@ DEPENDENCIES:
|
||||||
- stack_wallet_backup (from `.symlinks/plugins/stack_wallet_backup/ios`)
|
- stack_wallet_backup (from `.symlinks/plugins/stack_wallet_backup/ios`)
|
||||||
- tor_ffi_plugin (from `.symlinks/plugins/tor_ffi_plugin/ios`)
|
- tor_ffi_plugin (from `.symlinks/plugins/tor_ffi_plugin/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
- wakelock (from `.symlinks/plugins/wakelock/ios`)
|
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
|
@ -156,6 +160,8 @@ EXTERNAL SOURCES:
|
||||||
:path: ".symlinks/plugins/coinlib_flutter/darwin"
|
:path: ".symlinks/plugins/coinlib_flutter/darwin"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
|
cs_monero_flutter_libs:
|
||||||
|
:path: ".symlinks/plugins/cs_monero_flutter_libs/ios"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||||
devicelocale:
|
devicelocale:
|
||||||
|
@ -166,8 +172,6 @@ EXTERNAL SOURCES:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_libepiccash:
|
flutter_libepiccash:
|
||||||
:path: ".symlinks/plugins/flutter_libepiccash/ios"
|
:path: ".symlinks/plugins/flutter_libepiccash/ios"
|
||||||
flutter_libmonero:
|
|
||||||
:path: ".symlinks/plugins/flutter_libmonero/ios"
|
|
||||||
flutter_libsparkmobile:
|
flutter_libsparkmobile:
|
||||||
:path: ".symlinks/plugins/flutter_libsparkmobile/ios"
|
:path: ".symlinks/plugins/flutter_libsparkmobile/ios"
|
||||||
flutter_local_notifications:
|
flutter_local_notifications:
|
||||||
|
@ -184,8 +188,8 @@ EXTERNAL SOURCES:
|
||||||
:path: ".symlinks/plugins/isar_flutter_libs/ios"
|
:path: ".symlinks/plugins/isar_flutter_libs/ios"
|
||||||
lelantus:
|
lelantus:
|
||||||
:path: ".symlinks/plugins/lelantus/ios"
|
:path: ".symlinks/plugins/lelantus/ios"
|
||||||
local_auth:
|
local_auth_darwin:
|
||||||
:path: ".symlinks/plugins/local_auth/ios"
|
:path: ".symlinks/plugins/local_auth_darwin/darwin"
|
||||||
package_info_plus:
|
package_info_plus:
|
||||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
|
@ -202,45 +206,45 @@ EXTERNAL SOURCES:
|
||||||
:path: ".symlinks/plugins/tor_ffi_plugin/ios"
|
:path: ".symlinks/plugins/tor_ffi_plugin/ios"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
wakelock:
|
wakelock_plus:
|
||||||
:path: ".symlinks/plugins/wakelock/ios"
|
:path: ".symlinks/plugins/wakelock_plus/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0
|
barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0
|
||||||
coinlib_flutter: 6abec900d67762a6e7ccfd567a3cd3ae00bbee35
|
coinlib_flutter: 9275e8255ef67d3da33beb6e117d09ced4f46eb5
|
||||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||||
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
|
cs_monero_flutter_libs: 43cda3474c2bc907f2b2b5bb26fd89cb864fcfc6
|
||||||
devicelocale: b22617f40038496deffba44747101255cee005b0
|
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
|
||||||
|
devicelocale: 35ba84dc7f45f527c3001535d8c8d104edd5d926
|
||||||
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
||||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||||
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
flutter_libepiccash: 36241aa7d3126f6521529985ccb3dc5eaf7bb317
|
flutter_libepiccash: 36241aa7d3126f6521529985ccb3dc5eaf7bb317
|
||||||
flutter_libmonero: da68a616b73dd0374a8419c684fa6b6df2c44ffe
|
|
||||||
flutter_libsparkmobile: 6373955cc3327a926d17059e7405dde2fb12f99f
|
flutter_libsparkmobile: 6373955cc3327a926d17059e7405dde2fb12f99f
|
||||||
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
|
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
|
||||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
||||||
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
|
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
|
||||||
frostdart: 4c72b69ccac2f13ede744107db046a125acce597
|
frostdart: 4c72b69ccac2f13ede744107db046a125acce597
|
||||||
integration_test: 13825b8a9334a850581300559b8839134b124670
|
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
|
||||||
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
|
isar_flutter_libs: fdf730ca925d05687f36d7f1d355e482529ed097
|
||||||
lelantus: 417f0221260013dfc052cae9cf4b741b6479edba
|
lelantus: 417f0221260013dfc052cae9cf4b741b6479edba
|
||||||
local_auth: 1740f55d7af0a2e2a8684ce225fe79d8931e808c
|
local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3
|
||||||
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
|
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
|
||||||
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
|
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
|
||||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
|
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
|
||||||
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
|
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
|
||||||
sqlite3: 154b084339ede06960a5b3c8160066adc9176b7d
|
sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630
|
||||||
sqlite3_flutter_libs: 0d611efdf6d1c9297d5ab03dab21b75aeebdae31
|
sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b
|
||||||
stack_wallet_backup: 5b8563aba5d8ffbf2ce1944331ff7294a0ec7c03
|
stack_wallet_backup: 5b8563aba5d8ffbf2ce1944331ff7294a0ec7c03
|
||||||
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3
|
SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3
|
||||||
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
|
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
|
||||||
tor_ffi_plugin: d80e291b649379c8176e1be739e49be007d4ef93
|
tor_ffi_plugin: d80e291b649379c8176e1be739e49be007d4ef93
|
||||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
||||||
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
|
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
|
||||||
|
|
||||||
PODFILE CHECKSUM: 57c8aed26fba39d3ec9424816221f294a07c58eb
|
PODFILE CHECKSUM: 57c8aed26fba39d3ec9424816221f294a07c58eb
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
|
|
||||||
@UIApplicationMain
|
@main
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
override func application(
|
override func application(
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
|
|
1
ios/WowneroWallet.framework/.gitignore
vendored
1
ios/WowneroWallet.framework/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
WowneroWallet
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-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>BuildMachineOSBuild</key>
|
|
||||||
<string>23E224</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>WowneroWallet</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.cypherstack.WowneroWallet</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>WowneroWallet</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>???</string>
|
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
|
||||||
<array>
|
|
||||||
<string>iPhoneOS</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>DTCompiler</key>
|
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
||||||
<key>DTPlatformBuild</key>
|
|
||||||
<string>21E210</string>
|
|
||||||
<key>DTPlatformName</key>
|
|
||||||
<string>iphoneos</string>
|
|
||||||
<key>DTPlatformVersion</key>
|
|
||||||
<string>17.4</string>
|
|
||||||
<key>DTSDKBuild</key>
|
|
||||||
<string>21E210</string>
|
|
||||||
<key>DTSDKName</key>
|
|
||||||
<string>iphoneos17.4</string>
|
|
||||||
<key>DTXcode</key>
|
|
||||||
<string>1530</string>
|
|
||||||
<key>DTXcodeBuild</key>
|
|
||||||
<string>15E204a</string>
|
|
||||||
<key>MinimumOSVersion</key>
|
|
||||||
<string>16.0</string>
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>1</integer>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -27,6 +27,8 @@ abstract class AppConfig {
|
||||||
|
|
||||||
static List<CryptoCurrency> get coins => _supportedCoins;
|
static List<CryptoCurrency> get coins => _supportedCoins;
|
||||||
|
|
||||||
|
static ({String from, String to}) get swapDefaults => _swapDefaults;
|
||||||
|
|
||||||
static bool get isSingleCoinApp => coins.length == 1;
|
static bool get isSingleCoinApp => coins.length == 1;
|
||||||
|
|
||||||
static CryptoCurrency? getCryptoCurrencyFor(String coinIdentifier) {
|
static CryptoCurrency? getCryptoCurrencyFor(String coinIdentifier) {
|
||||||
|
|
|
@ -77,6 +77,8 @@ class DbVersionMigrator with WalletDB {
|
||||||
name: e.name,
|
name: e.name,
|
||||||
id: e.id,
|
id: e.id,
|
||||||
useSSL: e.useSSL,
|
useSSL: e.useSSL,
|
||||||
|
torEnabled: e.torEnabled,
|
||||||
|
clearnetEnabled: e.clearnetEnabled,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
@ -88,6 +90,8 @@ class DbVersionMigrator with WalletDB {
|
||||||
name: node.name,
|
name: node.name,
|
||||||
id: node.id,
|
id: node.id,
|
||||||
useSSL: node.useSSL,
|
useSSL: node.useSSL,
|
||||||
|
torEnabled: node.torEnabled,
|
||||||
|
clearnetEnabled: node.clearnetEnabled,
|
||||||
),
|
),
|
||||||
prefs: prefs,
|
prefs: prefs,
|
||||||
failovers: failovers,
|
failovers: failovers,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:cw_core/wallet_info.dart' as xmr;
|
import 'package:compat/compat.dart' as lib_monero_compat;
|
||||||
import 'package:hive/hive.dart' show Box;
|
import 'package:hive/hive.dart' show Box;
|
||||||
import 'package:hive/src/hive_impl.dart';
|
import 'package:hive/src/hive_impl.dart';
|
||||||
import 'package:mutex/mutex.dart';
|
import 'package:mutex/mutex.dart';
|
||||||
|
@ -71,7 +71,7 @@ class DB {
|
||||||
Box<Trade>? _boxTradesV2;
|
Box<Trade>? _boxTradesV2;
|
||||||
Box<String>? _boxTradeNotes;
|
Box<String>? _boxTradeNotes;
|
||||||
Box<String>? _boxFavoriteWallets;
|
Box<String>? _boxFavoriteWallets;
|
||||||
Box<xmr.WalletInfo>? _walletInfoSource;
|
Box<lib_monero_compat.WalletInfo>? _walletInfoSource;
|
||||||
Box<dynamic>? _boxPrefs;
|
Box<dynamic>? _boxPrefs;
|
||||||
Box<TradeWalletLookup>? _boxTradeLookup;
|
Box<TradeWalletLookup>? _boxTradeLookup;
|
||||||
Box<dynamic>? _boxDBInfo;
|
Box<dynamic>? _boxDBInfo;
|
||||||
|
@ -85,7 +85,8 @@ class DB {
|
||||||
final Map<String, Box<dynamic>> _getSparkUsedCoinsTagsCacheBoxes = {};
|
final Map<String, Box<dynamic>> _getSparkUsedCoinsTagsCacheBoxes = {};
|
||||||
|
|
||||||
// exposed for monero
|
// exposed for monero
|
||||||
Box<xmr.WalletInfo> get moneroWalletInfoBox => _walletInfoSource!;
|
Box<lib_monero_compat.WalletInfo> get moneroWalletInfoBox =>
|
||||||
|
_walletInfoSource!;
|
||||||
|
|
||||||
// mutex for stack backup
|
// mutex for stack backup
|
||||||
final mutex = Mutex();
|
final mutex = Mutex();
|
||||||
|
@ -147,8 +148,8 @@ class DB {
|
||||||
_boxTradesV2 = await hive.openBox<Trade>(boxNameTradesV2);
|
_boxTradesV2 = await hive.openBox<Trade>(boxNameTradesV2);
|
||||||
_boxTradeNotes = await hive.openBox<String>(boxNameTradeNotes);
|
_boxTradeNotes = await hive.openBox<String>(boxNameTradeNotes);
|
||||||
_boxTradeLookup = await hive.openBox<TradeWalletLookup>(boxNameTradeLookup);
|
_boxTradeLookup = await hive.openBox<TradeWalletLookup>(boxNameTradeLookup);
|
||||||
_walletInfoSource =
|
_walletInfoSource = await hive.openBox<lib_monero_compat.WalletInfo>(
|
||||||
await hive.openBox<xmr.WalletInfo>(xmr.WalletInfo.boxName);
|
lib_monero_compat.WalletInfo.boxName);
|
||||||
_boxFavoriteWallets = await hive.openBox<String>(boxNameFavoriteWallets);
|
_boxFavoriteWallets = await hive.openBox<String>(boxNameFavoriteWallets);
|
||||||
|
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
|
|
|
@ -19,8 +19,8 @@ FCResult _updateSparkUsedTagsWith(
|
||||||
) {
|
) {
|
||||||
// hash the tags here since this function is called in a background isolate
|
// hash the tags here since this function is called in a background isolate
|
||||||
final hashedTags = LibSpark.hashTags(
|
final hashedTags = LibSpark.hashTags(
|
||||||
base64Tags: tags.map((e) => e[0] as String),
|
base64Tags: tags.map((e) => e[0] as String).toSet(),
|
||||||
);
|
).toList();
|
||||||
|
|
||||||
if (hashedTags.isEmpty) {
|
if (hashedTags.isEmpty) {
|
||||||
// nothing to add, return early
|
// nothing to add, return early
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:electrum_adapter/electrum_adapter.dart';
|
import 'package:electrum_adapter/electrum_adapter.dart';
|
||||||
|
|
||||||
|
import '../utilities/logger.dart';
|
||||||
|
import '../utilities/prefs.dart';
|
||||||
|
import '../utilities/tor_plain_net_option_enum.dart';
|
||||||
import '../wallets/crypto_currency/crypto_currency.dart';
|
import '../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
|
||||||
class ClientManager {
|
class ClientManager {
|
||||||
|
@ -8,6 +12,7 @@ class ClientManager {
|
||||||
static final ClientManager sharedInstance = ClientManager._();
|
static final ClientManager sharedInstance = ClientManager._();
|
||||||
|
|
||||||
final Map<String, ElectrumClient> _map = {};
|
final Map<String, ElectrumClient> _map = {};
|
||||||
|
final Map<String, TorPlainNetworkOption> _mapNet = {};
|
||||||
final Map<String, int> _heights = {};
|
final Map<String, int> _heights = {};
|
||||||
final Map<String, StreamSubscription<BlockHeader>> _subscriptions = {};
|
final Map<String, StreamSubscription<BlockHeader>> _subscriptions = {};
|
||||||
final Map<String, Completer<int>> _heightCompleters = {};
|
final Map<String, Completer<int>> _heightCompleters = {};
|
||||||
|
@ -22,28 +27,53 @@ class ClientManager {
|
||||||
|
|
||||||
ElectrumClient? getClient({
|
ElectrumClient? getClient({
|
||||||
required CryptoCurrency cryptoCurrency,
|
required CryptoCurrency cryptoCurrency,
|
||||||
}) =>
|
required TorPlainNetworkOption netType,
|
||||||
_map[_keyHelper(cryptoCurrency)];
|
}) {
|
||||||
|
final _key = _keyHelper(cryptoCurrency);
|
||||||
|
|
||||||
void addClient(
|
if (netType == _mapNet[_key]) {
|
||||||
|
return _map[_key];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> addClient(
|
||||||
ElectrumClient client, {
|
ElectrumClient client, {
|
||||||
required CryptoCurrency cryptoCurrency,
|
required CryptoCurrency cryptoCurrency,
|
||||||
}) {
|
required TorPlainNetworkOption netType,
|
||||||
|
}) async {
|
||||||
final key = _keyHelper(cryptoCurrency);
|
final key = _keyHelper(cryptoCurrency);
|
||||||
if (_map[key] != null) {
|
if (_map[key] != null) {
|
||||||
throw Exception("ElectrumX Client for $key already exists.");
|
if (_mapNet[key] == netType) {
|
||||||
|
throw Exception(
|
||||||
|
"ElectrumX Client for $key and $netType already exists.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await remove(cryptoCurrency: cryptoCurrency);
|
||||||
|
|
||||||
|
_map[key] = client;
|
||||||
|
_mapNet[key] = netType;
|
||||||
} else {
|
} else {
|
||||||
_map[key] = client;
|
_map[key] = client;
|
||||||
|
_mapNet[key] = netType;
|
||||||
}
|
}
|
||||||
|
|
||||||
_heightCompleters[key] = Completer<int>();
|
_heightCompleters[key] = Completer<int>();
|
||||||
_subscriptions[key] = client.subscribeHeaders().listen((event) {
|
_subscriptions[key] = client.subscribeHeaders().listen(
|
||||||
_heights[key] = event.height;
|
(event) {
|
||||||
|
_heights[key] = event.height;
|
||||||
|
|
||||||
if (!_heightCompleters[key]!.isCompleted) {
|
if (!_heightCompleters[key]!.isCompleted) {
|
||||||
_heightCompleters[key]!.complete(event.height);
|
_heightCompleters[key]!.complete(event.height);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
onError: (Object err, StackTrace s) => Logging.instance.log(
|
||||||
|
"ClientManager listen: $err\n$s",
|
||||||
|
level: LogLevel.Error,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getChainHeightFor(CryptoCurrency cryptoCurrency) async {
|
Future<int> getChainHeightFor(CryptoCurrency cryptoCurrency) async {
|
||||||
|
@ -60,10 +90,24 @@ class ClientManager {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Prefs.instance.useTor) {
|
||||||
|
if (_mapNet[key]! == TorPlainNetworkOption.clear) {
|
||||||
|
throw Exception(
|
||||||
|
"Non-TOR only client for $key found.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_mapNet[key]! == TorPlainNetworkOption.tor) {
|
||||||
|
throw Exception(
|
||||||
|
"TOR only client for $key found.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return _heights[key] ?? await _heightCompleters[key]!.future;
|
return _heights[key] ?? await _heightCompleters[key]!.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ElectrumClient?> remove({
|
Future<(ElectrumClient?, TorPlainNetworkOption?)> remove({
|
||||||
required CryptoCurrency cryptoCurrency,
|
required CryptoCurrency cryptoCurrency,
|
||||||
}) async {
|
}) async {
|
||||||
final key = _keyHelper(cryptoCurrency);
|
final key = _keyHelper(cryptoCurrency);
|
||||||
|
@ -72,7 +116,7 @@ class ClientManager {
|
||||||
_heights.remove(key);
|
_heights.remove(key);
|
||||||
_heightCompleters.remove(key);
|
_heightCompleters.remove(key);
|
||||||
|
|
||||||
return _map.remove(key);
|
return (_map.remove(key), _mapNet.remove(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> closeAll() async {
|
Future<void> closeAll() async {
|
||||||
|
@ -91,6 +135,7 @@ class ClientManager {
|
||||||
_heightCompleters.clear();
|
_heightCompleters.clear();
|
||||||
_heights.clear();
|
_heights.clear();
|
||||||
_subscriptions.clear();
|
_subscriptions.clear();
|
||||||
|
_mapNet.clear();
|
||||||
_map.clear();
|
_map.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import '../utilities/amount/amount.dart';
|
||||||
import '../utilities/extensions/impl/string.dart';
|
import '../utilities/extensions/impl/string.dart';
|
||||||
import '../utilities/logger.dart';
|
import '../utilities/logger.dart';
|
||||||
import '../utilities/prefs.dart';
|
import '../utilities/prefs.dart';
|
||||||
|
import '../utilities/tor_plain_net_option_enum.dart';
|
||||||
import '../wallets/crypto_currency/crypto_currency.dart';
|
import '../wallets/crypto_currency/crypto_currency.dart';
|
||||||
import '../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart';
|
import '../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart';
|
||||||
import 'client_manager.dart';
|
import 'client_manager.dart';
|
||||||
|
@ -42,6 +43,10 @@ typedef SparkMempoolData = ({
|
||||||
|
|
||||||
class WifiOnlyException implements Exception {}
|
class WifiOnlyException implements Exception {}
|
||||||
|
|
||||||
|
class TorOnlyException implements Exception {}
|
||||||
|
|
||||||
|
class ClearnetOnlyException implements Exception {}
|
||||||
|
|
||||||
class ElectrumXNode {
|
class ElectrumXNode {
|
||||||
ElectrumXNode({
|
ElectrumXNode({
|
||||||
required this.address,
|
required this.address,
|
||||||
|
@ -49,12 +54,16 @@ class ElectrumXNode {
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.useSSL,
|
required this.useSSL,
|
||||||
|
required this.torEnabled,
|
||||||
|
required this.clearnetEnabled,
|
||||||
});
|
});
|
||||||
final String address;
|
final String address;
|
||||||
final int port;
|
final int port;
|
||||||
final String name;
|
final String name;
|
||||||
final String id;
|
final String id;
|
||||||
final bool useSSL;
|
final bool useSSL;
|
||||||
|
final bool torEnabled;
|
||||||
|
final bool clearnetEnabled;
|
||||||
|
|
||||||
factory ElectrumXNode.from(ElectrumXNode node) {
|
factory ElectrumXNode.from(ElectrumXNode node) {
|
||||||
return ElectrumXNode(
|
return ElectrumXNode(
|
||||||
|
@ -63,6 +72,8 @@ class ElectrumXNode {
|
||||||
name: node.name,
|
name: node.name,
|
||||||
id: node.id,
|
id: node.id,
|
||||||
useSSL: node.useSSL,
|
useSSL: node.useSSL,
|
||||||
|
torEnabled: node.torEnabled,
|
||||||
|
clearnetEnabled: node.clearnetEnabled,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +85,7 @@ class ElectrumXNode {
|
||||||
|
|
||||||
class ElectrumXClient {
|
class ElectrumXClient {
|
||||||
final CryptoCurrency cryptoCurrency;
|
final CryptoCurrency cryptoCurrency;
|
||||||
|
final TorPlainNetworkOption netType;
|
||||||
|
|
||||||
String get host => _host;
|
String get host => _host;
|
||||||
late String _host;
|
late String _host;
|
||||||
|
@ -90,6 +102,7 @@ class ElectrumXClient {
|
||||||
ElectrumClient? getElectrumAdapter() =>
|
ElectrumClient? getElectrumAdapter() =>
|
||||||
ClientManager.sharedInstance.getClient(
|
ClientManager.sharedInstance.getClient(
|
||||||
cryptoCurrency: cryptoCurrency,
|
cryptoCurrency: cryptoCurrency,
|
||||||
|
netType: netType,
|
||||||
);
|
);
|
||||||
|
|
||||||
late Prefs _prefs;
|
late Prefs _prefs;
|
||||||
|
@ -119,6 +132,7 @@ class ElectrumXClient {
|
||||||
required int port,
|
required int port,
|
||||||
required bool useSSL,
|
required bool useSSL,
|
||||||
required Prefs prefs,
|
required Prefs prefs,
|
||||||
|
required this.netType,
|
||||||
required List<ElectrumXNode> failovers,
|
required List<ElectrumXNode> failovers,
|
||||||
required this.cryptoCurrency,
|
required this.cryptoCurrency,
|
||||||
this.connectionTimeoutForSpecialCaseJsonRPCClients =
|
this.connectionTimeoutForSpecialCaseJsonRPCClients =
|
||||||
|
@ -168,6 +182,7 @@ class ElectrumXClient {
|
||||||
_electrumAdapterChannel = null;
|
_electrumAdapterChannel = null;
|
||||||
await (await ClientManager.sharedInstance
|
await (await ClientManager.sharedInstance
|
||||||
.remove(cryptoCurrency: cryptoCurrency))
|
.remove(cryptoCurrency: cryptoCurrency))
|
||||||
|
.$1
|
||||||
?.close();
|
?.close();
|
||||||
|
|
||||||
// Also close any chain height services that are currently open.
|
// Also close any chain height services that are currently open.
|
||||||
|
@ -193,6 +208,10 @@ class ElectrumXClient {
|
||||||
failovers: failovers,
|
failovers: failovers,
|
||||||
globalEventBusForTesting: globalEventBusForTesting,
|
globalEventBusForTesting: globalEventBusForTesting,
|
||||||
cryptoCurrency: cryptoCurrency,
|
cryptoCurrency: cryptoCurrency,
|
||||||
|
netType: TorPlainNetworkOption.fromNodeData(
|
||||||
|
node.torEnabled,
|
||||||
|
node.clearnetEnabled,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,6 +255,18 @@ class ElectrumXClient {
|
||||||
// Get the proxy info from the TorService.
|
// Get the proxy info from the TorService.
|
||||||
proxyInfo = _torService.getProxyInfo();
|
proxyInfo = _torService.getProxyInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (netType == TorPlainNetworkOption.clear) {
|
||||||
|
_electrumAdapterChannel = null;
|
||||||
|
await ClientManager.sharedInstance
|
||||||
|
.remove(cryptoCurrency: cryptoCurrency);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (netType == TorPlainNetworkOption.tor) {
|
||||||
|
_electrumAdapterChannel = null;
|
||||||
|
await ClientManager.sharedInstance
|
||||||
|
.remove(cryptoCurrency: cryptoCurrency);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current ElectrumAdapterClient is closed, create a new one.
|
// If the current ElectrumAdapterClient is closed, create a new one.
|
||||||
|
@ -288,9 +319,10 @@ class ElectrumXClient {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientManager.sharedInstance.addClient(
|
await ClientManager.sharedInstance.addClient(
|
||||||
newClient,
|
newClient,
|
||||||
cryptoCurrency: cryptoCurrency,
|
cryptoCurrency: cryptoCurrency,
|
||||||
|
netType: netType,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +384,10 @@ class ElectrumXClient {
|
||||||
return response;
|
return response;
|
||||||
} on WifiOnlyException {
|
} on WifiOnlyException {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
} on ClearnetOnlyException {
|
||||||
|
rethrow;
|
||||||
|
} on TorOnlyException {
|
||||||
|
rethrow;
|
||||||
} on SocketException {
|
} on SocketException {
|
||||||
// likely timed out so then retry
|
// likely timed out so then retry
|
||||||
if (retries > 0) {
|
if (retries > 0) {
|
||||||
|
@ -442,6 +478,10 @@ class ElectrumXClient {
|
||||||
return response;
|
return response;
|
||||||
} on WifiOnlyException {
|
} on WifiOnlyException {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
} on ClearnetOnlyException {
|
||||||
|
rethrow;
|
||||||
|
} on TorOnlyException {
|
||||||
|
rethrow;
|
||||||
} on SocketException {
|
} on SocketException {
|
||||||
// likely timed out so then retry
|
// likely timed out so then retry
|
||||||
if (retries > 0) {
|
if (retries > 0) {
|
||||||
|
@ -488,9 +528,17 @@ class ElectrumXClient {
|
||||||
return await request(
|
return await request(
|
||||||
requestID: requestID,
|
requestID: requestID,
|
||||||
command: 'server.ping',
|
command: 'server.ping',
|
||||||
requestTimeout: const Duration(seconds: 2),
|
requestTimeout: const Duration(seconds: 3),
|
||||||
retries: retryCount,
|
retries: retryCount,
|
||||||
).timeout(const Duration(seconds: 2)) as bool;
|
).timeout(
|
||||||
|
const Duration(seconds: 3),
|
||||||
|
onTimeout: () {
|
||||||
|
Logging.instance.log(
|
||||||
|
"ElectrumxClient.ping timed out with retryCount=$retryCount, host=$_host",
|
||||||
|
level: LogLevel.Debug,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
) as bool;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
class NodeTorMismatchConfigException implements Exception {
|
||||||
|
final String message;
|
||||||
|
|
||||||
|
NodeTorMismatchConfigException({required this.message});
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => message;
|
||||||
|
}
|
|
@ -13,15 +13,11 @@ import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:coinlib_flutter/coinlib_flutter.dart';
|
import 'package:coinlib_flutter/coinlib_flutter.dart';
|
||||||
import 'package:cw_core/node.dart';
|
import 'package:compat/compat.dart' as lib_monero_compat;
|
||||||
import 'package:cw_core/pathForWallet.dart';
|
import 'package:cs_monero/cs_monero.dart' as lib_monero;
|
||||||
import 'package:cw_core/unspent_coins_info.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:cw_core/wallet_info.dart';
|
|
||||||
import 'package:cw_core/wallet_type.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_libmonero/monero/monero.dart';
|
|
||||||
import 'package:flutter_libmonero/wownero/wownero.dart';
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
@ -94,12 +90,6 @@ void main(List<String> args) async {
|
||||||
StackFileSystem.setDesktopOverrideDir(args.last);
|
StackFileSystem.setDesktopOverrideDir(args.last);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell flutter_libmonero how to get access to the application dir
|
|
||||||
FS.setApplicationRootDirectoryFunction(
|
|
||||||
StackFileSystem.applicationRootDirectory,
|
|
||||||
);
|
|
||||||
// TODO set any other external libs file paths (bad external lib design workaround)
|
|
||||||
|
|
||||||
final loadCoinlibFuture = loadCoinlib();
|
final loadCoinlibFuture = loadCoinlib();
|
||||||
|
|
||||||
GoogleFonts.config.allowRuntimeFetching = false;
|
GoogleFonts.config.allowRuntimeFetching = false;
|
||||||
|
@ -172,15 +162,14 @@ void main(List<String> args) async {
|
||||||
// node model adapter
|
// node model adapter
|
||||||
DB.instance.hive.registerAdapter(NodeModelAdapter());
|
DB.instance.hive.registerAdapter(NodeModelAdapter());
|
||||||
|
|
||||||
DB.instance.hive.registerAdapter(NodeAdapter());
|
if (!DB.instance.hive
|
||||||
|
.isAdapterRegistered(lib_monero_compat.WalletInfoAdapter().typeId)) {
|
||||||
if (!DB.instance.hive.isAdapterRegistered(WalletInfoAdapter().typeId)) {
|
DB.instance.hive.registerAdapter(lib_monero_compat.WalletInfoAdapter());
|
||||||
DB.instance.hive.registerAdapter(WalletInfoAdapter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DB.instance.hive.registerAdapter(WalletTypeAdapter());
|
DB.instance.hive.registerAdapter(lib_monero_compat.WalletTypeAdapter());
|
||||||
|
|
||||||
DB.instance.hive.registerAdapter(UnspentCoinsInfoAdapter());
|
lib_monero.Logging.useLogger = kDebugMode;
|
||||||
|
|
||||||
DB.instance.hive.init(
|
DB.instance.hive.init(
|
||||||
(await StackFileSystem.applicationHiveDirectory()).path,
|
(await StackFileSystem.applicationHiveDirectory()).path,
|
||||||
|
@ -237,12 +226,9 @@ void main(List<String> args) async {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
monero.onStartup();
|
|
||||||
wownero.onStartup();
|
|
||||||
|
|
||||||
// SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
|
// SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
|
||||||
// overlays: [SystemUiOverlay.bottom]);
|
// overlays: [SystemUiOverlay.bottom]);
|
||||||
await NotificationApi.init();
|
unawaited(NotificationApi.init());
|
||||||
|
|
||||||
await loadCoinlibFuture;
|
await loadCoinlibFuture;
|
||||||
|
|
||||||
|
@ -378,7 +364,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
// TODO: this should probably run unawaited. Keep commented out for now as proper community nodes ui hasn't been implemented yet
|
// TODO: this should probably run unawaited. Keep commented out for now as proper community nodes ui hasn't been implemented yet
|
||||||
// unawaited(_nodeService.updateCommunityNodes());
|
// unawaited(_nodeService.updateCommunityNodes());
|
||||||
|
|
||||||
if (AppConfig.hasFeature(AppFeature.swap)) {
|
if (AppConfig.hasFeature(AppFeature.swap) &&
|
||||||
|
ref.read(prefsChangeNotifierProvider).enableExchange) {
|
||||||
await ExchangeDataLoadingService.instance.initDB();
|
await ExchangeDataLoadingService.instance.initDB();
|
||||||
// run without awaiting
|
// run without awaiting
|
||||||
if (ref.read(prefsChangeNotifierProvider).externalCalls &&
|
if (ref.read(prefsChangeNotifierProvider).externalCalls &&
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'currency.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetCurrencyCollection on Isar {
|
extension GetCurrencyCollection on Isar {
|
||||||
IsarCollection<Currency> get currencies => this.collection();
|
IsarCollection<Currency> get currencies => this.collection();
|
||||||
|
@ -135,7 +135,7 @@ const CurrencySchema = CollectionSchema(
|
||||||
getId: _currencyGetId,
|
getId: _currencyGetId,
|
||||||
getLinks: _currencyGetLinks,
|
getLinks: _currencyGetLinks,
|
||||||
attach: _currencyAttach,
|
attach: _currencyAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _currencyEstimateSize(
|
int _currencyEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'pair.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetPairCollection on Isar {
|
extension GetPairCollection on Isar {
|
||||||
IsarCollection<Pair> get pairs => this.collection();
|
IsarCollection<Pair> get pairs => this.collection();
|
||||||
|
@ -92,7 +92,7 @@ const PairSchema = CollectionSchema(
|
||||||
getId: _pairGetId,
|
getId: _pairGetId,
|
||||||
getLinks: _pairGetLinks,
|
getLinks: _pairGetLinks,
|
||||||
attach: _pairAttach,
|
attach: _pairAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _pairEstimateSize(
|
int _pairEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'address_label.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetAddressLabelCollection on Isar {
|
extension GetAddressLabelCollection on Isar {
|
||||||
IsarCollection<AddressLabel> get addressLabels => this.collection();
|
IsarCollection<AddressLabel> get addressLabels => this.collection();
|
||||||
|
@ -81,7 +81,7 @@ const AddressLabelSchema = CollectionSchema(
|
||||||
getId: _addressLabelGetId,
|
getId: _addressLabelGetId,
|
||||||
getLinks: _addressLabelGetLinks,
|
getLinks: _addressLabelGetLinks,
|
||||||
attach: _addressLabelAttach,
|
attach: _addressLabelAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _addressLabelEstimateSize(
|
int _addressLabelEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'block_explorer.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetTransactionBlockExplorerCollection on Isar {
|
extension GetTransactionBlockExplorerCollection on Isar {
|
||||||
IsarCollection<TransactionBlockExplorer> get transactionBlockExplorers =>
|
IsarCollection<TransactionBlockExplorer> get transactionBlockExplorers =>
|
||||||
|
@ -54,7 +54,7 @@ const TransactionBlockExplorerSchema = CollectionSchema(
|
||||||
getId: _transactionBlockExplorerGetId,
|
getId: _transactionBlockExplorerGetId,
|
||||||
getLinks: _transactionBlockExplorerGetLinks,
|
getLinks: _transactionBlockExplorerGetLinks,
|
||||||
attach: _transactionBlockExplorerAttach,
|
attach: _transactionBlockExplorerAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _transactionBlockExplorerEstimateSize(
|
int _transactionBlockExplorerEstimateSize(
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
import '../../../../exceptions/address/address_exception.dart';
|
import '../../../../exceptions/address/address_exception.dart';
|
||||||
import 'crypto_currency_address.dart';
|
import 'crypto_currency_address.dart';
|
||||||
import 'transaction.dart';
|
import 'transaction.dart';
|
||||||
|
@ -27,6 +28,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
required this.derivationPath,
|
required this.derivationPath,
|
||||||
required this.type,
|
required this.type,
|
||||||
required this.subType,
|
required this.subType,
|
||||||
|
this.zSafeFrost,
|
||||||
this.otherData,
|
this.otherData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -55,6 +57,8 @@ class Address extends CryptoCurrencyAddress {
|
||||||
|
|
||||||
final transactions = IsarLinks<Transaction>();
|
final transactions = IsarLinks<Transaction>();
|
||||||
|
|
||||||
|
late final bool? zSafeFrost;
|
||||||
|
|
||||||
int derivationChain() {
|
int derivationChain() {
|
||||||
if (subType == AddressSubType.receiving) {
|
if (subType == AddressSubType.receiving) {
|
||||||
return 0; // 0 for receiving (external)
|
return 0; // 0 for receiving (external)
|
||||||
|
@ -80,6 +84,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
AddressType? type,
|
AddressType? type,
|
||||||
AddressSubType? subType,
|
AddressSubType? subType,
|
||||||
DerivationPath? derivationPath,
|
DerivationPath? derivationPath,
|
||||||
|
bool? zSafeFrost,
|
||||||
String? otherData,
|
String? otherData,
|
||||||
}) {
|
}) {
|
||||||
return Address(
|
return Address(
|
||||||
|
@ -90,6 +95,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
type: type ?? this.type,
|
type: type ?? this.type,
|
||||||
subType: subType ?? this.subType,
|
subType: subType ?? this.subType,
|
||||||
derivationPath: derivationPath ?? this.derivationPath,
|
derivationPath: derivationPath ?? this.derivationPath,
|
||||||
|
zSafeFrost: zSafeFrost ?? this.zSafeFrost,
|
||||||
otherData: otherData ?? this.otherData,
|
otherData: otherData ?? this.otherData,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +111,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
"subType: ${subType.name}, "
|
"subType: ${subType.name}, "
|
||||||
"transactionsLength: ${transactions.length} "
|
"transactionsLength: ${transactions.length} "
|
||||||
"derivationPath: $derivationPath, "
|
"derivationPath: $derivationPath, "
|
||||||
|
"zSafeFrost: $zSafeFrost, "
|
||||||
"otherData: $otherData, "
|
"otherData: $otherData, "
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
@ -117,6 +124,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
"type": type.name,
|
"type": type.name,
|
||||||
"subType": subType.name,
|
"subType": subType.name,
|
||||||
"derivationPath": derivationPath?.value,
|
"derivationPath": derivationPath?.value,
|
||||||
|
"zSafeFrost": zSafeFrost,
|
||||||
"otherData": otherData,
|
"otherData": otherData,
|
||||||
};
|
};
|
||||||
return jsonEncode(result);
|
return jsonEncode(result);
|
||||||
|
@ -143,6 +151,7 @@ class Address extends CryptoCurrencyAddress {
|
||||||
derivationPath: derivationPath,
|
derivationPath: derivationPath,
|
||||||
type: AddressType.values.byName(json["type"] as String),
|
type: AddressType.values.byName(json["type"] as String),
|
||||||
subType: AddressSubType.values.byName(json["subType"] as String),
|
subType: AddressSubType.values.byName(json["subType"] as String),
|
||||||
|
zSafeFrost: json["zSafeFrost"] as bool?,
|
||||||
otherData: json["otherData"] as String?,
|
otherData: json["otherData"] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +174,8 @@ enum AddressType {
|
||||||
tezos,
|
tezos,
|
||||||
frostMS,
|
frostMS,
|
||||||
p2tr,
|
p2tr,
|
||||||
solana;
|
solana,
|
||||||
|
cardanoShelley;
|
||||||
|
|
||||||
String get readableName {
|
String get readableName {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
|
@ -201,6 +211,8 @@ enum AddressType {
|
||||||
return "Solana";
|
return "Solana";
|
||||||
case AddressType.p2tr:
|
case AddressType.p2tr:
|
||||||
return "P2TR (taproot)";
|
return "P2TR (taproot)";
|
||||||
|
case AddressType.cardanoShelley:
|
||||||
|
return "Cardano Shelley";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'address.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetAddressCollection on Isar {
|
extension GetAddressCollection on Isar {
|
||||||
IsarCollection<Address> get addresses => this.collection();
|
IsarCollection<Address> get addresses => this.collection();
|
||||||
|
@ -59,6 +59,11 @@ const AddressSchema = CollectionSchema(
|
||||||
id: 7,
|
id: 7,
|
||||||
name: r'walletId',
|
name: r'walletId',
|
||||||
type: IsarType.string,
|
type: IsarType.string,
|
||||||
|
),
|
||||||
|
r'zSafeFrost': PropertySchema(
|
||||||
|
id: 8,
|
||||||
|
name: r'zSafeFrost',
|
||||||
|
type: IsarType.bool,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
estimateSize: _addressEstimateSize,
|
estimateSize: _addressEstimateSize,
|
||||||
|
@ -124,7 +129,7 @@ const AddressSchema = CollectionSchema(
|
||||||
getId: _addressGetId,
|
getId: _addressGetId,
|
||||||
getLinks: _addressGetLinks,
|
getLinks: _addressGetLinks,
|
||||||
attach: _addressAttach,
|
attach: _addressAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _addressEstimateSize(
|
int _addressEstimateSize(
|
||||||
|
@ -172,6 +177,7 @@ void _addressSerialize(
|
||||||
writer.writeByte(offsets[5], object.type.index);
|
writer.writeByte(offsets[5], object.type.index);
|
||||||
writer.writeString(offsets[6], object.value);
|
writer.writeString(offsets[6], object.value);
|
||||||
writer.writeString(offsets[7], object.walletId);
|
writer.writeString(offsets[7], object.walletId);
|
||||||
|
writer.writeBool(offsets[8], object.zSafeFrost);
|
||||||
}
|
}
|
||||||
|
|
||||||
Address _addressDeserialize(
|
Address _addressDeserialize(
|
||||||
|
@ -195,6 +201,7 @@ Address _addressDeserialize(
|
||||||
AddressType.p2pkh,
|
AddressType.p2pkh,
|
||||||
value: reader.readString(offsets[6]),
|
value: reader.readString(offsets[6]),
|
||||||
walletId: reader.readString(offsets[7]),
|
walletId: reader.readString(offsets[7]),
|
||||||
|
zSafeFrost: reader.readBoolOrNull(offsets[8]),
|
||||||
);
|
);
|
||||||
object.id = id;
|
object.id = id;
|
||||||
return object;
|
return object;
|
||||||
|
@ -229,6 +236,8 @@ P _addressDeserializeProp<P>(
|
||||||
return (reader.readString(offset)) as P;
|
return (reader.readString(offset)) as P;
|
||||||
case 7:
|
case 7:
|
||||||
return (reader.readString(offset)) as P;
|
return (reader.readString(offset)) as P;
|
||||||
|
case 8:
|
||||||
|
return (reader.readBoolOrNull(offset)) as P;
|
||||||
default:
|
default:
|
||||||
throw IsarError('Unknown property with id $propertyId');
|
throw IsarError('Unknown property with id $propertyId');
|
||||||
}
|
}
|
||||||
|
@ -1474,6 +1483,32 @@ extension AddressQueryFilter
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterFilterCondition> zSafeFrostIsNull() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addFilterCondition(const FilterCondition.isNull(
|
||||||
|
property: r'zSafeFrost',
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterFilterCondition> zSafeFrostIsNotNull() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addFilterCondition(const FilterCondition.isNotNull(
|
||||||
|
property: r'zSafeFrost',
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterFilterCondition> zSafeFrostEqualTo(
|
||||||
|
bool? value) {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addFilterCondition(FilterCondition.equalTo(
|
||||||
|
property: r'zSafeFrost',
|
||||||
|
value: value,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AddressQueryObject
|
extension AddressQueryObject
|
||||||
|
@ -1621,6 +1656,18 @@ extension AddressQuerySortBy on QueryBuilder<Address, Address, QSortBy> {
|
||||||
return query.addSortBy(r'walletId', Sort.desc);
|
return query.addSortBy(r'walletId', Sort.desc);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterSortBy> sortByZSafeFrost() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addSortBy(r'zSafeFrost', Sort.asc);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterSortBy> sortByZSafeFrostDesc() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addSortBy(r'zSafeFrost', Sort.desc);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AddressQuerySortThenBy
|
extension AddressQuerySortThenBy
|
||||||
|
@ -1708,6 +1755,18 @@ extension AddressQuerySortThenBy
|
||||||
return query.addSortBy(r'walletId', Sort.desc);
|
return query.addSortBy(r'walletId', Sort.desc);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterSortBy> thenByZSafeFrost() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addSortBy(r'zSafeFrost', Sort.asc);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QAfterSortBy> thenByZSafeFrostDesc() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addSortBy(r'zSafeFrost', Sort.desc);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AddressQueryWhereDistinct
|
extension AddressQueryWhereDistinct
|
||||||
|
@ -1756,6 +1815,12 @@ extension AddressQueryWhereDistinct
|
||||||
return query.addDistinctBy(r'walletId', caseSensitive: caseSensitive);
|
return query.addDistinctBy(r'walletId', caseSensitive: caseSensitive);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, Address, QDistinct> distinctByZSafeFrost() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addDistinctBy(r'zSafeFrost');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AddressQueryProperty
|
extension AddressQueryProperty
|
||||||
|
@ -1814,6 +1879,12 @@ extension AddressQueryProperty
|
||||||
return query.addPropertyName(r'walletId');
|
return query.addPropertyName(r'walletId');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryBuilder<Address, bool?, QQueryOperations> zSafeFrostProperty() {
|
||||||
|
return QueryBuilder.apply(this, (query) {
|
||||||
|
return query.addPropertyName(r'zSafeFrost');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
@ -1821,7 +1892,7 @@ extension AddressQueryProperty
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const DerivationPathSchema = Schema(
|
const DerivationPathSchema = Schema(
|
||||||
name: r'DerivationPath',
|
name: r'DerivationPath',
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'input.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const InputSchema = Schema(
|
const InputSchema = Schema(
|
||||||
name: r'Input',
|
name: r'Input',
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'output.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const OutputSchema = Schema(
|
const OutputSchema = Schema(
|
||||||
name: r'Output',
|
name: r'Output',
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'transaction.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetTransactionCollection on Isar {
|
extension GetTransactionCollection on Isar {
|
||||||
IsarCollection<Transaction> get transactions => this.collection();
|
IsarCollection<Transaction> get transactions => this.collection();
|
||||||
|
@ -171,7 +171,7 @@ const TransactionSchema = CollectionSchema(
|
||||||
getId: _transactionGetId,
|
getId: _transactionGetId,
|
||||||
getLinks: _transactionGetLinks,
|
getLinks: _transactionGetLinks,
|
||||||
attach: _transactionAttach,
|
attach: _transactionAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _transactionEstimateSize(
|
int _transactionEstimateSize(
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
@ -79,9 +80,28 @@ class UTXO {
|
||||||
return max(0, currentChainHeight - (blockHeight! - 1));
|
return max(0, currentChainHeight - (blockHeight! - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isConfirmed(int currentChainHeight, int minimumConfirms) {
|
bool isConfirmed(
|
||||||
|
int currentChainHeight,
|
||||||
|
int minimumConfirms,
|
||||||
|
int minimumCoinbaseConfirms,
|
||||||
|
) {
|
||||||
final confirmations = getConfirmations(currentChainHeight);
|
final confirmations = getConfirmations(currentChainHeight);
|
||||||
return confirmations >= minimumConfirms;
|
return confirmations >=
|
||||||
|
(isCoinbase ? minimumCoinbaseConfirms : minimumConfirms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ignore
|
||||||
|
String? get keyImage {
|
||||||
|
if (otherData == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final map = jsonDecode(otherData!) as Map;
|
||||||
|
return map["keyImage"] as String;
|
||||||
|
} catch (_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UTXO copyWith({
|
UTXO copyWith({
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'utxo.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetUTXOCollection on Isar {
|
extension GetUTXOCollection on Isar {
|
||||||
IsarCollection<UTXO> get utxos => this.collection();
|
IsarCollection<UTXO> get utxos => this.collection();
|
||||||
|
@ -149,7 +149,7 @@ const UTXOSchema = CollectionSchema(
|
||||||
getId: _uTXOGetId,
|
getId: _uTXOGetId,
|
||||||
getLinks: _uTXOGetLinks,
|
getLinks: _uTXOGetLinks,
|
||||||
attach: _uTXOAttach,
|
attach: _uTXOAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _uTXOEstimateSize(
|
int _uTXOEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'input_v2.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const OutpointV2Schema = Schema(
|
const OutpointV2Schema = Schema(
|
||||||
name: r'OutpointV2',
|
name: r'OutpointV2',
|
||||||
|
@ -330,7 +330,7 @@ extension OutpointV2QueryObject
|
||||||
on QueryBuilder<OutpointV2, OutpointV2, QFilterCondition> {}
|
on QueryBuilder<OutpointV2, OutpointV2, QFilterCondition> {}
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const InputV2Schema = Schema(
|
const InputV2Schema = Schema(
|
||||||
name: r'InputV2',
|
name: r'InputV2',
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'output_v2.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const OutputV2Schema = Schema(
|
const OutputV2Schema = Schema(
|
||||||
name: r'OutputV2',
|
name: r'OutputV2',
|
||||||
|
|
|
@ -87,7 +87,10 @@ class TransactionV2 {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ignore
|
||||||
int? get size => _getFromOtherData(key: TxV2OdKeys.size) as int?;
|
int? get size => _getFromOtherData(key: TxV2OdKeys.size) as int?;
|
||||||
|
|
||||||
|
@ignore
|
||||||
int? get vSize => _getFromOtherData(key: TxV2OdKeys.vSize) as int?;
|
int? get vSize => _getFromOtherData(key: TxV2OdKeys.vSize) as int?;
|
||||||
|
|
||||||
bool get isEpiccashTransaction =>
|
bool get isEpiccashTransaction =>
|
||||||
|
@ -109,9 +112,14 @@ class TransactionV2 {
|
||||||
return max(0, currentChainHeight - (height! - 1));
|
return max(0, currentChainHeight - (height! - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isConfirmed(int currentChainHeight, int minimumConfirms) {
|
bool isConfirmed(
|
||||||
|
int currentChainHeight,
|
||||||
|
int minimumConfirms,
|
||||||
|
int minimumCoinbaseConfirms,
|
||||||
|
) {
|
||||||
final confirmations = getConfirmations(currentChainHeight);
|
final confirmations = getConfirmations(currentChainHeight);
|
||||||
return confirmations >= minimumConfirms;
|
return confirmations >=
|
||||||
|
(isCoinbase() ? minimumCoinbaseConfirms : minimumConfirms);
|
||||||
}
|
}
|
||||||
|
|
||||||
Amount getFee({required int fractionDigits}) {
|
Amount getFee({required int fractionDigits}) {
|
||||||
|
@ -121,6 +129,10 @@ class TransactionV2 {
|
||||||
return fee;
|
return fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCoinbase()) {
|
||||||
|
return Amount.zeroWith(fractionDigits: fractionDigits);
|
||||||
|
}
|
||||||
|
|
||||||
final inSum =
|
final inSum =
|
||||||
inputs.map((e) => e.value).reduce((value, element) => value += element);
|
inputs.map((e) => e.value).reduce((value, element) => value += element);
|
||||||
final outSum = outputs
|
final outSum = outputs
|
||||||
|
@ -131,6 +143,14 @@ class TransactionV2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
Amount getAmountReceivedInThisWallet({required int fractionDigits}) {
|
Amount getAmountReceivedInThisWallet({required int fractionDigits}) {
|
||||||
|
if (_isMonero()) {
|
||||||
|
if (type == TransactionType.incoming) {
|
||||||
|
return _getMoneroAmount()!;
|
||||||
|
} else {
|
||||||
|
return Amount.zeroWith(fractionDigits: fractionDigits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final outSum = outputs
|
final outSum = outputs
|
||||||
.where((e) => e.walletOwns)
|
.where((e) => e.walletOwns)
|
||||||
.fold(BigInt.zero, (p, e) => p + e.value);
|
.fold(BigInt.zero, (p, e) => p + e.value);
|
||||||
|
@ -148,6 +168,14 @@ class TransactionV2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
Amount getAmountSentFromThisWallet({required int fractionDigits}) {
|
Amount getAmountSentFromThisWallet({required int fractionDigits}) {
|
||||||
|
if (_isMonero()) {
|
||||||
|
if (type == TransactionType.outgoing) {
|
||||||
|
return _getMoneroAmount()!;
|
||||||
|
} else {
|
||||||
|
return Amount.zeroWith(fractionDigits: fractionDigits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final inSum = inputs
|
final inSum = inputs
|
||||||
.where((e) => e.walletOwns)
|
.where((e) => e.walletOwns)
|
||||||
.fold(BigInt.zero, (p, e) => p + e.value);
|
.fold(BigInt.zero, (p, e) => p + e.value);
|
||||||
|
@ -188,18 +216,40 @@ class TransactionV2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Amount? _getMoneroAmount() {
|
||||||
|
try {
|
||||||
|
return Amount.fromSerializedJsonString(
|
||||||
|
_getFromOtherData(key: TxV2OdKeys.moneroAmount) as String,
|
||||||
|
);
|
||||||
|
} catch (_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isMonero() {
|
||||||
|
final value = _getFromOtherData(key: TxV2OdKeys.isMoneroTransaction);
|
||||||
|
return value is bool ? value : false;
|
||||||
|
}
|
||||||
|
|
||||||
String statusLabel({
|
String statusLabel({
|
||||||
required int currentChainHeight,
|
required int currentChainHeight,
|
||||||
required int minConfirms,
|
required int minConfirms,
|
||||||
|
required int minCoinbaseConfirms,
|
||||||
}) {
|
}) {
|
||||||
|
String prettyConfirms() => "("
|
||||||
|
"${getConfirmations(currentChainHeight)}"
|
||||||
|
"/"
|
||||||
|
"${(isCoinbase() ? minCoinbaseConfirms : minConfirms)}"
|
||||||
|
")";
|
||||||
|
|
||||||
if (subType == TransactionSubType.cashFusion ||
|
if (subType == TransactionSubType.cashFusion ||
|
||||||
subType == TransactionSubType.mint ||
|
subType == TransactionSubType.mint ||
|
||||||
(subType == TransactionSubType.sparkMint &&
|
(subType == TransactionSubType.sparkMint &&
|
||||||
type == TransactionType.sentToSelf)) {
|
type == TransactionType.sentToSelf)) {
|
||||||
if (isConfirmed(currentChainHeight, minConfirms)) {
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
return "Anonymized";
|
return "Anonymized";
|
||||||
} else {
|
} else {
|
||||||
return "Anonymizing";
|
return "Anonymizing ${prettyConfirms()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +261,7 @@ class TransactionV2 {
|
||||||
if (isCancelled) {
|
if (isCancelled) {
|
||||||
return "Cancelled";
|
return "Cancelled";
|
||||||
} else if (type == TransactionType.incoming) {
|
} else if (type == TransactionType.incoming) {
|
||||||
if (isConfirmed(currentChainHeight, minConfirms)) {
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
return "Received";
|
return "Received";
|
||||||
} else {
|
} else {
|
||||||
if (numberOfMessages == 1) {
|
if (numberOfMessages == 1) {
|
||||||
|
@ -219,11 +269,11 @@ class TransactionV2 {
|
||||||
} else if ((numberOfMessages ?? 0) > 1) {
|
} else if ((numberOfMessages ?? 0) > 1) {
|
||||||
return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no)
|
return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no)
|
||||||
} else {
|
} else {
|
||||||
return "Receiving";
|
return "Receiving ${prettyConfirms()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == TransactionType.outgoing) {
|
} else if (type == TransactionType.outgoing) {
|
||||||
if (isConfirmed(currentChainHeight, minConfirms)) {
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
return "Sent (confirmed)";
|
return "Sent (confirmed)";
|
||||||
} else {
|
} else {
|
||||||
if (numberOfMessages == 1) {
|
if (numberOfMessages == 1) {
|
||||||
|
@ -231,7 +281,7 @@ class TransactionV2 {
|
||||||
} else if ((numberOfMessages ?? 0) > 1) {
|
} else if ((numberOfMessages ?? 0) > 1) {
|
||||||
return "Sending (waiting for confirmations)";
|
return "Sending (waiting for confirmations)";
|
||||||
} else {
|
} else {
|
||||||
return "Sending";
|
return "Sending ${prettyConfirms()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,19 +291,23 @@ class TransactionV2 {
|
||||||
// if (_transaction.isMinting) {
|
// if (_transaction.isMinting) {
|
||||||
// return "Minting";
|
// return "Minting";
|
||||||
// } else
|
// } else
|
||||||
if (isConfirmed(currentChainHeight, minConfirms)) {
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
return "Received";
|
return "Received";
|
||||||
} else {
|
} else {
|
||||||
return "Receiving";
|
return "Receiving ${prettyConfirms()}";
|
||||||
}
|
}
|
||||||
} else if (type == TransactionType.outgoing) {
|
} else if (type == TransactionType.outgoing) {
|
||||||
if (isConfirmed(currentChainHeight, minConfirms)) {
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
return "Sent";
|
return "Sent";
|
||||||
} else {
|
} else {
|
||||||
return "Sending";
|
return "Sending ${prettyConfirms()}";
|
||||||
}
|
}
|
||||||
} else if (type == TransactionType.sentToSelf) {
|
} else if (type == TransactionType.sentToSelf) {
|
||||||
return "Sent to self";
|
if (isConfirmed(currentChainHeight, minConfirms, minCoinbaseConfirms)) {
|
||||||
|
return "Sent to self";
|
||||||
|
} else {
|
||||||
|
return "Sent to self ${prettyConfirms()}";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return type.name;
|
return type.name;
|
||||||
}
|
}
|
||||||
|
@ -267,6 +321,9 @@ class TransactionV2 {
|
||||||
return map[key];
|
return map[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isCoinbase() =>
|
||||||
|
type == TransactionType.incoming && inputs.any((e) => e.coinbase != null);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'TransactionV2(\n'
|
return 'TransactionV2(\n'
|
||||||
|
@ -297,4 +354,7 @@ abstract final class TxV2OdKeys {
|
||||||
static const contractAddress = "contractAddress";
|
static const contractAddress = "contractAddress";
|
||||||
static const nonce = "nonce";
|
static const nonce = "nonce";
|
||||||
static const overrideFee = "overrideFee";
|
static const overrideFee = "overrideFee";
|
||||||
|
static const moneroAmount = "moneroAmount";
|
||||||
|
static const moneroAccountIndex = "moneroAccountIndex";
|
||||||
|
static const isMoneroTransaction = "isMoneroTransaction";
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'transaction_v2.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetTransactionV2Collection on Isar {
|
extension GetTransactionV2Collection on Isar {
|
||||||
IsarCollection<TransactionV2> get transactionV2s => this.collection();
|
IsarCollection<TransactionV2> get transactionV2s => this.collection();
|
||||||
|
@ -177,7 +177,7 @@ const TransactionV2Schema = CollectionSchema(
|
||||||
getId: _transactionV2GetId,
|
getId: _transactionV2GetId,
|
||||||
getLinks: _transactionV2GetLinks,
|
getLinks: _transactionV2GetLinks,
|
||||||
attach: _transactionV2Attach,
|
attach: _transactionV2Attach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _transactionV2EstimateSize(
|
int _transactionV2EstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'contact_entry.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetContactEntryCollection on Isar {
|
extension GetContactEntryCollection on Isar {
|
||||||
IsarCollection<ContactEntry> get contactEntrys => this.collection();
|
IsarCollection<ContactEntry> get contactEntrys => this.collection();
|
||||||
|
@ -69,7 +69,7 @@ const ContactEntrySchema = CollectionSchema(
|
||||||
getId: _contactEntryGetId,
|
getId: _contactEntryGetId,
|
||||||
getLinks: _contactEntryGetLinks,
|
getLinks: _contactEntryGetLinks,
|
||||||
attach: _contactEntryAttach,
|
attach: _contactEntryAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _contactEntryEstimateSize(
|
int _contactEntryEstimateSize(
|
||||||
|
@ -1142,7 +1142,7 @@ extension ContactEntryQueryProperty
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const ContactAddressEntrySchema = Schema(
|
const ContactAddressEntrySchema = Schema(
|
||||||
name: r'ContactAddressEntry',
|
name: r'ContactAddressEntry',
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'encrypted_string_value.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetEncryptedStringValueCollection on Isar {
|
extension GetEncryptedStringValueCollection on Isar {
|
||||||
IsarCollection<EncryptedStringValue> get encryptedStringValues =>
|
IsarCollection<EncryptedStringValue> get encryptedStringValues =>
|
||||||
|
@ -54,7 +54,7 @@ const EncryptedStringValueSchema = CollectionSchema(
|
||||||
getId: _encryptedStringValueGetId,
|
getId: _encryptedStringValueGetId,
|
||||||
getLinks: _encryptedStringValueGetLinks,
|
getLinks: _encryptedStringValueGetLinks,
|
||||||
attach: _encryptedStringValueAttach,
|
attach: _encryptedStringValueAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _encryptedStringValueEstimateSize(
|
int _encryptedStringValueEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'eth_contract.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetEthContractCollection on Isar {
|
extension GetEthContractCollection on Isar {
|
||||||
IsarCollection<EthContract> get ethContracts => this.collection();
|
IsarCollection<EthContract> get ethContracts => this.collection();
|
||||||
|
@ -74,7 +74,7 @@ const EthContractSchema = CollectionSchema(
|
||||||
getId: _ethContractGetId,
|
getId: _ethContractGetId,
|
||||||
getLinks: _ethContractGetLinks,
|
getLinks: _ethContractGetLinks,
|
||||||
attach: _ethContractAttach,
|
attach: _ethContractAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _ethContractEstimateSize(
|
int _ethContractEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'lelantus_coin.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetLelantusCoinCollection on Isar {
|
extension GetLelantusCoinCollection on Isar {
|
||||||
IsarCollection<LelantusCoin> get lelantusCoins => this.collection();
|
IsarCollection<LelantusCoin> get lelantusCoins => this.collection();
|
||||||
|
@ -101,7 +101,7 @@ const LelantusCoinSchema = CollectionSchema(
|
||||||
getId: _lelantusCoinGetId,
|
getId: _lelantusCoinGetId,
|
||||||
getLinks: _lelantusCoinGetLinks,
|
getLinks: _lelantusCoinGetLinks,
|
||||||
attach: _lelantusCoinAttach,
|
attach: _lelantusCoinAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _lelantusCoinEstimateSize(
|
int _lelantusCoinEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'log.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetLogCollection on Isar {
|
extension GetLogCollection on Isar {
|
||||||
IsarCollection<Log> get logs => this.collection();
|
IsarCollection<Log> get logs => this.collection();
|
||||||
|
@ -59,7 +59,7 @@ const LogSchema = CollectionSchema(
|
||||||
getId: _logGetId,
|
getId: _logGetId,
|
||||||
getLinks: _logGetLinks,
|
getLinks: _logGetLinks,
|
||||||
attach: _logAttach,
|
attach: _logAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _logEstimateSize(
|
int _logEstimateSize(
|
||||||
|
|
35
lib/models/isar/models/sent_to_address.dart
Normal file
35
lib/models/isar/models/sent_to_address.dart
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Stack Wallet.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Cypher Stack
|
||||||
|
* All Rights Reserved.
|
||||||
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
||||||
|
* Generated by Cypher Stack on 2023-05-26
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
|
part 'sent_to_address.g.dart';
|
||||||
|
|
||||||
|
@Collection()
|
||||||
|
class SentToAddress {
|
||||||
|
SentToAddress({
|
||||||
|
required this.walletId,
|
||||||
|
required this.txid,
|
||||||
|
required this.value,
|
||||||
|
this.label = "",
|
||||||
|
});
|
||||||
|
|
||||||
|
Id id = Isar.autoIncrement;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
late final String walletId;
|
||||||
|
|
||||||
|
@Index(unique: true, composite: [CompositeIndex("walletId")])
|
||||||
|
late final String txid;
|
||||||
|
|
||||||
|
late final String value;
|
||||||
|
|
||||||
|
late final String label;
|
||||||
|
}
|
1248
lib/models/isar/models/sent_to_address.g.dart
Normal file
1248
lib/models/isar/models/sent_to_address.g.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@ part of 'transaction_note.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetTransactionNoteCollection on Isar {
|
extension GetTransactionNoteCollection on Isar {
|
||||||
IsarCollection<TransactionNote> get transactionNotes => this.collection();
|
IsarCollection<TransactionNote> get transactionNotes => this.collection();
|
||||||
|
@ -76,7 +76,7 @@ const TransactionNoteSchema = CollectionSchema(
|
||||||
getId: _transactionNoteGetId,
|
getId: _transactionNoteGetId,
|
||||||
getLinks: _transactionNoteGetLinks,
|
getLinks: _transactionNoteGetLinks,
|
||||||
attach: _transactionNoteAttach,
|
attach: _transactionNoteAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _transactionNoteEstimateSize(
|
int _transactionNoteEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'ordinal.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetOrdinalCollection on Isar {
|
extension GetOrdinalCollection on Isar {
|
||||||
IsarCollection<Ordinal> get ordinals => this.collection();
|
IsarCollection<Ordinal> get ordinals => this.collection();
|
||||||
|
@ -83,7 +83,7 @@ const OrdinalSchema = CollectionSchema(
|
||||||
getId: _ordinalGetId,
|
getId: _ordinalGetId,
|
||||||
getLinks: _ordinalGetLinks,
|
getLinks: _ordinalGetLinks,
|
||||||
attach: _ordinalAttach,
|
attach: _ordinalAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _ordinalEstimateSize(
|
int _ordinalEstimateSize(
|
||||||
|
|
|
@ -7,7 +7,7 @@ part of 'stack_theme.dart';
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
extension GetStackThemeCollection on Isar {
|
extension GetStackThemeCollection on Isar {
|
||||||
IsarCollection<StackTheme> get stackThemes => this.collection();
|
IsarCollection<StackTheme> get stackThemes => this.collection();
|
||||||
|
@ -860,7 +860,7 @@ const StackThemeSchema = CollectionSchema(
|
||||||
getId: _stackThemeGetId,
|
getId: _stackThemeGetId,
|
||||||
getLinks: _stackThemeGetLinks,
|
getLinks: _stackThemeGetLinks,
|
||||||
attach: _stackThemeAttach,
|
attach: _stackThemeAttach,
|
||||||
version: '3.0.5',
|
version: '3.1.8',
|
||||||
);
|
);
|
||||||
|
|
||||||
int _stackThemeEstimateSize(
|
int _stackThemeEstimateSize(
|
||||||
|
@ -18012,7 +18012,7 @@ extension StackThemeQueryProperty
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const ThemeAssetsSchema = Schema(
|
const ThemeAssetsSchema = Schema(
|
||||||
name: r'ThemeAssets',
|
name: r'ThemeAssets',
|
||||||
|
@ -25833,7 +25833,7 @@ extension ThemeAssetsQueryObject
|
||||||
on QueryBuilder<ThemeAssets, ThemeAssets, QFilterCondition> {}
|
on QueryBuilder<ThemeAssets, ThemeAssets, QFilterCondition> {}
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const ThemeAssetsV2Schema = Schema(
|
const ThemeAssetsV2Schema = Schema(
|
||||||
name: r'ThemeAssetsV2',
|
name: r'ThemeAssetsV2',
|
||||||
|
@ -29441,7 +29441,7 @@ extension ThemeAssetsV2QueryObject
|
||||||
on QueryBuilder<ThemeAssetsV2, ThemeAssetsV2, QFilterCondition> {}
|
on QueryBuilder<ThemeAssetsV2, ThemeAssetsV2, QFilterCondition> {}
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||||
|
|
||||||
const ThemeAssetsV3Schema = Schema(
|
const ThemeAssetsV3Schema = Schema(
|
||||||
name: r'ThemeAssetsV3',
|
name: r'ThemeAssetsV3',
|
||||||
|
|
164
lib/models/keys/view_only_wallet_data.dart
Normal file
164
lib/models/keys/view_only_wallet_data.dart
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
|
||||||
|
import 'key_data_interface.dart';
|
||||||
|
|
||||||
|
// do not remove or change the order of these enum values
|
||||||
|
enum ViewOnlyWalletType {
|
||||||
|
cryptonote,
|
||||||
|
addressOnly,
|
||||||
|
xPub;
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class ViewOnlyWalletData with KeyDataInterface {
|
||||||
|
@override
|
||||||
|
final String walletId;
|
||||||
|
|
||||||
|
ViewOnlyWalletType get type;
|
||||||
|
|
||||||
|
ViewOnlyWalletData({
|
||||||
|
required this.walletId,
|
||||||
|
});
|
||||||
|
|
||||||
|
static ViewOnlyWalletData fromJsonEncodedString(
|
||||||
|
String jsonEncodedString, {
|
||||||
|
required String walletId,
|
||||||
|
}) {
|
||||||
|
final map = jsonDecode(jsonEncodedString) as Map;
|
||||||
|
final json = Map<String, dynamic>.from(map);
|
||||||
|
final type = ViewOnlyWalletType.values[json["type"] as int];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case ViewOnlyWalletType.cryptonote:
|
||||||
|
return CryptonoteViewOnlyWalletData.fromJsonEncodedString(
|
||||||
|
jsonEncodedString,
|
||||||
|
walletId: walletId,
|
||||||
|
);
|
||||||
|
|
||||||
|
case ViewOnlyWalletType.addressOnly:
|
||||||
|
return AddressViewOnlyWalletData.fromJsonEncodedString(
|
||||||
|
jsonEncodedString,
|
||||||
|
walletId: walletId,
|
||||||
|
);
|
||||||
|
|
||||||
|
case ViewOnlyWalletType.xPub:
|
||||||
|
return ExtendedKeysViewOnlyWalletData.fromJsonEncodedString(
|
||||||
|
jsonEncodedString,
|
||||||
|
walletId: walletId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String toJsonEncodedString();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CryptonoteViewOnlyWalletData extends ViewOnlyWalletData {
|
||||||
|
@override
|
||||||
|
final type = ViewOnlyWalletType.cryptonote;
|
||||||
|
|
||||||
|
final String address;
|
||||||
|
final String privateViewKey;
|
||||||
|
|
||||||
|
CryptonoteViewOnlyWalletData({
|
||||||
|
required super.walletId,
|
||||||
|
required this.address,
|
||||||
|
required this.privateViewKey,
|
||||||
|
});
|
||||||
|
|
||||||
|
static CryptonoteViewOnlyWalletData fromJsonEncodedString(
|
||||||
|
String jsonEncodedString, {
|
||||||
|
required String walletId,
|
||||||
|
}) {
|
||||||
|
final map = jsonDecode(jsonEncodedString) as Map;
|
||||||
|
final json = Map<String, dynamic>.from(map);
|
||||||
|
|
||||||
|
return CryptonoteViewOnlyWalletData(
|
||||||
|
walletId: walletId,
|
||||||
|
address: json["address"] as String,
|
||||||
|
privateViewKey: json["privateViewKey"] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toJsonEncodedString() => jsonEncode({
|
||||||
|
"type": type.index,
|
||||||
|
"address": address,
|
||||||
|
"privateViewKey": privateViewKey,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddressViewOnlyWalletData extends ViewOnlyWalletData {
|
||||||
|
@override
|
||||||
|
final type = ViewOnlyWalletType.addressOnly;
|
||||||
|
|
||||||
|
final String address;
|
||||||
|
|
||||||
|
AddressViewOnlyWalletData({
|
||||||
|
required super.walletId,
|
||||||
|
required this.address,
|
||||||
|
});
|
||||||
|
|
||||||
|
static AddressViewOnlyWalletData fromJsonEncodedString(
|
||||||
|
String jsonEncodedString, {
|
||||||
|
required String walletId,
|
||||||
|
}) {
|
||||||
|
final map = jsonDecode(jsonEncodedString) as Map;
|
||||||
|
final json = Map<String, dynamic>.from(map);
|
||||||
|
|
||||||
|
return AddressViewOnlyWalletData(
|
||||||
|
walletId: walletId,
|
||||||
|
address: json["address"] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toJsonEncodedString() => jsonEncode({
|
||||||
|
"type": type.index,
|
||||||
|
"address": address,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExtendedKeysViewOnlyWalletData extends ViewOnlyWalletData {
|
||||||
|
@override
|
||||||
|
final type = ViewOnlyWalletType.xPub;
|
||||||
|
|
||||||
|
final List<XPub> xPubs;
|
||||||
|
|
||||||
|
ExtendedKeysViewOnlyWalletData({
|
||||||
|
required super.walletId,
|
||||||
|
required List<XPub> xPubs,
|
||||||
|
}) : xPubs = List.unmodifiable(xPubs);
|
||||||
|
|
||||||
|
static ExtendedKeysViewOnlyWalletData fromJsonEncodedString(
|
||||||
|
String jsonEncodedString, {
|
||||||
|
required String walletId,
|
||||||
|
}) {
|
||||||
|
final map = jsonDecode(jsonEncodedString) as Map;
|
||||||
|
final json = Map<String, dynamic>.from(map);
|
||||||
|
|
||||||
|
return ExtendedKeysViewOnlyWalletData(
|
||||||
|
walletId: walletId,
|
||||||
|
xPubs: List<Map<String, dynamic>>.from((json["xPubs"] as List))
|
||||||
|
.map(
|
||||||
|
(e) => XPub(
|
||||||
|
path: e["path"] as String,
|
||||||
|
encoded: e["encoded"] as String,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(growable: false),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toJsonEncodedString() => jsonEncode({
|
||||||
|
"type": type.index,
|
||||||
|
"xPubs": [
|
||||||
|
...xPubs.map(
|
||||||
|
(e) => {
|
||||||
|
"path": e.path,
|
||||||
|
"encoded": e.encoded,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
|
||||||
import '../utilities/default_nodes.dart';
|
import '../utilities/default_nodes.dart';
|
||||||
import '../utilities/flutter_secure_storage_interface.dart';
|
import '../utilities/flutter_secure_storage_interface.dart';
|
||||||
|
|
||||||
|
@ -38,6 +39,10 @@ class NodeModel {
|
||||||
final bool isDown;
|
final bool isDown;
|
||||||
// @HiveField(10)
|
// @HiveField(10)
|
||||||
final bool? trusted;
|
final bool? trusted;
|
||||||
|
// @HiveField(11)
|
||||||
|
final bool torEnabled;
|
||||||
|
// @HiveField(12)
|
||||||
|
final bool clearnetEnabled;
|
||||||
|
|
||||||
NodeModel({
|
NodeModel({
|
||||||
required this.host,
|
required this.host,
|
||||||
|
@ -49,6 +54,8 @@ class NodeModel {
|
||||||
required this.coinName,
|
required this.coinName,
|
||||||
required this.isFailover,
|
required this.isFailover,
|
||||||
required this.isDown,
|
required this.isDown,
|
||||||
|
required this.torEnabled,
|
||||||
|
required this.clearnetEnabled,
|
||||||
this.loginName,
|
this.loginName,
|
||||||
this.trusted,
|
this.trusted,
|
||||||
});
|
});
|
||||||
|
@ -64,6 +71,8 @@ class NodeModel {
|
||||||
bool? isFailover,
|
bool? isFailover,
|
||||||
bool? isDown,
|
bool? isDown,
|
||||||
bool? trusted,
|
bool? trusted,
|
||||||
|
bool? torEnabled,
|
||||||
|
bool? clearnetEnabled,
|
||||||
}) {
|
}) {
|
||||||
return NodeModel(
|
return NodeModel(
|
||||||
host: host ?? this.host,
|
host: host ?? this.host,
|
||||||
|
@ -77,6 +86,8 @@ class NodeModel {
|
||||||
isFailover: isFailover ?? this.isFailover,
|
isFailover: isFailover ?? this.isFailover,
|
||||||
isDown: isDown ?? this.isDown,
|
isDown: isDown ?? this.isDown,
|
||||||
trusted: trusted ?? this.trusted,
|
trusted: trusted ?? this.trusted,
|
||||||
|
torEnabled: torEnabled ?? this.torEnabled,
|
||||||
|
clearnetEnabled: clearnetEnabled ?? this.clearnetEnabled,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +109,8 @@ class NodeModel {
|
||||||
map['isFailover'] = isFailover;
|
map['isFailover'] = isFailover;
|
||||||
map['isDown'] = isDown;
|
map['isDown'] = isDown;
|
||||||
map['trusted'] = trusted;
|
map['trusted'] = trusted;
|
||||||
|
map['torEnabled'] = torEnabled;
|
||||||
|
map['clearEnabled'] = clearnetEnabled;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,15 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
|
||||||
isFailover: fields[8] as bool,
|
isFailover: fields[8] as bool,
|
||||||
isDown: fields[9] as bool,
|
isDown: fields[9] as bool,
|
||||||
trusted: fields[10] as bool?,
|
trusted: fields[10] as bool?,
|
||||||
|
torEnabled: fields[11] as bool? ?? true,
|
||||||
|
clearnetEnabled: fields[12] as bool? ?? true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(BinaryWriter writer, NodeModel obj) {
|
void write(BinaryWriter writer, NodeModel obj) {
|
||||||
writer
|
writer
|
||||||
..writeByte(11)
|
..writeByte(13)
|
||||||
..writeByte(0)
|
..writeByte(0)
|
||||||
..write(obj.id)
|
..write(obj.id)
|
||||||
..writeByte(1)
|
..writeByte(1)
|
||||||
|
@ -56,7 +58,11 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
|
||||||
..writeByte(9)
|
..writeByte(9)
|
||||||
..write(obj.isDown)
|
..write(obj.isDown)
|
||||||
..writeByte(10)
|
..writeByte(10)
|
||||||
..write(obj.trusted);
|
..write(obj.trusted)
|
||||||
|
..writeByte(11)
|
||||||
|
..write(obj.torEnabled)
|
||||||
|
..writeByte(12)
|
||||||
|
..write(obj.clearnetEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:socks5_proxy/socks_client.dart';
|
import 'package:socks5_proxy/socks_client.dart';
|
||||||
|
|
||||||
import '../utilities/logger.dart';
|
import '../utilities/logger.dart';
|
||||||
|
|
||||||
// WIP wrapper layer
|
// WIP wrapper layer
|
||||||
|
@ -118,6 +119,10 @@ class HTTP {
|
||||||
onDone: () => completer.complete(
|
onDone: () => completer.complete(
|
||||||
Uint8List.fromList(bytes),
|
Uint8List.fromList(bytes),
|
||||||
),
|
),
|
||||||
|
onError: (Object err, StackTrace s) => Logging.instance.log(
|
||||||
|
"Http wrapper layer listen: $err\n$s",
|
||||||
|
level: LogLevel.Error,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return completer.future;
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
@ -69,6 +68,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
||||||
...AppConfig.coins.where((e) => e.network == CryptoCurrencyNetwork.main),
|
...AppConfig.coins.where((e) => e.network == CryptoCurrencyNetwork.main),
|
||||||
];
|
];
|
||||||
final List<AddWalletListEntity> coinEntities = [];
|
final List<AddWalletListEntity> coinEntities = [];
|
||||||
|
final List<AddWalletListEntity> coinTestnetEntities = [];
|
||||||
final List<EthTokenEntity> tokenEntities = [];
|
final List<EthTokenEntity> tokenEntities = [];
|
||||||
|
|
||||||
final bool isDesktop = Util.isDesktop;
|
final bool isDesktop = Util.isDesktop;
|
||||||
|
@ -130,16 +130,11 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
||||||
void initState() {
|
void initState() {
|
||||||
_searchFieldController = TextEditingController();
|
_searchFieldController = TextEditingController();
|
||||||
_searchFocusNode = FocusNode();
|
_searchFocusNode = FocusNode();
|
||||||
// _coinsTestnet.remove(Coin.firoTestNet);
|
|
||||||
|
|
||||||
if (Util.isDesktop && !kDebugMode) {
|
|
||||||
_coins.removeWhere((e) => e is BitcoinFrost);
|
|
||||||
}
|
|
||||||
|
|
||||||
coinEntities.addAll(_coins.map((e) => CoinEntity(e)));
|
coinEntities.addAll(_coins.map((e) => CoinEntity(e)));
|
||||||
|
|
||||||
if (ref.read(prefsChangeNotifierProvider).showTestNetCoins) {
|
if (ref.read(prefsChangeNotifierProvider).showTestNetCoins) {
|
||||||
coinEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e)));
|
coinTestnetEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppConfig.coins.whereType<Ethereum>().isNotEmpty) {
|
if (AppConfig.coins.whereType<Ethereum>().isNotEmpty) {
|
||||||
|
@ -286,6 +281,14 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
||||||
initialState: ExpandableState.expanded,
|
initialState: ExpandableState.expanded,
|
||||||
animationDurationMultiplier: 0.5,
|
animationDurationMultiplier: 0.5,
|
||||||
),
|
),
|
||||||
|
if (coinTestnetEntities.isNotEmpty)
|
||||||
|
ExpandingSubListItem(
|
||||||
|
title: "Testnet",
|
||||||
|
entities:
|
||||||
|
filter(_searchTerm, coinTestnetEntities),
|
||||||
|
initialState: ExpandableState.expanded,
|
||||||
|
animationDurationMultiplier: 0.5,
|
||||||
|
),
|
||||||
if (tokenEntities.isNotEmpty)
|
if (tokenEntities.isNotEmpty)
|
||||||
ExpandingSubListItem(
|
ExpandingSubListItem(
|
||||||
title: "Tokens",
|
title: "Tokens",
|
||||||
|
@ -419,6 +422,13 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
||||||
entities: filter(_searchTerm, coinEntities),
|
entities: filter(_searchTerm, coinEntities),
|
||||||
initialState: ExpandableState.expanded,
|
initialState: ExpandableState.expanded,
|
||||||
),
|
),
|
||||||
|
if (coinTestnetEntities.isNotEmpty)
|
||||||
|
ExpandingSubListItem(
|
||||||
|
title: "Testnet",
|
||||||
|
entities:
|
||||||
|
filter(_searchTerm, coinTestnetEntities),
|
||||||
|
initialState: ExpandableState.expanded,
|
||||||
|
),
|
||||||
if (tokenEntities.isNotEmpty)
|
if (tokenEntities.isNotEmpty)
|
||||||
ExpandingSubListItem(
|
ExpandingSubListItem(
|
||||||
title: "Tokens",
|
title: "Tokens",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -32,6 +33,7 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import '../../../../widgets/desktop/desktop_app_bar.dart';
|
import '../../../../widgets/desktop/desktop_app_bar.dart';
|
||||||
import '../../../../widgets/desktop/desktop_scaffold.dart';
|
import '../../../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import '../../../../widgets/desktop/primary_button.dart';
|
import '../../../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../../../../widgets/desktop/qr_code_scanner_dialog.dart';
|
||||||
import '../../../../widgets/frost_mascot.dart';
|
import '../../../../widgets/frost_mascot.dart';
|
||||||
import '../../../../widgets/icon_widgets/clipboard_icon.dart';
|
import '../../../../widgets/icon_widgets/clipboard_icon.dart';
|
||||||
import '../../../../widgets/icon_widgets/qrcode_icon.dart';
|
import '../../../../widgets/icon_widgets/qrcode_icon.dart';
|
||||||
|
@ -207,6 +209,54 @@ class _RestoreFrostMsWalletViewState
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> scanQr() async {
|
||||||
|
try {
|
||||||
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
if (FocusScope.of(context).hasFocus) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 75),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final qrResult = await BarcodeScanner.scan();
|
||||||
|
|
||||||
|
configFieldController.text = qrResult.rawContent;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_configEmpty = configFieldController.text.isEmpty;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Platform.isLinux, Platform.isWindows, or Platform.isMacOS.
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return QrCodeScannerDialog(
|
||||||
|
onQrCodeDetected: (qrCodeData) {
|
||||||
|
try {
|
||||||
|
// TODO [prio=low]: Validate QR code data.
|
||||||
|
configFieldController.text = qrCodeData;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_configEmpty = configFieldController.text.isEmpty;
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
Logging.instance.log("Error processing QR code data: $e\n$s",
|
||||||
|
level: LogLevel.Error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} on PlatformException catch (e, s) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed to get camera permissions while trying to scan qr code: $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
|
@ -351,31 +401,7 @@ class _RestoreFrostMsWalletViewState
|
||||||
semanticsLabel:
|
semanticsLabel:
|
||||||
"Scan QR Button. Opens Camera For Scanning QR Code.",
|
"Scan QR Button. Opens Camera For Scanning QR Code.",
|
||||||
key: const Key("frConfigScanQrButtonKey"),
|
key: const Key("frConfigScanQrButtonKey"),
|
||||||
onTap: () async {
|
onTap: scanQr,
|
||||||
try {
|
|
||||||
if (FocusScope.of(context).hasFocus) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
await Future<void>.delayed(
|
|
||||||
const Duration(milliseconds: 75),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final qrResult = await BarcodeScanner.scan();
|
|
||||||
|
|
||||||
configFieldController.text =
|
|
||||||
qrResult.rawContent;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_configEmpty =
|
|
||||||
configFieldController.text.isEmpty;
|
|
||||||
});
|
|
||||||
} on PlatformException catch (e, s) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"Failed to get camera permissions while trying to scan qr code: $e\n$s",
|
|
||||||
level: LogLevel.Warning,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const QrCodeIcon(),
|
child: const QrCodeIcon(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -25,6 +25,7 @@ import '../../../utilities/name_generator.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../utilities/util.dart';
|
import '../../../utilities/util.dart';
|
||||||
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
import '../../../wallets/crypto_currency/interfaces/view_only_option_currency_interface.dart';
|
||||||
import '../../../wallets/crypto_currency/intermediate/frost_currency.dart';
|
import '../../../wallets/crypto_currency/intermediate/frost_currency.dart';
|
||||||
import '../../../wallets/isar/models/wallet_info.dart';
|
import '../../../wallets/isar/models/wallet_info.dart';
|
||||||
import '../../../widgets/background.dart';
|
import '../../../widgets/background.dart';
|
||||||
|
@ -104,7 +105,9 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
|
||||||
case AddWalletType.New:
|
case AddWalletType.New:
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
coin.hasMnemonicPassphraseSupport
|
coin.possibleMnemonicLengths.length > 1 ||
|
||||||
|
coin.hasMnemonicPassphraseSupport ||
|
||||||
|
coin is ViewOnlyOptionCurrencyInterface
|
||||||
? NewWalletOptionsView.routeName
|
? NewWalletOptionsView.routeName
|
||||||
: NewWalletRecoveryPhraseWarningView.routeName,
|
: NewWalletRecoveryPhraseWarningView.routeName,
|
||||||
arguments: Tuple2(
|
arguments: Tuple2(
|
||||||
|
|
|
@ -12,9 +12,11 @@ import '../../../utilities/constants.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../utilities/util.dart';
|
import '../../../utilities/util.dart';
|
||||||
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
import '../../../wallets/crypto_currency/interfaces/view_only_option_currency_interface.dart';
|
||||||
import '../../../widgets/background.dart';
|
import '../../../widgets/background.dart';
|
||||||
import '../../../widgets/conditional_parent.dart';
|
import '../../../widgets/conditional_parent.dart';
|
||||||
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import '../../../widgets/custom_buttons/checkbox_text_button.dart';
|
||||||
import '../../../widgets/desktop/desktop_app_bar.dart';
|
import '../../../widgets/desktop/desktop_app_bar.dart';
|
||||||
import '../../../widgets/desktop/desktop_scaffold.dart';
|
import '../../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import '../../../widgets/desktop/primary_button.dart';
|
import '../../../widgets/desktop/primary_button.dart';
|
||||||
|
@ -25,8 +27,12 @@ import '../new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_wa
|
||||||
import '../restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart';
|
import '../restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart';
|
||||||
import '../restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart';
|
import '../restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart';
|
||||||
|
|
||||||
final pNewWalletOptions =
|
final pNewWalletOptions = StateProvider<
|
||||||
StateProvider<({String mnemonicPassphrase, int mnemonicWordsCount})?>(
|
({
|
||||||
|
String mnemonicPassphrase,
|
||||||
|
int mnemonicWordsCount,
|
||||||
|
bool convertToViewOnly,
|
||||||
|
})?>(
|
||||||
(ref) => null,
|
(ref) => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -59,6 +65,8 @@ class _NewWalletOptionsViewState extends ConsumerState<NewWalletOptionsView> {
|
||||||
bool hidePassword = true;
|
bool hidePassword = true;
|
||||||
NewWalletOptions _selectedOptions = NewWalletOptions.Default;
|
NewWalletOptions _selectedOptions = NewWalletOptions.Default;
|
||||||
|
|
||||||
|
bool _convertToViewOnly = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
passwordController = TextEditingController();
|
passwordController = TextEditingController();
|
||||||
|
@ -210,7 +218,7 @@ class _NewWalletOptionsViewState extends ConsumerState<NewWalletOptionsView> {
|
||||||
if (_selectedOptions == NewWalletOptions.Advanced)
|
if (_selectedOptions == NewWalletOptions.Advanced)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
if (Util.isDesktop)
|
if (Util.isDesktop && lengths.length > 1)
|
||||||
DropdownButtonHideUnderline(
|
DropdownButtonHideUnderline(
|
||||||
child: DropdownButton2<int>(
|
child: DropdownButton2<int>(
|
||||||
value: ref
|
value: ref
|
||||||
|
@ -265,7 +273,7 @@ class _NewWalletOptionsViewState extends ConsumerState<NewWalletOptionsView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!Util.isDesktop)
|
if (!Util.isDesktop && lengths.length > 1)
|
||||||
MobileMnemonicLengthSelector(
|
MobileMnemonicLengthSelector(
|
||||||
chooseMnemonicLength: () {
|
chooseMnemonicLength: () {
|
||||||
showModalBottomSheet<dynamic>(
|
showModalBottomSheet<dynamic>(
|
||||||
|
@ -284,91 +292,109 @@ class _NewWalletOptionsViewState extends ConsumerState<NewWalletOptionsView> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
if (widget.coin.hasMnemonicPassphraseSupport)
|
||||||
height: 24,
|
const SizedBox(
|
||||||
),
|
height: 24,
|
||||||
RoundedWhiteContainer(
|
),
|
||||||
child: Center(
|
if (widget.coin.hasMnemonicPassphraseSupport)
|
||||||
child: Text(
|
RoundedWhiteContainer(
|
||||||
"You may add a BIP39 passphrase. This is optional. "
|
child: Center(
|
||||||
"You will need BOTH your seed and your passphrase to recover the wallet.",
|
child: Text(
|
||||||
style: Util.isDesktop
|
"You may add a BIP39 passphrase. This is optional. "
|
||||||
? STextStyles.desktopTextExtraSmall(context)
|
"You will need BOTH your seed and your passphrase to recover the wallet.",
|
||||||
.copyWith(
|
style: Util.isDesktop
|
||||||
color: Theme.of(context)
|
? STextStyles.desktopTextExtraSmall(context)
|
||||||
.extension<StackColors>()!
|
.copyWith(
|
||||||
.textSubtitle1,
|
color: Theme.of(context)
|
||||||
)
|
.extension<StackColors>()!
|
||||||
: STextStyles.itemSubtitle(context),
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (widget.coin.hasMnemonicPassphraseSupport)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
Constants.size.circularBorderRadius,
|
|
||||||
),
|
),
|
||||||
child: TextField(
|
if (widget.coin.hasMnemonicPassphraseSupport)
|
||||||
key: const Key("mnemonicPassphraseFieldKey1"),
|
ClipRRect(
|
||||||
focusNode: passwordFocusNode,
|
borderRadius: BorderRadius.circular(
|
||||||
controller: passwordController,
|
Constants.size.circularBorderRadius,
|
||||||
style: Util.isDesktop
|
),
|
||||||
? STextStyles.desktopTextMedium(context).copyWith(
|
child: TextField(
|
||||||
height: 2,
|
key: const Key("mnemonicPassphraseFieldKey1"),
|
||||||
)
|
focusNode: passwordFocusNode,
|
||||||
: STextStyles.field(context),
|
controller: passwordController,
|
||||||
obscureText: hidePassword,
|
style: Util.isDesktop
|
||||||
enableSuggestions: false,
|
? STextStyles.desktopTextMedium(context).copyWith(
|
||||||
autocorrect: false,
|
height: 2,
|
||||||
decoration: standardInputDecoration(
|
)
|
||||||
"BIP39 passphrase",
|
: STextStyles.field(context),
|
||||||
passwordFocusNode,
|
obscureText: hidePassword,
|
||||||
context,
|
enableSuggestions: false,
|
||||||
).copyWith(
|
autocorrect: false,
|
||||||
suffixIcon: UnconstrainedBox(
|
decoration: standardInputDecoration(
|
||||||
child: ConditionalParent(
|
"BIP39 passphrase",
|
||||||
condition: Util.isDesktop,
|
passwordFocusNode,
|
||||||
builder: (child) => SizedBox(
|
context,
|
||||||
height: 70,
|
).copyWith(
|
||||||
child: child,
|
suffixIcon: UnconstrainedBox(
|
||||||
),
|
child: ConditionalParent(
|
||||||
child: Row(
|
condition: Util.isDesktop,
|
||||||
children: [
|
builder: (child) => SizedBox(
|
||||||
SizedBox(
|
height: 70,
|
||||||
width: Util.isDesktop ? 24 : 16,
|
child: child,
|
||||||
),
|
),
|
||||||
GestureDetector(
|
child: Row(
|
||||||
key: const Key(
|
children: [
|
||||||
"mnemonicPassphraseFieldShowPasswordButtonKey",
|
SizedBox(
|
||||||
),
|
|
||||||
onTap: () async {
|
|
||||||
setState(() {
|
|
||||||
hidePassword = !hidePassword;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
hidePassword
|
|
||||||
? Assets.svg.eye
|
|
||||||
: Assets.svg.eyeSlash,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
width: Util.isDesktop ? 24 : 16,
|
width: Util.isDesktop ? 24 : 16,
|
||||||
height: Util.isDesktop ? 24 : 16,
|
|
||||||
),
|
),
|
||||||
),
|
GestureDetector(
|
||||||
const SizedBox(
|
key: const Key(
|
||||||
width: 12,
|
"mnemonicPassphraseFieldShowPasswordButtonKey",
|
||||||
),
|
),
|
||||||
],
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
hidePassword = !hidePassword;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
hidePassword
|
||||||
|
? Assets.svg.eye
|
||||||
|
: Assets.svg.eyeSlash,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
width: Util.isDesktop ? 24 : 16,
|
||||||
|
height: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (widget.coin is ViewOnlyOptionCurrencyInterface)
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
if (widget.coin is ViewOnlyOptionCurrencyInterface)
|
||||||
|
CheckboxTextButton(
|
||||||
|
label: "Convert to view only wallet. "
|
||||||
|
"You will only be shown the seed phrase once. "
|
||||||
|
"Save it somewhere. "
|
||||||
|
"If you lose it you will lose access to any funds in this wallet.",
|
||||||
|
onChanged: (value) {
|
||||||
|
_convertToViewOnly = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!Util.isDesktop) const Spacer(),
|
if (!Util.isDesktop) const Spacer(),
|
||||||
|
@ -383,6 +409,7 @@ class _NewWalletOptionsViewState extends ConsumerState<NewWalletOptionsView> {
|
||||||
mnemonicWordsCount:
|
mnemonicWordsCount:
|
||||||
ref.read(mnemonicWordCountStateProvider.state).state,
|
ref.read(mnemonicWordCountStateProvider.state).state,
|
||||||
mnemonicPassphrase: passwordController.text,
|
mnemonicPassphrase: passwordController.text,
|
||||||
|
convertToViewOnly: _convertToViewOnly,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ref.read(pNewWalletOptions.notifier).state = null;
|
ref.read(pNewWalletOptions.notifier).state = null;
|
||||||
|
|
|
@ -560,6 +560,8 @@ class _NewWalletRecoveryPhraseWarningViewState
|
||||||
wordCount = info
|
wordCount = info
|
||||||
.coin.defaultSeedPhraseLength;
|
.coin.defaultSeedPhraseLength;
|
||||||
|
|
||||||
|
// TODO: Refactor these to generate each coin in their respective classes
|
||||||
|
// This code should not be in a random view page file
|
||||||
if (coin is Monero ||
|
if (coin is Monero ||
|
||||||
coin is Wownero) {
|
coin is Wownero) {
|
||||||
// currently a special case due to the
|
// currently a special case due to the
|
||||||
|
@ -580,7 +582,12 @@ class _NewWalletRecoveryPhraseWarningViewState
|
||||||
)
|
)
|
||||||
.state!
|
.state!
|
||||||
.mnemonicPassphrase;
|
.mnemonicPassphrase;
|
||||||
} else {}
|
} else {
|
||||||
|
// this may not be epiccash specific?
|
||||||
|
if (coin is Epiccash) {
|
||||||
|
mnemonicPassphrase = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wordCount = ref
|
wordCount = ref
|
||||||
.read(
|
.read(
|
||||||
|
|
|
@ -23,6 +23,8 @@ import '../../../../utilities/format.dart';
|
||||||
import '../../../../utilities/text_styles.dart';
|
import '../../../../utilities/text_styles.dart';
|
||||||
import '../../../../utilities/util.dart';
|
import '../../../../utilities/util.dart';
|
||||||
import '../../../../wallets/crypto_currency/crypto_currency.dart';
|
import '../../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
import '../../../../wallets/crypto_currency/interfaces/view_only_option_currency_interface.dart';
|
||||||
|
import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
|
||||||
import '../../../../widgets/conditional_parent.dart';
|
import '../../../../widgets/conditional_parent.dart';
|
||||||
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import '../../../../widgets/custom_buttons/checkbox_text_button.dart';
|
import '../../../../widgets/custom_buttons/checkbox_text_button.dart';
|
||||||
|
@ -32,7 +34,9 @@ import '../../../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import '../../../../widgets/expandable.dart';
|
import '../../../../widgets/expandable.dart';
|
||||||
import '../../../../widgets/rounded_white_container.dart';
|
import '../../../../widgets/rounded_white_container.dart';
|
||||||
import '../../../../widgets/stack_text_field.dart';
|
import '../../../../widgets/stack_text_field.dart';
|
||||||
|
import '../../../../widgets/toggle.dart';
|
||||||
import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart';
|
import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart';
|
||||||
|
import '../restore_view_only_wallet_view.dart';
|
||||||
import '../restore_wallet_view.dart';
|
import '../restore_wallet_view.dart';
|
||||||
import '../sub_widgets/mnemonic_word_count_select_sheet.dart';
|
import '../sub_widgets/mnemonic_word_count_select_sheet.dart';
|
||||||
import 'sub_widgets/mobile_mnemonic_length_selector.dart';
|
import 'sub_widgets/mobile_mnemonic_length_selector.dart';
|
||||||
|
@ -67,9 +71,8 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
late final TextEditingController passwordController;
|
late final TextEditingController passwordController;
|
||||||
|
|
||||||
final bool _nextEnabled = true;
|
final bool _nextEnabled = true;
|
||||||
DateTime _restoreFromDate = DateTime.fromMillisecondsSinceEpoch(0);
|
DateTime? _restoreFromDate;
|
||||||
bool hidePassword = true;
|
bool hidePassword = true;
|
||||||
bool _expandedAdavnced = false;
|
|
||||||
|
|
||||||
bool get supportsMnemonicPassphrase => coin.hasMnemonicPassphraseSupport;
|
bool get supportsMnemonicPassphrase => coin.hasMnemonicPassphraseSupport;
|
||||||
|
|
||||||
|
@ -99,27 +102,46 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _nextLock = false;
|
||||||
Future<void> nextPressed() async {
|
Future<void> nextPressed() async {
|
||||||
if (!isDesktop) {
|
if (_nextLock) return;
|
||||||
// hide keyboard if has focus
|
_nextLock = true;
|
||||||
if (FocusScope.of(context).hasFocus) {
|
try {
|
||||||
FocusScope.of(context).unfocus();
|
if (!isDesktop) {
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 75));
|
// hide keyboard if has focus
|
||||||
|
if (FocusScope.of(context).hasFocus) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 75));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await Navigator.of(context).pushNamed(
|
if (!_showViewOnlyOption) {
|
||||||
RestoreWalletView.routeName,
|
await Navigator.of(context).pushNamed(
|
||||||
arguments: Tuple6(
|
RestoreWalletView.routeName,
|
||||||
walletName,
|
arguments: Tuple6(
|
||||||
coin,
|
walletName,
|
||||||
ref.read(mnemonicWordCountStateProvider.state).state,
|
coin,
|
||||||
_restoreFromDate,
|
ref.read(mnemonicWordCountStateProvider.state).state,
|
||||||
passwordController.text,
|
_restoreFromDate,
|
||||||
enableLelantusScanning,
|
passwordController.text,
|
||||||
),
|
enableLelantusScanning,
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await Navigator.of(context).pushNamed(
|
||||||
|
RestoreViewOnlyWalletView.routeName,
|
||||||
|
arguments: (
|
||||||
|
walletName: walletName,
|
||||||
|
coin: coin,
|
||||||
|
restoreFromDate: _restoreFromDate,
|
||||||
|
enableLelantusScanning: enableLelantusScanning,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
_nextLock = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,17 +186,12 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _showViewOnlyOption = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType with ${coin.identifier} $walletName");
|
debugPrint("BUILD: $runtimeType with ${coin.identifier} $walletName");
|
||||||
|
|
||||||
final lengths = coin.possibleMnemonicLengths;
|
|
||||||
|
|
||||||
final isMoneroAnd25 = coin is Monero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
|
|
||||||
final isWowneroAnd25 = coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
|
|
||||||
|
|
||||||
return MasterScaffold(
|
return MasterScaffold(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
appBar: isDesktop
|
appBar: isDesktop
|
||||||
|
@ -227,288 +244,57 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 40 : 24,
|
height: isDesktop ? 40 : 24,
|
||||||
),
|
),
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
if (coin is ViewOnlyOptionCurrencyInterface)
|
||||||
Text(
|
|
||||||
"Choose start date",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
)
|
|
||||||
: STextStyles.smallMed12(context),
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
),
|
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 16 : 8,
|
height: isDesktop ? 56 : 48,
|
||||||
),
|
width: isDesktop ? 490 : null,
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
child: Toggle(
|
||||||
if (!isDesktop)
|
key: UniqueKey(),
|
||||||
RestoreFromDatePicker(
|
onText: "Seed",
|
||||||
onTap: chooseDate,
|
offText: "View Only",
|
||||||
controller: _dateController,
|
onColor:
|
||||||
),
|
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
offColor: Theme.of(context)
|
||||||
if (isDesktop)
|
.extension<StackColors>()!
|
||||||
// TODO desktop date picker
|
.textFieldDefaultBG,
|
||||||
RestoreFromDatePicker(
|
isOn: _showViewOnlyOption,
|
||||||
onTap: chooseDesktopDate,
|
onValueChanged: (value) {
|
||||||
controller: _dateController,
|
setState(() {
|
||||||
),
|
_showViewOnlyOption = value;
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
});
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
|
||||||
RoundedWhiteContainer(
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
"Choose the date you made the wallet (approximate is fine)",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.smallMed12(context).copyWith(
|
|
||||||
fontSize: 10,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
|
||||||
SizedBox(
|
|
||||||
height: isDesktop ? 24 : 16,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Choose recovery phrase length",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
)
|
|
||||||
: STextStyles.smallMed12(context),
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: isDesktop ? 16 : 8,
|
|
||||||
),
|
|
||||||
if (isDesktop)
|
|
||||||
DropdownButtonHideUnderline(
|
|
||||||
child: DropdownButton2<int>(
|
|
||||||
value:
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state,
|
|
||||||
items: [
|
|
||||||
...lengths.map(
|
|
||||||
(e) => DropdownMenuItem(
|
|
||||||
value: e,
|
|
||||||
child: Text(
|
|
||||||
"$e words",
|
|
||||||
style: STextStyles.desktopTextMedium(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value is int) {
|
|
||||||
ref.read(mnemonicWordCountStateProvider.state).state =
|
|
||||||
value;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
isExpanded: true,
|
decoration: BoxDecoration(
|
||||||
iconStyleData: IconStyleData(
|
color: Colors.transparent,
|
||||||
icon: SvgPicture.asset(
|
borderRadius: BorderRadius.circular(
|
||||||
Assets.svg.chevronDown,
|
Constants.size.circularBorderRadius,
|
||||||
width: 12,
|
|
||||||
height: 6,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFieldActiveSearchIconRight,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
dropdownStyleData: DropdownStyleData(
|
|
||||||
offset: const Offset(0, -10),
|
|
||||||
elevation: 0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFieldDefaultBG,
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
Constants.size.circularBorderRadius,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
menuItemStyleData: const MenuItemStyleData(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: 8,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!isDesktop)
|
if (coin is ViewOnlyOptionCurrencyInterface)
|
||||||
MobileMnemonicLengthSelector(
|
|
||||||
chooseMnemonicLength: chooseMnemonicLength,
|
|
||||||
),
|
|
||||||
if (supportsMnemonicPassphrase)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 24 : 16,
|
height: isDesktop ? 40 : 24,
|
||||||
),
|
),
|
||||||
if (supportsMnemonicPassphrase)
|
_showViewOnlyOption
|
||||||
Expandable(
|
? ViewOnlyRestoreOption(
|
||||||
onExpandChanged: (state) {
|
coin: coin,
|
||||||
setState(() {
|
dateController: _dateController,
|
||||||
_expandedAdavnced = state == ExpandableState.expanded;
|
dateChooserFunction:
|
||||||
});
|
isDesktop ? chooseDesktopDate : chooseDate,
|
||||||
},
|
)
|
||||||
header: Container(
|
: SeedRestoreOption(
|
||||||
color: Colors.transparent,
|
coin: coin,
|
||||||
child: Padding(
|
dateController: _dateController,
|
||||||
padding: const EdgeInsets.only(
|
pwController: passwordController,
|
||||||
top: 8.0,
|
pwFocusNode: passwordFocusNode,
|
||||||
bottom: 8.0,
|
supportsMnemonicPassphrase: supportsMnemonicPassphrase,
|
||||||
right: 10,
|
dateChooserFunction:
|
||||||
),
|
isDesktop ? chooseDesktopDate : chooseDate,
|
||||||
child: Row(
|
chooseMnemonicLength: chooseMnemonicLength,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
lelScanChanged: (value) {
|
||||||
children: [
|
enableLelantusScanning = value;
|
||||||
Text(
|
},
|
||||||
"Advanced",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraExtraSmall(
|
|
||||||
context,
|
|
||||||
).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
)
|
|
||||||
: STextStyles.smallMed12(context),
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
),
|
|
||||||
SvgPicture.asset(
|
|
||||||
_expandedAdavnced
|
|
||||||
? Assets.svg.chevronUp
|
|
||||||
: Assets.svg.chevronDown,
|
|
||||||
width: 12,
|
|
||||||
height: 6,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFieldActiveSearchIconRight,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
body: Container(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
if (coin is Firo)
|
|
||||||
CheckboxTextButton(
|
|
||||||
label: "Scan for Lelantus transactions",
|
|
||||||
onChanged: (newValue) {
|
|
||||||
setState(() {
|
|
||||||
enableLelantusScanning = newValue ?? true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (coin is Firo)
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
Constants.size.circularBorderRadius,
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
key: const Key("mnemonicPassphraseFieldKey1"),
|
|
||||||
focusNode: passwordFocusNode,
|
|
||||||
controller: passwordController,
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextMedium(context)
|
|
||||||
.copyWith(
|
|
||||||
height: 2,
|
|
||||||
)
|
|
||||||
: STextStyles.field(context),
|
|
||||||
obscureText: hidePassword,
|
|
||||||
enableSuggestions: false,
|
|
||||||
autocorrect: false,
|
|
||||||
decoration: standardInputDecoration(
|
|
||||||
"BIP39 passphrase",
|
|
||||||
passwordFocusNode,
|
|
||||||
context,
|
|
||||||
).copyWith(
|
|
||||||
suffixIcon: UnconstrainedBox(
|
|
||||||
child: ConditionalParent(
|
|
||||||
condition: isDesktop,
|
|
||||||
builder: (child) => SizedBox(
|
|
||||||
height: 70,
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: isDesktop ? 24 : 16,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key(
|
|
||||||
"mnemonicPassphraseFieldShowPasswordButtonKey",
|
|
||||||
),
|
|
||||||
onTap: () async {
|
|
||||||
setState(() {
|
|
||||||
hidePassword = !hidePassword;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
hidePassword
|
|
||||||
? Assets.svg.eye
|
|
||||||
: Assets.svg.eyeSlash,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark3,
|
|
||||||
width: isDesktop ? 24 : 16,
|
|
||||||
height: isDesktop ? 24 : 16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 12,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
RoundedWhiteContainer(
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
"If the recovery phrase you are about to restore "
|
|
||||||
"was created with an optional BIP39 passphrase "
|
|
||||||
"you can enter it here.",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopTextExtraSmall(context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
)
|
|
||||||
: STextStyles.itemSubtitle(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 16,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (!isDesktop)
|
if (!isDesktop)
|
||||||
const Spacer(
|
const Spacer(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
|
@ -532,3 +318,394 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SeedRestoreOption extends ConsumerStatefulWidget {
|
||||||
|
const SeedRestoreOption({
|
||||||
|
super.key,
|
||||||
|
required this.coin,
|
||||||
|
required this.dateController,
|
||||||
|
required this.pwController,
|
||||||
|
required this.pwFocusNode,
|
||||||
|
required this.supportsMnemonicPassphrase,
|
||||||
|
required this.dateChooserFunction,
|
||||||
|
required this.chooseMnemonicLength,
|
||||||
|
required this.lelScanChanged,
|
||||||
|
});
|
||||||
|
|
||||||
|
final CryptoCurrency coin;
|
||||||
|
final TextEditingController dateController;
|
||||||
|
final TextEditingController pwController;
|
||||||
|
final FocusNode pwFocusNode;
|
||||||
|
final bool supportsMnemonicPassphrase;
|
||||||
|
|
||||||
|
final Future<void> Function() dateChooserFunction;
|
||||||
|
final Future<void> Function() chooseMnemonicLength;
|
||||||
|
final void Function(bool) lelScanChanged;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<SeedRestoreOption> createState() => _SeedRestoreOptionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SeedRestoreOptionState extends ConsumerState<SeedRestoreOption> {
|
||||||
|
bool _hidePassword = true;
|
||||||
|
bool _expandedAdvanced = false;
|
||||||
|
bool _enableLelantusScanning = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final lengths = widget.coin.possibleMnemonicLengths;
|
||||||
|
|
||||||
|
final isMoneroAnd25 = widget.coin is Monero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
|
||||||
|
final isWowneroAnd25 = widget.coin is Wownero &&
|
||||||
|
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
Text(
|
||||||
|
"Choose start date",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 16 : 8,
|
||||||
|
),
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
RestoreFromDatePicker(
|
||||||
|
onTap: widget.dateChooserFunction,
|
||||||
|
controller: widget.dateController,
|
||||||
|
),
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
RoundedWhiteContainer(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Choose the date you made the wallet (approximate is fine)",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context).copyWith(
|
||||||
|
fontSize: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isMoneroAnd25 || widget.coin is Epiccash || isWowneroAnd25)
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Choose recovery phrase length",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 16 : 8,
|
||||||
|
),
|
||||||
|
if (Util.isDesktop)
|
||||||
|
DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton2<int>(
|
||||||
|
value: ref.watch(mnemonicWordCountStateProvider.state).state,
|
||||||
|
items: [
|
||||||
|
...lengths.map(
|
||||||
|
(e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(
|
||||||
|
"$e words",
|
||||||
|
style: STextStyles.desktopTextMedium(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value is int) {
|
||||||
|
ref.read(mnemonicWordCountStateProvider.state).state = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isExpanded: true,
|
||||||
|
iconStyleData: IconStyleData(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.chevronDown,
|
||||||
|
width: 12,
|
||||||
|
height: 6,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldActiveSearchIconRight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dropdownStyleData: DropdownStyleData(
|
||||||
|
offset: const Offset(0, -10),
|
||||||
|
elevation: 0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
menuItemStyleData: const MenuItemStyleData(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!Util.isDesktop)
|
||||||
|
MobileMnemonicLengthSelector(
|
||||||
|
chooseMnemonicLength: widget.chooseMnemonicLength,
|
||||||
|
),
|
||||||
|
if (widget.supportsMnemonicPassphrase)
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
if (widget.supportsMnemonicPassphrase)
|
||||||
|
Expandable(
|
||||||
|
onExpandChanged: (state) {
|
||||||
|
setState(() {
|
||||||
|
_expandedAdvanced = state == ExpandableState.expanded;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
header: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8.0,
|
||||||
|
bottom: 8.0,
|
||||||
|
right: 10,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Advanced",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
SvgPicture.asset(
|
||||||
|
_expandedAdvanced
|
||||||
|
? Assets.svg.chevronUp
|
||||||
|
: Assets.svg.chevronDown,
|
||||||
|
width: 12,
|
||||||
|
height: 6,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldActiveSearchIconRight,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
if (widget.coin is Firo)
|
||||||
|
CheckboxTextButton(
|
||||||
|
label: "Scan for Lelantus transactions",
|
||||||
|
onChanged: (newValue) {
|
||||||
|
setState(() {
|
||||||
|
_enableLelantusScanning = newValue ?? true;
|
||||||
|
});
|
||||||
|
|
||||||
|
widget.lelScanChanged(_enableLelantusScanning);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (widget.coin is Firo)
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
key: const Key("mnemonicPassphraseFieldKey1"),
|
||||||
|
focusNode: widget.pwFocusNode,
|
||||||
|
controller: widget.pwController,
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextMedium(context).copyWith(
|
||||||
|
height: 2,
|
||||||
|
)
|
||||||
|
: STextStyles.field(context),
|
||||||
|
obscureText: _hidePassword,
|
||||||
|
enableSuggestions: false,
|
||||||
|
autocorrect: false,
|
||||||
|
decoration: standardInputDecoration(
|
||||||
|
"BIP39 passphrase",
|
||||||
|
widget.pwFocusNode,
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
suffixIcon: UnconstrainedBox(
|
||||||
|
child: ConditionalParent(
|
||||||
|
condition: Util.isDesktop,
|
||||||
|
builder: (child) => SizedBox(
|
||||||
|
height: 70,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key(
|
||||||
|
"mnemonicPassphraseFieldShowPasswordButtonKey",
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
_hidePassword = !_hidePassword;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
_hidePassword
|
||||||
|
? Assets.svg.eye
|
||||||
|
: Assets.svg.eyeSlash,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
width: Util.isDesktop ? 24 : 16,
|
||||||
|
height: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
RoundedWhiteContainer(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"If the recovery phrase you are about to restore "
|
||||||
|
"was created with an optional BIP39 passphrase "
|
||||||
|
"you can enter it here.",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ViewOnlyRestoreOption extends StatefulWidget {
|
||||||
|
const ViewOnlyRestoreOption({
|
||||||
|
super.key,
|
||||||
|
required this.coin,
|
||||||
|
required this.dateController,
|
||||||
|
required this.dateChooserFunction,
|
||||||
|
});
|
||||||
|
|
||||||
|
final CryptoCurrency coin;
|
||||||
|
final TextEditingController dateController;
|
||||||
|
|
||||||
|
final Future<void> Function() dateChooserFunction;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ViewOnlyRestoreOption> createState() => _ViewOnlyRestoreOptionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ViewOnlyRestoreOptionState extends State<ViewOnlyRestoreOption> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final showDateOption = widget.coin is CryptonoteCurrency;
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
if (showDateOption)
|
||||||
|
Text(
|
||||||
|
"Choose start date",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
if (showDateOption)
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 16 : 8,
|
||||||
|
),
|
||||||
|
if (showDateOption)
|
||||||
|
RestoreFromDatePicker(
|
||||||
|
onTap: widget.dateChooserFunction,
|
||||||
|
controller: widget.dateController,
|
||||||
|
),
|
||||||
|
if (showDateOption)
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
if (showDateOption)
|
||||||
|
RoundedWhiteContainer(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Choose the date you made the wallet (approximate is fine)",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.smallMed12(context).copyWith(
|
||||||
|
fontSize: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (showDateOption)
|
||||||
|
SizedBox(
|
||||||
|
height: Util.isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,592 @@
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cs_monero/src/deprecated/get_height_by_date.dart'
|
||||||
|
as cs_monero_deprecated;
|
||||||
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
|
|
||||||
|
import '../../../models/keys/view_only_wallet_data.dart';
|
||||||
|
import '../../../pages_desktop_specific/desktop_home_view.dart';
|
||||||
|
import '../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
|
||||||
|
import '../../../providers/db/main_db_provider.dart';
|
||||||
|
import '../../../providers/global/secure_store_provider.dart';
|
||||||
|
import '../../../providers/providers.dart';
|
||||||
|
import '../../../themes/stack_colors.dart';
|
||||||
|
import '../../../utilities/assets.dart';
|
||||||
|
import '../../../utilities/barcode_scanner_interface.dart';
|
||||||
|
import '../../../utilities/clipboard_interface.dart';
|
||||||
|
import '../../../utilities/constants.dart';
|
||||||
|
import '../../../utilities/text_styles.dart';
|
||||||
|
import '../../../utilities/util.dart';
|
||||||
|
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
import '../../../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart';
|
||||||
|
import '../../../wallets/crypto_currency/intermediate/bip39_hd_currency.dart';
|
||||||
|
import '../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
|
||||||
|
import '../../../wallets/isar/models/wallet_info.dart';
|
||||||
|
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/impl/monero_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/impl/wownero_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/wallet.dart';
|
||||||
|
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
|
||||||
|
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import '../../../widgets/desktop/desktop_app_bar.dart';
|
||||||
|
import '../../../widgets/desktop/desktop_scaffold.dart';
|
||||||
|
import '../../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../../../widgets/stack_text_field.dart';
|
||||||
|
import '../../../widgets/toggle.dart';
|
||||||
|
import '../../home_view/home_view.dart';
|
||||||
|
import 'confirm_recovery_dialog.dart';
|
||||||
|
import 'sub_widgets/restore_failed_dialog.dart';
|
||||||
|
import 'sub_widgets/restore_succeeded_dialog.dart';
|
||||||
|
import 'sub_widgets/restoring_dialog.dart';
|
||||||
|
|
||||||
|
class RestoreViewOnlyWalletView extends ConsumerStatefulWidget {
|
||||||
|
const RestoreViewOnlyWalletView({
|
||||||
|
super.key,
|
||||||
|
required this.walletName,
|
||||||
|
required this.coin,
|
||||||
|
required this.restoreFromDate,
|
||||||
|
this.enableLelantusScanning = false,
|
||||||
|
this.barcodeScanner = const BarcodeScannerWrapper(),
|
||||||
|
this.clipboard = const ClipboardWrapper(),
|
||||||
|
});
|
||||||
|
|
||||||
|
static const routeName = "/restoreViewOnlyWallet";
|
||||||
|
|
||||||
|
final String walletName;
|
||||||
|
final CryptoCurrency coin;
|
||||||
|
final DateTime? restoreFromDate;
|
||||||
|
final bool enableLelantusScanning;
|
||||||
|
final BarcodeScannerInterface barcodeScanner;
|
||||||
|
final ClipboardInterface clipboard;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<RestoreViewOnlyWalletView> createState() =>
|
||||||
|
_RestoreViewOnlyWalletViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RestoreViewOnlyWalletViewState
|
||||||
|
extends ConsumerState<RestoreViewOnlyWalletView> {
|
||||||
|
late final TextEditingController addressController;
|
||||||
|
late final TextEditingController viewKeyController;
|
||||||
|
|
||||||
|
late String _currentDropDownValue;
|
||||||
|
|
||||||
|
bool _enableRestoreButton = false;
|
||||||
|
bool _addressOnly = false;
|
||||||
|
|
||||||
|
bool _buttonLock = false;
|
||||||
|
|
||||||
|
Future<void> _requestRestore() async {
|
||||||
|
if (_buttonLock) return;
|
||||||
|
_buttonLock = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!Util.isDesktop) {
|
||||||
|
// wait for keyboard to disappear
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 100),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
await showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: false,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (context) {
|
||||||
|
return ConfirmRecoveryDialog(
|
||||||
|
onConfirm: _attemptRestore,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
_buttonLock = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _attemptRestore() async {
|
||||||
|
int height = 0;
|
||||||
|
final Map<String, dynamic> otherDataJson = {
|
||||||
|
WalletInfoKeys.isViewOnlyKey: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
final ViewOnlyWalletType viewOnlyWalletType;
|
||||||
|
if (widget.coin is Bip39HDCurrency) {
|
||||||
|
if (widget.coin is Firo) {
|
||||||
|
otherDataJson.addAll(
|
||||||
|
{
|
||||||
|
WalletInfoKeys.lelantusCoinIsarRescanRequired: false,
|
||||||
|
WalletInfoKeys.enableLelantusScanning:
|
||||||
|
widget.enableLelantusScanning,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
viewOnlyWalletType = _addressOnly
|
||||||
|
? ViewOnlyWalletType.addressOnly
|
||||||
|
: ViewOnlyWalletType.xPub;
|
||||||
|
} else if (widget.coin is CryptonoteCurrency) {
|
||||||
|
if (widget.restoreFromDate != null) {
|
||||||
|
if (widget.coin is Monero) {
|
||||||
|
height = cs_monero_deprecated.getMoneroHeightByDate(
|
||||||
|
date: widget.restoreFromDate!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (widget.coin is Wownero) {
|
||||||
|
height = cs_monero_deprecated.getWowneroHeightByDate(
|
||||||
|
date: widget.restoreFromDate!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (height < 0) height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
viewOnlyWalletType = ViewOnlyWalletType.cryptonote;
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
"Unsupported view only wallet currency type found: ${widget.coin.runtimeType}",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
otherDataJson[WalletInfoKeys.viewOnlyTypeIndexKey] =
|
||||||
|
viewOnlyWalletType.index;
|
||||||
|
|
||||||
|
if (!Platform.isLinux && !Util.isDesktop) await WakelockPlus.enable();
|
||||||
|
|
||||||
|
try {
|
||||||
|
final info = WalletInfo.createNew(
|
||||||
|
coin: widget.coin,
|
||||||
|
name: widget.walletName,
|
||||||
|
restoreHeight: height,
|
||||||
|
otherDataJsonString: jsonEncode(otherDataJson),
|
||||||
|
);
|
||||||
|
|
||||||
|
bool isRestoring = true;
|
||||||
|
// show restoring in progress
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
unawaited(
|
||||||
|
showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: false,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) {
|
||||||
|
return RestoringDialog(
|
||||||
|
onCancel: () async {
|
||||||
|
isRestoring = false;
|
||||||
|
|
||||||
|
await ref.read(pWallets).deleteWallet(
|
||||||
|
info,
|
||||||
|
ref.read(secureStoreProvider),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final ViewOnlyWalletData viewOnlyData;
|
||||||
|
switch (viewOnlyWalletType) {
|
||||||
|
case ViewOnlyWalletType.cryptonote:
|
||||||
|
if (addressController.text.isEmpty ||
|
||||||
|
viewKeyController.text.isEmpty) {
|
||||||
|
throw Exception("Missing address and/or private view key fields");
|
||||||
|
}
|
||||||
|
viewOnlyData = CryptonoteViewOnlyWalletData(
|
||||||
|
walletId: info.walletId,
|
||||||
|
address: addressController.text,
|
||||||
|
privateViewKey: viewKeyController.text,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ViewOnlyWalletType.addressOnly:
|
||||||
|
if (addressController.text.isEmpty) {
|
||||||
|
throw Exception("Address is empty");
|
||||||
|
}
|
||||||
|
viewOnlyData = AddressViewOnlyWalletData(
|
||||||
|
walletId: info.walletId,
|
||||||
|
address: addressController.text,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ViewOnlyWalletType.xPub:
|
||||||
|
viewOnlyData = ExtendedKeysViewOnlyWalletData(
|
||||||
|
walletId: info.walletId,
|
||||||
|
xPubs: [
|
||||||
|
XPub(
|
||||||
|
path: _currentDropDownValue,
|
||||||
|
encoded: viewKeyController.text,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var node = ref
|
||||||
|
.read(nodeServiceChangeNotifierProvider)
|
||||||
|
.getPrimaryNodeFor(currency: widget.coin);
|
||||||
|
|
||||||
|
if (node == null) {
|
||||||
|
node = widget.coin.defaultNode;
|
||||||
|
await ref.read(nodeServiceChangeNotifierProvider).setPrimaryNodeFor(
|
||||||
|
coin: widget.coin,
|
||||||
|
node: node,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final wallet = await Wallet.create(
|
||||||
|
walletInfo: info,
|
||||||
|
mainDB: ref.read(mainDBProvider),
|
||||||
|
secureStorageInterface: ref.read(secureStoreProvider),
|
||||||
|
nodeService: ref.read(nodeServiceChangeNotifierProvider),
|
||||||
|
prefs: ref.read(prefsChangeNotifierProvider),
|
||||||
|
viewOnlyData: viewOnlyData,
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: extract interface with isRestore param
|
||||||
|
switch (wallet.runtimeType) {
|
||||||
|
case const (EpiccashWallet):
|
||||||
|
await (wallet as EpiccashWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case const (MoneroWallet):
|
||||||
|
await (wallet as MoneroWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case const (WowneroWallet):
|
||||||
|
await (wallet as WowneroWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
await wallet.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
await wallet.recover(isRescan: false);
|
||||||
|
|
||||||
|
// check if state is still active before continuing
|
||||||
|
if (mounted) {
|
||||||
|
// don't remove this setMnemonicVerified thing
|
||||||
|
await wallet.info.setMnemonicVerified(
|
||||||
|
isar: ref.read(mainDBProvider).isar,
|
||||||
|
);
|
||||||
|
|
||||||
|
ref.read(pWallets).addWallet(wallet);
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
if (Util.isDesktop) {
|
||||||
|
Navigator.of(context).popUntil(
|
||||||
|
ModalRoute.withName(
|
||||||
|
DesktopHomeView.routeName,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
unawaited(
|
||||||
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
|
HomeView.routeName,
|
||||||
|
(route) => false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: false,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (context) {
|
||||||
|
return const RestoreSucceededDialog();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// check if state is still active and restore wasn't cancelled
|
||||||
|
// before continuing
|
||||||
|
if (mounted && isRestoring) {
|
||||||
|
// pop waiting dialog
|
||||||
|
Navigator.pop(context);
|
||||||
|
|
||||||
|
// show restoring wallet failed dialog
|
||||||
|
await showDialog<dynamic>(
|
||||||
|
context: context,
|
||||||
|
useSafeArea: false,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (context) {
|
||||||
|
return RestoreFailedDialog(
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
walletId: info.walletId,
|
||||||
|
walletName: info.name,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (!Platform.isLinux && !Util.isDesktop) await WakelockPlus.disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
addressController = TextEditingController();
|
||||||
|
viewKeyController = TextEditingController();
|
||||||
|
|
||||||
|
if (widget.coin is Bip39HDCurrency) {
|
||||||
|
_currentDropDownValue = (widget.coin as Bip39HDCurrency)
|
||||||
|
.supportedHardenedDerivationPaths
|
||||||
|
.last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
addressController.dispose();
|
||||||
|
viewKeyController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
|
final isElectrumX = widget.coin is ElectrumXCurrencyInterface;
|
||||||
|
|
||||||
|
return MasterScaffold(
|
||||||
|
isDesktop: isDesktop,
|
||||||
|
appBar: isDesktop
|
||||||
|
? const DesktopAppBar(
|
||||||
|
isCompactHeight: false,
|
||||||
|
leading: AppBarBackButton(),
|
||||||
|
trailing: ExitToMyStackButton(),
|
||||||
|
)
|
||||||
|
: AppBar(
|
||||||
|
leading: AppBarBackButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (FocusScope.of(context).hasFocus) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 50),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
maxWidth: isDesktop ? 480 : double.infinity,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
if (isDesktop)
|
||||||
|
const Spacer(
|
||||||
|
flex: 10,
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
|
Text(
|
||||||
|
widget.walletName,
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 0 : 4,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Enter view only details",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles.desktopH2(context)
|
||||||
|
: STextStyles.pageTitleH1(context),
|
||||||
|
),
|
||||||
|
if (isElectrumX)
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
if (isElectrumX)
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 56 : 48,
|
||||||
|
width: isDesktop ? 490 : null,
|
||||||
|
child: Toggle(
|
||||||
|
key: UniqueKey(),
|
||||||
|
onText: "Extended pub key",
|
||||||
|
offText: "Single address",
|
||||||
|
onColor: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.popupBG,
|
||||||
|
offColor: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
isOn: _addressOnly,
|
||||||
|
onValueChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_addressOnly = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
if (!isElectrumX || _addressOnly)
|
||||||
|
FullTextField(
|
||||||
|
key: const Key("viewOnlyAddressRestoreFieldKey"),
|
||||||
|
label: "Address",
|
||||||
|
controller: addressController,
|
||||||
|
onChanged: (newValue) {
|
||||||
|
if (isElectrumX) {
|
||||||
|
viewKeyController.text = "";
|
||||||
|
setState(() {
|
||||||
|
_enableRestoreButton = newValue.isNotEmpty;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_enableRestoreButton = newValue.isNotEmpty &&
|
||||||
|
viewKeyController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (!isElectrumX)
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 16 : 12,
|
||||||
|
),
|
||||||
|
if (isElectrumX && !_addressOnly)
|
||||||
|
DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton2<String>(
|
||||||
|
value: _currentDropDownValue,
|
||||||
|
items: [
|
||||||
|
...(widget.coin as Bip39HDCurrency)
|
||||||
|
.supportedHardenedDerivationPaths
|
||||||
|
.map(
|
||||||
|
(e) => DropdownMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(
|
||||||
|
e,
|
||||||
|
style: STextStyles.w500_14(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value is String) {
|
||||||
|
setState(() {
|
||||||
|
_currentDropDownValue = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isExpanded: true,
|
||||||
|
buttonStyleData: ButtonStyleData(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
iconStyleData: IconStyleData(
|
||||||
|
icon: Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.svg.chevronDown,
|
||||||
|
width: 12,
|
||||||
|
height: 6,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldActiveSearchIconRight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dropdownStyleData: DropdownStyleData(
|
||||||
|
offset: const Offset(0, -10),
|
||||||
|
elevation: 0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
menuItemStyleData: const MenuItemStyleData(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isElectrumX && !_addressOnly)
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 16 : 12,
|
||||||
|
),
|
||||||
|
if (!isElectrumX || !_addressOnly)
|
||||||
|
FullTextField(
|
||||||
|
key: const Key("viewOnlyKeyRestoreFieldKey"),
|
||||||
|
label:
|
||||||
|
"${isElectrumX ? "Extended" : "Private View"} Key",
|
||||||
|
controller: viewKeyController,
|
||||||
|
onChanged: (value) {
|
||||||
|
if (isElectrumX) {
|
||||||
|
addressController.text = "";
|
||||||
|
setState(() {
|
||||||
|
_enableRestoreButton = value.isNotEmpty;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_enableRestoreButton = value.isNotEmpty &&
|
||||||
|
addressController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (!isDesktop) const Spacer(),
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
PrimaryButton(
|
||||||
|
enabled: _enableRestoreButton,
|
||||||
|
onPressed: _requestRestore,
|
||||||
|
width: isDesktop ? 480 : null,
|
||||||
|
label: "Restore",
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const Spacer(
|
||||||
|
flex: 15,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,13 +16,14 @@ import 'dart:math';
|
||||||
|
|
||||||
import 'package:bip39/bip39.dart' as bip39;
|
import 'package:bip39/bip39.dart' as bip39;
|
||||||
import 'package:bip39/src/wordlists/english.dart' as bip39wordlist;
|
import 'package:bip39/src/wordlists/english.dart' as bip39wordlist;
|
||||||
|
import 'package:cs_monero/cs_monero.dart' as lib_monero;
|
||||||
|
import 'package:cs_monero/src/deprecated/get_height_by_date.dart'
|
||||||
|
as cs_monero_deprecated;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_libmonero/monero/monero.dart' as libxmr;
|
|
||||||
import 'package:flutter_libmonero/wownero/wownero.dart' as libwow;
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:wakelock/wakelock.dart';
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
|
|
||||||
import '../../../notifications/show_flush_bar.dart';
|
import '../../../notifications/show_flush_bar.dart';
|
||||||
import '../../../pages_desktop_specific/desktop_home_view.dart';
|
import '../../../pages_desktop_specific/desktop_home_view.dart';
|
||||||
|
@ -86,7 +87,7 @@ class RestoreWalletView extends ConsumerStatefulWidget {
|
||||||
final CryptoCurrency coin;
|
final CryptoCurrency coin;
|
||||||
final String mnemonicPassphrase;
|
final String mnemonicPassphrase;
|
||||||
final int seedWordsLength;
|
final int seedWordsLength;
|
||||||
final DateTime restoreFromDate;
|
final DateTime? restoreFromDate;
|
||||||
final bool enableLelantusScanning;
|
final bool enableLelantusScanning;
|
||||||
|
|
||||||
final BarcodeScannerInterface barcodeScanner;
|
final BarcodeScannerInterface barcodeScanner;
|
||||||
|
@ -181,7 +182,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
if (widget.coin is Monero) {
|
if (widget.coin is Monero) {
|
||||||
switch (widget.seedWordsLength) {
|
switch (widget.seedWordsLength) {
|
||||||
case 25:
|
case 25:
|
||||||
return libxmr.monero.getMoneroWordList("English").contains(word);
|
return lib_monero.getMoneroWordList("English").contains(word);
|
||||||
case 16:
|
case 16:
|
||||||
return Monero.sixteenWordsWordList.contains(word);
|
return Monero.sixteenWordsWordList.contains(word);
|
||||||
default:
|
default:
|
||||||
|
@ -189,7 +190,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (widget.coin is Wownero) {
|
if (widget.coin is Wownero) {
|
||||||
final wowneroWordList = libwow.wownero.getWowneroWordList(
|
final wowneroWordList = lib_monero.getWowneroWordList(
|
||||||
"English",
|
"English",
|
||||||
seedWordsLength: widget.seedWordsLength,
|
seedWordsLength: widget.seedWordsLength,
|
||||||
);
|
);
|
||||||
|
@ -219,29 +220,35 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
String? otherDataJsonString;
|
String? otherDataJsonString;
|
||||||
|
|
||||||
if (widget.coin is Monero) {
|
if (widget.restoreFromDate != null) {
|
||||||
height = libxmr.monero.getHeigthByDate(date: widget.restoreFromDate);
|
if (widget.coin is Monero) {
|
||||||
} else if (widget.coin is Wownero) {
|
height = cs_monero_deprecated.getMoneroHeightByDate(
|
||||||
height = libwow.wownero.getHeightByDate(date: widget.restoreFromDate);
|
date: widget.restoreFromDate!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (widget.coin is Wownero) {
|
||||||
|
height = cs_monero_deprecated.getWowneroHeightByDate(
|
||||||
|
date: widget.restoreFromDate!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (height < 0) {
|
||||||
|
height = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// todo: wait until this implemented
|
|
||||||
// else if (widget.coin is Wownero) {
|
|
||||||
// height = wownero.getHeightByDate(date: widget.restoreFromDate);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO: make more robust estimate of date maybe using https://explorer.epic.tech/api-index
|
// TODO: make more robust estimate of date maybe using https://explorer.epic.tech/api-index
|
||||||
if (widget.coin is Epiccash) {
|
if (widget.coin is Epiccash) {
|
||||||
final int secondsSinceEpoch =
|
if (widget.restoreFromDate != null) {
|
||||||
widget.restoreFromDate.millisecondsSinceEpoch ~/ 1000;
|
final int secondsSinceEpoch =
|
||||||
const int epicCashFirstBlock = 1565370278;
|
widget.restoreFromDate!.millisecondsSinceEpoch ~/ 1000;
|
||||||
const double overestimateSecondsPerBlock = 61;
|
const int epicCashFirstBlock = 1565370278;
|
||||||
final int chosenSeconds = secondsSinceEpoch - epicCashFirstBlock;
|
const double overestimateSecondsPerBlock = 61;
|
||||||
final int approximateHeight =
|
final int chosenSeconds = secondsSinceEpoch - epicCashFirstBlock;
|
||||||
chosenSeconds ~/ overestimateSecondsPerBlock;
|
final int approximateHeight =
|
||||||
//todo: check if print needed
|
chosenSeconds ~/ overestimateSecondsPerBlock;
|
||||||
// debugPrint(
|
|
||||||
// "approximate height: $approximateHeight chosen_seconds: $chosenSeconds");
|
height = approximateHeight;
|
||||||
height = approximateHeight;
|
}
|
||||||
if (height < 0) {
|
if (height < 0) {
|
||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
@ -282,7 +289,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!Platform.isLinux) await Wakelock.enable();
|
if (!Platform.isLinux) await WakelockPlus.enable();
|
||||||
|
|
||||||
final info = WalletInfo.createNew(
|
final info = WalletInfo.createNew(
|
||||||
coin: widget.coin,
|
coin: widget.coin,
|
||||||
|
@ -426,12 +433,12 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Platform.isLinux && !isDesktop) {
|
if (!Platform.isLinux && !isDesktop) {
|
||||||
await Wakelock.disable();
|
await WakelockPlus.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!Platform.isLinux && !isDesktop) {
|
if (!Platform.isLinux && !isDesktop) {
|
||||||
await Wakelock.disable();
|
await WakelockPlus.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (e is HiveError &&
|
// if (e is HiveError &&
|
||||||
|
@ -463,7 +470,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Platform.isLinux && !isDesktop) {
|
if (!Platform.isLinux && !isDesktop) {
|
||||||
await Wakelock.disable();
|
await WakelockPlus.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,16 +655,18 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
const Duration(milliseconds: 100),
|
const Duration(milliseconds: 100),
|
||||||
);
|
);
|
||||||
|
|
||||||
await showDialog<dynamic>(
|
if (mounted) {
|
||||||
context: context,
|
await showDialog<dynamic>(
|
||||||
useSafeArea: false,
|
context: context,
|
||||||
barrierDismissible: true,
|
useSafeArea: false,
|
||||||
builder: (context) {
|
barrierDismissible: true,
|
||||||
return ConfirmRecoveryDialog(
|
builder: (context) {
|
||||||
onConfirm: attemptRestore,
|
return ConfirmRecoveryDialog(
|
||||||
);
|
onConfirm: attemptRestore,
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -9,19 +9,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:cs_monero/src/deprecated/get_height_by_date.dart'
|
||||||
|
as cs_monero_deprecated;
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
|
import '../../../models/keys/view_only_wallet_data.dart';
|
||||||
import '../../../notifications/show_flush_bar.dart';
|
import '../../../notifications/show_flush_bar.dart';
|
||||||
import '../add_token_view/edit_wallet_tokens_view.dart';
|
|
||||||
import '../new_wallet_options/new_wallet_options_view.dart';
|
|
||||||
import '../new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
|
|
||||||
import '../select_wallet_for_token_view.dart';
|
|
||||||
import 'sub_widgets/word_table.dart';
|
|
||||||
import 'verify_mnemonic_passphrase_dialog.dart';
|
|
||||||
import '../../home_view/home_view.dart';
|
|
||||||
import '../../../pages_desktop_specific/desktop_home_view.dart';
|
import '../../../pages_desktop_specific/desktop_home_view.dart';
|
||||||
import '../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
|
import '../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
|
||||||
import '../../../providers/db/main_db_provider.dart';
|
import '../../../providers/db/main_db_provider.dart';
|
||||||
|
@ -30,15 +29,32 @@ import '../../../providers/providers.dart';
|
||||||
import '../../../themes/stack_colors.dart';
|
import '../../../themes/stack_colors.dart';
|
||||||
import '../../../utilities/assets.dart';
|
import '../../../utilities/assets.dart';
|
||||||
import '../../../utilities/constants.dart';
|
import '../../../utilities/constants.dart';
|
||||||
|
import '../../../utilities/logger.dart';
|
||||||
|
import '../../../utilities/show_loading.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../utilities/util.dart';
|
import '../../../utilities/util.dart';
|
||||||
import '../../../wallets/crypto_currency/coins/ethereum.dart';
|
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
|
import '../../../wallets/crypto_currency/intermediate/bip39_hd_currency.dart';
|
||||||
|
import '../../../wallets/isar/models/wallet_info.dart';
|
||||||
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
||||||
|
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/impl/monero_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/impl/wownero_wallet.dart';
|
||||||
|
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
|
||||||
import '../../../wallets/wallet/wallet.dart';
|
import '../../../wallets/wallet/wallet.dart';
|
||||||
|
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
|
||||||
|
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
|
||||||
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import '../../../widgets/desktop/desktop_app_bar.dart';
|
import '../../../widgets/desktop/desktop_app_bar.dart';
|
||||||
import '../../../widgets/desktop/desktop_scaffold.dart';
|
import '../../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import '../../../widgets/stack_dialog.dart';
|
||||||
|
import '../../home_view/home_view.dart';
|
||||||
|
import '../add_token_view/edit_wallet_tokens_view.dart';
|
||||||
|
import '../new_wallet_options/new_wallet_options_view.dart';
|
||||||
|
import '../new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
|
||||||
|
import '../select_wallet_for_token_view.dart';
|
||||||
|
import 'sub_widgets/word_table.dart';
|
||||||
|
import 'verify_mnemonic_passphrase_dialog.dart';
|
||||||
|
|
||||||
final createSpecialEthWalletRoutingFlag = StateProvider((ref) => false);
|
final createSpecialEthWalletRoutingFlag = StateProvider((ref) => false);
|
||||||
|
|
||||||
|
@ -63,46 +79,25 @@ class _VerifyRecoveryPhraseViewState
|
||||||
extends ConsumerState<VerifyRecoveryPhraseView>
|
extends ConsumerState<VerifyRecoveryPhraseView>
|
||||||
// with WidgetsBindingObserver
|
// with WidgetsBindingObserver
|
||||||
{
|
{
|
||||||
late Wallet _wallet;
|
late String _walletId;
|
||||||
|
late CryptoCurrency _coin;
|
||||||
late List<String> _mnemonic;
|
late List<String> _mnemonic;
|
||||||
late final bool isDesktop;
|
late final bool isDesktop;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_wallet = widget.wallet;
|
_walletId = widget.wallet.walletId;
|
||||||
|
_coin = widget.wallet.cryptoCurrency;
|
||||||
_mnemonic = widget.mnemonic;
|
_mnemonic = widget.mnemonic;
|
||||||
isDesktop = Util.isDesktop;
|
isDesktop = Util.isDesktop;
|
||||||
// WidgetsBinding.instance?.addObserver(this);
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
dispose() {
|
dispose() {
|
||||||
// WidgetsBinding.instance?.removeObserver(this);
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
|
||||||
// void didChangeAppLifecycleState(AppLifecycleState state) {
|
|
||||||
// switch (state) {
|
|
||||||
// case AppLifecycleState.inactive:
|
|
||||||
// debugPrint(
|
|
||||||
// "VerifyRecoveryPhraseView ========================= Inactive");
|
|
||||||
// break;
|
|
||||||
// case AppLifecycleState.paused:
|
|
||||||
// debugPrint("VerifyRecoveryPhraseView ========================= Paused");
|
|
||||||
// break;
|
|
||||||
// case AppLifecycleState.resumed:
|
|
||||||
// debugPrint(
|
|
||||||
// "VerifyRecoveryPhraseView ========================= Resumed");
|
|
||||||
// break;
|
|
||||||
// case AppLifecycleState.detached:
|
|
||||||
// debugPrint(
|
|
||||||
// "VerifyRecoveryPhraseView ========================= Detached");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<bool> _verifyMnemonicPassphrase() async {
|
Future<bool> _verifyMnemonicPassphrase() async {
|
||||||
final result = await showDialog<String?>(
|
final result = await showDialog<String?>(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -112,9 +107,161 @@ class _VerifyRecoveryPhraseViewState
|
||||||
return result == "verified";
|
return result == "verified";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _convertToViewOnly() async {
|
||||||
|
int height = 0;
|
||||||
|
final Map<String, dynamic> otherDataJson = {
|
||||||
|
WalletInfoKeys.isViewOnlyKey: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
final ViewOnlyWalletType viewOnlyWalletType;
|
||||||
|
if (widget.wallet is ExtendedKeysInterface) {
|
||||||
|
if (widget.wallet.cryptoCurrency is Firo) {
|
||||||
|
otherDataJson.addAll(
|
||||||
|
{
|
||||||
|
WalletInfoKeys.lelantusCoinIsarRescanRequired: false,
|
||||||
|
WalletInfoKeys.enableLelantusScanning: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
viewOnlyWalletType = ViewOnlyWalletType.xPub;
|
||||||
|
} else if (widget.wallet is LibMoneroWallet) {
|
||||||
|
if (widget.wallet.cryptoCurrency is Monero) {
|
||||||
|
height = cs_monero_deprecated.getMoneroHeightByDate(
|
||||||
|
date: DateTime.now().subtract(const Duration(days: 7)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (widget.wallet.cryptoCurrency is Wownero) {
|
||||||
|
height = cs_monero_deprecated.getWowneroHeightByDate(
|
||||||
|
date: DateTime.now().subtract(const Duration(days: 7)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (height < 0) height = 0;
|
||||||
|
|
||||||
|
viewOnlyWalletType = ViewOnlyWalletType.cryptonote;
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
"Unsupported view only wallet type found: ${widget.wallet.runtimeType}",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
otherDataJson[WalletInfoKeys.viewOnlyTypeIndexKey] =
|
||||||
|
viewOnlyWalletType.index;
|
||||||
|
|
||||||
|
final voInfo = WalletInfo.createNew(
|
||||||
|
coin: _coin,
|
||||||
|
name: widget.wallet.info.name,
|
||||||
|
restoreHeight: height,
|
||||||
|
otherDataJsonString: jsonEncode(otherDataJson),
|
||||||
|
);
|
||||||
|
|
||||||
|
final ViewOnlyWalletData viewOnlyData;
|
||||||
|
if (widget.wallet is ExtendedKeysInterface) {
|
||||||
|
final extendedKeyInfo =
|
||||||
|
await (widget.wallet as ExtendedKeysInterface).getXPubs();
|
||||||
|
final testPath = (_coin as Bip39HDCurrency).constructDerivePath(
|
||||||
|
derivePathType: (_coin as Bip39HDCurrency).defaultDerivePathType,
|
||||||
|
chain: 0,
|
||||||
|
index: 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
XPub? xPub;
|
||||||
|
for (final pub in extendedKeyInfo.xpubs) {
|
||||||
|
if (testPath.startsWith(pub.path)) {
|
||||||
|
xPub = pub;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xPub == null) {
|
||||||
|
throw Exception("Default derivation path not matched in xPubs");
|
||||||
|
}
|
||||||
|
|
||||||
|
viewOnlyData = ExtendedKeysViewOnlyWalletData(
|
||||||
|
walletId: voInfo.walletId,
|
||||||
|
xPubs: [xPub],
|
||||||
|
);
|
||||||
|
} else if (widget.wallet is LibMoneroWallet) {
|
||||||
|
final w = widget.wallet as LibMoneroWallet;
|
||||||
|
|
||||||
|
final info = await w
|
||||||
|
.hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
|
||||||
|
final address = info.$1;
|
||||||
|
final privateViewKey = info.$2;
|
||||||
|
|
||||||
|
await w.exit();
|
||||||
|
|
||||||
|
viewOnlyData = CryptonoteViewOnlyWalletData(
|
||||||
|
walletId: voInfo.walletId,
|
||||||
|
address: address,
|
||||||
|
privateViewKey: privateViewKey,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
"Unsupported view only wallet type found: ${widget.wallet.runtimeType}",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final voWallet = await Wallet.create(
|
||||||
|
walletInfo: voInfo,
|
||||||
|
mainDB: ref.read(mainDBProvider),
|
||||||
|
secureStorageInterface: ref.read(secureStoreProvider),
|
||||||
|
nodeService: ref.read(nodeServiceChangeNotifierProvider),
|
||||||
|
prefs: ref.read(prefsChangeNotifierProvider),
|
||||||
|
viewOnlyData: viewOnlyData,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// TODO: extract interface with isRestore param
|
||||||
|
switch (voWallet.runtimeType) {
|
||||||
|
case const (EpiccashWallet):
|
||||||
|
await (voWallet as EpiccashWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case const (MoneroWallet):
|
||||||
|
await (voWallet as MoneroWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case const (WowneroWallet):
|
||||||
|
await (voWallet as WowneroWallet).init(isRestore: true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
await voWallet.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
await voWallet.recover(isRescan: false);
|
||||||
|
|
||||||
|
// don't remove this setMnemonicVerified thing
|
||||||
|
await voWallet.info.setMnemonicVerified(
|
||||||
|
isar: ref.read(mainDBProvider).isar,
|
||||||
|
);
|
||||||
|
|
||||||
|
ref.read(pWallets).addWallet(voWallet);
|
||||||
|
|
||||||
|
await voWallet.exit();
|
||||||
|
|
||||||
|
await ref.read(pWallets).deleteWallet(
|
||||||
|
widget.wallet.info,
|
||||||
|
ref.read(secureStoreProvider),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
await ref.read(pWallets).deleteWallet(
|
||||||
|
widget.wallet.info,
|
||||||
|
ref.read(secureStoreProvider),
|
||||||
|
);
|
||||||
|
await ref.read(pWallets).deleteWallet(
|
||||||
|
voWallet.info,
|
||||||
|
ref.read(secureStoreProvider),
|
||||||
|
);
|
||||||
|
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _continue(bool isMatch) async {
|
Future<void> _continue(bool isMatch) async {
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
if (ref.read(pNewWalletOptions.state).state != null) {
|
if (ref.read(pNewWalletOptions) != null &&
|
||||||
|
ref.read(pNewWalletOptions)!.mnemonicPassphrase.isNotEmpty) {
|
||||||
final passphraseVerified = await _verifyMnemonicPassphrase();
|
final passphraseVerified = await _verifyMnemonicPassphrase();
|
||||||
|
|
||||||
if (!passphraseVerified) {
|
if (!passphraseVerified) {
|
||||||
|
@ -122,11 +269,11 @@ class _VerifyRecoveryPhraseViewState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await ref.read(pWalletInfo(_wallet.walletId)).setMnemonicVerified(
|
await ref.read(pWalletInfo(widget.wallet.walletId)).setMnemonicVerified(
|
||||||
isar: ref.read(mainDBProvider).isar,
|
isar: ref.read(mainDBProvider).isar,
|
||||||
);
|
);
|
||||||
|
|
||||||
ref.read(pWallets).addWallet(_wallet);
|
ref.read(pWallets).addWallet(widget.wallet);
|
||||||
|
|
||||||
final isCreateSpecialEthWallet =
|
final isCreateSpecialEthWallet =
|
||||||
ref.read(createSpecialEthWalletRoutingFlag);
|
ref.read(createSpecialEthWalletRoutingFlag);
|
||||||
|
@ -140,6 +287,51 @@ class _VerifyRecoveryPhraseViewState
|
||||||
.state;
|
.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mounted &&
|
||||||
|
ref.read(pNewWalletOptions)?.convertToViewOnly == true &&
|
||||||
|
widget.wallet is ViewOnlyOptionInterface) {
|
||||||
|
try {
|
||||||
|
Exception? ex;
|
||||||
|
await showLoading(
|
||||||
|
whileFuture: _convertToViewOnly(),
|
||||||
|
context: context,
|
||||||
|
message: "Converting to view only wallet",
|
||||||
|
rootNavigator: Util.isDesktop,
|
||||||
|
onException: (e) {
|
||||||
|
ex = e;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ex != null) {
|
||||||
|
throw ex!;
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"$e\n$s",
|
||||||
|
level: LogLevel.Fatal,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => StackOkDialog(
|
||||||
|
title: e.toString(),
|
||||||
|
desktopPopRootNavigator: Util.isDesktop,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.of(context).popUntil(
|
||||||
|
ModalRoute.withName(
|
||||||
|
NewWalletRecoveryPhraseView.routeName,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
if (isCreateSpecialEthWallet) {
|
if (isCreateSpecialEthWallet) {
|
||||||
|
@ -154,7 +346,7 @@ class _VerifyRecoveryPhraseViewState
|
||||||
DesktopHomeView.routeName,
|
DesktopHomeView.routeName,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (widget.wallet.info.coin is Ethereum) {
|
if (_coin is Ethereum) {
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
EditWalletTokensView.routeName,
|
EditWalletTokensView.routeName,
|
||||||
|
@ -177,7 +369,7 @@ class _VerifyRecoveryPhraseViewState
|
||||||
(route) => false,
|
(route) => false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (widget.wallet.info.coin is Ethereum) {
|
if (_coin is Ethereum) {
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
EditWalletTokensView.routeName,
|
EditWalletTokensView.routeName,
|
||||||
|
@ -267,7 +459,7 @@ class _VerifyRecoveryPhraseViewState
|
||||||
|
|
||||||
Future<void> delete() async {
|
Future<void> delete() async {
|
||||||
await ref.read(pWallets).deleteWallet(
|
await ref.read(pWallets).deleteWallet(
|
||||||
_wallet.info,
|
widget.wallet.info,
|
||||||
ref.read(secureStoreProvider),
|
ref.read(secureStoreProvider),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +489,7 @@ class _VerifyRecoveryPhraseViewState
|
||||||
trailing: ExitToMyStackButton(
|
trailing: ExitToMyStackButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await delete();
|
await delete();
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
Navigator.of(context).popUntil(
|
Navigator.of(context).popUntil(
|
||||||
ModalRoute.withName(DesktopHomeView.routeName),
|
ModalRoute.withName(DesktopHomeView.routeName),
|
||||||
);
|
);
|
||||||
|
|
|
@ -66,6 +66,62 @@ class _NewContactAddressEntryFormState
|
||||||
|
|
||||||
List<CryptoCurrency> coins = [];
|
List<CryptoCurrency> coins = [];
|
||||||
|
|
||||||
|
void _onQrTapped() async {
|
||||||
|
try {
|
||||||
|
// ref
|
||||||
|
// .read(shouldShowLockscreenOnResumeStateProvider
|
||||||
|
// .state)
|
||||||
|
// .state = false;
|
||||||
|
final qrResult = await widget.barcodeScanner.scan();
|
||||||
|
|
||||||
|
// Future<void>.delayed(
|
||||||
|
// const Duration(seconds: 2),
|
||||||
|
// () => ref
|
||||||
|
// .read(
|
||||||
|
// shouldShowLockscreenOnResumeStateProvider
|
||||||
|
// .state)
|
||||||
|
// .state = true,
|
||||||
|
// );
|
||||||
|
|
||||||
|
final paymentData = AddressUtils.parsePaymentUri(
|
||||||
|
qrResult.rawContent,
|
||||||
|
logging: Logging.instance,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (paymentData != null) {
|
||||||
|
addressController.text = paymentData.address;
|
||||||
|
ref.read(addressEntryDataProvider(widget.id)).address =
|
||||||
|
addressController.text.isEmpty ? null : addressController.text;
|
||||||
|
|
||||||
|
addressLabelController.text =
|
||||||
|
paymentData.label ?? addressLabelController.text;
|
||||||
|
ref.read(addressEntryDataProvider(widget.id)).addressLabel =
|
||||||
|
addressLabelController.text.isEmpty
|
||||||
|
? null
|
||||||
|
: addressLabelController.text;
|
||||||
|
|
||||||
|
// now check for non standard encoded basic address
|
||||||
|
} else if (ref.read(addressEntryDataProvider(widget.id)).coin != null) {
|
||||||
|
if (ref.read(addressEntryDataProvider(widget.id)).coin!.validateAddress(
|
||||||
|
qrResult.rawContent,
|
||||||
|
)) {
|
||||||
|
addressController.text = qrResult.rawContent;
|
||||||
|
ref.read(addressEntryDataProvider(widget.id)).address =
|
||||||
|
qrResult.rawContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} on PlatformException catch (e, s) {
|
||||||
|
// ref
|
||||||
|
// .read(shouldShowLockscreenOnResumeStateProvider
|
||||||
|
// .state)
|
||||||
|
// .state = true;
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed to get camera permissions to scan address qr code: $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
addressLabelController = TextEditingController()
|
addressLabelController = TextEditingController()
|
||||||
|
@ -75,6 +131,14 @@ class _NewContactAddressEntryFormState
|
||||||
addressLabelFocusNode = FocusNode();
|
addressLabelFocusNode = FocusNode();
|
||||||
addressFocusNode = FocusNode();
|
addressFocusNode = FocusNode();
|
||||||
coins = [...AppConfig.coins];
|
coins = [...AppConfig.coins];
|
||||||
|
|
||||||
|
if (AppConfig.isSingleCoinApp) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (mounted) {
|
||||||
|
ref.read(addressEntryDataProvider(widget.id)).coin = coins.first;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +173,7 @@ class _NewContactAddressEntryFormState
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
if (isDesktop)
|
if (isDesktop && !AppConfig.isSingleCoinApp)
|
||||||
DropdownButtonHideUnderline(
|
DropdownButtonHideUnderline(
|
||||||
child: DropdownButton2<CryptoCurrency>(
|
child: DropdownButton2<CryptoCurrency>(
|
||||||
hint: Text(
|
hint: Text(
|
||||||
|
@ -188,7 +252,7 @@ class _NewContactAddressEntryFormState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!isDesktop)
|
if (!isDesktop && !AppConfig.isSingleCoinApp)
|
||||||
TextField(
|
TextField(
|
||||||
autocorrect: Util.isDesktop ? false : true,
|
autocorrect: Util.isDesktop ? false : true,
|
||||||
enableSuggestions: Util.isDesktop ? false : true,
|
enableSuggestions: Util.isDesktop ? false : true,
|
||||||
|
@ -280,9 +344,10 @@ class _NewContactAddressEntryFormState
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
if (!AppConfig.isSingleCoinApp)
|
||||||
height: 8,
|
const SizedBox(
|
||||||
),
|
height: 8,
|
||||||
|
),
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
|
@ -395,71 +460,7 @@ class _NewContactAddressEntryFormState
|
||||||
null)
|
null)
|
||||||
TextFieldIconButton(
|
TextFieldIconButton(
|
||||||
key: const Key("addAddressBookEntryScanQrButtonKey"),
|
key: const Key("addAddressBookEntryScanQrButtonKey"),
|
||||||
onTap: () async {
|
onTap: _onQrTapped,
|
||||||
try {
|
|
||||||
// ref
|
|
||||||
// .read(shouldShowLockscreenOnResumeStateProvider
|
|
||||||
// .state)
|
|
||||||
// .state = false;
|
|
||||||
final qrResult = await widget.barcodeScanner.scan();
|
|
||||||
|
|
||||||
// Future<void>.delayed(
|
|
||||||
// const Duration(seconds: 2),
|
|
||||||
// () => ref
|
|
||||||
// .read(
|
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
|
||||||
// .state)
|
|
||||||
// .state = true,
|
|
||||||
// );
|
|
||||||
|
|
||||||
final results =
|
|
||||||
AddressUtils.parseUri(qrResult.rawContent);
|
|
||||||
if (results.isNotEmpty) {
|
|
||||||
addressController.text = results["address"] ?? "";
|
|
||||||
ref
|
|
||||||
.read(addressEntryDataProvider(widget.id))
|
|
||||||
.address =
|
|
||||||
addressController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: addressController.text;
|
|
||||||
|
|
||||||
addressLabelController.text = results["label"] ??
|
|
||||||
addressLabelController.text;
|
|
||||||
ref
|
|
||||||
.read(addressEntryDataProvider(widget.id))
|
|
||||||
.addressLabel =
|
|
||||||
addressLabelController.text.isEmpty
|
|
||||||
? null
|
|
||||||
: addressLabelController.text;
|
|
||||||
|
|
||||||
// now check for non standard encoded basic address
|
|
||||||
} else if (ref
|
|
||||||
.read(addressEntryDataProvider(widget.id))
|
|
||||||
.coin !=
|
|
||||||
null) {
|
|
||||||
if (ref
|
|
||||||
.read(addressEntryDataProvider(widget.id))
|
|
||||||
.coin!
|
|
||||||
.validateAddress(
|
|
||||||
qrResult.rawContent,
|
|
||||||
)) {
|
|
||||||
addressController.text = qrResult.rawContent;
|
|
||||||
ref
|
|
||||||
.read(addressEntryDataProvider(widget.id))
|
|
||||||
.address = qrResult.rawContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} on PlatformException catch (e, s) {
|
|
||||||
// ref
|
|
||||||
// .read(shouldShowLockscreenOnResumeStateProvider
|
|
||||||
// .state)
|
|
||||||
// .state = true;
|
|
||||||
Logging.instance.log(
|
|
||||||
"Failed to get camera permissions to scan address qr code: $e\n$s",
|
|
||||||
level: LogLevel.Warning,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const QrCodeIcon(),
|
child: const QrCodeIcon(),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
|
@ -154,6 +154,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _receivingAddressValidationErrorString = "";
|
||||||
|
|
||||||
void selectCrypto() async {
|
void selectCrypto() async {
|
||||||
if (ref.read(simplexProvider).supportedCryptos.isEmpty) {
|
if (ref.read(simplexProvider).supportedCryptos.isEmpty) {
|
||||||
bool shouldPop = false;
|
bool shouldPop = false;
|
||||||
|
@ -711,6 +713,60 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onQrTapped() async {
|
||||||
|
try {
|
||||||
|
if (FocusScope.of(context).hasFocus) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 75),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final qrResult = await scanner.scan();
|
||||||
|
|
||||||
|
Logging.instance.log(
|
||||||
|
"qrResult content: ${qrResult.rawContent}",
|
||||||
|
level: LogLevel.Info,
|
||||||
|
);
|
||||||
|
|
||||||
|
final paymentData = AddressUtils.parsePaymentUri(
|
||||||
|
qrResult.rawContent,
|
||||||
|
logging: Logging.instance,
|
||||||
|
);
|
||||||
|
|
||||||
|
Logging.instance.log(
|
||||||
|
"qrResult parsed: $paymentData",
|
||||||
|
level: LogLevel.Info,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (paymentData != null) {
|
||||||
|
// auto fill address
|
||||||
|
_address = paymentData.address;
|
||||||
|
_receiveAddressController.text = _address!;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_addressToggleFlag = _receiveAddressController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
|
||||||
|
// now check for non standard encoded basic address
|
||||||
|
} else {
|
||||||
|
_address = qrResult.rawContent;
|
||||||
|
_receiveAddressController.text = _address ?? "";
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_addressToggleFlag = _receiveAddressController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} on PlatformException catch (e, s) {
|
||||||
|
// here we ignore the exception caused by not giving permission
|
||||||
|
// to use the camera to scan a qr code
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_receiveAddressController = TextEditingController();
|
_receiveAddressController = TextEditingController();
|
||||||
|
@ -1218,6 +1274,15 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
_address = newValue;
|
_address = newValue;
|
||||||
setState(() {
|
setState(() {
|
||||||
_addressToggleFlag = newValue.isNotEmpty;
|
_addressToggleFlag = newValue.isNotEmpty;
|
||||||
|
|
||||||
|
// TODO [prio=low]: Validate address.
|
||||||
|
if (newValue.startsWith("bc1p")) {
|
||||||
|
// Display an error message or handle invalid address
|
||||||
|
_receivingAddressValidationErrorString =
|
||||||
|
"Taproot addresses are not allowed.";
|
||||||
|
} else {
|
||||||
|
_receivingAddressValidationErrorString = "";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
focusNode: _receiveAddressFocusNode,
|
focusNode: _receiveAddressFocusNode,
|
||||||
|
@ -1364,63 +1429,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
!isDesktop)
|
!isDesktop)
|
||||||
TextFieldIconButton(
|
TextFieldIconButton(
|
||||||
key: const Key("buyViewScanQrButtonKey"),
|
key: const Key("buyViewScanQrButtonKey"),
|
||||||
onTap: () async {
|
onTap: _onQrTapped,
|
||||||
try {
|
|
||||||
if (FocusScope.of(context).hasFocus) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
await Future<void>.delayed(
|
|
||||||
const Duration(milliseconds: 75),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final qrResult = await scanner.scan();
|
|
||||||
|
|
||||||
Logging.instance.log(
|
|
||||||
"qrResult content: ${qrResult.rawContent}",
|
|
||||||
level: LogLevel.Info,
|
|
||||||
);
|
|
||||||
|
|
||||||
final results = AddressUtils.parseUri(
|
|
||||||
qrResult.rawContent,
|
|
||||||
);
|
|
||||||
|
|
||||||
Logging.instance.log(
|
|
||||||
"qrResult parsed: $results",
|
|
||||||
level: LogLevel.Info,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.isNotEmpty) {
|
|
||||||
// auto fill address
|
|
||||||
_address = results["address"] ?? "";
|
|
||||||
_receiveAddressController.text = _address!;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_addressToggleFlag =
|
|
||||||
_receiveAddressController
|
|
||||||
.text.isNotEmpty;
|
|
||||||
});
|
|
||||||
|
|
||||||
// now check for non standard encoded basic address
|
|
||||||
} else {
|
|
||||||
_address = qrResult.rawContent;
|
|
||||||
_receiveAddressController.text =
|
|
||||||
_address ?? "";
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_addressToggleFlag =
|
|
||||||
_receiveAddressController
|
|
||||||
.text.isNotEmpty;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} on PlatformException catch (e, s) {
|
|
||||||
// here we ignore the exception caused by not giving permission
|
|
||||||
// to use the camera to scan a qr code
|
|
||||||
Logging.instance.log(
|
|
||||||
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
|
||||||
level: LogLevel.Warning,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const QrCodeIcon(),
|
child: const QrCodeIcon(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -1430,6 +1439,14 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 10 : 4,
|
||||||
|
),
|
||||||
|
if (_receivingAddressValidationErrorString.isNotEmpty)
|
||||||
|
Text(
|
||||||
|
_receivingAddressValidationErrorString,
|
||||||
|
style: STextStyles.errorSmall(context),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 20 : 12,
|
height: isDesktop ? 20 : 12,
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,7 +12,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:wakelock/wakelock.dart';
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
|
|
||||||
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
|
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
|
||||||
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
||||||
|
@ -85,7 +85,7 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
message: "Stopping fusion",
|
message: "Stopping fusion",
|
||||||
);
|
);
|
||||||
|
|
||||||
await Wakelock.disable();
|
await WakelockPlus.disable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,7 +101,7 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
Wakelock.disable();
|
WakelockPlus.disable();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
.watch(fusionProgressUIStateProvider(widget.walletId))
|
.watch(fusionProgressUIStateProvider(widget.walletId))
|
||||||
.fusionRoundsCompleted;
|
.fusionRoundsCompleted;
|
||||||
|
|
||||||
Wakelock.enable();
|
WakelockPlus.enable();
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
|
|
127
lib/pages/churning/churn_error_dialog.dart
Normal file
127
lib/pages/churning/churn_error_dialog.dart
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../../providers/churning/churning_service_provider.dart';
|
||||||
|
import '../../utilities/text_styles.dart';
|
||||||
|
import '../../utilities/util.dart';
|
||||||
|
import '../../widgets/conditional_parent.dart';
|
||||||
|
import '../../widgets/desktop/desktop_dialog.dart';
|
||||||
|
import '../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../../widgets/desktop/secondary_button.dart';
|
||||||
|
import '../../widgets/stack_dialog.dart';
|
||||||
|
|
||||||
|
class ChurnErrorDialog extends ConsumerWidget {
|
||||||
|
const ChurnErrorDialog({
|
||||||
|
super.key,
|
||||||
|
required this.error,
|
||||||
|
required this.walletId,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String error;
|
||||||
|
final String walletId;
|
||||||
|
|
||||||
|
static const errorTitle = "An error occurred";
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
return ConditionalParent(
|
||||||
|
condition: Util.isDesktop,
|
||||||
|
builder: (child) => DesktopDialog(
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: ConditionalParent(
|
||||||
|
condition: !Util.isDesktop,
|
||||||
|
builder: (child) => StackDialogBase(
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Util.isDesktop
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 32, top: 32),
|
||||||
|
child: Text(
|
||||||
|
errorTitle,
|
||||||
|
style: STextStyles.desktopH2(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
errorTitle,
|
||||||
|
style: STextStyles.pageTitleH2(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: Util.isDesktop
|
||||||
|
? const EdgeInsets.all(32)
|
||||||
|
: const EdgeInsets.all(20),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: SelectableText(
|
||||||
|
error.startsWith("Exception:")
|
||||||
|
? error.substring(10).trim()
|
||||||
|
: error,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: Util.isDesktop
|
||||||
|
? const EdgeInsets.all(32)
|
||||||
|
: const EdgeInsets.all(20),
|
||||||
|
child: Text(
|
||||||
|
"Stop churning or try and continue?",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.w600_14(context)
|
||||||
|
: STextStyles.w600_14(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: Util.isDesktop ? 32 : 20,
|
||||||
|
bottom: Util.isDesktop ? 32 : 20,
|
||||||
|
right: Util.isDesktop ? 32 : 20,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
label: "Stop",
|
||||||
|
onPressed: () {
|
||||||
|
ref.read(pChurningService(walletId)).stopChurning();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: Util.isDesktop ? 20 : 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PrimaryButton(
|
||||||
|
label: "Continue",
|
||||||
|
onPressed: () {
|
||||||
|
ref.read(pChurningService(walletId)).unpause();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
264
lib/pages/churning/churning_progress_view.dart
Normal file
264
lib/pages/churning/churning_progress_view.dart
Normal file
|
@ -0,0 +1,264 @@
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
|
|
||||||
|
import '../../providers/churning/churning_service_provider.dart';
|
||||||
|
import '../../themes/stack_colors.dart';
|
||||||
|
import '../../utilities/assets.dart';
|
||||||
|
import '../../utilities/text_styles.dart';
|
||||||
|
import '../../widgets/background.dart';
|
||||||
|
import '../../widgets/churning/churn_progress_item.dart';
|
||||||
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import '../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../../widgets/desktop/secondary_button.dart';
|
||||||
|
import '../../widgets/monero_chan_dance.dart';
|
||||||
|
import '../../widgets/rounded_container.dart';
|
||||||
|
import '../../widgets/stack_dialog.dart';
|
||||||
|
import 'churn_error_dialog.dart';
|
||||||
|
|
||||||
|
class ChurningProgressView extends ConsumerStatefulWidget {
|
||||||
|
const ChurningProgressView({
|
||||||
|
super.key,
|
||||||
|
required this.walletId,
|
||||||
|
});
|
||||||
|
|
||||||
|
static const routeName = "/churningProgressView";
|
||||||
|
|
||||||
|
final String walletId;
|
||||||
|
@override
|
||||||
|
ConsumerState<ChurningProgressView> createState() =>
|
||||||
|
_ChurningProgressViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChurningProgressViewState extends ConsumerState<ChurningProgressView> {
|
||||||
|
Future<bool> _requestAndProcessCancel() async {
|
||||||
|
final shouldCancel = await showDialog<bool?>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (_) => StackDialog(
|
||||||
|
title: "Cancel churning?",
|
||||||
|
leftButton: SecondaryButton(
|
||||||
|
label: "No",
|
||||||
|
buttonHeight: null,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
rightButton: PrimaryButton(
|
||||||
|
label: "Yes",
|
||||||
|
buttonHeight: null,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (shouldCancel == true && mounted) {
|
||||||
|
ref.read(pChurningService(widget.walletId)).stopChurning();
|
||||||
|
|
||||||
|
await WakelockPlus.disable();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (mounted) ref.read(pChurningService(widget.walletId)).churn();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
WakelockPlus.disable();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final bool _succeeded = ref.watch(
|
||||||
|
pChurningService(widget.walletId).select((s) => s.done),
|
||||||
|
);
|
||||||
|
|
||||||
|
final int _roundsCompleted = ref.watch(
|
||||||
|
pChurningService(widget.walletId).select((s) => s.roundsCompleted),
|
||||||
|
);
|
||||||
|
|
||||||
|
WakelockPlus.enable();
|
||||||
|
|
||||||
|
ref.listen(
|
||||||
|
pChurningService(widget.walletId).select((s) => s.lastSeenError),
|
||||||
|
(p, n) {
|
||||||
|
if (!ref.read(pChurningService(widget.walletId)).ignoreErrors &&
|
||||||
|
n != null) {
|
||||||
|
if (context.mounted) {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ChurnErrorDialog(
|
||||||
|
error: n.toString(),
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
return await _requestAndProcessCancel();
|
||||||
|
},
|
||||||
|
child: Background(
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
leading: AppBarBackButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (await _requestAndProcessCancel()) {
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
"Churning progress",
|
||||||
|
style: STextStyles.navBarTitle(context),
|
||||||
|
),
|
||||||
|
titleSpacing: 0,
|
||||||
|
),
|
||||||
|
body: LayoutBuilder(
|
||||||
|
builder: (builderContext, constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
if (_roundsCompleted == 0)
|
||||||
|
RoundedContainer(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.snackBarBackError,
|
||||||
|
child: Text(
|
||||||
|
"Do not close this window. If you exit, "
|
||||||
|
"the process will be canceled.",
|
||||||
|
style:
|
||||||
|
STextStyles.smallMed14(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.snackBarTextError,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_roundsCompleted > 0)
|
||||||
|
RoundedContainer(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.snackBarBackInfo,
|
||||||
|
child: Text(
|
||||||
|
"Churning rounds completed: $_roundsCompleted",
|
||||||
|
style: STextStyles.w500_14(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.snackBarTextInfo,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const MoneroChanDance(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
ProgressItem(
|
||||||
|
iconAsset: Assets.svg.alertCircle,
|
||||||
|
label: "Waiting for balance to unlock ${ref.watch(
|
||||||
|
pChurningService(widget.walletId)
|
||||||
|
.select((s) => s.confirmsInfo),
|
||||||
|
) ?? ""}",
|
||||||
|
status: ref.watch(
|
||||||
|
pChurningService(widget.walletId)
|
||||||
|
.select((s) => s.waitingForUnlockedBalance),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
ProgressItem(
|
||||||
|
iconAsset: Assets.svg.churn,
|
||||||
|
label: "Creating churn transaction",
|
||||||
|
status: ref.watch(
|
||||||
|
pChurningService(widget.walletId)
|
||||||
|
.select((s) => s.makingChurnTransaction),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
ProgressItem(
|
||||||
|
iconAsset: Assets.svg.checkCircle,
|
||||||
|
label: "Complete",
|
||||||
|
status: ref.watch(
|
||||||
|
pChurningService(widget.walletId)
|
||||||
|
.select((s) => s.completedStatus),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
if (_succeeded)
|
||||||
|
PrimaryButton(
|
||||||
|
label: "Churn again",
|
||||||
|
onPressed: ref
|
||||||
|
.read(pChurningService(widget.walletId))
|
||||||
|
.churn,
|
||||||
|
),
|
||||||
|
if (_succeeded)
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
SecondaryButton(
|
||||||
|
label: "Cancel",
|
||||||
|
onPressed: () async {
|
||||||
|
if (await _requestAndProcessCancel()) {
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
159
lib/pages/churning/churning_rounds_selection_sheet.dart
Normal file
159
lib/pages/churning/churning_rounds_selection_sheet.dart
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
|
||||||
|
import '../../themes/stack_colors.dart';
|
||||||
|
import '../../utilities/constants.dart';
|
||||||
|
import '../../utilities/extensions/extensions.dart';
|
||||||
|
import '../../utilities/text_styles.dart';
|
||||||
|
|
||||||
|
enum ChurnOption {
|
||||||
|
continuous,
|
||||||
|
custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ChurnRoundCountSelectSheet extends HookWidget {
|
||||||
|
const ChurnRoundCountSelectSheet({
|
||||||
|
super.key,
|
||||||
|
required this.currentOption,
|
||||||
|
});
|
||||||
|
|
||||||
|
final ChurnOption currentOption;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final option = useState(currentOption);
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.of(context).pop(option.value);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
top: Radius.circular(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 24,
|
||||||
|
right: 24,
|
||||||
|
top: 10,
|
||||||
|
bottom: 0,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
width: 60,
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 36,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Rounds of churn",
|
||||||
|
style: STextStyles.pageTitleH2(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
for (int i = 0; i < ChurnOption.values.length; i++)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
option.value = ChurnOption.values[i];
|
||||||
|
Navigator.of(context).pop(option.value);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Column(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
child: Radio(
|
||||||
|
activeColor: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.radioButtonIconEnabled,
|
||||||
|
value: ChurnOption.values[i],
|
||||||
|
groupValue: option.value,
|
||||||
|
onChanged: (_) {
|
||||||
|
option.value = ChurnOption.values[i];
|
||||||
|
Navigator.of(context).pop(option.value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
ChurnOption.values[i].name.capitalize(),
|
||||||
|
style: STextStyles.titleBold12(context),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
ChurnOption.values[i] ==
|
||||||
|
ChurnOption.continuous
|
||||||
|
? "Keep churning until manually stopped"
|
||||||
|
: "Stop after a set number of churns",
|
||||||
|
style: STextStyles.itemSubtitle12(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
292
lib/pages/churning/churning_view.dart
Normal file
292
lib/pages/churning/churning_view.dart
Normal file
|
@ -0,0 +1,292 @@
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
|
||||||
|
import '../../providers/churning/churning_service_provider.dart';
|
||||||
|
import '../../themes/stack_colors.dart';
|
||||||
|
import '../../utilities/assets.dart';
|
||||||
|
import '../../utilities/constants.dart';
|
||||||
|
import '../../utilities/extensions/extensions.dart';
|
||||||
|
import '../../utilities/text_styles.dart';
|
||||||
|
import '../../widgets/background.dart';
|
||||||
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import '../../widgets/custom_buttons/checkbox_text_button.dart';
|
||||||
|
import '../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../../widgets/rounded_container.dart';
|
||||||
|
import '../../widgets/rounded_white_container.dart';
|
||||||
|
import '../../widgets/stack_dialog.dart';
|
||||||
|
import '../../widgets/stack_text_field.dart';
|
||||||
|
import 'churning_progress_view.dart';
|
||||||
|
import 'churning_rounds_selection_sheet.dart';
|
||||||
|
|
||||||
|
class ChurningView extends ConsumerStatefulWidget {
|
||||||
|
const ChurningView({
|
||||||
|
super.key,
|
||||||
|
required this.walletId,
|
||||||
|
});
|
||||||
|
|
||||||
|
static const routeName = "/churnView";
|
||||||
|
|
||||||
|
final String walletId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<ChurningView> createState() => _ChurnViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ChurnViewState extends ConsumerState<ChurningView> {
|
||||||
|
late final TextEditingController churningRoundController;
|
||||||
|
late final FocusNode churningRoundFocusNode;
|
||||||
|
|
||||||
|
bool _enableStartButton = false;
|
||||||
|
|
||||||
|
ChurnOption _option = ChurnOption.continuous;
|
||||||
|
|
||||||
|
Future<void> _startChurn() async {
|
||||||
|
final churningService = ref.read(pChurningService(widget.walletId));
|
||||||
|
|
||||||
|
final int rounds = _option == ChurnOption.continuous
|
||||||
|
? 0
|
||||||
|
: int.parse(churningRoundController.text);
|
||||||
|
|
||||||
|
churningService.rounds = rounds;
|
||||||
|
|
||||||
|
await Navigator.of(context).pushNamed(
|
||||||
|
ChurningProgressView.routeName,
|
||||||
|
arguments: widget.walletId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
churningRoundController = TextEditingController();
|
||||||
|
|
||||||
|
churningRoundFocusNode = FocusNode();
|
||||||
|
|
||||||
|
final rounds = ref.read(pChurningService(widget.walletId)).rounds;
|
||||||
|
|
||||||
|
_option = rounds == 0 ? ChurnOption.continuous : ChurnOption.custom;
|
||||||
|
churningRoundController.text = rounds.toString();
|
||||||
|
|
||||||
|
_enableStartButton = churningRoundController.text.isNotEmpty;
|
||||||
|
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
churningRoundController.dispose();
|
||||||
|
churningRoundFocusNode.dispose();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Background(
|
||||||
|
child: SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
leading: const AppBarBackButton(),
|
||||||
|
title: Text(
|
||||||
|
"Churn",
|
||||||
|
style: STextStyles.navBarTitle(context),
|
||||||
|
),
|
||||||
|
titleSpacing: 0,
|
||||||
|
actions: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: AppBarIconButton(
|
||||||
|
size: 36,
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.circleQuestion,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.topNavIconPrimary,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => const StackOkDialog(
|
||||||
|
title: "What is churning?",
|
||||||
|
message: "Churning in a Monero wallet involves"
|
||||||
|
" sending Monero to oneself in multiple"
|
||||||
|
" transactions, which can enhance privacy"
|
||||||
|
" by making it harder for observers to "
|
||||||
|
"link your transactions. This process"
|
||||||
|
" re-mixes the funds within the network,"
|
||||||
|
" helping obscure transaction history. "
|
||||||
|
"Churning is optional and mainly beneficial"
|
||||||
|
" in scenarios where maximum privacy is"
|
||||||
|
" desired or if you received the Monero from"
|
||||||
|
" a source from which you'd like to disassociate.",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: LayoutBuilder(
|
||||||
|
builder: (builderContext, constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
RoundedWhiteContainer(
|
||||||
|
child: Text(
|
||||||
|
"Churning helps anonymize your coins by mixing them.",
|
||||||
|
style: STextStyles.w500_12(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Configuration",
|
||||||
|
style: STextStyles.w500_14(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
RoundedContainer(
|
||||||
|
onPressed: () async {
|
||||||
|
final option =
|
||||||
|
await showModalBottomSheet<ChurnOption?>(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
context: context,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.vertical(
|
||||||
|
top: Radius.circular(20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
builder: (_) {
|
||||||
|
return ChurnRoundCountSelectSheet(
|
||||||
|
currentOption: _option,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (option != null) {
|
||||||
|
setState(() {
|
||||||
|
_option = option;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldActiveBG,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
_option.name.capitalize(),
|
||||||
|
style: STextStyles.w500_12(context),
|
||||||
|
),
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.chevronDown,
|
||||||
|
width: 12,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_option == ChurnOption.custom)
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
if (_option == ChurnOption.custom)
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
autocorrect: false,
|
||||||
|
enableSuggestions: false,
|
||||||
|
controller: churningRoundController,
|
||||||
|
focusNode: churningRoundFocusNode,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
|
],
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_enableStartButton = value.isNotEmpty;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
style: STextStyles.field(context),
|
||||||
|
decoration: standardInputDecoration(
|
||||||
|
"Number of churns",
|
||||||
|
churningRoundFocusNode,
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
labelText: "Enter number of churns..",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
CheckboxTextButton(
|
||||||
|
label: "Pause on errors",
|
||||||
|
initialValue: !ref
|
||||||
|
.read(pChurningService(widget.walletId))
|
||||||
|
.ignoreErrors,
|
||||||
|
onChanged: (value) {
|
||||||
|
ref
|
||||||
|
.read(pChurningService(widget.walletId))
|
||||||
|
.ignoreErrors = !value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
PrimaryButton(
|
||||||
|
label: "Start",
|
||||||
|
enabled: _enableStartButton,
|
||||||
|
onPressed: _startChurn,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -350,6 +350,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
||||||
utxo.isConfirmed(
|
utxo.isConfirmed(
|
||||||
currentHeight,
|
currentHeight,
|
||||||
minConfirms,
|
minConfirms,
|
||||||
|
coin.minCoinbaseConfirms,
|
||||||
)),
|
)),
|
||||||
initialSelectedState: isSelected,
|
initialSelectedState: isSelected,
|
||||||
onSelectedChanged: (value) {
|
onSelectedChanged: (value) {
|
||||||
|
@ -414,6 +415,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
||||||
utxo.isConfirmed(
|
utxo.isConfirmed(
|
||||||
currentHeight,
|
currentHeight,
|
||||||
minConfirms,
|
minConfirms,
|
||||||
|
coin.minCoinbaseConfirms,
|
||||||
)),
|
)),
|
||||||
initialSelectedState: isSelected,
|
initialSelectedState: isSelected,
|
||||||
onSelectedChanged: (value) {
|
onSelectedChanged: (value) {
|
||||||
|
@ -558,6 +560,7 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
||||||
utxo.isConfirmed(
|
utxo.isConfirmed(
|
||||||
currentHeight,
|
currentHeight,
|
||||||
minConfirms,
|
minConfirms,
|
||||||
|
coin.minCoinbaseConfirms,
|
||||||
)),
|
)),
|
||||||
initialSelectedState: isSelected,
|
initialSelectedState: isSelected,
|
||||||
onSelectedChanged: (value) {
|
onSelectedChanged: (value) {
|
||||||
|
|
|
@ -117,6 +117,11 @@ class _UtxoCardState extends ConsumerState<UtxoCard> {
|
||||||
.getWallet(widget.walletId)
|
.getWallet(widget.walletId)
|
||||||
.cryptoCurrency
|
.cryptoCurrency
|
||||||
.minConfirms,
|
.minConfirms,
|
||||||
|
ref
|
||||||
|
.watch(pWallets)
|
||||||
|
.getWallet(widget.walletId)
|
||||||
|
.cryptoCurrency
|
||||||
|
.minCoinbaseConfirms,
|
||||||
)
|
)
|
||||||
? UTXOStatusIconStatus.confirmed
|
? UTXOStatusIconStatus.confirmed
|
||||||
: UTXOStatusIconStatus.unconfirmed,
|
: UTXOStatusIconStatus.unconfirmed,
|
||||||
|
|
|
@ -13,9 +13,9 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
|
||||||
import '../../db/isar/main_db.dart';
|
import '../../db/isar/main_db.dart';
|
||||||
import '../../models/isar/models/isar_models.dart';
|
import '../../models/isar/models/isar_models.dart';
|
||||||
import '../wallet_view/transaction_views/transaction_details_view.dart';
|
|
||||||
import '../../providers/global/wallets_provider.dart';
|
import '../../providers/global/wallets_provider.dart';
|
||||||
import '../../themes/stack_colors.dart';
|
import '../../themes/stack_colors.dart';
|
||||||
import '../../utilities/amount/amount.dart';
|
import '../../utilities/amount/amount.dart';
|
||||||
|
@ -33,6 +33,7 @@ import '../../widgets/desktop/desktop_dialog_close_button.dart';
|
||||||
import '../../widgets/desktop/secondary_button.dart';
|
import '../../widgets/desktop/secondary_button.dart';
|
||||||
import '../../widgets/icon_widgets/utxo_status_icon.dart';
|
import '../../widgets/icon_widgets/utxo_status_icon.dart';
|
||||||
import '../../widgets/rounded_container.dart';
|
import '../../widgets/rounded_container.dart';
|
||||||
|
import '../wallet_view/transaction_views/transaction_details_view.dart';
|
||||||
|
|
||||||
class UtxoDetailsView extends ConsumerStatefulWidget {
|
class UtxoDetailsView extends ConsumerStatefulWidget {
|
||||||
const UtxoDetailsView({
|
const UtxoDetailsView({
|
||||||
|
@ -97,6 +98,11 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
||||||
final confirmed = utxo!.isConfirmed(
|
final confirmed = utxo!.isConfirmed(
|
||||||
currentHeight,
|
currentHeight,
|
||||||
ref.watch(pWallets).getWallet(widget.walletId).cryptoCurrency.minConfirms,
|
ref.watch(pWallets).getWallet(widget.walletId).cryptoCurrency.minConfirms,
|
||||||
|
ref
|
||||||
|
.watch(pWallets)
|
||||||
|
.getWallet(widget.walletId)
|
||||||
|
.cryptoCurrency
|
||||||
|
.minCoinbaseConfirms,
|
||||||
);
|
);
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
|
|
|
@ -70,6 +70,78 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
|
|
||||||
bool enableNext = false;
|
bool enableNext = false;
|
||||||
|
|
||||||
|
void _onRefundQrTapped() async {
|
||||||
|
try {
|
||||||
|
final qrResult = await scanner.scan();
|
||||||
|
|
||||||
|
final paymentData = AddressUtils.parsePaymentUri(
|
||||||
|
qrResult.rawContent,
|
||||||
|
logging: Logging.instance,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (paymentData != null) {
|
||||||
|
// auto fill address
|
||||||
|
_refundController.text = paymentData.address;
|
||||||
|
model.refundAddress = _refundController.text;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
enableNext = _toController.text.isNotEmpty &&
|
||||||
|
_refundController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_refundController.text = qrResult.rawContent;
|
||||||
|
model.refundAddress = _refundController.text;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
enableNext = _toController.text.isNotEmpty &&
|
||||||
|
_refundController.text.isNotEmpty;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} on PlatformException catch (e, s) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onToQrTapped() async {
|
||||||
|
try {
|
||||||
|
final qrResult = await scanner.scan();
|
||||||
|
|
||||||
|
final paymentData = AddressUtils.parsePaymentUri(
|
||||||
|
qrResult.rawContent,
|
||||||
|
logging: Logging.instance,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (paymentData != null) {
|
||||||
|
// auto fill address
|
||||||
|
_toController.text = paymentData.address;
|
||||||
|
model.recipientAddress = _toController.text;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
enableNext = _toController.text.isNotEmpty &&
|
||||||
|
(_refundController.text.isNotEmpty ||
|
||||||
|
!ref.read(efExchangeProvider).supportsRefundAddress);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_toController.text = qrResult.rawContent;
|
||||||
|
model.recipientAddress = _toController.text;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
enableNext = _toController.text.isNotEmpty &&
|
||||||
|
(_refundController.text.isNotEmpty ||
|
||||||
|
!!ref.read(efExchangeProvider).supportsRefundAddress);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} on PlatformException catch (e, s) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
model = widget.model;
|
model = widget.model;
|
||||||
|
@ -137,7 +209,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 75));
|
await Future<void>.delayed(const Duration(milliseconds: 75));
|
||||||
}
|
}
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -405,50 +477,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewScanQrButtonKey",
|
"sendViewScanQrButtonKey",
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: _onToQrTapped,
|
||||||
try {
|
|
||||||
final qrResult =
|
|
||||||
await scanner.scan();
|
|
||||||
|
|
||||||
final results =
|
|
||||||
AddressUtils.parseUri(
|
|
||||||
qrResult.rawContent,
|
|
||||||
);
|
|
||||||
if (results.isNotEmpty) {
|
|
||||||
// auto fill address
|
|
||||||
_toController.text =
|
|
||||||
results["address"] ?? "";
|
|
||||||
model.recipientAddress =
|
|
||||||
_toController.text;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
enableNext = _toController
|
|
||||||
.text.isNotEmpty &&
|
|
||||||
(_refundController.text
|
|
||||||
.isNotEmpty ||
|
|
||||||
!supportsRefund);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
_toController.text =
|
|
||||||
qrResult.rawContent;
|
|
||||||
model.recipientAddress =
|
|
||||||
_toController.text;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
enableNext = _toController
|
|
||||||
.text.isNotEmpty &&
|
|
||||||
(_refundController.text
|
|
||||||
.isNotEmpty ||
|
|
||||||
!supportsRefund);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} on PlatformException catch (e, s) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
|
||||||
level: LogLevel.Warning,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const QrCodeIcon(),
|
child: const QrCodeIcon(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -685,51 +714,7 @@ class _Step2ViewState extends ConsumerState<Step2View> {
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewScanQrButtonKey",
|
"sendViewScanQrButtonKey",
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: _onRefundQrTapped,
|
||||||
try {
|
|
||||||
final qrResult =
|
|
||||||
await scanner.scan();
|
|
||||||
|
|
||||||
final results =
|
|
||||||
AddressUtils.parseUri(
|
|
||||||
qrResult.rawContent,
|
|
||||||
);
|
|
||||||
if (results.isNotEmpty) {
|
|
||||||
// auto fill address
|
|
||||||
_refundController.text =
|
|
||||||
results["address"] ??
|
|
||||||
"";
|
|
||||||
model.refundAddress =
|
|
||||||
_refundController.text;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
enableNext = _toController
|
|
||||||
.text
|
|
||||||
.isNotEmpty &&
|
|
||||||
_refundController
|
|
||||||
.text.isNotEmpty;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
_refundController.text =
|
|
||||||
qrResult.rawContent;
|
|
||||||
model.refundAddress =
|
|
||||||
_refundController.text;
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
enableNext = _toController
|
|
||||||
.text
|
|
||||||
.isNotEmpty &&
|
|
||||||
_refundController
|
|
||||||
.text.isNotEmpty;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} on PlatformException catch (e, s) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"Failed to get camera permissions while trying to scan qr code in SendView: $e\n$s",
|
|
||||||
level: LogLevel.Warning,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const QrCodeIcon(),
|
child: const QrCodeIcon(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -28,6 +28,7 @@ import '../../../utilities/assets.dart';
|
||||||
import '../../../utilities/clipboard_interface.dart';
|
import '../../../utilities/clipboard_interface.dart';
|
||||||
import '../../../utilities/constants.dart';
|
import '../../../utilities/constants.dart';
|
||||||
import '../../../utilities/enums/fee_rate_type_enum.dart';
|
import '../../../utilities/enums/fee_rate_type_enum.dart';
|
||||||
|
import '../../../utilities/logger.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
||||||
|
@ -315,7 +316,8 @@ class _Step4ViewState extends ConsumerState<Step4View> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
|
Logging.instance.log("$e\n$s", level: LogLevel.Error);
|
||||||
if (mounted && !wasCancelled) {
|
if (mounted && !wasCancelled) {
|
||||||
// pop building dialog
|
// pop building dialog
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|
|
@ -28,12 +28,14 @@ import '../../utilities/amount/amount_formatter.dart';
|
||||||
import '../../utilities/assets.dart';
|
import '../../utilities/assets.dart';
|
||||||
import '../../utilities/constants.dart';
|
import '../../utilities/constants.dart';
|
||||||
import '../../utilities/enums/fee_rate_type_enum.dart';
|
import '../../utilities/enums/fee_rate_type_enum.dart';
|
||||||
|
import '../../utilities/logger.dart';
|
||||||
import '../../utilities/text_styles.dart';
|
import '../../utilities/text_styles.dart';
|
||||||
import '../../utilities/util.dart';
|
import '../../utilities/util.dart';
|
||||||
import '../../wallets/crypto_currency/crypto_currency.dart';
|
import '../../wallets/crypto_currency/crypto_currency.dart';
|
||||||
import '../../wallets/isar/providers/wallet_info_provider.dart';
|
import '../../wallets/isar/providers/wallet_info_provider.dart';
|
||||||
import '../../wallets/models/tx_data.dart';
|
import '../../wallets/models/tx_data.dart';
|
||||||
import '../../wallets/wallet/impl/firo_wallet.dart';
|
import '../../wallets/wallet/impl/firo_wallet.dart';
|
||||||
|
import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
|
||||||
import '../../widgets/background.dart';
|
import '../../widgets/background.dart';
|
||||||
import '../../widgets/conditional_parent.dart';
|
import '../../widgets/conditional_parent.dart';
|
||||||
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
@ -271,6 +273,15 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Currently CwBasedInterface wallets (xmr/wow) shouldn't even have
|
||||||
|
// access to this screen but this is needed to get past an error that
|
||||||
|
// would occur only to lead to another error which is why xmr/wow wallets
|
||||||
|
// don't have access to this screen currently
|
||||||
|
if (wallet is LibMoneroWallet) {
|
||||||
|
await wallet.init();
|
||||||
|
await wallet.open();
|
||||||
|
}
|
||||||
|
|
||||||
final time = Future<dynamic>.delayed(
|
final time = Future<dynamic>.delayed(
|
||||||
const Duration(
|
const Duration(
|
||||||
milliseconds: 2500,
|
milliseconds: 2500,
|
||||||
|
@ -375,7 +386,8 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
|
Logging.instance.log("$e\n$s", level: LogLevel.Error);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
// pop building dialog
|
// pop building dialog
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|
|
@ -190,6 +190,15 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
|
|
||||||
final isDesktop = Util.isDesktop;
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
|
final showSendFromStackButton = !hasTx &&
|
||||||
|
!["xmr", "monero", "wow", "wownero"]
|
||||||
|
.contains(trade.payInCurrency.toLowerCase()) &&
|
||||||
|
AppConfig.isStackCoin(trade.payInCurrency) &&
|
||||||
|
(trade.status == "New" ||
|
||||||
|
trade.status == "new" ||
|
||||||
|
trade.status == "waiting" ||
|
||||||
|
trade.status == "Waiting");
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !isDesktop,
|
condition: !isDesktop,
|
||||||
builder: (child) => Background(
|
builder: (child) => Background(
|
||||||
|
@ -248,21 +257,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
children: children,
|
children: children,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!hasTx &&
|
if (showSendFromStackButton)
|
||||||
AppConfig.isStackCoin(trade.payInCurrency) &&
|
|
||||||
(trade.status == "New" ||
|
|
||||||
trade.status == "new" ||
|
|
||||||
trade.status == "waiting" ||
|
|
||||||
trade.status == "Waiting"))
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 32,
|
height: 32,
|
||||||
),
|
),
|
||||||
if (!hasTx &&
|
if (showSendFromStackButton)
|
||||||
AppConfig.isStackCoin(trade.payInCurrency) &&
|
|
||||||
(trade.status == "New" ||
|
|
||||||
trade.status == "new" ||
|
|
||||||
trade.status == "waiting" ||
|
|
||||||
trade.status == "Waiting"))
|
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
label: "Send from ${AppConfig.prefix}",
|
label: "Send from ${AppConfig.prefix}",
|
||||||
buttonHeight: ButtonHeight.l,
|
buttonHeight: ButtonHeight.l,
|
||||||
|
@ -1371,13 +1370,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (!isDesktop &&
|
if (!isDesktop && showSendFromStackButton)
|
||||||
!hasTx &&
|
|
||||||
AppConfig.isStackCoin(trade.payInCurrency) &&
|
|
||||||
(trade.status == "New" ||
|
|
||||||
trade.status == "new" ||
|
|
||||||
trade.status == "waiting" ||
|
|
||||||
trade.status == "Waiting"))
|
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
label: "Send from ${AppConfig.prefix}",
|
label: "Send from ${AppConfig.prefix}",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import 'package:flutter_svg/svg.dart';
|
||||||
|
|
||||||
import '../../app_config.dart';
|
import '../../app_config.dart';
|
||||||
import '../../providers/global/notifications_provider.dart';
|
import '../../providers/global/notifications_provider.dart';
|
||||||
|
import '../../providers/global/prefs_provider.dart';
|
||||||
import '../../providers/ui/home_view_index_provider.dart';
|
import '../../providers/ui/home_view_index_provider.dart';
|
||||||
import '../../providers/ui/unread_notifications_provider.dart';
|
import '../../providers/ui/unread_notifications_provider.dart';
|
||||||
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
||||||
|
@ -172,6 +173,20 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType");
|
debugPrint("BUILD: $runtimeType");
|
||||||
|
|
||||||
|
// dirty hack
|
||||||
|
ref.listen(
|
||||||
|
prefsChangeNotifierProvider.select((value) => value.enableExchange),
|
||||||
|
(prev, next) {
|
||||||
|
if (next == false &&
|
||||||
|
mounted &&
|
||||||
|
ref.read(homeViewPageIndexStateProvider) != 0) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
|
(_) => ref.read(homeViewPageIndexStateProvider.state).state = 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: _onWillPop,
|
onWillPop: _onWillPop,
|
||||||
child: Background(
|
child: Background(
|
||||||
|
@ -345,7 +360,8 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
if (_children.length > 1)
|
if (_children.length > 1 &&
|
||||||
|
ref.watch(prefsChangeNotifierProvider).enableExchange)
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
|
|
|
@ -44,8 +44,6 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//todo: check if print needed
|
|
||||||
// debugPrint("BUILD: HomeViewButtonBar");
|
|
||||||
final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state;
|
final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state;
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
|
|
@ -382,13 +382,15 @@ class _PaynymDetailsPopupState extends ConsumerState<PaynymDetailsPopup> {
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
kDisableFollowing
|
||||||
child: PaynymFollowToggleButton(
|
? const Spacer()
|
||||||
walletId: widget.walletId,
|
: Expanded(
|
||||||
paymentCodeStringToFollow: widget.accountLite.code,
|
child: PaynymFollowToggleButton(
|
||||||
style: PaynymFollowToggleButtonStyle.detailsPopup,
|
walletId: widget.walletId,
|
||||||
),
|
paymentCodeStringToFollow: widget.accountLite.code,
|
||||||
),
|
style: PaynymFollowToggleButtonStyle.detailsPopup,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
|
|
|
@ -13,10 +13,7 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import '../../models/paynym/paynym_account.dart';
|
|
||||||
import 'dialogs/claiming_paynym_dialog.dart';
|
|
||||||
import 'paynym_home_view.dart';
|
|
||||||
import '../wallet_view/wallet_view.dart';
|
|
||||||
import '../../providers/global/paynym_api_provider.dart';
|
import '../../providers/global/paynym_api_provider.dart';
|
||||||
import '../../providers/global/wallets_provider.dart';
|
import '../../providers/global/wallets_provider.dart';
|
||||||
import '../../providers/wallet/my_paynym_account_state_provider.dart';
|
import '../../providers/wallet/my_paynym_account_state_provider.dart';
|
||||||
|
@ -30,6 +27,9 @@ import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import '../../widgets/desktop/desktop_app_bar.dart';
|
import '../../widgets/desktop/desktop_app_bar.dart';
|
||||||
import '../../widgets/desktop/desktop_scaffold.dart';
|
import '../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import '../../widgets/desktop/primary_button.dart';
|
import '../../widgets/desktop/primary_button.dart';
|
||||||
|
import '../wallet_view/wallet_view.dart';
|
||||||
|
import 'dialogs/claiming_paynym_dialog.dart';
|
||||||
|
import 'paynym_home_view.dart';
|
||||||
|
|
||||||
class PaynymClaimView extends ConsumerStatefulWidget {
|
class PaynymClaimView extends ConsumerStatefulWidget {
|
||||||
const PaynymClaimView({
|
const PaynymClaimView({
|
||||||
|
@ -46,25 +46,25 @@ class PaynymClaimView extends ConsumerStatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
Future<bool> _addSegwitCode(PaynymAccount myAccount) async {
|
// Future<bool> _addSegwitCode(PaynymAccount myAccount) async {
|
||||||
final wallet =
|
// final wallet =
|
||||||
ref.read(pWallets).getWallet(widget.walletId) as PaynymInterface;
|
// ref.read(pWallets).getWallet(widget.walletId) as PaynymInterface;
|
||||||
|
//
|
||||||
final token = await ref
|
// final token = await ref
|
||||||
.read(paynymAPIProvider)
|
// .read(paynymAPIProvider)
|
||||||
.token(myAccount.nonSegwitPaymentCode.code);
|
// .token(myAccount.nonSegwitPaymentCode.code);
|
||||||
final signature = await wallet.signStringWithNotificationKey(token.value!);
|
// final signature = await wallet.signStringWithNotificationKey(token.value!);
|
||||||
|
//
|
||||||
final pCodeSegwit = await wallet.getPaymentCode(isSegwit: true);
|
// final pCodeSegwit = await wallet.getPaymentCode(isSegwit: true);
|
||||||
final addResult = await ref.read(paynymAPIProvider).add(
|
// final addResult = await ref.read(paynymAPIProvider).add(
|
||||||
token.value!,
|
// token.value!,
|
||||||
signature,
|
// signature,
|
||||||
myAccount.nymID,
|
// myAccount.nymID,
|
||||||
pCodeSegwit.toString(),
|
// pCodeSegwit.toString(),
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
return addResult.value ?? false;
|
// return addResult.value ?? false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -197,7 +197,7 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
|
|
||||||
if (shouldCancel) return;
|
if (shouldCancel) return;
|
||||||
|
|
||||||
// attempt to create new entry in paynym.is db
|
// attempt to create new entry in [PaynymIsApi.baseURL] db
|
||||||
final created = await ref
|
final created = await ref
|
||||||
.read(paynymAPIProvider)
|
.read(paynymAPIProvider)
|
||||||
.create(pCode.toString());
|
.create(pCode.toString());
|
||||||
|
@ -209,16 +209,16 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
// payment code already claimed
|
// payment code already claimed
|
||||||
debugPrint("pcode already claimed!!");
|
debugPrint("pcode already claimed!!");
|
||||||
|
|
||||||
final account =
|
// final account =
|
||||||
await ref.read(paynymAPIProvider).nym(pCode.toString());
|
// await ref.read(paynymAPIProvider).nym(pCode.toString());
|
||||||
if (!account.value!.segwit) {
|
// if (!account.value!.segwit) {
|
||||||
for (int i = 0; i < 100; i++) {
|
// for (int i = 0; i < 100; i++) {
|
||||||
final result = await _addSegwitCode(account.value!);
|
// final result = await _addSegwitCode(account.value!);
|
||||||
if (result == true) {
|
// if (result == true) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
|
@ -258,14 +258,14 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
if (claim.value?.claimed == pCode.toString()) {
|
if (claim.value?.claimed == pCode.toString()) {
|
||||||
final account =
|
final account =
|
||||||
await ref.read(paynymAPIProvider).nym(pCode.toString());
|
await ref.read(paynymAPIProvider).nym(pCode.toString());
|
||||||
if (!account.value!.segwit) {
|
// if (!account.value!.segwit) {
|
||||||
for (int i = 0; i < 100; i++) {
|
// for (int i = 0; i < 100; i++) {
|
||||||
final result = await _addSegwitCode(account.value!);
|
// final result = await _addSegwitCode(account.value!);
|
||||||
if (result == true) {
|
// if (result == true) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
ref.read(myPaynymAccountStateProvider.state).state =
|
ref.read(myPaynymAccountStateProvider.state).state =
|
||||||
account.value!;
|
account.value!;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import '../../utilities/text_styles.dart';
|
||||||
import '../../utilities/util.dart';
|
import '../../utilities/util.dart';
|
||||||
import '../../widgets/conditional_parent.dart';
|
import '../../widgets/conditional_parent.dart';
|
||||||
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import '../../widgets/custom_buttons/paynym_follow_toggle_button.dart';
|
||||||
import '../../widgets/desktop/desktop_app_bar.dart';
|
import '../../widgets/desktop/desktop_app_bar.dart';
|
||||||
import '../../widgets/desktop/desktop_scaffold.dart';
|
import '../../widgets/desktop/desktop_scaffold.dart';
|
||||||
import '../../widgets/desktop/secondary_button.dart';
|
import '../../widgets/desktop/secondary_button.dart';
|
||||||
|
@ -121,72 +122,75 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: Padding(
|
trailing: kDisableFollowing
|
||||||
padding: const EdgeInsets.only(right: 12),
|
? null
|
||||||
child: SizedBox(
|
: Padding(
|
||||||
height: 56,
|
padding: const EdgeInsets.only(right: 12),
|
||||||
child: MouseRegion(
|
child: SizedBox(
|
||||||
cursor: SystemMouseCursors.click,
|
height: 56,
|
||||||
onEnter: (_) => setState(() {
|
child: MouseRegion(
|
||||||
_followButtonHoverState = true;
|
cursor: SystemMouseCursors.click,
|
||||||
}),
|
onEnter: (_) => setState(() {
|
||||||
onExit: (_) => setState(() {
|
_followButtonHoverState = true;
|
||||||
_followButtonHoverState = false;
|
}),
|
||||||
}),
|
onExit: (_) => setState(() {
|
||||||
child: GestureDetector(
|
_followButtonHoverState = false;
|
||||||
onTap: () {
|
}),
|
||||||
showDialog<void>(
|
child: GestureDetector(
|
||||||
context: context,
|
onTap: () {
|
||||||
builder: (context) => AddNewPaynymFollowView(
|
showDialog<void>(
|
||||||
walletId: widget.walletId,
|
context: context,
|
||||||
),
|
builder: (context) => AddNewPaynymFollowView(
|
||||||
);
|
walletId: widget.walletId,
|
||||||
},
|
),
|
||||||
child: RoundedContainer(
|
);
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
},
|
||||||
color: _followButtonHoverState
|
child: RoundedContainer(
|
||||||
? Theme.of(context)
|
padding:
|
||||||
.extension<StackColors>()!
|
const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
.highlight
|
color: _followButtonHoverState
|
||||||
: Colors.transparent,
|
? Theme.of(context)
|
||||||
radiusMultiplier: 100,
|
.extension<StackColors>()!
|
||||||
child: Row(
|
.highlight
|
||||||
children: [
|
: Colors.transparent,
|
||||||
SvgPicture.asset(
|
radiusMultiplier: 100,
|
||||||
Assets.svg.plus,
|
child: Row(
|
||||||
width: 16,
|
children: [
|
||||||
height: 16,
|
SvgPicture.asset(
|
||||||
color: Theme.of(context)
|
Assets.svg.plus,
|
||||||
.extension<StackColors>()!
|
width: 16,
|
||||||
.textDark,
|
height: 16,
|
||||||
),
|
color: Theme.of(context)
|
||||||
const SizedBox(
|
.extension<StackColors>()!
|
||||||
width: 8,
|
.textDark,
|
||||||
),
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Follow",
|
|
||||||
style:
|
|
||||||
STextStyles.desktopButtonSecondaryEnabled(
|
|
||||||
context,
|
|
||||||
).copyWith(
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
width: 8,
|
||||||
height: 2,
|
),
|
||||||
),
|
Column(
|
||||||
],
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Follow",
|
||||||
|
style: STextStyles
|
||||||
|
.desktopButtonSecondaryEnabled(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: AppBar(
|
: AppBar(
|
||||||
leading: AppBarBackButton(
|
leading: AppBarBackButton(
|
||||||
|
@ -201,28 +205,29 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Padding(
|
if (!kDisableFollowing)
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
Padding(
|
||||||
child: AspectRatio(
|
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||||
aspectRatio: 1,
|
child: AspectRatio(
|
||||||
child: AppBarIconButton(
|
aspectRatio: 1,
|
||||||
icon: SvgPicture.asset(
|
child: AppBarIconButton(
|
||||||
Assets.svg.circlePlusFilled,
|
icon: SvgPicture.asset(
|
||||||
width: 20,
|
Assets.svg.circlePlusFilled,
|
||||||
height: 20,
|
width: 20,
|
||||||
color: Theme.of(context)
|
height: 20,
|
||||||
.extension<StackColors>()!
|
color: Theme.of(context)
|
||||||
.accentColorDark,
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
AddNewPaynymFollowView.routeName,
|
||||||
|
arguments: widget.walletId,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
AddNewPaynymFollowView.routeName,
|
|
||||||
arguments: widget.walletId,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
|
|
|
@ -284,13 +284,17 @@ class _PaynymDetailsPopupState extends ConsumerState<DesktopPaynymDetails> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
),
|
),
|
||||||
Expanded(
|
kDisableFollowing
|
||||||
child: PaynymFollowToggleButton(
|
? const Spacer()
|
||||||
walletId: widget.walletId,
|
: Expanded(
|
||||||
paymentCodeStringToFollow: widget.accountLite.code,
|
child: PaynymFollowToggleButton(
|
||||||
style: PaynymFollowToggleButtonStyle.detailsDesktop,
|
walletId: widget.walletId,
|
||||||
),
|
paymentCodeStringToFollow:
|
||||||
),
|
widget.accountLite.code,
|
||||||
|
style:
|
||||||
|
PaynymFollowToggleButtonStyle.detailsDesktop,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_showInsufficientFundsInfo)
|
if (_showInsufficientFundsInfo)
|
||||||
|
|
|
@ -11,8 +11,10 @@
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../networking/http.dart';
|
import '../../../networking/http.dart';
|
||||||
import '../../../services/tor_service.dart';
|
import '../../../services/tor_service.dart';
|
||||||
|
import '../../../utilities/paynym_is_api.dart';
|
||||||
import '../../../utilities/prefs.dart';
|
import '../../../utilities/prefs.dart';
|
||||||
|
|
||||||
class PayNymBot extends StatelessWidget {
|
class PayNymBot extends StatelessWidget {
|
||||||
|
@ -50,7 +52,8 @@ class PayNymBot extends StatelessWidget {
|
||||||
|
|
||||||
Future<Uint8List> _fetchImage() async {
|
Future<Uint8List> _fetchImage() async {
|
||||||
final HTTP client = HTTP();
|
final HTTP client = HTTP();
|
||||||
final Uri uri = Uri.parse("https://paynym.is/$paymentCodeString/avatar");
|
final Uri uri =
|
||||||
|
Uri.parse("${PaynymIsApi.baseURL}/$paymentCodeString/avatar");
|
||||||
|
|
||||||
final response = await client.get(
|
final response = await client.get(
|
||||||
url: uri,
|
url: uri,
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'paynym_bot.dart';
|
|
||||||
import '../../../themes/stack_colors.dart';
|
import '../../../themes/stack_colors.dart';
|
||||||
import '../../../utilities/format.dart';
|
import '../../../utilities/format.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../utilities/util.dart';
|
import '../../../utilities/util.dart';
|
||||||
import '../../../widgets/custom_buttons/paynym_follow_toggle_button.dart';
|
import '../../../widgets/custom_buttons/paynym_follow_toggle_button.dart';
|
||||||
|
import 'paynym_bot.dart';
|
||||||
|
|
||||||
class PaynymCard extends StatefulWidget {
|
class PaynymCard extends StatefulWidget {
|
||||||
const PaynymCard({
|
const PaynymCard({
|
||||||
|
@ -84,10 +85,11 @@ class _PaynymCardState extends State<PaynymCard> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PaynymFollowToggleButton(
|
if (!kDisableFollowing)
|
||||||
walletId: widget.walletId,
|
PaynymFollowToggleButton(
|
||||||
paymentCodeStringToFollow: widget.paymentCodeString,
|
walletId: widget.walletId,
|
||||||
),
|
paymentCodeStringToFollow: widget.paymentCodeString,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,9 +12,11 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:mutex/mutex.dart';
|
||||||
|
|
||||||
import '../../notifications/show_flush_bar.dart';
|
import '../../notifications/show_flush_bar.dart';
|
||||||
// import 'package:stackwallet/providers/global/has_authenticated_start_state_provider.dart';
|
// import 'package:stackwallet/providers/global/has_authenticated_start_state_provider.dart';
|
||||||
|
import '../../providers/global/node_service_provider.dart';
|
||||||
import '../../providers/global/prefs_provider.dart';
|
import '../../providers/global/prefs_provider.dart';
|
||||||
import '../../providers/global/secure_store_provider.dart';
|
import '../../providers/global/secure_store_provider.dart';
|
||||||
import '../../providers/global/wallets_provider.dart';
|
import '../../providers/global/wallets_provider.dart';
|
||||||
|
@ -24,8 +26,10 @@ import '../../utilities/assets.dart';
|
||||||
import '../../utilities/biometrics.dart';
|
import '../../utilities/biometrics.dart';
|
||||||
import '../../utilities/flutter_secure_storage_interface.dart';
|
import '../../utilities/flutter_secure_storage_interface.dart';
|
||||||
import '../../utilities/show_loading.dart';
|
import '../../utilities/show_loading.dart';
|
||||||
|
import '../../utilities/show_node_tor_settings_mismatch.dart';
|
||||||
import '../../utilities/text_styles.dart';
|
import '../../utilities/text_styles.dart';
|
||||||
import '../../wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart';
|
import '../../utilities/util.dart';
|
||||||
|
import '../../wallets/wallet/intermediate/lib_monero_wallet.dart';
|
||||||
import '../../widgets/background.dart';
|
import '../../widgets/background.dart';
|
||||||
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import '../../widgets/custom_buttons/blue_text_button.dart';
|
import '../../widgets/custom_buttons/blue_text_button.dart';
|
||||||
|
@ -70,6 +74,7 @@ class LockscreenView extends ConsumerStatefulWidget {
|
||||||
|
|
||||||
class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
late final ShakeController _shakeController;
|
late final ShakeController _shakeController;
|
||||||
|
late final bool _autoPin;
|
||||||
|
|
||||||
late int _attempts;
|
late int _attempts;
|
||||||
bool _attemptLock = false;
|
bool _attemptLock = false;
|
||||||
|
@ -99,8 +104,22 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
final walletId = widget.routeOnSuccessArguments as String;
|
final walletId = widget.routeOnSuccessArguments as String;
|
||||||
|
|
||||||
final wallet = ref.read(pWallets).getWallet(walletId);
|
final wallet = ref.read(pWallets).getWallet(walletId);
|
||||||
|
|
||||||
|
final canContinue = await checkShowNodeTorSettingsMismatch(
|
||||||
|
context: context,
|
||||||
|
currency: wallet.cryptoCurrency,
|
||||||
|
prefs: ref.read(prefsChangeNotifierProvider),
|
||||||
|
nodeService: ref.read(nodeServiceChangeNotifierProvider),
|
||||||
|
allowCancel: false,
|
||||||
|
rootNavigator: Util.isDesktop,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!canContinue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Future<void> loadFuture;
|
final Future<void> loadFuture;
|
||||||
if (wallet is CwBasedInterface) {
|
if (wallet is LibMoneroWallet) {
|
||||||
loadFuture =
|
loadFuture =
|
||||||
wallet.init().then((value) async => await (wallet).open());
|
wallet.init().then((value) async => await (wallet).open());
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,16 +205,18 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
biometrics = widget.biometrics;
|
biometrics = widget.biometrics;
|
||||||
_attempts = 0;
|
_attempts = 0;
|
||||||
_timeout = Duration.zero;
|
_timeout = Duration.zero;
|
||||||
|
_autoPin = ref.read(prefsChangeNotifierProvider).autoPin;
|
||||||
|
if (_autoPin) {
|
||||||
|
_pinTextController.addListener(_onPinChangedAutologinCheck);
|
||||||
|
}
|
||||||
_checkUseBiometrics();
|
_checkUseBiometrics();
|
||||||
_pinTextController.addListener(_onPinChanged);
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
dispose() {
|
dispose() {
|
||||||
// _shakeController.dispose();
|
// _shakeController.dispose();
|
||||||
_pinTextController.removeListener(_onPinChanged);
|
_pinTextController.removeListener(_onPinChangedAutologinCheck);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,16 +239,120 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
|
|
||||||
final _pinTextController = TextEditingController();
|
final _pinTextController = TextEditingController();
|
||||||
|
|
||||||
void _onPinChanged() async {
|
final Mutex _autoPinCheckLock = Mutex();
|
||||||
String enteredPin = _pinTextController.text;
|
void _onPinChangedAutologinCheck() async {
|
||||||
final storedPin = await _secureStore.read(key: 'stack_pin');
|
if (mounted) {
|
||||||
final autoPin = ref.read(prefsChangeNotifierProvider).autoPin;
|
await _autoPinCheckLock.acquire();
|
||||||
|
}
|
||||||
|
|
||||||
if (enteredPin.length >= 4 && autoPin && enteredPin == storedPin) {
|
try {
|
||||||
|
if (_autoPin && _pinTextController.text.length >= 4) {
|
||||||
|
final storedPin = await _secureStore.read(key: 'stack_pin');
|
||||||
|
if (_pinTextController.text == storedPin) {
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 200),
|
||||||
|
);
|
||||||
|
unawaited(_onUnlock());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
_autoPinCheckLock.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onSubmitPin(String pin) async {
|
||||||
|
_attempts++;
|
||||||
|
|
||||||
|
if (_attempts > maxAttemptsBeforeThrottling) {
|
||||||
|
_attemptLock = true;
|
||||||
|
switch (_attempts) {
|
||||||
|
case 4:
|
||||||
|
_timeout = const Duration(seconds: 30);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
_timeout = const Duration(seconds: 60);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
_timeout = const Duration(minutes: 5);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
_timeout = const Duration(minutes: 10);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
_timeout = const Duration(minutes: 20);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
_timeout = const Duration(minutes: 30);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
_timeout = const Duration(minutes: 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
_timer?.cancel();
|
||||||
|
_timer = Timer(_timeout, () {
|
||||||
|
_attemptLock = false;
|
||||||
|
_attempts = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_attemptLock) {
|
||||||
|
String prettyTime = "";
|
||||||
|
if (_timeout.inSeconds >= 60) {
|
||||||
|
prettyTime += "${_timeout.inMinutes} minutes";
|
||||||
|
} else {
|
||||||
|
prettyTime += "${_timeout.inSeconds} seconds";
|
||||||
|
}
|
||||||
|
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.warning,
|
||||||
|
message:
|
||||||
|
"Incorrect PIN entered too many times. Please wait $prettyTime",
|
||||||
|
context: context,
|
||||||
|
iconAsset: Assets.svg.alertCircle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 100),
|
||||||
|
);
|
||||||
|
|
||||||
|
_pinTextController.text = '';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final storedPin = await _secureStore.read(key: 'stack_pin');
|
||||||
|
|
||||||
|
if (storedPin == pin) {
|
||||||
await Future<void>.delayed(
|
await Future<void>.delayed(
|
||||||
const Duration(milliseconds: 200),
|
const Duration(milliseconds: 200),
|
||||||
);
|
);
|
||||||
unawaited(_onUnlock());
|
unawaited(_onUnlock());
|
||||||
|
} else {
|
||||||
|
unawaited(_shakeController.shake());
|
||||||
|
if (mounted) {
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.warning,
|
||||||
|
message: "Incorrect PIN. Please try again",
|
||||||
|
context: context,
|
||||||
|
iconAsset: Assets.svg.alertCircle,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 100),
|
||||||
|
);
|
||||||
|
|
||||||
|
_pinTextController.text = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,98 +454,9 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
isRandom: ref
|
isRandom: ref
|
||||||
.read(prefsChangeNotifierProvider)
|
.read(prefsChangeNotifierProvider)
|
||||||
.randomizePIN,
|
.randomizePIN,
|
||||||
onSubmit: (String pin) async {
|
onSubmit: (pin) {
|
||||||
_attempts++;
|
if (!_autoPinCheckLock.isLocked) {
|
||||||
|
_onSubmitPin(pin);
|
||||||
if (_attempts > maxAttemptsBeforeThrottling) {
|
|
||||||
_attemptLock = true;
|
|
||||||
switch (_attempts) {
|
|
||||||
case 4:
|
|
||||||
_timeout = const Duration(seconds: 30);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
_timeout = const Duration(seconds: 60);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
_timeout = const Duration(minutes: 5);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
_timeout = const Duration(minutes: 10);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
_timeout = const Duration(minutes: 20);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
_timeout = const Duration(minutes: 30);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
_timeout = const Duration(minutes: 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
_timer?.cancel();
|
|
||||||
_timer = Timer(_timeout, () {
|
|
||||||
_attemptLock = false;
|
|
||||||
_attempts = 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_attemptLock) {
|
|
||||||
String prettyTime = "";
|
|
||||||
if (_timeout.inSeconds >= 60) {
|
|
||||||
prettyTime += "${_timeout.inMinutes} minutes";
|
|
||||||
} else {
|
|
||||||
prettyTime += "${_timeout.inSeconds} seconds";
|
|
||||||
}
|
|
||||||
|
|
||||||
unawaited(
|
|
||||||
showFloatingFlushBar(
|
|
||||||
type: FlushBarType.warning,
|
|
||||||
message:
|
|
||||||
"Incorrect PIN entered too many times. Please wait $prettyTime",
|
|
||||||
context: context,
|
|
||||||
iconAsset: Assets.svg.alertCircle,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await Future<void>.delayed(
|
|
||||||
const Duration(milliseconds: 100),
|
|
||||||
);
|
|
||||||
|
|
||||||
_pinTextController.text = '';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final storedPin =
|
|
||||||
await _secureStore.read(key: 'stack_pin');
|
|
||||||
|
|
||||||
if (storedPin == pin) {
|
|
||||||
await Future<void>.delayed(
|
|
||||||
const Duration(milliseconds: 200),
|
|
||||||
);
|
|
||||||
unawaited(_onUnlock());
|
|
||||||
} else {
|
|
||||||
unawaited(_shakeController.shake());
|
|
||||||
unawaited(
|
|
||||||
showFloatingFlushBar(
|
|
||||||
type: FlushBarType.warning,
|
|
||||||
message: "Incorrect PIN. Please try again",
|
|
||||||
context: context,
|
|
||||||
iconAsset: Assets.svg.alertCircle,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await Future<void>.delayed(
|
|
||||||
const Duration(milliseconds: 100),
|
|
||||||
);
|
|
||||||
|
|
||||||
_pinTextController.text = '';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:mutex/mutex.dart';
|
||||||
|
|
||||||
import '../../notifications/show_flush_bar.dart';
|
import '../../notifications/show_flush_bar.dart';
|
||||||
import '../../providers/global/prefs_provider.dart';
|
import '../../providers/global/prefs_provider.dart';
|
||||||
|
@ -38,6 +39,8 @@ class PinpadDialog extends ConsumerStatefulWidget {
|
||||||
class _PinpadDialogState extends ConsumerState<PinpadDialog> {
|
class _PinpadDialogState extends ConsumerState<PinpadDialog> {
|
||||||
late final ShakeController _shakeController;
|
late final ShakeController _shakeController;
|
||||||
|
|
||||||
|
late final bool _autoPin;
|
||||||
|
|
||||||
late int _attempts;
|
late int _attempts;
|
||||||
bool _attemptLock = false;
|
bool _attemptLock = false;
|
||||||
late Duration _timeout;
|
late Duration _timeout;
|
||||||
|
@ -63,16 +66,24 @@ class _PinpadDialogState extends ConsumerState<PinpadDialog> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onPinChanged() async {
|
final Mutex _autoPinCheckLock = Mutex();
|
||||||
final enteredPin = _pinTextController.text;
|
void _onPinChangedAutologinCheck() async {
|
||||||
final storedPin = await _secureStore.read(key: 'stack_pin');
|
if (mounted) {
|
||||||
final autoPin = ref.read(prefsChangeNotifierProvider).autoPin;
|
await _autoPinCheckLock.acquire();
|
||||||
|
}
|
||||||
|
|
||||||
if (enteredPin.length >= 4 && autoPin && enteredPin == storedPin) {
|
try {
|
||||||
await Future<void>.delayed(
|
if (_autoPin && _pinTextController.text.length >= 4) {
|
||||||
const Duration(milliseconds: 200),
|
final storedPin = await _secureStore.read(key: 'stack_pin');
|
||||||
);
|
if (_pinTextController.text == storedPin) {
|
||||||
unawaited(_onUnlock());
|
await Future<void>.delayed(
|
||||||
|
const Duration(milliseconds: 200),
|
||||||
|
);
|
||||||
|
unawaited(_onUnlock());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
_autoPinCheckLock.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,16 +226,19 @@ class _PinpadDialogState extends ConsumerState<PinpadDialog> {
|
||||||
biometrics = widget.biometrics;
|
biometrics = widget.biometrics;
|
||||||
_attempts = 0;
|
_attempts = 0;
|
||||||
_timeout = Duration.zero;
|
_timeout = Duration.zero;
|
||||||
|
_autoPin = ref.read(prefsChangeNotifierProvider).autoPin;
|
||||||
|
if (_autoPin) {
|
||||||
|
_pinTextController.addListener(_onPinChangedAutologinCheck);
|
||||||
|
}
|
||||||
|
|
||||||
_checkUseBiometrics();
|
_checkUseBiometrics();
|
||||||
_pinTextController.addListener(_onPinChanged);
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
dispose() {
|
dispose() {
|
||||||
// _shakeController.dispose();
|
// _shakeController.dispose();
|
||||||
_pinTextController.removeListener(_onPinChanged);
|
_pinTextController.removeListener(_onPinChangedAutologinCheck);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +290,11 @@ class _PinpadDialogState extends ConsumerState<PinpadDialog> {
|
||||||
submittedFieldDecoration: _pinPutDecoration,
|
submittedFieldDecoration: _pinPutDecoration,
|
||||||
isRandom:
|
isRandom:
|
||||||
ref.read(prefsChangeNotifierProvider).randomizePIN,
|
ref.read(prefsChangeNotifierProvider).randomizePIN,
|
||||||
onSubmit: _onSubmit,
|
onSubmit: (pin) {
|
||||||
|
if (!_autoPinCheckLock.isLocked) {
|
||||||
|
_onSubmit(pin);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 32,
|
height: 32,
|
||||||
|
|
|
@ -304,7 +304,7 @@ class _AddressCardState extends ConsumerState<AddressCard> {
|
||||||
key: _qrKey,
|
key: _qrKey,
|
||||||
child: QR(
|
child: QR(
|
||||||
data: AddressUtils.buildUriString(
|
data: AddressUtils.buildUriString(
|
||||||
widget.coin,
|
widget.coin.uriScheme,
|
||||||
address.value,
|
address.value,
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
@ -22,6 +23,7 @@ import '../../../utilities/address_utils.dart';
|
||||||
import '../../../utilities/text_styles.dart';
|
import '../../../utilities/text_styles.dart';
|
||||||
import '../../../utilities/util.dart';
|
import '../../../utilities/util.dart';
|
||||||
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
import '../../../wallets/isar/providers/wallet_info_provider.dart';
|
||||||
|
import '../../../wallets/wallet/intermediate/bip39_hd_wallet.dart';
|
||||||
import '../../../widgets/address_private_key.dart';
|
import '../../../widgets/address_private_key.dart';
|
||||||
import '../../../widgets/background.dart';
|
import '../../../widgets/background.dart';
|
||||||
import '../../../widgets/conditional_parent.dart';
|
import '../../../widgets/conditional_parent.dart';
|
||||||
|
@ -96,7 +98,7 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
|
||||||
key: _qrKey,
|
key: _qrKey,
|
||||||
child: QR(
|
child: QR(
|
||||||
data: AddressUtils.buildUriString(
|
data: AddressUtils.buildUriString(
|
||||||
ref.watch(pWalletCoin(widget.walletId)),
|
ref.watch(pWalletCoin(widget.walletId)).uriScheme,
|
||||||
address.value,
|
address.value,
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
|
@ -146,6 +148,7 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final coin = ref.watch(pWalletCoin(widget.walletId));
|
final coin = ref.watch(pWalletCoin(widget.walletId));
|
||||||
|
final wallet = ref.watch(pWallets).getWallet(widget.walletId);
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !isDesktop,
|
condition: !isDesktop,
|
||||||
builder: (child) => Background(
|
builder: (child) => Background(
|
||||||
|
@ -288,7 +291,7 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
|
||||||
key: _qrKey,
|
key: _qrKey,
|
||||||
child: QR(
|
child: QR(
|
||||||
data: AddressUtils.buildUriString(
|
data: AddressUtils.buildUriString(
|
||||||
coin,
|
coin.uriScheme,
|
||||||
address.value,
|
address.value,
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
|
@ -371,13 +374,25 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
|
||||||
detail: address.subType.prettyName,
|
detail: address.subType.prettyName,
|
||||||
button: Container(),
|
button: Container(),
|
||||||
),
|
),
|
||||||
const _Div(
|
if (kDebugMode)
|
||||||
height: 12,
|
const _Div(
|
||||||
),
|
height: 12,
|
||||||
AddressPrivateKey(
|
),
|
||||||
walletId: widget.walletId,
|
if (kDebugMode)
|
||||||
address: address,
|
DetailItem(
|
||||||
),
|
title: "frost secure (kDebugMode)",
|
||||||
|
detail: address.zSafeFrost.toString(),
|
||||||
|
button: Container(),
|
||||||
|
),
|
||||||
|
if (wallet is Bip39HDWallet && !wallet.isViewOnly)
|
||||||
|
const _Div(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
if (wallet is Bip39HDWallet && !wallet.isViewOnly)
|
||||||
|
AddressPrivateKey(
|
||||||
|
walletId: widget.walletId,
|
||||||
|
address: address,
|
||||||
|
),
|
||||||
if (!isDesktop)
|
if (!isDesktop)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
|
|
|
@ -142,7 +142,7 @@ class _AddressQrPopupState extends State<AddressQrPopup> {
|
||||||
key: _qrKey,
|
key: _qrKey,
|
||||||
child: QR(
|
child: QR(
|
||||||
data: AddressUtils.buildUriString(
|
data: AddressUtils.buildUriString(
|
||||||
widget.coin,
|
widget.coin.uriScheme,
|
||||||
widget.addressString,
|
widget.addressString,
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue