Merge branch 'themes' of github.com:cypherstack/stack_wallet into themes

This commit is contained in:
likho 2023-04-28 14:29:06 +02:00
commit 228afdd29a
63 changed files with 2532 additions and 3381 deletions

131
README.md
View file

@ -3,12 +3,25 @@
# Stack Wallet
Stack Wallet is a fully open source cryptocurrency wallet. With an easy to use user interface and quick and speedy transactions, this wallet is ideal for anyone no matter how much they know about the cryptocurrency space. The app is actively maintained to provide new user friendly features.
[![Playstore](https://bluewallet.io/img/play-store-badge.svg)](https://play.google.com/store/apps/details?id=com.cypherstack.stackwallet)
<a href="https://play.google.com/store/apps/details?id=com.cypherstack.stackwallet">
<img width="250px" src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png"></img>
</a>
## Feature List
Highlights include:
- 11 Different cryptocurrencies
- 11 Different cryptocurrencies:
- [Bitcoin](https://bitcoin.org/en/)
- [Bitcoin Cash](https://bch.info/en/)
- [Dogecoin](https://dogecoin.com/)
- [Epic Cash](https://linktr.ee/epiccash)
- [Ethereum](https://ethereum.org/en/)
- [Firo](https://firo.org/)
- [Litecoin](https://litecoin.org/)
- [Monero](https://www.getmonero.org/)
- [Namecoin](https://www.namecoin.org/)
- [Particl](https://particl.io/)
- [Wownero](https://wownero.org/)
- All private keys and seeds stay on device and are never shared.
- Easy backup and restore feature to save all the information that's important to you.
- Trading cryptocurrencies through our partners.
@ -16,116 +29,10 @@ Highlights include:
- Favorite wallets with fast syncing
- Custom Nodes.
- Open source software.
- No ads.
> You can find the roadmap [here](docs/roadmap.md).
## Building
### Prerequisites
- The only OS supported for building is Ubuntu 20.04
- A machine with at least 100 GB of Storage
The following prerequisites can be installed with the setup script `scripts/setup.sh` or manually as described below:
- Flutter 3.7.10 [(install manually or with git, do not install with snap)](https://docs.flutter.dev/get-started/install)
- Dart SDK Requirement (>=2.19.0, up until <3.0.0) (normally included with a flutter install)
- Android setup ([Android Studio](https://developer.android.com/studio) and subsequent dependencies)
### Scripted setup
[`scripts/setup.sh`](https://github.com/cypherstack/stack_wallet/blob/main/scripts/setup.sh) is provided as a tool to set up a stock Ubuntu 20.04 installation for building: download the script and run it anywhere. This script should skip the entire [Manual setup](#manual-setup) section below and prepare you for [running](#running). It will set up the stack_wallet repository in `~/projects/stack_wallet` and build it there.
### Manual setup
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
```
The following *may* be needed for Android studio:
```
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
```
Install [Rust](https://www.rust-lang.org/tools/install)
```
cargo install cargo-ndk
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
Linux desktop specific dependencies:
```
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev meson python3-pip libgirepository1.0-dev valac xsltproc docbook-xsl
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
```
After installing the prerequisites listed above, download the code and init the submodules
```
git clone https://github.com/cypherstack/stack_wallet.git
cd stack_wallet
git submodule update --init --recursive
```
Run prebuild script
```
cd scripts
./prebuild.sh
// when finished go back to the root directory
cd ..
```
Remove pre-installed system libraries for the following packages built by cryptography plugins in the crypto_plugins folder: `boost iconv libjson-dev libsecret openssl sodium unbound zmq`. You can use
```
sudo apt list --installed | grep boost
```
for example to find which pre-installed packages you may need to remove with `sudo apt remove`. Be careful, as some packages (especially boost) are linked to GNOME (GUI) packages: when in doubt, remove `-dev` packages first like with
```
sudo apt-get remove '^libboost.*-dev.*'
```
<!-- TODO: configure compiler to prefer built over system libraries. Should already use them? -->
Building plugins for Android
```
cd scripts/android/
./build_all.sh
// when finished go back to the root directory
cd ../..
```
Building plugins for Linux
```
cd scripts/linux/
./build_all.sh
// when finished go back to the root directory
cd ../..
```
## Running
### Android
Plug in your android device or use the emulator available via Android Studio and then run the following commands:
```
flutter pub get
flutter run android
```
Note on Emulators: Only x86_64 emulators are supported, x86 emulators will not work
### Linux
Plug in your android device or use the emulator available via Android Studio and then run the following commands:
```
flutter pub get Linux
flutter run linux
```
## Android Studio
Android Studio is the recommended IDE for development, not just for launching on Android devices and emulators but also for Linux desktop development.
Follow instructions here [https://developer.android.com/studio/install#linux](https://developer.android.com/studio/install#linux) or install via snap:
```
# setup android studio
sudo apt install -y openjdk-11-jdk
sudo snap install android-studio --classic
```
Use Tools > SDK Manager to install the SDK Tools > Android SDK (API 30), SDK Tools > NDK, SDK Tools > Android SDK command line tools, and SDK Tools > CMake
Then install the Flutter plugin and restart the IDE. In Android Studio's options for the Flutter language, enable auto format on save to match the project's code style. If you have problems with the Dart SDK, make sure to run `flutter` in a terminal to download it (use `source ~/.bashrc` to update your environment variables if you're still using the same terminal from which you ran `setup.sh`)
Make a Pixel 4 (API 30) x86_64 emulator with 2GB of storage space for emulation
You can look at the [build instructions](docs/building.md) for more details.

View file

@ -0,0 +1 @@
{"v":"5.10.2","fr":30,"ip":0,"op":60,"w":30,"h":30,"nm":"arrow-rotate","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"arrow-rotate","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":44,"s":[200]},{"t":60,"s":[360]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-0.828],[0,0],[3.389,0],[1.441,-4.074],[-0.781,-0.277],[-0.276,0.778],[-3.22,0],[-1.369,-1.823],[0,0],[0,-0.83],[-0.83,0],[0,0],[-0.023,0],[0,0],[0,0.83],[0,0],[0.83,0]],"o":[[0,0],[-1.964,-2.437],[-4.533,0],[-0.276,0.741],[0.781,0.277],[1.031,-2.916],[2.494,0],[0,0],[-0.83,0],[0,0.83],[0,0],[0.023,0],[0,0],[0.83,0],[0,0],[0,-0.828],[-0.83,0]],"v":[[8.25,-8.25],[8.25,-6.497],[-0.042,-10.5],[-9.902,-3.502],[-8.988,-1.584],[-7.073,-2.498],[-0.042,-7.5],[6,-4.5],[4.5,-4.5],[3,-3],[4.5,-1.5],[8.452,-1.5],[8.522,-1.5],[9.75,-1.5],[11.25,-3],[11.25,-8.25],[9.75,-9.75]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[-0.828,0],[0,0.83],[0,0],[-3.347,0],[-1.439,4.073],[0.783,0.277],[0.277,-0.778],[3.262,0],[1.411,1.823],[0,0],[0,0.83],[0.83,0],[0,0],[0,-0.83]],"o":[[0,0.83],[0.828,0],[0,0],[1.922,2.438],[4.575,0],[0.277,-0.783],[-0.778,-0.277],[-1.031,2.916],[-2.452,0],[0,0],[0.83,0],[0,-0.83],[0,0],[-0.828,0],[0,0]],"v":[[-11.25,8.25],[-9.75,9.75],[-8.25,8.25],[-8.25,6.497],[0,10.5],[9.9,3.502],[8.986,1.584],[7.073,2.498],[0,7.5],[-6.042,4.5],[-4.5,4.5],[-3,3],[-4.5,1.5],[-9.75,1.5],[-11.25,3]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Vector","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"ct":1,"bm":0}],"markers":[]}

View file

@ -0,0 +1 @@
{"v":"5.10.2","fr":30,"ip":0,"op":100,"w":24,"h":24,"nm":"icon-send","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"MASK","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0.125,0.125,0],"ix":1,"l":2},"s":{"a":0,"k":[87.368,87.368,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[23.75,23.75],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0.125,0.125],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Arrow","tt":1,"tp":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[-1.009,25.009,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":33,"s":[11.695,12.306,0],"to":[0,0,0],"ti":[0,0,0]},{"t":53,"s":[24.398,-0.397,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-0.69],[-0.69,0],[0,0],[0,0],[-0.488,-0.488],[-0.488,0.488],[0,0],[0,0],[-0.69,0],[0,0.69],[0,0],[0.234,0.234],[0.332,0]],"o":[[-0.69,0],[0,0.69],[0,0],[0,0],[-0.488,0.488],[0.488,0.488],[0,0],[0,0],[0,0.69],[0.69,0],[0,0],[0,-0.332],[-0.234,-0.234],[0,0]],"v":[[-2,-5.25],[-3.25,-4],[-2,-2.75],[0.982,-2.75],[-4.884,3.116],[-4.884,4.884],[-3.116,4.884],[2.75,-0.982],[2.75,2],[4,3.25],[5.25,2],[5.25,-4],[4.884,-4.884],[4,-5.25]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Vector (Stroke)","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Outline","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[12,0.063,0],"ix":1,"l":2},"s":{"a":0,"k":[90.104,90.104,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254901961,0.137254901961,0.137254901961,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.5,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[12,0.063],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":58,"s":[0]},{"t":97,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":58,"s":[100]},{"t":97,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0}],"markers":[{"tm":0,"cm":"{\r\n\"name\":\"SEGMENT 1\"\r\n}","dr":0},{"tm":53,"cm":"{\r\n\"name\":\"SEGMENT 2\"\r\n}","dr":0},{"tm":97,"cm":"{\r\n\"name\":\"SEGMENT 3\"\r\n}","dr":0}]}

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M23.2499 2.25V9C23.2499 9.82922 22.5782 10.5 21.7499 10.5H15.7499C14.9217 10.5 14.2499 9.82922 14.2499 9C14.2499 8.17078 14.9217 7.5 15.7499 7.5H17.8302C16.514 5.64844 14.3671 4.5 11.9999 4.5C8.87806 4.5 6.13588 6.49219 5.17963 9.45938C4.9265 10.2469 4.08181 10.6828 3.2901 10.425C2.50213 10.1716 2.069 9.32484 2.324 8.53687C3.68385 4.32844 7.57025 1.5 11.9999 1.5C15.3449 1.5 18.3796 3.11812 20.2499 5.72297V2.25C20.2499 1.42078 20.9216 0.75 21.7499 0.75C22.5782 0.75 23.2499 1.42078 23.2499 2.25Z" fill="white"/>
<path d="M21.675 15.4594C20.3156 19.6734 16.425 22.5 11.9578 22.5C8.65313 22.5 5.62031 20.8828 3.75 18.2766V21.75C3.75 22.5792 3.07828 23.25 2.25 23.25C1.42172 23.25 0.75 22.5792 0.75 21.75V15C0.75 14.1708 1.42172 13.5 2.25 13.5H8.25C9.07828 13.5 9.75 14.1708 9.75 15C9.75 15.8292 9.07828 16.5 8.25 16.5H6.16875C7.48594 18.3516 9.63281 19.5 12 19.5C15.1209 19.5 17.8641 17.5064 18.8203 14.5406C19.0745 13.7541 19.9163 13.3205 20.7094 13.5755C21.4969 13.7859 21.9328 14.6719 21.675 15.4594Z" fill="white"/>
<path d="M20.25 5.50313V3.75C20.25 2.92172 20.9203 2.25 21.75 2.25C22.5797 2.25 23.25 2.92172 23.25 3.75V9C23.25 9.82969 22.5797 10.5 21.75 10.5H20.5219C20.4984 10.5 20.475 10.5 20.4516 10.5H16.5C15.6703 10.5 15 9.82969 15 9C15 8.17031 15.6703 7.5 16.5 7.5H18C16.6313 5.67656 14.4516 4.5 11.9578 4.5C8.7375 4.5 5.95781 6.58594 4.92656 9.50156C4.65047 10.2797 3.79312 10.6922 3.01219 10.4156C2.23125 10.1391 1.82156 9.23906 2.09766 8.49844C3.53859 4.42406 7.425 1.5 11.9578 1.5C15.3469 1.5 18.2859 3.06656 20.25 5.50313ZM2.25 21.75C1.42172 21.75 0.75 21.0797 0.75 20.25V15C0.75 14.1703 1.42172 13.5 2.25 13.5H7.5C8.32969 13.5 9 14.1703 9 15C9 15.8297 8.32969 16.5 7.5 16.5H5.95781C7.36875 18.3234 9.54844 19.5 12 19.5C15.2625 19.5 18.0422 17.4141 19.0734 14.4984C19.35 13.7203 20.2078 13.3078 20.9859 13.5844C21.7688 13.8609 22.1766 14.7188 21.9 15.5016C20.4609 19.575 16.575 22.5 12 22.5C8.65312 22.5 5.67188 20.9344 3.75 18.4969V20.25C3.75 21.0797 3.07828 21.75 2.25 21.75Z" fill="#232323"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.66875V2.5C13.5 1.94781 13.9469 1.5 14.5 1.5C15.0531 1.5 15.5 1.94781 15.5 2.5V6C15.5 6.55313 15.0531 7 14.5 7H13.6812C13.6656 7 13.65 7 13.6344 7H11C10.4469 7 10 6.55313 10 6C10 5.44688 10.4469 5 11 5H12C11.0875 3.78438 9.63438 3 7.97188 3C5.825 3 3.97187 4.39062 3.28437 6.33437C3.10031 6.85312 2.52875 7.12812 2.00813 6.94375C1.4875 6.75937 1.21438 6.15938 1.39844 5.66563C2.35906 2.94938 4.95 1 7.97188 1C10.2313 1 12.1906 2.04438 13.5 3.66875ZM1.5 14.5C0.947812 14.5 0.5 14.0531 0.5 13.5V10C0.5 9.44688 0.947812 9 1.5 9H5C5.55313 9 6 9.44688 6 10C6 10.5531 5.55313 11 5 11H3.97187C4.9125 12.2156 6.36563 13 8 13C10.175 13 12.0281 11.6094 12.7156 9.66562C12.9 9.14687 13.4719 8.87187 13.9906 9.05625C14.5125 9.24062 14.7844 9.8125 14.6 10.3344C13.6406 13.05 11.05 15 8 15C5.76875 15 3.78125 13.9563 2.5 12.3313V13.5C2.5 14.0531 2.05219 14.5 1.5 14.5Z" fill="#232323"/>
</svg>

Before

Width:  |  Height:  |  Size: 992 B

143
docs/building.md Normal file
View file

@ -0,0 +1,143 @@
# Building
Here you will find instructions on how to install the necessary tools for building and running the app.
### Prerequisites
- The OS'es supported for building is Ubuntu (20.04) and Fedora (37 - Work In Progress)
- A machine with at least 100 GB of Storage
The following prerequisites can be installed with the setup script [`scripts/setup.sh`](./../scripts/setup.sh) or manually as described below:
- Flutter 3.7.11 [(install manually or with git, do not install with snap)](https://docs.flutter.dev/get-started/install)
- Dart SDK Requirement (>=2.19.0, up until <3.0.0) (normally included with a flutter install)
- Android setup ([Android Studio](https://developer.android.com/studio) and subsequent dependencies)
### Scripted setup
[`scripts/setup.sh`](./../scripts/setup.sh) is provided as a tool to set up installation for building: download the script and run it anywhere. This script should skip the entire [Manual setup](#manual-setup) section below and prepare you for [running](#running). It will set up the stack_wallet repository in `~/projects/stack_wallet` and build it there.
### Manual setup
> If you have installed with script, skip to [running](#running)
Please go to your Linux distribution's title below for instructions on how to manually setup:
- [Ubuntu (20.04)](#ubuntu-2004)
- [Fedora (37) (Work In Progress)](#fedora-37-work-in-progress)
#### Ubuntu (20.04)
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
```
The following *may* be needed for Android studio:
```
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
```
Install [Rust](https://www.rust-lang.org/tools/install) with command:
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install 1.67.1
rustup default 1.67.1
```
Install the additional components for Rust:
```
cargo install cargo-ndk --version 2.12.7
```
Android specific dependencies:
```
sudo apt-get install libc6-dev-i386
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
Linux desktop specific dependencies:
```
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev meson python3-pip libgirepository1.0-dev valac xsltproc docbook-xsl
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
```
After installing the prerequisites listed above, download the code and init the submodules
```
git clone https://github.com/cypherstack/stack_wallet.git
cd stack_wallet
git submodule update --init --recursive
```
Run prebuild script
```
cd scripts
./prebuild.sh
// when finished go back to the root directory
cd ..
```
Remove pre-installed system libraries for the following packages built by cryptography plugins in the crypto_plugins folder: `boost iconv libjson-dev libsecret openssl sodium unbound zmq`. You can use
```
sudo apt list --installed | grep boost
```
for example to find which pre-installed packages you may need to remove with `sudo apt remove`. Be careful, as some packages (especially boost) are linked to GNOME (GUI) packages: when in doubt, remove `-dev` packages first like with
```
sudo apt-get remove '^libboost.*-dev.*'
```
<!-- TODO: configure compiler to prefer built over system libraries. Should already use them? -->
Building plugins for Android
> Warning: This will take a long time, please be patient
```
cd scripts/android/
./build_all.sh
// when finished go back to the root directory
cd ../..
```
Building plugins for Linux
```
cd scripts/linux/
./build_all.sh
// when finished go back to the root directory
cd ../..
```
#### Fedora (37) (Work In Progress)
This is a work in progress, please use Ubuntu for now.
## Running
### Android
Plug in your android device or use the emulator available via Android Studio and then run the following commands:
```
flutter pub get
flutter run android
```
Note on Emulators: Only x86_64 emulators are supported, x86 emulators will not work
### Linux
Plug in your android device or use the emulator available via Android Studio and then run the following commands:
```
flutter pub get Linux
flutter run linux
```
## Android Studio
Android Studio is the recommended IDE for development, not just for launching on Android devices and emulators but also for Linux desktop development.
Follow instructions here [https://developer.android.com/studio/install#linux](https://developer.android.com/studio/install#linux) or install via snap:
```
# setup android studio
sudo apt install -y openjdk-11-jdk
sudo snap install android-studio --classic
```
Use Tools > SDK Manager to install the SDK Tools > Android SDK (API 30), SDK Tools > NDK, SDK Tools > Android SDK command line tools, and SDK Tools > CMake
Then install the Flutter plugin and restart the IDE. In Android Studio's options for the Flutter language, enable auto format on save to match the project's code style. If you have problems with the Dart SDK, make sure to run `flutter` in a terminal to download it (use `source ~/.bashrc` to update your environment variables if you're still using the same terminal from which you ran `setup.sh`)
Make a Pixel 4 (API 30) x86_64 emulator with 2GB of storage space for emulation

5
docs/roadmap.md Normal file
View file

@ -0,0 +1,5 @@
# Roadmap
This document describes the roadmap for the project. It is a living document that will be updated as the project evolves.
- [ ] Fill in the roadmap

View file

@ -300,11 +300,11 @@ 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
// unawaited(_nodeService.updateCommunityNodes());
await ExchangeDataLoadingService.instance.initDB();
// run without awaiting
if (ref.read(prefsChangeNotifierProvider).externalCalls &&
await ref.read(prefsChangeNotifierProvider).isExternalCallsSet()) {
if (Constants.enableExchange) {
await ExchangeDataLoadingService.instance.init();
await ExchangeDataLoadingService.instance.setCurrenciesIfEmpty(
ref.read(exchangeFormStateProvider),
);

View file

@ -4,6 +4,7 @@ import 'package:stackwallet/models/paynym/paynym_code.dart';
class PaynymAccount {
final String nymID;
final String nymName;
final bool segwit;
final List<PaynymCode> codes;
@ -13,9 +14,13 @@ class PaynymAccount {
/// list of nymId
final List<PaynymAccountLite> following;
PaynymCode get nonSegwitPaymentCode =>
codes.firstWhere((element) => !element.segwit);
PaynymAccount(
this.nymID,
this.nymName,
this.segwit,
this.codes,
this.followers,
this.following,
@ -24,6 +29,7 @@ class PaynymAccount {
PaynymAccount.fromMap(Map<String, dynamic> map)
: nymID = map["nymID"] as String,
nymName = map["nymName"] as String,
segwit = map["segwit"] as bool,
codes = (map["codes"] as List<dynamic>)
.map((e) => PaynymCode.fromMap(Map<String, dynamic>.from(e as Map)))
.toList(),
@ -39,6 +45,7 @@ class PaynymAccount {
PaynymAccount copyWith({
String? nymID,
String? nymName,
bool? segwit,
List<PaynymCode>? codes,
List<PaynymAccountLite>? followers,
List<PaynymAccountLite>? following,
@ -46,6 +53,7 @@ class PaynymAccount {
return PaynymAccount(
nymID ?? this.nymID,
nymName ?? this.nymName,
segwit ?? this.segwit,
codes ?? this.codes,
followers ?? this.followers,
following ?? this.following,
@ -55,6 +63,7 @@ class PaynymAccount {
Map<String, dynamic> toMap() => {
"nymID": nymID,
"nymName": nymName,
"segwit": segwit,
"codes": codes.map((e) => e.toMap()),
"followers": followers.map((e) => e.toMap()),
"following": followers.map((e) => e.toMap()),

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
@ -21,37 +20,15 @@ class RestoringDialog extends StatefulWidget {
State<RestoringDialog> createState() => _RestoringDialogState();
}
class _RestoringDialogState extends State<RestoringDialog>
with TickerProviderStateMixin {
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
class _RestoringDialogState extends State<RestoringDialog> {
late final Future<void> Function() onCancel;
@override
void initState() {
onCancel = widget.onCancel;
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat();
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
super.initState();
}
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
if (Util.isDesktop) {
@ -69,14 +46,9 @@ class _RestoringDialogState extends State<RestoringDialog>
const Spacer(
flex: 1,
),
RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(Assets.svg.arrowRotate3,
width: 40,
height: 40,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
const RotatingArrows(
width: 40,
height: 40,
),
const Spacer(
flex: 2,
@ -127,14 +99,9 @@ class _RestoringDialogState extends State<RestoringDialog>
child: StackDialog(
title: "Restoring wallet",
message: "This may take a while. Please do not exit this screen.",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(Assets.svg.arrowRotate3,
width: 24,
height: 24,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
icon: const RotatingArrows(
width: 24,
height: 24,
),
rightButton: TextButton(
style: Theme.of(context)

View file

@ -66,6 +66,9 @@ class _ConfirmChangeNowSendViewState
Future<void> _attemptSend(BuildContext context) async {
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
final sendProgressController = ProgressAndSuccessController();
unawaited(
showDialog<void>(
context: context,
@ -74,6 +77,7 @@ class _ConfirmChangeNowSendViewState
builder: (context) {
return SendingTransactionDialog(
coin: manager.coin,
controller: sendProgressController,
);
},
),
@ -105,6 +109,9 @@ class _ConfirmChangeNowSendViewState
time,
]);
sendProgressController.triggerSuccess?.call();
await Future<void>.delayed(const Duration(seconds: 5));
txid = results.first as String;
// save note

View file

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
import 'package:stackwallet/pages/exchange_view/exchange_form.dart';
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
@ -17,8 +18,6 @@ import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/trade_card.dart';
import 'package:tuple/tuple.dart';
import '../../db/isar/main_db.dart';
class ExchangeView extends ConsumerStatefulWidget {
const ExchangeView({Key? key}) : super(key: key);
@ -46,9 +45,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
});
};
}
ExchangeDataLoadingService.instance
.init()
.then((_) => ExchangeDataLoadingService.instance.loadAll());
ExchangeDataLoadingService.instance.loadAll();
} else if (ExchangeDataLoadingService.instance.isLoading &&
ExchangeDataLoadingService.currentCacheVersion <
ExchangeDataLoadingService.cacheVersion) {

View file

@ -62,9 +62,7 @@ class _WalletInitiatedExchangeViewState
});
};
}
ExchangeDataLoadingService.instance
.init()
.then((_) => ExchangeDataLoadingService.instance.loadAll());
ExchangeDataLoadingService.instance.loadAll();
} else if (ExchangeDataLoadingService.instance.isLoading &&
ExchangeDataLoadingService.currentCacheVersion <
ExchangeDataLoadingService.cacheVersion) {

View file

@ -447,7 +447,7 @@ class _AddNewPaynymFollowViewState
child: PaynymCard(
key: UniqueKey(),
label: _searchResult!.nymName,
paymentCodeString: _searchResult!.codes.first.code,
paymentCodeString: _searchResult!.nonSegwitPaymentCode.code,
walletId: widget.walletId,
),
),

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
@ -18,34 +17,7 @@ class ClaimingPaynymDialog extends StatefulWidget {
State<ClaimingPaynymDialog> createState() => _RestoringDialogState();
}
class _RestoringDialogState extends State<ClaimingPaynymDialog>
with TickerProviderStateMixin {
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
@override
void initState() {
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat();
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
super.initState();
}
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
super.dispose();
}
class _RestoringDialogState extends State<ClaimingPaynymDialog> {
@override
Widget build(BuildContext context) {
if (Util.isDesktop) {
@ -62,15 +34,9 @@ class _RestoringDialogState extends State<ClaimingPaynymDialog>
),
],
),
RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
width: 40,
height: 40,
),
const RotatingArrows(
width: 40,
height: 40,
),
Padding(
padding: const EdgeInsets.all(40),
@ -115,15 +81,9 @@ class _RestoringDialogState extends State<ClaimingPaynymDialog>
child: StackDialog(
title: "Claiming PayNym",
message: "We are generating your PayNym",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
width: 24,
height: 24,
),
icon: const RotatingArrows(
width: 24,
height: 24,
),
rightButton: SecondaryButton(
label: "Cancel",

View file

@ -55,7 +55,7 @@ class PaynymQrPopup extends StatelessWidget {
child: Row(
children: [
PayNymBot(
paymentCodeString: paynymAccount.codes.first.code,
paymentCodeString: paynymAccount.nonSegwitPaymentCode.code,
size: isDesktop ? 56 : 36,
),
const SizedBox(
@ -108,7 +108,7 @@ class PaynymQrPopup extends StatelessWidget {
height: 6,
),
Text(
paynymAccount.codes.first.code,
paynymAccount.nonSegwitPaymentCode.code,
style: isDesktop
? STextStyles.desktopTextSmall(context)
: STextStyles.infoSmall(context).copyWith(
@ -127,7 +127,7 @@ class PaynymQrPopup extends StatelessWidget {
onTap: () async {
await Clipboard.setData(
ClipboardData(
text: paynymAccount.codes.first.code,
text: paynymAccount.nonSegwitPaymentCode.code,
),
);
unawaited(
@ -150,7 +150,7 @@ class PaynymQrPopup extends StatelessWidget {
QrImage(
padding: const EdgeInsets.all(0),
size: 130,
data: paynymAccount.codes.first.code,
data: paynymAccount.nonSegwitPaymentCode.code,
foregroundColor:
Theme.of(context).extension<StackColors>()!.textDark,
),

View file

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/models/paynym/paynym_account.dart';
import 'package:stackwallet/pages/paynym/dialogs/claiming_paynym_dialog.dart';
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
@ -11,7 +12,6 @@ import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
@ -36,6 +36,29 @@ class PaynymClaimView extends ConsumerStatefulWidget {
}
class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
Future<bool> _addSegwitCode(PaynymAccount myAccount) async {
final manager =
ref.read(walletsChangeNotifierProvider).getManager(widget.walletId);
// get wallet to access paynym calls
final wallet = manager.wallet as PaynymWalletInterface;
final token = await ref
.read(paynymAPIProvider)
.token(myAccount.nonSegwitPaymentCode.code);
final signature = await wallet.signStringWithNotificationKey(token.value!);
final pCodeSegwit = await wallet.getPaymentCode(isSegwit: true);
final addResult = await ref.read(paynymAPIProvider).add(
token.value!,
signature,
myAccount.nymID,
pCodeSegwit.toString(),
);
return addResult.value ?? false;
}
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
@ -169,8 +192,7 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
if (shouldCancel) return;
// get payment code
final pCode = await wallet.getPaymentCode(
DerivePathTypeExt.primaryFor(manager.coin));
final pCode = await wallet.getPaymentCode(isSegwit: false);
if (shouldCancel) return;
@ -185,6 +207,18 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
if (created.value!.claimed) {
// payment code already claimed
debugPrint("pcode already claimed!!");
final account =
await ref.read(paynymAPIProvider).nym(pCode.toString());
if (!account.value!.segwit) {
for (int i = 0; i < 100; i++) {
final result = await _addSegwitCode(account.value!);
if (result == true) {
break;
}
}
}
if (mounted) {
if (isDesktop) {
Navigator.of(context, rootNavigator: true).pop();
@ -223,6 +257,14 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
if (claim.value?.claimed == pCode.toString()) {
final account =
await ref.read(paynymAPIProvider).nym(pCode.toString());
if (!account.value!.segwit) {
for (int i = 0; i < 100; i++) {
final result = await _addSegwitCode(account.value!);
if (result == true) {
break;
}
}
}
ref.read(myPaynymAccountStateProvider.state).state =
account.value!;

View file

@ -275,8 +275,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
paymentCodeString: ref
.watch(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
),
),
@ -298,8 +297,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
ref
.watch(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
12,
5),
@ -330,8 +328,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
text: ref
.read(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
),
);
@ -376,8 +373,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
ref
.read(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
sharePositionOrigin: sharePositionOrigin);
},
@ -447,8 +443,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
paymentCodeString: ref
.watch(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
),
),
@ -473,8 +468,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
ref
.watch(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
12,
5),
@ -501,8 +495,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
text: ref
.read(myPaynymAccountStateProvider.state)
.state!
.codes
.first
.nonSegwitPaymentCode
.code,
),
);

View file

@ -8,7 +8,6 @@ import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -75,7 +74,7 @@ class _PaynymFollowersListState extends ConsumerState<PaynymFollowersList> {
// get payment code
final pCode = await wallet.getPaymentCode(
DerivePathTypeExt.primaryFor(manager.coin),
isSegwit: false,
);
// get account from api

View file

@ -8,7 +8,6 @@ import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -75,7 +74,7 @@ class _PaynymFollowingListState extends ConsumerState<PaynymFollowingList> {
// get payment code
final pCode = await wallet.getPaymentCode(
DerivePathTypeExt.primaryFor(manager.coin),
isSegwit: false,
);
// get account from api

View file

@ -232,6 +232,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
children: [
GestureDetector(
onTap: () {
HapticFeedback.lightImpact();
clipboard.setData(
ClipboardData(text: receivingAddress),
);

View file

@ -80,6 +80,9 @@ class _ConfirmTransactionViewState
Future<void> _attemptSend(BuildContext context) async {
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
final sendProgressController = ProgressAndSuccessController();
unawaited(
showDialog<dynamic>(
context: context,
@ -88,6 +91,7 @@ class _ConfirmTransactionViewState
builder: (context) {
return SendingTransactionDialog(
coin: manager.coin,
controller: sendProgressController,
);
},
),
@ -131,6 +135,9 @@ class _ConfirmTransactionViewState
time,
]);
sendProgressController.triggerSuccess?.call();
await Future<void>.delayed(const Duration(seconds: 5));
txid = results.first as String;
ref.refresh(desktopUseUTXOs);

View file

@ -453,11 +453,12 @@ class _SendViewState extends ConsumerState<SendView> {
final wallet = manager.wallet as PaynymWalletInterface;
final paymentCode = PaymentCode.fromPaymentCode(
widget.accountLite!.code,
wallet.networkType,
networkType: wallet.networkType,
);
final feeRate = ref.read(feeRateTypeStateProvider);
txDataFuture = wallet.preparePaymentCodeSend(
paymentCode: paymentCode,
isSegwit: widget.accountLite!.segwit,
amount: amount,
args: {
"feeRate": feeRate,

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/color_theme.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@ -23,38 +23,16 @@ class BuildingTransactionDialog extends StatefulWidget {
State<BuildingTransactionDialog> createState() => _RestoringDialogState();
}
class _RestoringDialogState extends State<BuildingTransactionDialog>
with TickerProviderStateMixin {
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
class _RestoringDialogState extends State<BuildingTransactionDialog> {
late final VoidCallback onCancel;
@override
void initState() {
onCancel = widget.onCancel;
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat();
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
super.initState();
}
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
final isChans = Theme.of(context).extension<StackColors>()!.themeType ==
@ -80,15 +58,9 @@ class _RestoringDialogState extends State<BuildingTransactionDialog>
),
),
if (!isChans)
RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
width: 24,
height: 24,
),
const RotatingArrows(
width: 40,
height: 40,
),
const SizedBox(
height: 40,
@ -151,16 +123,9 @@ class _RestoringDialogState extends State<BuildingTransactionDialog>
)
: StackDialog(
title: "Generating transaction",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
width: 24,
height: 24,
),
icon: const RotatingArrows(
width: 24,
height: 24,
),
rightButton: TextButton(
style: Theme.of(context)

View file

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:lottie/lottie.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
@ -13,38 +13,29 @@ class SendingTransactionDialog extends StatefulWidget {
const SendingTransactionDialog({
Key? key,
required this.coin,
required this.controller,
}) : super(key: key);
final Coin coin;
final ProgressAndSuccessController controller;
@override
State<SendingTransactionDialog> createState() => _RestoringDialogState();
}
class _RestoringDialogState extends State<SendingTransactionDialog>
with TickerProviderStateMixin {
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
class _RestoringDialogState extends State<SendingTransactionDialog> {
late ProgressAndSuccessController? _progressAndSuccessController;
@override
void initState() {
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat();
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
_progressAndSuccessController = widget.controller;
super.initState();
}
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
_progressAndSuccessController = null;
super.dispose();
}
@ -76,16 +67,8 @@ class _RestoringDialogState extends State<SendingTransactionDialog>
Assets.gif.kiss(widget.coin),
),
)
: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
width: 24,
height: 24,
),
: ProgressAndSuccess(
controller: _progressAndSuccessController!,
),
],
),
@ -120,19 +103,128 @@ class _RestoringDialogState extends State<SendingTransactionDialog>
)
: StackDialog(
title: "Sending transaction",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
width: 24,
height: 24,
),
icon: ProgressAndSuccess(
controller: _progressAndSuccessController!,
),
),
);
}
}
}
class ProgressAndSuccessController {
VoidCallback? triggerSuccess;
}
class ProgressAndSuccess extends StatefulWidget {
const ProgressAndSuccess({
Key? key,
this.height = 24,
this.width = 24,
required this.controller,
}) : super(key: key);
final double height;
final double width;
final ProgressAndSuccessController controller;
@override
State<ProgressAndSuccess> createState() => _ProgressAndSuccessState();
}
class _ProgressAndSuccessState extends State<ProgressAndSuccess>
with TickerProviderStateMixin {
late final AnimationController controller1;
late final AnimationController controller2;
CrossFadeState _crossFadeState = CrossFadeState.showFirst;
bool _triggered = false;
@override
void initState() {
controller1 = AnimationController(vsync: this);
controller2 = AnimationController(vsync: this);
controller1.addListener(() => setState(() {}));
controller2.addListener(() => setState(() {}));
controller1.addStatusListener((status) {
if (status == AnimationStatus.completed && _triggered) {
controller2.forward();
setState(() {
_crossFadeState = CrossFadeState.showSecond;
});
}
});
widget.controller.triggerSuccess = () {
controller1.forward();
_triggered = true;
};
super.initState();
}
@override
void dispose() {
controller1.dispose();
controller2.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AnimatedCrossFade(
crossFadeState: _crossFadeState,
firstChild: Lottie.asset(
Assets.lottie.iconSend,
controller: controller1,
width: widget.width,
delegates: LottieDelegates(
values: [
ValueDelegate.color(
const ["**"],
value:
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
ValueDelegate.strokeColor(
const ["**"],
value:
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
],
),
height: widget.height,
onLoaded: (composition) {
final start = composition.markers[0].start;
final end = composition.markers[1].start;
setState(() {
controller1.duration = composition.duration;
});
controller1.repeat(
min: start,
max: end,
period: composition.duration * (end - start),
);
},
),
secondChild: Lottie.asset(
Assets.lottie.loaderAndCheckmark,
controller: controller2,
width: widget.width,
height: widget.height,
onLoaded: (composition) {
setState(() {
controller2.duration = composition.duration *
(composition.markers.last.end - composition.markers[1].start);
controller2.value = composition.markers[1].start;
});
},
),
duration: const Duration(microseconds: 1),
);
}
}

View file

@ -8,8 +8,11 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'manage_themes.dart';
class AppearanceSettingsView extends ConsumerWidget {
const AppearanceSettingsView({Key? key}) : super(key: key);
@ -99,21 +102,9 @@ class AppearanceSettingsView extends ConsumerWidget {
height: 10,
),
RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: RawMaterialButton(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
padding: const EdgeInsets.all(0),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: null,
child: Padding(
padding: const EdgeInsets.all(12),
child: Row(
child: Column(
children: [
Row(
children: [
Column(
crossAxisAlignment:
@ -124,15 +115,29 @@ class AppearanceSettingsView extends ConsumerWidget {
style: STextStyles.titleBold12(context),
textAlign: TextAlign.left,
),
const SizedBox(
height: 12,
),
const Padding(
padding: EdgeInsets.all(10),
padding: EdgeInsets.all(4),
child: ThemeOptionsWidget(),
),
],
),
],
),
),
const SizedBox(
height: 12,
),
SecondaryButton(
label: "Add more themes",
onPressed: () {
Navigator.of(context).pushNamed(
ManageThemesView.routeName,
);
},
)
],
),
),
],

View file

@ -0,0 +1,142 @@
import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
class ManageThemesView extends StatefulWidget {
const ManageThemesView({Key? key}) : super(key: key);
static const String routeName = "/manageThemes";
@override
State<ManageThemesView> createState() => _ManageThemesViewState();
}
class _ManageThemesViewState extends State<ManageThemesView> {
@override
Widget build(BuildContext context) {
return ConditionalParent(
condition: !Util.isDesktop,
builder: (child) => Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
Navigator.of(context).pop();
},
),
title: Text(
"Add more themes",
style: STextStyles.navBarTitle(context),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
child: child,
),
),
),
child: Column(
children: [
const SizedBox(
height: 16,
),
GridView.builder(
shrinkWrap: true,
primary: false,
itemCount: 100,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
childAspectRatio: 2 / 2.7,
),
itemBuilder: (_, index) {
return StackThemeCard(
name: index.toString(),
size: "lol GB",
);
},
),
const SizedBox(
height: 28,
),
SecondaryButton(
label: "Install theme file",
onPressed: () {},
),
const SizedBox(
height: 16,
),
],
),
);
}
}
class StackThemeCard extends StatefulWidget {
const StackThemeCard({
Key? key,
required this.name,
required this.size,
}) : super(key: key);
final String name;
final String size;
@override
State<StackThemeCard> createState() => _StackThemeCardState();
}
class _StackThemeCardState extends State<StackThemeCard> {
String buttonLabel = "Download";
@override
Widget build(BuildContext context) {
return RoundedWhiteContainer(
child: Column(
children: [
const Padding(
padding: EdgeInsets.symmetric(
horizontal: 18,
),
child: AspectRatio(
aspectRatio: 1,
child: RoundedContainer(
color: Colors.grey,
radiusMultiplier: 100,
),
),
),
const SizedBox(
height: 12,
),
Text(
widget.name,
),
const SizedBox(
height: 6,
),
Text(
widget.size,
),
const Spacer(),
PrimaryButton(
label: buttonLabel,
buttonHeight: ButtonHeight.l,
onPressed: () {},
),
],
),
);
}
}

View file

@ -162,7 +162,7 @@ class GlobalSettingsView extends StatelessWidget {
height: 8,
),
SettingsListButton(
iconAssetName: Assets.svg.arrowRotate3,
iconAssetName: Assets.svg.arrowRotate,
iconSize: 18,
title: "Syncing preferences",
onPressed: () {

View file

@ -214,7 +214,7 @@ class _StackRestoreProgressViewState
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) async {
_restore();
unawaited(_restore());
});
super.initState();
}
@ -325,7 +325,7 @@ class _StackRestoreProgressViewState
: null,
)
: RoundedContainer(
padding: EdgeInsets.all(0),
padding: EdgeInsets.zero,
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
@ -411,7 +411,7 @@ class _StackRestoreProgressViewState
: null,
)
: RoundedContainer(
padding: EdgeInsets.all(0),
padding: EdgeInsets.zero,
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
@ -497,7 +497,7 @@ class _StackRestoreProgressViewState
: null,
)
: RoundedContainer(
padding: EdgeInsets.all(0),
padding: EdgeInsets.zero,
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
@ -548,44 +548,42 @@ class _StackRestoreProgressViewState
final state = ref.watch(stackRestoringUIStateProvider
.select((value) => value.trades));
return !isDesktop
? Container(
child: RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
color: Theme.of(context)
.extension<StackColors>()!
.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.arrowRotate2,
width: 16,
height: 16,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
? RestoringItemCard(
left: SizedBox(
width: 32,
height: 32,
child: RoundedContainer(
padding: const EdgeInsets.all(0),
color: Theme.of(context)
.extension<StackColors>()!
.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.arrowsTwoWay,
width: 16,
height: 16,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
),
),
right: SizedBox(
width: 20,
height: 20,
child: _getIconForState(state),
),
title: "Exchange history",
subTitle: state == StackRestoringStatus.failed
? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
: null,
),
right: SizedBox(
width: 20,
height: 20,
child: _getIconForState(state),
),
title: "Exchange history",
subTitle: state == StackRestoringStatus.failed
? Text(
"Something went wrong",
style: STextStyles.errorSmall(context),
)
: null,
)
: RoundedContainer(
padding: EdgeInsets.all(0),
padding: EdgeInsets.zero,
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
@ -603,7 +601,7 @@ class _StackRestoreProgressViewState
.buttonBackSecondary,
child: Center(
child: SvgPicture.asset(
Assets.svg.arrowRotate2,
Assets.svg.arrowsTwoWay,
width: 16,
height: 16,
color: Theme.of(context)

View file

@ -154,17 +154,17 @@ class _XPubViewState extends ConsumerState<XPubView> {
rootNavigator: true,
).pop,
),
AnimatedSize(
duration: const Duration(
milliseconds: 150,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(32, 0, 32, 32),
child: child,
),
),
],
),
AnimatedSize(
duration: const Duration(
milliseconds: 150,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(32, 0, 32, 32),
child: child,
),
),
],
),
),

View file

@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@ -66,18 +64,12 @@ class _RescanningDialogState extends State<RescanningDialog>
maxWidth: 500,
child: child,
),
child: StackDialog(
child: const StackDialog(
title: "Rescanning blockchain",
message: "This may take a while. Please do not exit this screen.",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate3,
width: 24,
height: 24,
color:
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
icon: RotatingArrows(
width: 24,
height: 24,
),
// rightButton: TextButton(
// style: Theme.of(context).textButtonTheme.style?.copyWith(

View file

@ -269,7 +269,7 @@ class _WalletSettingsViewState extends State<WalletSettingsView> {
height: 8,
),
SettingsListButton(
iconAssetName: Assets.svg.arrowRotate3,
iconAssetName: Assets.svg.arrowRotate,
title: "Syncing preferences",
onPressed: () {
Navigator.of(context).pushNamed(

View file

@ -236,10 +236,7 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
if (isEasy) {
unawaited(
ExchangeDataLoadingService.instance
.init()
.then((_) => ExchangeDataLoadingService
.instance
.loadAll()),
.loadAll(),
);
// unawaited(
// BuyDataLoadingService().loadAll(ref));

View file

@ -1,10 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/isar/sw_theme.dart';
import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class TxIcon extends ConsumerWidget {
const TxIcon({
@ -20,8 +21,21 @@ class TxIcon extends ConsumerWidget {
static const Size size = Size(32, 32);
// String _getBundleAssetName(
// bool isCancelled, bool isReceived, bool isPending, BuildContext context) {
// if (!isReceived && transaction.subType == TransactionSubType.mint) {
// if (isCancelled) {
// return Assets.svg.anonymizeFailed;
// }
// if (isPending) {
// return Assets.svg.anonymizePending;
// }
// return Assets.svg.anonymize;
// }
// }
String _getAssetName(
bool isCancelled, bool isReceived, bool isPending, WidgetRef ref) {
bool isCancelled, bool isReceived, bool isPending, ThemeAssets assets) {
if (!isReceived && transaction.subType == TransactionSubType.mint) {
if (isCancelled) {
return Assets.svg.anonymizeFailed;
@ -34,20 +48,20 @@ class TxIcon extends ConsumerWidget {
if (isReceived) {
if (isCancelled) {
return ref.watch(themeProvider).assets.receiveCancelled;
return assets.receive;
}
if (isPending) {
return ref.watch(themeProvider).assets.receivePending;
return assets.receivePending;
}
return ref.watch(themeProvider).assets.receive;
return assets.receive;
} else {
if (isCancelled) {
return ref.watch(themeProvider).assets.sendCancelled;
return assets.sendCancelled;
}
if (isPending) {
return ref.watch(themeProvider).assets.sendPending;
return assets.sendPending;
}
return ref.watch(themeProvider).assets.send;
return assets.send;
}
}
@ -67,7 +81,7 @@ class TxIcon extends ConsumerWidget {
currentHeight,
coin.requiredConfirmations,
),
ref,
ref.watch(themeProvider).assets as ThemeAssets,
),
width: size.width,
height: size.height,

View file

@ -3,15 +3,14 @@ import 'dart:async';
import 'package:event_bus/event_bus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/token_view/token_view.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
/// [eventBus] should only be set during testing
class WalletRefreshButton extends ConsumerStatefulWidget {
@ -36,30 +35,16 @@ class WalletRefreshButton extends ConsumerStatefulWidget {
ConsumerState<WalletRefreshButton> createState() => _RefreshButtonState();
}
class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
with TickerProviderStateMixin {
class _RefreshButtonState extends ConsumerState<WalletRefreshButton> {
late final EventBus eventBus;
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
late RotatingArrowsController _spinController;
late StreamSubscription<dynamic> _syncStatusSubscription;
@override
void initState() {
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
);
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
if (widget.initialSyncStatus == WalletSyncStatus.syncing) {
_spinController?.repeat();
}
_spinController = RotatingArrowsController();
eventBus =
widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance;
@ -71,26 +56,26 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
widget.tokenContractAddress == null) {
switch (event.newStatus) {
case WalletSyncStatus.unableToSync:
_spinController?.stop();
_spinController.stop?.call();
break;
case WalletSyncStatus.synced:
_spinController?.stop();
_spinController.stop?.call();
break;
case WalletSyncStatus.syncing:
unawaited(_spinController?.repeat());
_spinController.repeat?.call();
break;
}
} else if (widget.tokenContractAddress != null &&
event.walletId == widget.walletId + widget.tokenContractAddress!) {
switch (event.newStatus) {
case WalletSyncStatus.unableToSync:
_spinController?.stop();
_spinController.stop?.call();
break;
case WalletSyncStatus.synced:
_spinController?.stop();
_spinController.stop?.call();
break;
case WalletSyncStatus.syncing:
unawaited(_spinController?.repeat());
_spinController.repeat?.call();
break;
}
}
@ -102,9 +87,6 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
_syncStatusSubscription.cancel();
super.dispose();
@ -129,11 +111,11 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
.getManagerProvider(widget.walletId);
final isRefreshing = ref.read(managerProvider).isRefreshing;
if (!isRefreshing) {
_spinController?.repeat();
_spinController.repeat?.call();
ref
.read(managerProvider)
.refresh()
.then((_) => _spinController?.stop());
.then((_) => _spinController.stop?.call());
}
} else {
if (!ref.read(tokenServiceProvider)!.isRefreshing) {
@ -151,22 +133,20 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton>
Constants.size.circularBorderRadius,
),
),
child: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate,
width: isDesktop ? 12 : 24,
height: isDesktop ? 12 : 24,
color: widget.overrideIconColor != null
? widget.overrideIconColor!
: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
child: RotatingArrows(
spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing,
width: isDesktop ? 12 : 24,
height: isDesktop ? 12 : 24,
controller: _spinController,
color: widget.overrideIconColor != null
? widget.overrideIconColor!
: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
),
);

View file

@ -852,6 +852,8 @@ class _DesktopTransactionCardRowState
prefix = "-";
} else if (_transaction.type == TransactionType.incoming) {
prefix = "+";
} else {
prefix = "";
}
} else {
prefix = "";

View file

@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/animated_widgets/rotating_arrows.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class CancellingTransactionProgressDialog extends StatefulWidget {
@ -13,51 +11,19 @@ class CancellingTransactionProgressDialog extends StatefulWidget {
}
class _CancellingTransactionProgressDialogState
extends State<CancellingTransactionProgressDialog>
with TickerProviderStateMixin {
late AnimationController? _spinController;
late Animation<double> _spinAnimation;
@override
void initState() {
_spinController = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat();
_spinAnimation = CurvedAnimation(
parent: _spinController!,
curve: Curves.linear,
);
super.initState();
}
@override
void dispose() {
_spinController?.dispose();
_spinController = null;
super.dispose();
}
extends State<CancellingTransactionProgressDialog> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
return false;
},
child: StackDialog(
child: const StackDialog(
title: "Cancelling transaction",
message: "This may take a while. Please do not exit this screen.",
icon: RotationTransition(
turns: _spinAnimation,
child: SvgPicture.asset(
Assets.svg.arrowRotate3,
width: 24,
height: 24,
color: Theme.of(context).extension<StackColors>()!.accentColorDark,
),
icon: RotatingArrows(
width: 24,
height: 24,
),
// rightButton: TextButton(
// style: Theme.of(context).textButtonTheme.style?.copyWith(

View file

@ -44,7 +44,6 @@ import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/show_loading.dart';
@ -285,12 +284,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
.tickerEqualToAnyExchangeNameName(coin.ticker)
.findFirst();
} catch (_) {
_future = ExchangeDataLoadingService.instance
.init()
.then(
(_) => ExchangeDataLoadingService.instance.loadAll(),
)
.then((_) => ExchangeDataLoadingService.instance.isar.currencies
_future = ExchangeDataLoadingService.instance.loadAll().then((_) =>
ExchangeDataLoadingService.instance.isar.currencies
.where()
.tickerEqualToAnyExchangeNameName(coin.ticker)
.findFirst());
@ -918,7 +913,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
manager.wallet as PaynymWalletInterface;
final code = await paynymInterface.getPaymentCode(
DerivePathTypeExt.primaryFor(manager.coin));
isSegwit: false,
);
final account = await ref
.read(paynymAPIProvider)
@ -934,7 +930,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
// check if account exists and for matching code to see if claimed
if (account.value != null &&
account.value!.codes.first.claimed) {
account.value!.nonSegwitPaymentCode.claimed &&
account.value!.segwit) {
ref.read(myPaynymAccountStateProvider.state).state =
account.value!;

View file

@ -46,9 +46,7 @@ class _DesktopExchangeViewState extends ConsumerState<DesktopExchangeView> {
});
};
}
ExchangeDataLoadingService.instance
.init()
.then((_) => ExchangeDataLoadingService.instance.loadAll());
ExchangeDataLoadingService.instance.loadAll();
} else if (ExchangeDataLoadingService.instance.isLoading &&
ExchangeDataLoadingService.currentCacheVersion <
ExchangeDataLoadingService.cacheVersion) {

View file

@ -7,6 +7,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart';
import 'package:stackwallet/pages/token_view/my_tokens_view.dart';
import 'package:stackwallet/pages/wallet_view/sub_widgets/transactions_list.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart';
@ -285,7 +286,12 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Tokens",
ref.watch(walletsChangeNotifierProvider.select(
(value) => value
.getManager(widget.walletId)
.hasTokenSupport))
? "Tokens"
: "Recent transactions",
style: STextStyles.desktopTextExtraSmall(context)
.copyWith(
color: Theme.of(context)
@ -294,21 +300,36 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
),
),
CustomTextButton(
text: "Edit",
onTap: () async {
final result = await showDialog<int?>(
context: context,
builder: (context) => EditWalletTokensView(
walletId: widget.walletId,
isDesktopPopup: true,
),
);
text: ref.watch(walletsChangeNotifierProvider.select(
(value) => value
.getManager(widget.walletId)
.hasTokenSupport))
? "Edit"
: "See all",
onTap: ref.watch(walletsChangeNotifierProvider.select(
(value) => value
.getManager(widget.walletId)
.hasTokenSupport))
? () async {
final result = await showDialog<int?>(
context: context,
builder: (context) => EditWalletTokensView(
walletId: widget.walletId,
isDesktopPopup: true,
),
);
if (result == 42) {
// wallet tokens were edited so update ui
setState(() {});
}
},
if (result == 42) {
// wallet tokens were edited so update ui
setState(() {});
}
}
: () {
Navigator.of(context).pushNamed(
AllTransactionsView.routeName,
arguments: widget.walletId,
);
},
),
],
),

View file

@ -262,11 +262,12 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
final wallet = manager.wallet as PaynymWalletInterface;
final paymentCode = PaymentCode.fromPaymentCode(
widget.accountLite!.code,
wallet.networkType,
networkType: wallet.networkType,
);
final feeRate = ref.read(feeRateTypeStateProvider);
txDataFuture = wallet.preparePaymentCodeSend(
paymentCode: paymentCode,
isSegwit: widget.accountLite!.segwit,
amount: amount,
args: {
"feeRate": feeRate,

View file

@ -21,7 +21,6 @@ import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -271,8 +270,7 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
final wallet = manager.wallet as PaynymWalletInterface;
final code =
await wallet.getPaymentCode(DerivePathTypeExt.primaryFor(manager.coin));
final code = await wallet.getPaymentCode(isSegwit: false);
final account = await ref.read(paynymAPIProvider).nym(code.toString());
@ -285,7 +283,9 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
Navigator.of(context, rootNavigator: true).pop();
// check if account exists and for matching code to see if claimed
if (account.value != null && account.value!.codes.first.claimed) {
if (account.value != null &&
account.value!.nonSegwitPaymentCode.claimed &&
account.value!.segwit) {
ref.read(myPaynymAccountStateProvider.state).state = account.value!;
await Navigator.of(context).pushNamed(

View file

@ -64,6 +64,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/about_view
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/debug_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/currency_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/delete_account_view.dart';
@ -1560,6 +1561,12 @@ class RouteGenerator {
builder: (_) => const AppearanceOptionSettings(),
settings: RouteSettings(name: settings.name));
case ManageThemesView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const ManageThemesView(),
settings: RouteSettings(name: settings.name));
case AdvancedSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,

View file

@ -162,9 +162,9 @@ class BitcoinWallet extends CoinServiceAPI
checkChangeAddressForTransactions: _checkChangeAddressForTransactions,
// checkChangeAddressForTransactions:
// _checkP2PKHChangeAddressForTransactions,
addDerivation: addDerivation,
dustLimitP2PKH: DUST_LIMIT_P2PKH.raw.toInt(),
minConfirms: MINIMUM_CONFIRMATIONS,
dustLimit: DUST_LIMIT.raw.toInt(),
);
}
@ -423,17 +423,18 @@ class BitcoinWallet extends CoinServiceAPI
level: LogLevel.Info);
}
Future<Map<String, dynamic>> _checkGaps(
int maxNumberOfIndexesToCheck,
int maxUnusedAddressGap,
int txCountBatchSize,
bip32.BIP32 root,
DerivePathType type,
int chain) async {
Future<Tuple3<List<isar_models.Address>, DerivePathType, int>> _checkGaps(
int maxNumberOfIndexesToCheck,
int maxUnusedAddressGap,
int txCountBatchSize,
bip32.BIP32 root,
DerivePathType type,
int chain,
) async {
List<isar_models.Address> addressArray = [];
int returningIndex = -1;
Map<String, Map<String, String>> derivations = {};
int gapCounter = 0;
int highestIndexWithHistory = 0;
for (int index = 0;
index < maxNumberOfIndexesToCheck && gapCounter < maxUnusedAddressGap;
index += txCountBatchSize) {
@ -444,7 +445,6 @@ class BitcoinWallet extends CoinServiceAPI
final _id = "k_$index";
Map<String, String> txCountCallArgs = {};
final Map<String, dynamic> receivingNodes = {};
for (int j = 0; j < txCountBatchSize; j++) {
final derivePath = constructDerivePath(
@ -492,12 +492,8 @@ class BitcoinWallet extends CoinServiceAPI
: isar_models.AddressSubType.change,
);
receivingNodes.addAll({
"${_id}_$j": {
"node": node,
"address": address,
}
});
addressArray.add(address);
txCountCallArgs.addAll({
"${_id}_$j": addressString,
});
@ -510,21 +506,13 @@ class BitcoinWallet extends CoinServiceAPI
for (int k = 0; k < txCountBatchSize; k++) {
int count = counts["${_id}_$k"]!;
if (count > 0) {
final node = receivingNodes["${_id}_$k"];
final address = node["address"] as isar_models.Address;
// add address to array
addressArray.add(address);
iterationsAddressArray.add(address.value);
// set current index
returningIndex = index + k;
iterationsAddressArray.add(txCountCallArgs["${_id}_$k"]!);
// update highest
highestIndexWithHistory = index + k;
// reset counter
gapCounter = 0;
// add info to derivations
derivations[address.value] = {
"pubKey": Format.uint8listToString(
(node["node"] as bip32.BIP32).publicKey),
"wif": (node["node"] as bip32.BIP32).toWIF(),
};
}
// increase counter when no tx history found
@ -535,11 +523,7 @@ class BitcoinWallet extends CoinServiceAPI
// cache all the transactions while waiting for the current function to finish.
unawaited(getTransactionCacheEarly(iterationsAddressArray));
}
return {
"addressArray": addressArray,
"index": returningIndex,
"derivations": derivations
};
return Tuple3(addressArray, type, highestIndexWithHistory);
}
Future<void> getTransactionCacheEarly(List<String> allAddresses) async {
@ -571,205 +555,135 @@ class BitcoinWallet extends CoinServiceAPI
}) async {
longMutex = true;
Map<String, Map<String, String>> p2pkhReceiveDerivations = {};
Map<String, Map<String, String>> p2shReceiveDerivations = {};
Map<String, Map<String, String>> p2wpkhReceiveDerivations = {};
Map<String, Map<String, String>> p2pkhChangeDerivations = {};
Map<String, Map<String, String>> p2shChangeDerivations = {};
Map<String, Map<String, String>> p2wpkhChangeDerivations = {};
final root = await Bip32Utils.getBip32Root(
mnemonic,
mnemonicPassphrase,
_network,
);
List<isar_models.Address> p2pkhReceiveAddressArray = [];
List<isar_models.Address> p2shReceiveAddressArray = [];
List<isar_models.Address> p2wpkhReceiveAddressArray = [];
int p2pkhReceiveIndex = -1;
int p2shReceiveIndex = -1;
int p2wpkhReceiveIndex = -1;
final deriveTypes = [
DerivePathType.bip44,
DerivePathType.bip49,
DerivePathType.bip84,
];
List<isar_models.Address> p2pkhChangeAddressArray = [];
List<isar_models.Address> p2shChangeAddressArray = [];
List<isar_models.Address> p2wpkhChangeAddressArray = [];
int p2pkhChangeIndex = -1;
int p2shChangeIndex = -1;
int p2wpkhChangeIndex = -1;
final List<Future<Tuple3<List<isar_models.Address>, DerivePathType, int>>>
receiveFutures = [];
final List<Future<Tuple3<List<isar_models.Address>, DerivePathType, int>>>
changeFutures = [];
const receiveChain = 0;
const changeChain = 1;
const indexZero = 0;
// actual size is 36 due to p2pkh, p2sh, and p2wpkh so 12x3
const txCountBatchSize = 12;
try {
// receiving addresses
Logging.instance
.log("checking receiving addresses...", level: LogLevel.Info);
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
Logging.instance.log(
"checking receiving addresses...",
level: LogLevel.Info,
);
final resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 0);
for (final type in deriveTypes) {
receiveFutures.add(
_checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
type,
receiveChain,
),
);
}
final resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 0);
Logging.instance
.log("checking change addresses...", level: LogLevel.Info);
// change addresses
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
Logging.instance.log(
"checking change addresses...",
level: LogLevel.Info,
);
for (final type in deriveTypes) {
changeFutures.add(
_checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
type,
changeChain,
),
);
}
final resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 1);
final resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 1);
await Future.wait([
resultReceive44,
resultReceive49,
resultReceive84,
resultChange44,
resultChange49,
resultChange84
// io limitations may require running these linearly instead
final futuresResult = await Future.wait([
Future.wait(receiveFutures),
Future.wait(changeFutures),
]);
p2pkhReceiveAddressArray =
(await resultReceive44)['addressArray'] as List<isar_models.Address>;
p2pkhReceiveIndex = (await resultReceive44)['index'] as int;
p2pkhReceiveDerivations = (await resultReceive44)['derivations']
as Map<String, Map<String, String>>;
final receiveResults = futuresResult[0];
final changeResults = futuresResult[1];
p2shReceiveAddressArray =
(await resultReceive49)['addressArray'] as List<isar_models.Address>;
p2shReceiveIndex = (await resultReceive49)['index'] as int;
p2shReceiveDerivations = (await resultReceive49)['derivations']
as Map<String, Map<String, String>>;
p2wpkhReceiveAddressArray =
(await resultReceive84)['addressArray'] as List<isar_models.Address>;
p2wpkhReceiveIndex = (await resultReceive84)['index'] as int;
p2wpkhReceiveDerivations = (await resultReceive84)['derivations']
as Map<String, Map<String, String>>;
p2pkhChangeAddressArray =
(await resultChange44)['addressArray'] as List<isar_models.Address>;
p2pkhChangeIndex = (await resultChange44)['index'] as int;
p2pkhChangeDerivations = (await resultChange44)['derivations']
as Map<String, Map<String, String>>;
p2shChangeAddressArray =
(await resultChange49)['addressArray'] as List<isar_models.Address>;
p2shChangeIndex = (await resultChange49)['index'] as int;
p2shChangeDerivations = (await resultChange49)['derivations']
as Map<String, Map<String, String>>;
p2wpkhChangeAddressArray =
(await resultChange84)['addressArray'] as List<isar_models.Address>;
p2wpkhChangeIndex = (await resultChange84)['index'] as int;
p2wpkhChangeDerivations = (await resultChange84)['derivations']
as Map<String, Map<String, String>>;
// save the derivations (if any)
if (p2pkhReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip44,
derivationsToAdd: p2pkhReceiveDerivations);
}
if (p2shReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shReceiveDerivations);
}
if (p2wpkhReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip84,
derivationsToAdd: p2wpkhReceiveDerivations);
}
if (p2pkhChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip44,
derivationsToAdd: p2pkhChangeDerivations);
}
if (p2shChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shChangeDerivations);
}
if (p2wpkhChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip84,
derivationsToAdd: p2wpkhChangeDerivations);
}
final List<isar_models.Address> addressesToStore = [];
int highestReceivingIndexWithHistory = 0;
// If restoring a wallet that never received any funds, then set receivingArray manually
// If we didn't do this, it'd store an empty array
if (p2pkhReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip44);
p2pkhReceiveAddressArray.add(address);
}
if (p2shReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip49);
p2shReceiveAddressArray.add(address);
}
if (p2wpkhReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip84);
p2wpkhReceiveAddressArray.add(address);
for (final tuple in receiveResults) {
if (tuple.item1.isEmpty) {
final address = await _generateAddressForChain(
receiveChain,
indexZero,
tuple.item2,
);
addressesToStore.add(address);
} else {
highestReceivingIndexWithHistory =
max(tuple.item3, highestReceivingIndexWithHistory);
addressesToStore.addAll(tuple.item1);
}
}
int highestChangeIndexWithHistory = 0;
// If restoring a wallet that never sent any funds with change, then set changeArray
// manually. If we didn't do this, it'd store an empty array.
if (p2pkhChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip44);
p2pkhChangeAddressArray.add(address);
}
if (p2shChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip49);
p2shChangeAddressArray.add(address);
}
if (p2wpkhChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip84);
p2wpkhChangeAddressArray.add(address);
for (final tuple in changeResults) {
if (tuple.item1.isEmpty) {
final address = await _generateAddressForChain(
changeChain,
indexZero,
tuple.item2,
);
addressesToStore.add(address);
} else {
highestChangeIndexWithHistory =
max(tuple.item3, highestChangeIndexWithHistory);
addressesToStore.addAll(tuple.item1);
}
}
// remove extra addresses to help minimize risk of creating a large gap
addressesToStore.removeWhere((e) =>
e.subType == isar_models.AddressSubType.change &&
e.derivationIndex > highestChangeIndexWithHistory);
addressesToStore.removeWhere((e) =>
e.subType == isar_models.AddressSubType.receiving &&
e.derivationIndex > highestReceivingIndexWithHistory);
if (isRescan) {
await db.updateOrPutAddresses([
...p2wpkhReceiveAddressArray,
...p2wpkhChangeAddressArray,
...p2pkhReceiveAddressArray,
...p2pkhChangeAddressArray,
...p2shReceiveAddressArray,
...p2shChangeAddressArray,
]);
await db.updateOrPutAddresses(addressesToStore);
} else {
await db.putAddresses([
...p2wpkhReceiveAddressArray,
...p2wpkhChangeAddressArray,
...p2pkhReceiveAddressArray,
...p2pkhChangeAddressArray,
...p2shReceiveAddressArray,
...p2shChangeAddressArray,
]);
await db.putAddresses(addressesToStore);
}
// get own payment code
final myCode = await getPaymentCode(DerivePathType.bip44);
// isSegwit does not matter here at all
final myCode = await getPaymentCode(isSegwit: false);
// refresh transactions to pick up any received notification transactions
await _refreshTransactions();
await _refreshNotificationAddressTransactions();
try {
final Set<String> codesToCheck = {};
@ -798,7 +712,10 @@ class BitcoinWallet extends CoinServiceAPI
);
}
await _updateUTXOs();
await Future.wait([
_refreshTransactions(),
_updateUTXOs(),
]);
await Future.wait([
updateCachedId(walletId),
@ -1022,7 +939,8 @@ class BitcoinWallet extends CoinServiceAPI
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.0, walletId));
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.1, walletId));
final myCode = await getPaymentCode(DerivePathType.bip44);
// isSegwit does not matter here at all
final myCode = await getPaymentCode(isSegwit: false);
final Set<String> codesToCheck = {};
final nym = await PaynymIsApi().nym(myCode.toString());
if (nym.value != null) {
@ -1328,6 +1246,11 @@ class BitcoinWallet extends CoinServiceAPI
}
await _prefs.init();
// this will add the notification address to the db if it isn't
// already there for older wallets
await getMyNotificationAddress();
// await _checkCurrentChangeAddressesForTransactions();
// await _checkCurrentReceivingAddressesForTransactions();
}
@ -1453,10 +1376,12 @@ class BitcoinWallet extends CoinServiceAPI
.getAddresses(walletId)
.filter()
.not()
.typeEqualTo(isar_models.AddressType.nonWallet)
.and()
.not()
.subTypeEqualTo(isar_models.AddressSubType.nonWallet)
.group(
(q) => q
.typeEqualTo(isar_models.AddressType.nonWallet)
.or()
.subTypeEqualTo(isar_models.AddressSubType.nonWallet),
)
.findAll();
return allAddresses;
}
@ -1551,6 +1476,10 @@ class BitcoinWallet extends CoinServiceAPI
_generateAddressForChain(1, 0, DerivePathType.bip49),
]);
// this will add the notification address to the db if it isn't
// already there so it can be watched
await getMyNotificationAddress();
await db.putAddresses(initialAddresses);
Logging.instance.log("_generateNewWalletFinished", level: LogLevel.Info);
@ -1611,15 +1540,6 @@ class BitcoinWallet extends CoinServiceAPI
throw Exception("DerivePathType $derivePathType not supported");
}
// add generated address & info to derivations
await addDerivation(
chain: chain,
address: address,
pubKey: Format.uint8listToString(node.publicKey),
wif: node.toWIF(),
derivePathType: derivePathType,
);
return isar_models.Address(
walletId: walletId,
value: address,
@ -1633,42 +1553,6 @@ class BitcoinWallet extends CoinServiceAPI
);
}
/// Returns the latest receiving/change (external/internal) address for the wallet depending on [chain]
/// and
/// [chain] - Use 0 for receiving (external), 1 for change (internal). Should not be any other value!
Future<String> _getCurrentAddressForChain(
int chain,
DerivePathType derivePathType,
) async {
final subType = chain == 0 // Here, we assume that chain == 1 if it isn't 0
? isar_models.AddressSubType.receiving
: isar_models.AddressSubType.change;
isar_models.AddressType type;
isar_models.Address? address;
switch (derivePathType) {
case DerivePathType.bip44:
type = isar_models.AddressType.p2pkh;
break;
case DerivePathType.bip49:
type = isar_models.AddressType.p2sh;
break;
case DerivePathType.bip84:
type = isar_models.AddressType.p2wpkh;
break;
default:
throw Exception("DerivePathType unsupported");
}
address = await db
.getAddresses(walletId)
.filter()
.typeEqualTo(type)
.subTypeEqualTo(subType)
.sortByDerivationIndexDesc()
.findFirst();
return address!.value;
}
String _buildDerivationStorageKey({
required int chain,
required DerivePathType derivePathType,
@ -1705,74 +1589,6 @@ class BitcoinWallet extends CoinServiceAPI
jsonDecode(derivationsString ?? "{}") as Map);
}
/// Add a single derivation to the local secure storage for [chain] and
/// [derivePathType] where [chain] must either be 1 for change or 0 for receive.
/// This will overwrite a previous entry where the address of the new derivation
/// matches a derivation currently stored.
Future<void> addDerivation({
required int chain,
required String address,
required String pubKey,
required String wif,
required DerivePathType derivePathType,
}) async {
// build lookup key
final key = _buildDerivationStorageKey(
chain: chain, derivePathType: derivePathType);
// fetch current derivations
final derivationsString = await _secureStore.read(key: key);
final derivations =
Map<String, dynamic>.from(jsonDecode(derivationsString ?? "{}") as Map);
// add derivation
derivations[address] = {
"pubKey": pubKey,
"wif": wif,
};
// save derivations
final newReceiveDerivationsString = jsonEncode(derivations);
await _secureStore.write(key: key, value: newReceiveDerivationsString);
}
/// Add multiple derivations to the local secure storage for [chain] and
/// [derivePathType] where [chain] must either be 1 for change or 0 for receive.
/// This will overwrite any previous entries where the address of the new derivation
/// matches a derivation currently stored.
/// The [derivationsToAdd] must be in the format of:
/// {
/// addressA : {
/// "pubKey": <the pubKey string>,
/// "wif": <the wif string>,
/// },
/// addressB : {
/// "pubKey": <the pubKey string>,
/// "wif": <the wif string>,
/// },
/// }
Future<void> addDerivations({
required int chain,
required DerivePathType derivePathType,
required Map<String, dynamic> derivationsToAdd,
}) async {
// build lookup key
final key = _buildDerivationStorageKey(
chain: chain, derivePathType: derivePathType);
// fetch current derivations
final derivationsString = await _secureStore.read(key: key);
final derivations =
Map<String, dynamic>.from(jsonDecode(derivationsString ?? "{}") as Map);
// add derivation
derivations.addAll(derivationsToAdd);
// save derivations
final newReceiveDerivationsString = jsonEncode(derivations);
await _secureStore.write(key: key, value: newReceiveDerivationsString);
}
Future<List<Map<String, dynamic>>> fastFetch(List<String> allTxHashes) async {
List<Map<String, dynamic>> allTransactions = [];
@ -2204,6 +2020,60 @@ class BitcoinWallet extends CoinServiceAPI
return false;
}
Future<void> _refreshNotificationAddressTransactions() async {
final address = await getMyNotificationAddress();
final hashes = await _fetchHistory([address.value]);
List<Map<String, dynamic>> allTransactions = [];
final currentHeight = await chainHeight;
for (final txHash in hashes) {
final storedTx = await db
.getTransactions(walletId)
.filter()
.txidEqualTo(txHash["tx_hash"] as String)
.findFirst();
// TODO: remove bip47Notification type check sometime after Q2 2023
if (storedTx == null ||
storedTx.subType ==
isar_models.TransactionSubType.bip47Notification ||
!storedTx.isConfirmed(currentHeight, MINIMUM_CONFIRMATIONS)) {
final tx = await cachedElectrumXClient.getTransaction(
txHash: txHash["tx_hash"] as String,
verbose: true,
coin: coin,
);
tx["address"] = await db
.getAddresses(walletId)
.filter()
.valueEqualTo(txHash["address"] as String)
.findFirst();
tx["height"] = txHash["height"];
allTransactions.add(tx);
}
}
final List<Tuple2<isar_models.Transaction, isar_models.Address?>> txnsData =
[];
for (final txObject in allTransactions) {
final data = await parseTransaction(
txObject,
cachedElectrumXClient,
[address],
coin,
MINIMUM_CONFIRMATIONS,
walletId,
);
txnsData.add(data);
}
await db.addNewTransactionData(txnsData, walletId);
}
Future<void> _refreshTransactions() async {
final List<isar_models.Address> allAddresses =
await _fetchAllOwnAddresses();
@ -2466,8 +2336,7 @@ class BitcoinWallet extends CoinServiceAPI
utxoSigningData: utxoSigningData,
recipients: [
recipientAddress,
await _getCurrentAddressForChain(
1, DerivePathTypeExt.primaryFor(coin)),
await currentChangeAddress,
],
satoshiAmounts: [
satoshiAmountToSend,
@ -2510,8 +2379,7 @@ class BitcoinWallet extends CoinServiceAPI
feeForTwoOutputs) {
// generate new change address if current change address has been used
await _checkChangeAddressForTransactions();
final String newChangeAddress = await _getCurrentAddressForChain(
1, DerivePathTypeExt.primaryFor(coin));
final String newChangeAddress = await currentChangeAddress;
int feeBeingPaid =
satoshisBeingUsed - satoshiAmountToSend - changeOutputSize;
@ -2738,43 +2606,67 @@ class BitcoinWallet extends CoinServiceAPI
String? pubKey;
String? wif;
// fetch receiving derivations if null
receiveDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 0,
derivePathType: sd.derivePathType,
);
final receiveDerivation =
receiveDerivations[sd.derivePathType]![sd.utxo.address!];
final address = await db.getAddress(walletId, sd.utxo.address!);
if (address?.derivationPath != null) {
final bip32.BIP32 node;
if (address!.subType == isar_models.AddressSubType.paynymReceive) {
final code = await paymentCodeStringByKey(address.otherData!);
if (receiveDerivation != null) {
pubKey = receiveDerivation["pubKey"] as String;
wif = receiveDerivation["wif"] as String;
} else {
// fetch change derivations if null
changeDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 1,
derivePathType: sd.derivePathType,
);
final changeDerivation =
changeDerivations[sd.derivePathType]![sd.utxo.address!];
if (changeDerivation != null) {
pubKey = changeDerivation["pubKey"] as String;
wif = changeDerivation["wif"] as String;
}
}
final bip47base = await getBip47BaseNode();
if (wif == null || pubKey == null) {
final address = await db.getAddress(walletId, sd.utxo.address!);
if (address?.derivationPath != null) {
final node = await Bip32Utils.getBip32Node(
final privateKey = await getPrivateKeyForPaynymReceivingAddress(
paymentCodeString: code!,
index: address.derivationIndex,
);
node = bip32.BIP32.fromPrivateKey(
privateKey,
bip47base.chainCode,
bip32.NetworkType(
wif: _network.wif,
bip32: bip32.Bip32Type(
public: _network.bip32.public,
private: _network.bip32.private,
),
),
);
} else {
node = await Bip32Utils.getBip32Node(
(await mnemonicString)!,
(await mnemonicPassphrase)!,
_network,
address!.derivationPath!.value,
address.derivationPath!.value,
);
}
wif = node.toWIF();
pubKey = Format.uint8listToString(node.publicKey);
wif = node.toWIF();
pubKey = Format.uint8listToString(node.publicKey);
}
if (wif == null || pubKey == null) {
// fetch receiving derivations if null
receiveDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 0,
derivePathType: sd.derivePathType,
);
final receiveDerivation =
receiveDerivations[sd.derivePathType]![sd.utxo.address!];
if (receiveDerivation != null) {
pubKey = receiveDerivation["pubKey"] as String;
wif = receiveDerivation["wif"] as String;
} else {
// fetch change derivations if null
changeDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 1,
derivePathType: sd.derivePathType,
);
final changeDerivation =
changeDerivations[sd.derivePathType]![sd.utxo.address!];
if (changeDerivation != null) {
pubKey = changeDerivation["pubKey"] as String;
wif = changeDerivation["wif"] as String;
}
}
}
@ -2960,121 +2852,6 @@ class BitcoinWallet extends CoinServiceAPI
}
}
// Future<void> _rescanRestore() async {
// Logging.instance.log("starting rescan restore", level: LogLevel.Info);
//
// // restore from backup
// // P2PKH derivations
// final p2pkhReceiveDerivationsString = await _secureStore.read(
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
// final p2pkhChangeDerivationsString = await _secureStore.read(
// key: "${walletId}_changeDerivationsP2PKH_BACKUP");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2PKH",
// value: p2pkhReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2PKH",
// value: p2pkhChangeDerivationsString);
//
// await _secureStore.delete(
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH_BACKUP");
//
// // P2SH derivations
// final p2shReceiveDerivationsString = await _secureStore.read(
// key: "${walletId}_receiveDerivationsP2SH_BACKUP");
// final p2shChangeDerivationsString = await _secureStore.read(
// key: "${walletId}_changeDerivationsP2SH_BACKUP");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2SH",
// value: p2shReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2SH",
// value: p2shChangeDerivationsString);
//
// await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH_BACKUP");
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH_BACKUP");
//
// // P2WPKH derivations
// final p2wpkhReceiveDerivationsString = await _secureStore.read(
// key: "${walletId}_receiveDerivationsP2WPKH_BACKUP");
// final p2wpkhChangeDerivationsString = await _secureStore.read(
// key: "${walletId}_changeDerivationsP2WPKH_BACKUP");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2WPKH",
// value: p2wpkhReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2WPKH",
// value: p2wpkhChangeDerivationsString);
//
// await _secureStore.delete(
// key: "${walletId}_receiveDerivationsP2WPKH_BACKUP");
// await _secureStore.delete(
// key: "${walletId}_changeDerivationsP2WPKH_BACKUP");
//
// Logging.instance.log("rescan restore complete", level: LogLevel.Info);
// }
//
// Future<void> _rescanBackup() async {
// Logging.instance.log("starting rescan backup", level: LogLevel.Info);
//
// // backup current and clear data
// // P2PKH derivations
// final p2pkhReceiveDerivationsString =
// await _secureStore.read(key: "${walletId}_receiveDerivationsP2PKH");
// final p2pkhChangeDerivationsString =
// await _secureStore.read(key: "${walletId}_changeDerivationsP2PKH");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP",
// value: p2pkhReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2PKH_BACKUP",
// value: p2pkhChangeDerivationsString);
//
// await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
//
// // P2SH derivations
// final p2shReceiveDerivationsString =
// await _secureStore.read(key: "${walletId}_receiveDerivationsP2SH");
// final p2shChangeDerivationsString =
// await _secureStore.read(key: "${walletId}_changeDerivationsP2SH");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2SH_BACKUP",
// value: p2shReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2SH_BACKUP",
// value: p2shChangeDerivationsString);
//
// await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
//
// // P2WPKH derivations
// final p2wpkhReceiveDerivationsString =
// await _secureStore.read(key: "${walletId}_receiveDerivationsP2WPKH");
// final p2wpkhChangeDerivationsString =
// await _secureStore.read(key: "${walletId}_changeDerivationsP2WPKH");
//
// await _secureStore.write(
// key: "${walletId}_receiveDerivationsP2WPKH_BACKUP",
// value: p2wpkhReceiveDerivationsString);
// await _secureStore.write(
// key: "${walletId}_changeDerivationsP2WPKH_BACKUP",
// value: p2wpkhChangeDerivationsString);
//
// await _secureStore.delete(key: "${walletId}_receiveDerivationsP2WPKH");
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2WPKH");
//
//
//
// Logging.instance.log("rescan backup complete", level: LogLevel.Info);
// }
Future<void> _deleteDerivations() async {
// P2PKH derivations
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");

View file

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:bech32/bech32.dart';
import 'package:bip32/bip32.dart' as bip32;
@ -18,6 +19,7 @@ import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/models/signing_data.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/events/global/refresh_percent_changed_event.dart';
@ -376,17 +378,18 @@ class BitcoinCashWallet extends CoinServiceAPI
level: LogLevel.Info);
}
Future<Map<String, dynamic>> _checkGaps(
int maxNumberOfIndexesToCheck,
int maxUnusedAddressGap,
int txCountBatchSize,
bip32.BIP32 root,
DerivePathType type,
int chain) async {
Future<Tuple3<List<isar_models.Address>, DerivePathType, int>> _checkGaps(
int maxNumberOfIndexesToCheck,
int maxUnusedAddressGap,
int txCountBatchSize,
bip32.BIP32 root,
DerivePathType type,
int chain,
) async {
List<isar_models.Address> addressArray = [];
int returningIndex = -1;
Map<String, Map<String, String>> derivations = {};
int gapCounter = 0;
int highestIndexWithHistory = 0;
for (int index = 0;
index < maxNumberOfIndexesToCheck && gapCounter < maxUnusedAddressGap;
index += txCountBatchSize) {
@ -397,7 +400,6 @@ class BitcoinCashWallet extends CoinServiceAPI
final _id = "k_$index";
Map<String, String> txCountCallArgs = {};
final Map<String, dynamic> receivingNodes = {};
for (int j = 0; j < txCountBatchSize; j++) {
final derivePath = constructDerivePath(
@ -443,12 +445,8 @@ class BitcoinCashWallet extends CoinServiceAPI
: isar_models.AddressSubType.change,
);
receivingNodes.addAll({
"${_id}_$j": {
"node": node,
"address": address,
}
});
addressArray.add(address);
txCountCallArgs.addAll({
"${_id}_$j": addressString,
});
@ -463,21 +461,13 @@ class BitcoinCashWallet extends CoinServiceAPI
for (int k = 0; k < txCountBatchSize; k++) {
int count = counts["${_id}_$k"]!;
if (count > 0) {
final node = receivingNodes["${_id}_$k"];
final address = node["address"] as isar_models.Address;
// add address to array
addressArray.add(address);
iterationsAddressArray.add(address.value);
// set current index
returningIndex = index + k;
iterationsAddressArray.add(txCountCallArgs["${_id}_$k"]!);
// update highest
highestIndexWithHistory = index + k;
// reset counter
gapCounter = 0;
// add info to derivations
derivations[address.value] = {
"pubKey": Format.uint8listToString(
(node["node"] as bip32.BIP32).publicKey),
"wif": (node["node"] as bip32.BIP32).toWIF(),
};
}
// increase counter when no tx history found
@ -488,11 +478,7 @@ class BitcoinCashWallet extends CoinServiceAPI
// cache all the transactions while waiting for the current function to finish.
unawaited(getTransactionCacheEarly(iterationsAddressArray));
}
return {
"addressArray": addressArray,
"index": returningIndex,
"derivations": derivations
};
return Tuple3(addressArray, type, highestIndexWithHistory);
}
Future<void> getTransactionCacheEarly(List<String> allAddresses) async {
@ -525,213 +511,129 @@ class BitcoinCashWallet extends CoinServiceAPI
}) async {
longMutex = true;
Map<String, Map<String, String>> bip44P2pkhReceiveDerivations = {};
Map<String, Map<String, String>> bch44P2pkhReceiveDerivations = {};
Map<String, Map<String, String>> p2shReceiveDerivations = {};
Map<String, Map<String, String>> bip44P2pkhChangeDerivations = {};
Map<String, Map<String, String>> bch44P2pkhChangeDerivations = {};
Map<String, Map<String, String>> p2shChangeDerivations = {};
final root = await Bip32Utils.getBip32Root(
mnemonic,
mnemonicPassphrase,
_network,
);
List<isar_models.Address> bip44P2pkhReceiveAddressArray = [];
List<isar_models.Address> bch44P2pkhReceiveAddressArray = [];
List<isar_models.Address> p2shReceiveAddressArray = [];
int bch44P2pkhReceiveIndex = -1;
int bip44P2pkhReceiveIndex = -1;
int p2shReceiveIndex = -1;
final deriveTypes = [
DerivePathType.bip44,
DerivePathType.bip49,
];
List<isar_models.Address> bip44P2pkhChangeAddressArray = [];
List<isar_models.Address> bch44P2pkhChangeAddressArray = [];
List<isar_models.Address> p2shChangeAddressArray = [];
int bch44P2pkhChangeIndex = -1;
int bip44P2pkhChangeIndex = -1;
int p2shChangeIndex = -1;
if (coin != Coin.bitcoincashTestnet) {
deriveTypes.add(DerivePathType.bch44);
}
// The gap limit will be capped at [maxUnusedAddressGap]
// int receivingGapCounter = 0;
// int changeGapCounter = 0;
final List<Future<Tuple3<List<isar_models.Address>, DerivePathType, int>>>
receiveFutures = [];
final List<Future<Tuple3<List<isar_models.Address>, DerivePathType, int>>>
changeFutures = [];
const receiveChain = 0;
const changeChain = 1;
const indexZero = 0;
// actual size is 24 due to p2pkh and p2sh so 12x2
const txCountBatchSize = 12;
try {
bool testnet = ((coin) == Coin.bitcoincashTestnet) ? true : false;
// receiving addresses
Logging.instance
.log("checking receiving addresses...", level: LogLevel.Info);
final resultReceiveBip44 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
Logging.instance.log(
"checking receiving addresses...",
level: LogLevel.Info,
);
final resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 0);
for (final type in deriveTypes) {
receiveFutures.add(
_checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
type,
receiveChain,
),
);
}
Logging.instance
.log("checking change addresses...", level: LogLevel.Info);
// change addresses
final bip44ResultChange = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
Logging.instance.log(
"checking change addresses...",
level: LogLevel.Info,
);
for (final type in deriveTypes) {
changeFutures.add(
_checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
type,
changeChain,
),
);
}
final resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 1);
await Future.wait([
resultReceiveBip44,
resultReceive49,
bip44ResultChange,
resultChange49,
// io limitations may require running these linearly instead
final futuresResult = await Future.wait([
Future.wait(receiveFutures),
Future.wait(changeFutures),
]);
bip44P2pkhReceiveAddressArray = (await resultReceiveBip44)['addressArray']
as List<isar_models.Address>;
bip44P2pkhReceiveIndex = (await resultReceiveBip44)['index'] as int;
bip44P2pkhReceiveDerivations = (await resultReceiveBip44)['derivations']
as Map<String, Map<String, String>>;
final receiveResults = futuresResult[0];
final changeResults = futuresResult[1];
p2shReceiveAddressArray =
(await resultReceive49)['addressArray'] as List<isar_models.Address>;
p2shReceiveIndex = (await resultReceive49)['index'] as int;
p2shReceiveDerivations = (await resultReceive49)['derivations']
as Map<String, Map<String, String>>;
bip44P2pkhChangeAddressArray = (await bip44ResultChange)['addressArray']
as List<isar_models.Address>;
bip44P2pkhChangeIndex = (await bip44ResultChange)['index'] as int;
bip44P2pkhChangeDerivations = (await bip44ResultChange)['derivations']
as Map<String, Map<String, String>>;
p2shChangeAddressArray =
(await resultChange49)['addressArray'] as List<isar_models.Address>;
p2shChangeIndex = (await resultChange49)['index'] as int;
p2shChangeDerivations = (await resultChange49)['derivations']
as Map<String, Map<String, String>>;
// save the derivations (if any)
if (bip44P2pkhReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip44,
derivationsToAdd: bip44P2pkhReceiveDerivations);
}
if (p2shReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shReceiveDerivations);
}
if (bip44P2pkhChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip44,
derivationsToAdd: bip44P2pkhChangeDerivations);
}
if (p2shChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shChangeDerivations);
}
final List<isar_models.Address> addressesToStore = [];
int highestReceivingIndexWithHistory = 0;
// If restoring a wallet that never received any funds, then set receivingArray manually
// If we didn't do this, it'd store an empty array
if (bip44P2pkhReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip44);
bip44P2pkhReceiveAddressArray.add(address);
}
if (p2shReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip49);
p2shReceiveAddressArray.add(address);
for (final tuple in receiveResults) {
if (tuple.item1.isEmpty) {
final address = await _generateAddressForChain(
receiveChain,
indexZero,
tuple.item2,
);
addressesToStore.add(address);
} else {
highestReceivingIndexWithHistory = max(
tuple.item3,
highestReceivingIndexWithHistory,
);
addressesToStore.addAll(tuple.item1);
}
}
int highestChangeIndexWithHistory = 0;
// If restoring a wallet that never sent any funds with change, then set changeArray
// manually. If we didn't do this, it'd store an empty array.
if (bip44P2pkhChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip44);
bip44P2pkhChangeAddressArray.add(address);
}
if (p2shChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip49);
p2shChangeAddressArray.add(address);
for (final tuple in changeResults) {
if (tuple.item1.isEmpty) {
final address = await _generateAddressForChain(
changeChain,
indexZero,
tuple.item2,
);
addressesToStore.add(address);
} else {
highestChangeIndexWithHistory = max(
tuple.item3,
highestChangeIndexWithHistory,
);
addressesToStore.addAll(tuple.item1);
}
}
final addressesToStore = [
...bip44P2pkhReceiveAddressArray,
...bip44P2pkhChangeAddressArray,
...p2shReceiveAddressArray,
...p2shChangeAddressArray,
];
if (!testnet) {
final resultReceiveBch44 = _checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
DerivePathType.bch44,
0);
final Future<Map<String, dynamic>> bch44ResultChange = _checkGaps(
maxNumberOfIndexesToCheck,
maxUnusedAddressGap,
txCountBatchSize,
root,
DerivePathType.bch44,
1);
await Future.wait([
resultReceiveBch44,
bch44ResultChange,
]);
bch44P2pkhReceiveAddressArray =
(await resultReceiveBch44)['addressArray']
as List<isar_models.Address>;
bch44P2pkhReceiveIndex = (await resultReceiveBch44)['index'] as int;
bch44P2pkhReceiveDerivations = (await resultReceiveBch44)['derivations']
as Map<String, Map<String, String>>;
bch44P2pkhChangeAddressArray = (await bch44ResultChange)['addressArray']
as List<isar_models.Address>;
bch44P2pkhChangeIndex = (await bch44ResultChange)['index'] as int;
bch44P2pkhChangeDerivations = (await bch44ResultChange)['derivations']
as Map<String, Map<String, String>>;
if (bch44P2pkhReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bch44,
derivationsToAdd: bch44P2pkhReceiveDerivations);
}
if (bch44P2pkhChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bch44,
derivationsToAdd: bch44P2pkhChangeDerivations);
}
if (bch44P2pkhReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bch44);
bch44P2pkhReceiveAddressArray.add(address);
}
if (bch44P2pkhChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bch44);
bch44P2pkhChangeAddressArray.add(address);
}
addressesToStore.addAll([
...bch44P2pkhReceiveAddressArray,
...bch44P2pkhChangeAddressArray,
]);
}
// remove extra addresses to help minimize risk of creating a large gap
addressesToStore.removeWhere((e) =>
e.subType == isar_models.AddressSubType.change &&
e.derivationIndex > highestChangeIndexWithHistory);
addressesToStore.removeWhere((e) =>
e.subType == isar_models.AddressSubType.receiving &&
e.derivationIndex > highestReceivingIndexWithHistory);
if (isRescan) {
await db.updateOrPutAddresses(addressesToStore);
@ -739,7 +641,10 @@ class BitcoinCashWallet extends CoinServiceAPI
await db.putAddresses(addressesToStore);
}
await _updateUTXOs();
await Future.wait([
_refreshTransactions(),
_updateUTXOs(),
]);
await Future.wait([
updateCachedId(walletId),
@ -1557,15 +1462,6 @@ class BitcoinCashWallet extends CoinServiceAPI
throw Exception("DerivePathType $derivePathType not supported");
}
// add generated address & info to derivations
await addDerivation(
chain: chain,
address: address,
pubKey: Format.uint8listToString(node.publicKey),
wif: node.toWIF(),
derivePathType: derivePathType,
);
return isar_models.Address(
walletId: walletId,
value: address,
@ -1661,74 +1557,6 @@ class BitcoinCashWallet extends CoinServiceAPI
jsonDecode(derivationsString ?? "{}") as Map);
}
/// Add a single derivation to the local secure storage for [chain] and
/// [derivePathType] where [chain] must either be 1 for change or 0 for receive.
/// This will overwrite a previous entry where the address of the new derivation
/// matches a derivation currently stored.
Future<void> addDerivation({
required int chain,
required String address,
required String pubKey,
required String wif,
required DerivePathType derivePathType,
}) async {
// build lookup key
final key = _buildDerivationStorageKey(
chain: chain, derivePathType: derivePathType);
// fetch current derivations
final derivationsString = await _secureStore.read(key: key);
final derivations =
Map<String, dynamic>.from(jsonDecode(derivationsString ?? "{}") as Map);
// add derivation
derivations[address] = {
"pubKey": pubKey,
"wif": wif,
};
// save derivations
final newReceiveDerivationsString = jsonEncode(derivations);
await _secureStore.write(key: key, value: newReceiveDerivationsString);
}
/// Add multiple derivations to the local secure storage for [chain] and
/// [derivePathType] where [chain] must either be 1 for change or 0 for receive.
/// This will overwrite any previous entries where the address of the new derivation
/// matches a derivation currently stored.
/// The [derivationsToAdd] must be in the format of:
/// {
/// addressA : {
/// "pubKey": <the pubKey string>,
/// "wif": <the wif string>,
/// },
/// addressB : {
/// "pubKey": <the pubKey string>,
/// "wif": <the wif string>,
/// },
/// }
Future<void> addDerivations({
required int chain,
required DerivePathType derivePathType,
required Map<String, dynamic> derivationsToAdd,
}) async {
// build lookup key
final key = _buildDerivationStorageKey(
chain: chain, derivePathType: derivePathType);
// fetch current derivations
final derivationsString = await _secureStore.read(key: key);
final derivations =
Map<String, dynamic>.from(jsonDecode(derivationsString ?? "{}") as Map);
// add derivation
derivations.addAll(derivationsToAdd);
// save derivations
final newReceiveDerivationsString = jsonEncode(derivations);
await _secureStore.write(key: key, value: newReceiveDerivationsString);
}
Future<void> _updateUTXOs() async {
final allAddresses = await _fetchAllOwnAddresses();
@ -2783,16 +2611,11 @@ class BitcoinCashWallet extends CoinServiceAPI
}
}
Future<Map<String, dynamic>> fetchBuildTxData(
Future<List<SigningData>> fetchBuildTxData(
List<isar_models.UTXO> utxosToUse,
) async {
// return data
Map<String, dynamic> results = {};
Map<String, List<String>> addressTxid = {};
// addresses to check
List<String> addressesP2PKH = [];
List<String> addressesP2SH = [];
List<SigningData> signingData = [];
try {
// Populating the addresses to check
@ -2806,7 +2629,9 @@ class BitcoinCashWallet extends CoinServiceAPI
for (final output in tx["vout"] as List) {
final n = output["n"];
if (n != null && n == utxosToUse[i].vout) {
String address = output["scriptPubKey"]["addresses"][0] as String;
String address =
output["scriptPubKey"]?["addresses"]?[0] as String? ??
output["scriptPubKey"]["address"] as String;
if (bitbox.Address.detectFormat(address) !=
bitbox.Address.formatCashAddr) {
try {
@ -2815,169 +2640,114 @@ class BitcoinCashWallet extends CoinServiceAPI
rethrow;
}
}
if (!addressTxid.containsKey(address)) {
addressTxid[address] = <String>[];
}
(addressTxid[address] as List).add(txid);
final deriveType = addressType(address: address);
switch (deriveType) {
case DerivePathType.bip44:
case DerivePathType.bch44:
addressesP2PKH.add(address);
break;
case DerivePathType.bip49:
addressesP2SH.add(address);
break;
default:
throw UnsupportedError(
"${deriveType.name} not supported by ${coin.prettyName}");
}
utxosToUse[i] = utxosToUse[i].copyWith(address: address);
}
}
final derivePathType = addressType(address: utxosToUse[i].address!);
signingData.add(
SigningData(
derivePathType: derivePathType,
utxo: utxosToUse[i],
),
);
}
// p2pkh / bip44
final p2pkhLength = addressesP2PKH.length;
if (p2pkhLength > 0) {
final receiveDerivationsBip44 = await _fetchDerivations(
chain: 0,
derivePathType: DerivePathType.bip44,
);
final changeDerivationsBip44 = await _fetchDerivations(
chain: 1,
derivePathType: DerivePathType.bip44,
);
final receiveDerivationsBch44 = await _fetchDerivations(
chain: 0,
derivePathType: DerivePathType.bch44,
);
final changeDerivationsBch44 = await _fetchDerivations(
chain: 1,
derivePathType: DerivePathType.bch44,
);
for (int i = 0; i < p2pkhLength; i++) {
String address = addressesP2PKH[i];
Map<DerivePathType, Map<String, dynamic>> receiveDerivations = {};
Map<DerivePathType, Map<String, dynamic>> changeDerivations = {};
// receives
final receiveDerivation = receiveDerivationsBip44[address] ??
receiveDerivationsBch44[address];
// if a match exists it will not be null
if (receiveDerivation != null) {
final data = P2PKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
receiveDerivation["pubKey"] as String)),
network: _network,
).data;
for (final sd in signingData) {
String? pubKey;
String? wif;
for (String tx in addressTxid[address]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
receiveDerivation["wif"] as String,
network: _network,
),
};
}
} else {
// if its not a receive, check change
final changeDerivation = changeDerivationsBip44[address] ??
changeDerivationsBch44[address];
// if a match exists it will not be null
if (changeDerivation != null) {
final data = P2PKH(
// fetch receiving derivations if null
receiveDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 0,
derivePathType: sd.derivePathType,
);
final receiveDerivation =
receiveDerivations[sd.derivePathType]![sd.utxo.address!];
if (receiveDerivation != null) {
pubKey = receiveDerivation["pubKey"] as String;
wif = receiveDerivation["wif"] as String;
} else {
// fetch change derivations if null
changeDerivations[sd.derivePathType] ??= await _fetchDerivations(
chain: 1,
derivePathType: sd.derivePathType,
);
final changeDerivation =
changeDerivations[sd.derivePathType]![sd.utxo.address!];
if (changeDerivation != null) {
pubKey = changeDerivation["pubKey"] as String;
wif = changeDerivation["wif"] as String;
}
}
if (wif == null || pubKey == null) {
final address = await db.getAddress(walletId, sd.utxo.address!);
if (address?.derivationPath != null) {
final node = await Bip32Utils.getBip32Node(
(await mnemonicString)!,
(await mnemonicPassphrase)!,
_network,
address!.derivationPath!.value,
);
wif = node.toWIF();
pubKey = Format.uint8listToString(node.publicKey);
}
}
if (wif != null && pubKey != null) {
final PaymentData data;
final Uint8List? redeemScript;
switch (sd.derivePathType) {
case DerivePathType.bip44:
case DerivePathType.bch44:
data = P2PKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
changeDerivation["pubKey"] as String)),
pubkey: Format.stringToUint8List(pubKey),
),
network: _network,
).data;
redeemScript = null;
break;
for (String tx in addressTxid[address]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
changeDerivation["wif"] as String,
network: _network,
),
};
}
}
}
}
}
// p2sh / bip49
final p2shLength = addressesP2SH.length;
if (p2shLength > 0) {
final receiveDerivations = await _fetchDerivations(
chain: 0,
derivePathType: DerivePathType.bip49,
);
final changeDerivations = await _fetchDerivations(
chain: 1,
derivePathType: DerivePathType.bip49,
);
for (int i = 0; i < p2shLength; i++) {
// receives
final receiveDerivation = receiveDerivations[addressesP2SH[i]];
// if a match exists it will not be null
if (receiveDerivation != null) {
final p2wpkh = P2WPKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
receiveDerivation["pubKey"] as String)),
network: _network)
.data;
final redeemScript = p2wpkh.output;
final data =
P2SH(data: PaymentData(redeem: p2wpkh), network: _network).data;
for (String tx in addressTxid[addressesP2SH[i]]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
receiveDerivation["wif"] as String,
network: _network,
),
"redeemScript": redeemScript,
};
}
} else {
// if its not a receive, check change
final changeDerivation = changeDerivations[addressesP2SH[i]];
// if a match exists it will not be null
if (changeDerivation != null) {
case DerivePathType.bip49:
final p2wpkh = P2WPKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
changeDerivation["pubKey"] as String)),
network: _network)
.data;
data: PaymentData(
pubkey: Format.stringToUint8List(pubKey),
),
network: _network,
).data;
redeemScript = p2wpkh.output;
data = P2SH(
data: PaymentData(redeem: p2wpkh),
network: _network,
).data;
break;
final redeemScript = p2wpkh.output;
final data =
P2SH(data: PaymentData(redeem: p2wpkh), network: _network)
.data;
for (String tx in addressTxid[addressesP2SH[i]]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
changeDerivation["wif"] as String,
network: _network,
),
"redeemScript": redeemScript,
};
}
}
default:
throw Exception("DerivePathType unsupported");
}
final keyPair = ECPair.fromWIF(
wif,
network: _network,
);
sd.redeemScript = redeemScript;
sd.output = data.output;
sd.keyPair = keyPair;
}
}
return results;
return signingData;
} catch (e, s) {
Logging.instance
.log("fetchBuildTxData() threw: $e,\n$s", level: LogLevel.Error);
@ -2988,11 +2758,13 @@ class BitcoinCashWallet extends CoinServiceAPI
/// Builds and signs a transaction
Future<Map<String, dynamic>> buildTransaction({
required List<isar_models.UTXO> utxosToUse,
required Map<String, dynamic> utxoSigningData,
required List<SigningData> utxoSigningData,
required List<String> recipients,
required List<int> satoshiAmounts,
}) async {
final builder = bitbox.Bitbox.transactionBuilder();
final builder = bitbox.Bitbox.transactionBuilder(
testnet: coin == Coin.bitcoincashTestnet,
);
// retrieve address' utxos from the rest api
List<bitbox.Utxo> _utxos =
@ -3019,7 +2791,8 @@ class BitcoinCashWallet extends CoinServiceAPI
for (var utxo in _utxos) {
// add the utxo as an input for the transaction
builder.addInput(utxo.txid, utxo.vout);
final ec = utxoSigningData[utxo.txid]["keyPair"] as ECPair;
final ec =
utxoSigningData.firstWhere((e) => e.utxo.txid == utxo.txid).keyPair!;
final bitboxEC = bitbox.ECPair.fromWIF(ec.toWIF());

View file

@ -50,7 +50,7 @@ import 'package:stackwallet/utilities/prefs.dart';
import 'package:stackwallet/utilities/stack_file_system.dart';
import 'package:tuple/tuple.dart';
const int MINIMUM_CONFIRMATIONS = 4;
const int MINIMUM_CONFIRMATIONS = 15;
class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
WowneroWallet({

View file

@ -40,8 +40,9 @@ class ExchangeDataLoadingService {
);
}
Future<void> init() async {
if (_isar != null && isar.isOpen) return;
Future<void> initDB() async {
if (_isar != null) return;
await _isar?.close();
_isar = await Isar.open(
[
CurrencySchema,

File diff suppressed because it is too large Load diff

View file

@ -210,7 +210,7 @@ class _SVG {
String get pending => "assets/svg/pending.svg";
String get radio => "assets/svg/signal-stream.svg";
String get arrowRotate => "assets/svg/arrow-rotate.svg";
String get arrowRotate2 => "assets/svg/arrow-rotate2.svg";
String get arrowsTwoWay => "assets/svg/arrow-rotate2.svg";
String get alertCircle => "assets/svg/alert-circle.svg";
String get checkCircle => "assets/svg/circle-check.svg";
String get clipboard => "assets/svg/clipboard.svg";
@ -226,7 +226,6 @@ class _SVG {
String get networkWired => "assets/svg/network-wired-2.svg";
String get addressBook => "assets/svg/address-book.svg";
String get addressBook2 => "assets/svg/address-book2.svg";
String get arrowRotate3 => "assets/svg/rotate-exclamation.svg";
String get delete => "assets/svg/delete.svg";
String get arrowRight => "assets/svg/arrow-right.svg";
String get dollarSign => "assets/svg/dollar-sign.svg";
@ -419,6 +418,9 @@ class _ANIMATIONS {
const _ANIMATIONS();
String get test2 => "assets/lottie/test2.json";
String get iconSend => "assets/lottie/icon_send.json";
String get loaderAndCheckmark => "assets/lottie/loader_and_checkmark.json";
String get arrowRotate => "assets/lottie/arrow_rotate.json";
}
class _GIF {

View file

@ -6,13 +6,13 @@ Uri getBlockExplorerTransactionUrlFor({
}) {
switch (coin) {
case Coin.bitcoin:
return Uri.parse("https://chain.so/tx/BTC/$txid");
return Uri.parse("https://mempool.space/tx/$txid");
case Coin.litecoin:
return Uri.parse("https://chain.so/tx/LTC/$txid");
case Coin.litecoinTestNet:
return Uri.parse("https://chain.so/tx/LTCTEST/$txid");
case Coin.bitcoinTestNet:
return Uri.parse("https://chain.so/tx/BTCTEST/$txid");
return Uri.parse("https://mempool.space/testnet/tx/$txid");
case Coin.dogecoin:
return Uri.parse("https://chain.so/tx/DOGE/$txid");
case Coin.dogecoinTestNet:

View file

@ -25,14 +25,18 @@ class PaynymIsApi {
version +
(endpoint.startsWith("/") ? endpoint : "/$endpoint");
final uri = Uri.parse(url);
final headers = {
'Content-Type': 'application/json; charset=UTF-8',
}..addAll(additionalHeaders);
final response = await http.post(
uri,
headers: {
'Content-Type': 'application/json; charset=UTF-8',
}..addAll(additionalHeaders),
headers: headers,
body: jsonEncode(body),
);
debugPrint("Paynym request uri: $uri");
debugPrint("Paynym request body: $body");
debugPrint("Paynym request headers: $headers");
debugPrint("Paynym response code: ${response.statusCode}");
debugPrint("Paynym response body: ${response.body}");
@ -543,24 +547,44 @@ class PaynymIsApi {
// | 401 | Unauthorized token or signature or Unclaimed payment code |
//
// ------
Future<PaynymResponse<bool>> add(
String token,
String signature,
String nym,
String code,
) async {
final result = await _post(
"/nym/add",
{
"nym": nym,
"code": code,
"signature": signature,
},
{
"auth-token": token,
},
);
// NOT USED
// Future<Map<String, dynamic>> add(
// String token,
// String signature,
// String nym,
// String code,
// ) async {
// return _post(
// "/add",
// {
// "nym": nym,
// "code": code,
// "signature": signature,
// },
// {
// "auth-token": token,
// },
// );
// }
String message;
bool value = false;
switch (result.item2) {
case 200:
message = "Code added successfully";
value = true;
break;
case 400:
message = "Bad request";
break;
case 401:
message = "Unauthorized token or signature or Unclaimed payment code";
break;
case 404:
message = "Nym not found";
break;
default:
message = result.item1["message"] as String? ?? "Unknown error";
}
return PaynymResponse(value, result.item2, message);
}
}

View file

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
class RotatingArrowsController {
VoidCallback? forward;
VoidCallback? repeat;
VoidCallback? stop;
}
class RotatingArrows extends StatefulWidget {
const RotatingArrows({
Key? key,
required this.height,
required this.width,
this.controller,
this.color,
this.spinByDefault = true,
}) : super(key: key);
final double height;
final double width;
final RotatingArrowsController? controller;
final Color? color;
final bool spinByDefault;
@override
State<RotatingArrows> createState() => _RotatingArrowsState();
}
class _RotatingArrowsState extends State<RotatingArrows>
with SingleTickerProviderStateMixin {
late final AnimationController animationController;
@override
void initState() {
animationController = AnimationController(vsync: this);
widget.controller?.forward = animationController.forward;
widget.controller?.repeat = animationController.repeat;
widget.controller?.stop = animationController.stop;
super.initState();
}
@override
void dispose() {
animationController.dispose();
widget.controller?.forward = null;
widget.controller?.repeat = null;
widget.controller?.stop = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
return Lottie.asset(
Assets.lottie.arrowRotate,
controller: animationController,
height: widget.height,
width: widget.width,
delegates: LottieDelegates(
values: [
ValueDelegate.color(
const ["**"],
value: widget.color ??
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
ValueDelegate.strokeColor(
const ["**"],
value: widget.color ??
Theme.of(context).extension<StackColors>()!.accentColorDark,
),
],
),
onLoaded: (composition) {
animationController.duration = composition.duration;
// if controller was not set just assume continuous repeat
if (widget.spinByDefault) {
animationController.repeat();
}
},
);
}
}

View file

@ -11,7 +11,6 @@ import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/providers/wallet/my_paynym_account_state_provider.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
@ -68,8 +67,7 @@ class _PaynymFollowToggleButtonState
.read(paynymAPIProvider)
.nym(widget.paymentCodeStringToFollow, true);
final myPCode =
await wallet.getPaymentCode(DerivePathTypeExt.primaryFor(manager.coin));
final myPCode = await wallet.getPaymentCode(isSegwit: false);
PaynymResponse<String> token =
await ref.read(paynymAPIProvider).token(myPCode.toString());
@ -77,8 +75,8 @@ class _PaynymFollowToggleButtonState
// sign token with notification private key
String signature = await wallet.signStringWithNotificationKey(token.value!);
var result = await ref.read(paynymAPIProvider).follow(
token.value!, signature, followedAccount.value!.codes.first.code);
var result = await ref.read(paynymAPIProvider).follow(token.value!,
signature, followedAccount.value!.nonSegwitPaymentCode.code);
int i = 0;
for (;
@ -90,8 +88,8 @@ class _PaynymFollowToggleButtonState
// sign token with notification private key
signature = await wallet.signStringWithNotificationKey(token.value!);
result = await ref.read(paynymAPIProvider).follow(
token.value!, signature, followedAccount.value!.codes.first.code);
result = await ref.read(paynymAPIProvider).follow(token.value!, signature,
followedAccount.value!.nonSegwitPaymentCode.code);
await Future<void>.delayed(const Duration(milliseconds: 200));
print("RRR result: $result");
@ -118,8 +116,8 @@ class _PaynymFollowToggleButtonState
PaynymAccountLite(
followedAccount.value!.nymID,
followedAccount.value!.nymName,
followedAccount.value!.codes.first.code,
followedAccount.value!.codes.first.segwit,
followedAccount.value!.nonSegwitPaymentCode.code,
followedAccount.value!.segwit,
),
);
@ -169,8 +167,7 @@ class _PaynymFollowToggleButtonState
.read(paynymAPIProvider)
.nym(widget.paymentCodeStringToFollow, true);
final myPCode =
await wallet.getPaymentCode(DerivePathTypeExt.primaryFor(manager.coin));
final myPCode = await wallet.getPaymentCode(isSegwit: false);
PaynymResponse<String> token =
await ref.read(paynymAPIProvider).token(myPCode.toString());
@ -178,8 +175,8 @@ class _PaynymFollowToggleButtonState
// sign token with notification private key
String signature = await wallet.signStringWithNotificationKey(token.value!);
var result = await ref.read(paynymAPIProvider).unfollow(
token.value!, signature, followedAccount.value!.codes.first.code);
var result = await ref.read(paynymAPIProvider).unfollow(token.value!,
signature, followedAccount.value!.nonSegwitPaymentCode.code);
int i = 0;
for (;
@ -191,8 +188,8 @@ class _PaynymFollowToggleButtonState
// sign token with notification private key
signature = await wallet.signStringWithNotificationKey(token.value!);
result = await ref.read(paynymAPIProvider).unfollow(
token.value!, signature, followedAccount.value!.codes.first.code);
result = await ref.read(paynymAPIProvider).unfollow(token.value!,
signature, followedAccount.value!.nonSegwitPaymentCode.code);
await Future<void>.delayed(const Duration(milliseconds: 200));
print("unfollow RRR result: $result");
}

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
@ -266,6 +267,7 @@ class PinKeyboard extends StatelessWidget {
void _numberHandler(String number) {
onNumberKeyPressed.call(number);
HapticFeedback.lightImpact();
}
@override

View file

@ -111,11 +111,11 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "48dd65f88822fba8543826274f6d51c17f735f93"
resolved-ref: "48dd65f88822fba8543826274f6d51c17f735f93"
ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9"
resolved-ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9"
url: "https://github.com/cypherstack/bip47.git"
source: git
version: "1.0.0"
version: "2.0.0"
bitbox:
dependency: "direct main"
description:

View file

@ -11,7 +11,7 @@ description: Stack Wallet
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.2+162
version: 1.7.4+164
environment:
sdk: ">=2.17.0 <3.0.0"
@ -60,7 +60,7 @@ dependencies:
bip47:
git:
url: https://github.com/cypherstack/bip47.git
ref: 48dd65f88822fba8543826274f6d51c17f735f93
ref: 38847255d035c0f6ec5bc93d19130ec804cf90e9
# Utility plugins
# provider: ^6.0.1
@ -248,7 +248,6 @@ flutter:
- assets/svg/chevron-up.svg
- assets/svg/lock-keyhole.svg
- assets/svg/lock-open.svg
- assets/svg/rotate-exclamation.svg
- assets/svg/folder-down.svg
- assets/svg/network-wired.svg
- assets/svg/network-wired-2.svg
@ -381,6 +380,9 @@ flutter:
# lottie animations
# basic
- assets/lottie/test2.json
- assets/lottie/icon_send.json
- assets/lottie/loader_and_checkmark.json
- assets/lottie/arrow_rotate.json
# gifs
- assets/gif/

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i23;
import 'dart:typed_data' as _i30;
import 'dart:ui' as _i25;
import 'package:bip32/bip32.dart' as _i18;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip47/bip47.dart' as _i19;
import 'package:bitcoindart/bitcoindart.dart' as _i14;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i13;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10;
import 'package:stackwallet/models/balance.dart' as _i12;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i18;
import 'package:stackwallet/models/node_model.dart' as _i26;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i9;
import 'package:stackwallet/models/signing_data.dart' as _i29;
@ -209,8 +209,8 @@ class _FakeTuple2_14<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -219,8 +219,8 @@ class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
);
}
class _FakeBIP32_16 extends _i1.SmartFake implements _i18.BIP32 {
_FakeBIP32_16(
class _FakeAddress_16 extends _i1.SmartFake implements _i18.Address {
_FakeAddress_16(
Object parent,
Invocation parentInvocation,
) : super(
@ -987,16 +987,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
returnValue: _i22.Coin.bitcoin,
) as _i22.Coin);
@override
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i18.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
returnValue: _i23.Future<List<_i18.UTXO>>.value(<_i18.UTXO>[]),
) as _i23.Future<List<_i18.UTXO>>);
@override
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i18.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
_i23.Future<List<_i18.Transaction>>.value(<_i18.Transaction>[]),
) as _i23.Future<List<_i18.Transaction>>);
@override
_i23.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -1342,48 +1342,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
)),
) as _i23.Future<_i10.ElectrumXNode>);
@override
_i23.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i28.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> addDerivations({
required int? chain,
required _i28.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -1448,7 +1406,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i17.UTXO>? utxos,
List<_i18.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -1465,7 +1423,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
));
@override
_i23.Future<List<_i29.SigningData>> fetchBuildTxData(
List<_i17.UTXO>? utxosToUse) =>
List<_i18.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1719,10 +1677,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i23.Future<_i16.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
_i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i17.Address>? myAddresses,
List<_i18.Address>? myAddresses,
_i22.Coin? coin,
int? minConfirms,
String? walletId,
@ -1740,8 +1698,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
],
),
returnValue:
_i23.Future<_i16.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_14<_i17.Transaction, _i17.Address>(
_i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>.value(
_FakeTuple2_14<_i18.Transaction, _i18.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1755,7 +1713,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
],
),
)),
) as _i23.Future<_i16.Tuple2<_i17.Transaction, _i17.Address>>);
) as _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1765,6 +1723,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
required _i13.MainDB? db,
required _i10.ElectrumX? electrumXClient,
required _i7.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i23.Future<String?> Function()? getMnemonicString,
@ -1783,18 +1742,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
})?
prepareSend,
required _i23.Future<int> Function({required String address})? getTxCount,
required _i23.Future<List<_i29.SigningData>> Function(List<_i17.UTXO>)?
required _i23.Future<List<_i29.SigningData>> Function(List<_i18.UTXO>)?
fetchBuildTxData,
required _i23.Future<void> Function()? refresh,
required _i23.Future<void> Function()? checkChangeAddressForTransactions,
required _i23.Future<void> Function({
required String address,
required int chain,
required _i28.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1808,6 +1759,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1821,34 +1773,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i23.Future<_i17.Address> currentReceivingPaynymAddress(
_i19.PaymentCode? sender) =>
_i23.Future<_i17.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i23.Future<_i17.BIP32>);
@override
_i23.Future<_i30.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)),
) as _i23.Future<_i30.Uint8List>);
@override
_i23.Future<_i18.Address> currentReceivingPaynymAddress({
required _i19.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i23.Future<_i17.Address>);
) as _i23.Future<_i18.Address>);
@override
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i19.PaymentCode? sender) =>
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i19.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
@ -1864,73 +1861,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i18.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i23.Future<_i17.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i23.Future<_i18.BIP32>.value(_FakeBIP32_16(
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i23.Future<_i18.BIP32>);
) as _i23.Future<_i17.BIP32>);
@override
_i23.Future<_i18.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i23.Future<_i18.BIP32>.value(_FakeBIP32_16(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i23.Future<_i18.BIP32>);
@override
_i23.Future<_i19.PaymentCode> getPaymentCode(
_i28.DerivePathType? derivePathType) =>
_i23.Future<_i19.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i23.Future<_i19.PaymentCode>.value(_FakePaymentCode_17(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i23.Future<_i19.PaymentCode>);
@ -1955,6 +1912,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
@override
_i23.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i19.PaymentCode? paymentCode,
required bool? isSegwit,
required _i15.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1964,6 +1922,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1972,9 +1931,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
_i23.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i23.Future<Map<String, dynamic>>);
@override
_i23.Future<_i17.Address> nextUnusedSendAddressFrom({
_i23.Future<_i18.Address> nextUnusedSendAddressFrom({
required _i19.PaymentCode? pCode,
required _i18.BIP32? privateKeyNode,
required bool? isSegwit,
required _i17.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1983,29 +1943,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i23.Future<_i17.Address>);
) as _i23.Future<_i18.Address>);
@override
_i23.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i17.UTXO>? utxos,
List<_i18.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -2042,34 +2004,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
returnValue: _i23.Future<bool>.value(false),
) as _i23.Future<bool>);
@override
_i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i17.Transaction? transaction,
required _i17.Address? myNotificationAddress,
}) =>
_i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i18.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i19.PaymentCode?>.value(),
) as _i23.Future<_i19.PaymentCode?>);
@override
_i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i17.Transaction? transaction,
required _i17.Address? myNotificationAddress,
}) =>
_i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i18.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i19.PaymentCode?>.value(),
) as _i23.Future<_i19.PaymentCode?>);
@ -2114,103 +2066,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> restoreHistoryWith(
_i19.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i23.Future<void> restoreHistoryWith({
required _i19.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i17.Address> generatePaynymSendAddressFromKeyPair({
required _i14.ECPair? pair,
required int? derivationIndex,
required _i28.DerivePathType? derivePathType,
required _i19.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i23.Future<_i17.Address>);
@override
_i23.Future<_i17.Address> generatePaynymReceivingAddressFromKeyPair({
required _i14.ECPair? pair,
required int? derivationIndex,
required _i28.DerivePathType? derivePathType,
required _i19.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i23.Future<_i17.Address>);
@override
_i23.Future<_i17.Address> getMyNotificationAddress(
_i28.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i23.Future<_i18.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i23.Future<_i17.Address>);
) as _i23.Future<_i18.Address>);
@override
_i23.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(
@ -2847,16 +2736,16 @@ class MockManager extends _i1.Mock implements _i6.Manager {
),
) as _i12.Balance);
@override
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i18.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
_i23.Future<List<_i18.Transaction>>.value(<_i18.Transaction>[]),
) as _i23.Future<List<_i18.Transaction>>);
@override
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i18.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
returnValue: _i23.Future<List<_i18.UTXO>>.value(<_i18.UTXO>[]),
) as _i23.Future<List<_i18.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -3215,16 +3104,16 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI {
),
) as _i12.Balance);
@override
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i18.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
_i23.Future<List<_i18.Transaction>>.value(<_i18.Transaction>[]),
) as _i23.Future<List<_i18.Transaction>>);
@override
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i18.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
returnValue: _i23.Future<List<_i18.UTXO>>.value(<_i18.UTXO>[]),
) as _i23.Future<List<_i18.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i23;
import 'dart:typed_data' as _i29;
import 'dart:ui' as _i25;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip32/bip32.dart' as _i16;
import 'package:bip47/bip47.dart' as _i18;
import 'package:bitcoindart/bitcoindart.dart' as _i13;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i12;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9;
import 'package:stackwallet/models/balance.dart' as _i11;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/node_model.dart' as _i31;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8;
import 'package:stackwallet/models/signing_data.dart' as _i28;
@ -194,8 +194,8 @@ class _FakeTuple2_13<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
_FakeAddress_14(
class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 {
_FakeBIP32_14(
Object parent,
Invocation parentInvocation,
) : super(
@ -204,8 +204,8 @@ class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
);
}
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -779,16 +779,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i22.Coin.bitcoin,
) as _i22.Coin);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -1133,48 +1133,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
)),
) as _i23.Future<_i9.ElectrumXNode>);
@override
_i23.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i27.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> addDerivations({
required int? chain,
required _i27.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -1239,7 +1197,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -1256,7 +1214,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
));
@override
_i23.Future<List<_i28.SigningData>> fetchBuildTxData(
List<_i16.UTXO>? utxosToUse) =>
List<_i17.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1510,10 +1468,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>> parseTransaction(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i16.Address>? myAddresses,
List<_i17.Address>? myAddresses,
_i22.Coin? coin,
int? minConfirms,
String? walletId,
@ -1531,8 +1489,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
returnValue:
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>.value(
_FakeTuple2_13<_i16.Transaction, _i16.Address>(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_13<_i17.Transaction, _i17.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1546,7 +1504,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
)),
) as _i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>);
) as _i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1556,6 +1514,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required _i12.MainDB? db,
required _i9.ElectrumX? electrumXClient,
required _i19.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i23.Future<String?> Function()? getMnemonicString,
@ -1574,18 +1533,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
})?
prepareSend,
required _i23.Future<int> Function({required String address})? getTxCount,
required _i23.Future<List<_i28.SigningData>> Function(List<_i16.UTXO>)?
required _i23.Future<List<_i28.SigningData>> Function(List<_i17.UTXO>)?
fetchBuildTxData,
required _i23.Future<void> Function()? refresh,
required _i23.Future<void> Function()? checkChangeAddressForTransactions,
required _i23.Future<void> Function({
required String address,
required int chain,
required _i27.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1599,6 +1550,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1612,34 +1564,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i23.Future<_i16.Address> currentReceivingPaynymAddress(
_i18.PaymentCode? sender) =>
_i23.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)),
) as _i23.Future<_i29.Uint8List>);
@override
_i23.Future<_i17.Address> currentReceivingPaynymAddress({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i18.PaymentCode? sender) =>
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
@ -1655,73 +1652,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i17.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i23.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i23.Future<_i17.BIP32>);
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i17.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i23.Future<_i17.BIP32>);
@override
_i23.Future<_i18.PaymentCode> getPaymentCode(
_i27.DerivePathType? derivePathType) =>
_i23.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i23.Future<_i18.PaymentCode>.value(_FakePaymentCode_16(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i23.Future<_i18.PaymentCode>);
@ -1746,6 +1703,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
@override
_i23.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i18.PaymentCode? paymentCode,
required bool? isSegwit,
required _i14.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1755,6 +1713,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1763,9 +1722,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
_i23.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i23.Future<Map<String, dynamic>>);
@override
_i23.Future<_i16.Address> nextUnusedSendAddressFrom({
_i23.Future<_i17.Address> nextUnusedSendAddressFrom({
required _i18.PaymentCode? pCode,
required _i17.BIP32? privateKeyNode,
required bool? isSegwit,
required _i16.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1774,29 +1734,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -1833,34 +1795,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i23.Future<bool>.value(false),
) as _i23.Future<bool>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@ -1905,103 +1857,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> restoreHistoryWith(
_i18.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i23.Future<void> restoreHistoryWith({
required _i18.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i16.Address> generatePaynymSendAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> generatePaynymReceivingAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> getMyNotificationAddress(
_i27.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i23.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(
@ -2421,16 +2310,16 @@ class MockManager extends _i1.Mock implements _i6.Manager {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -2789,16 +2678,16 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i22;
import 'dart:typed_data' as _i29;
import 'dart:ui' as _i24;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip32/bip32.dart' as _i16;
import 'package:bip47/bip47.dart' as _i18;
import 'package:bitcoindart/bitcoindart.dart' as _i13;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i12;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9;
import 'package:stackwallet/models/balance.dart' as _i11;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8;
import 'package:stackwallet/models/signing_data.dart' as _i27;
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i25;
@ -192,8 +192,8 @@ class _FakeTuple2_13<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
_FakeAddress_14(
class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 {
_FakeBIP32_14(
Object parent,
Invocation parentInvocation,
) : super(
@ -202,8 +202,8 @@ class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
);
}
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -766,16 +766,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
returnValue: _i21.Coin.bitcoin,
) as _i21.Coin);
@override
_i22.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i22.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i22.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i22.Future<List<_i16.UTXO>>);
returnValue: _i22.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i22.Future<List<_i17.UTXO>>);
@override
_i22.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i22.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i22.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i22.Future<List<_i16.Transaction>>);
_i22.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i22.Future<List<_i17.Transaction>>);
@override
_i22.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -1120,48 +1120,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
)),
) as _i22.Future<_i9.ElectrumXNode>);
@override
_i22.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i26.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i22.Future<void>.value(),
returnValueForMissingStub: _i22.Future<void>.value(),
) as _i22.Future<void>);
@override
_i22.Future<void> addDerivations({
required int? chain,
required _i26.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i22.Future<void>.value(),
returnValueForMissingStub: _i22.Future<void>.value(),
) as _i22.Future<void>);
@override
_i22.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -1226,7 +1184,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -1243,7 +1201,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
));
@override
_i22.Future<List<_i27.SigningData>> fetchBuildTxData(
List<_i16.UTXO>? utxosToUse) =>
List<_i17.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1497,10 +1455,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i22.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>> parseTransaction(
_i22.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i16.Address>? myAddresses,
List<_i17.Address>? myAddresses,
_i21.Coin? coin,
int? minConfirms,
String? walletId,
@ -1518,8 +1476,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
],
),
returnValue:
_i22.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>.value(
_FakeTuple2_13<_i16.Transaction, _i16.Address>(
_i22.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_13<_i17.Transaction, _i17.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1533,7 +1491,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
],
),
)),
) as _i22.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>);
) as _i22.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1543,6 +1501,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
required _i12.MainDB? db,
required _i9.ElectrumX? electrumXClient,
required _i28.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i22.Future<String?> Function()? getMnemonicString,
@ -1561,18 +1520,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
})?
prepareSend,
required _i22.Future<int> Function({required String address})? getTxCount,
required _i22.Future<List<_i27.SigningData>> Function(List<_i16.UTXO>)?
required _i22.Future<List<_i27.SigningData>> Function(List<_i17.UTXO>)?
fetchBuildTxData,
required _i22.Future<void> Function()? refresh,
required _i22.Future<void> Function()? checkChangeAddressForTransactions,
required _i22.Future<void> Function({
required String address,
required int chain,
required _i26.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1586,6 +1537,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1599,34 +1551,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i22.Future<_i16.Address> currentReceivingPaynymAddress(
_i18.PaymentCode? sender) =>
_i22.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i22.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i22.Future<_i16.BIP32>);
@override
_i22.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i22.Future<_i29.Uint8List>.value(_i29.Uint8List(0)),
) as _i22.Future<_i29.Uint8List>);
@override
_i22.Future<_i17.Address> currentReceivingPaynymAddress({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i22.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i22.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i22.Future<_i16.Address>);
) as _i22.Future<_i17.Address>);
@override
_i22.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i18.PaymentCode? sender) =>
_i22.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i22.Future<void>.value(),
returnValueForMissingStub: _i22.Future<void>.value(),
@ -1642,73 +1639,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
returnValueForMissingStub: _i22.Future<void>.value(),
) as _i22.Future<void>);
@override
_i22.Future<_i17.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i22.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i22.Future<_i17.BIP32>.value(_FakeBIP32_15(
returnValue: _i22.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i22.Future<_i17.BIP32>);
) as _i22.Future<_i16.BIP32>);
@override
_i22.Future<_i17.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i22.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i22.Future<_i17.BIP32>);
@override
_i22.Future<_i18.PaymentCode> getPaymentCode(
_i26.DerivePathType? derivePathType) =>
_i22.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i22.Future<_i18.PaymentCode>.value(_FakePaymentCode_16(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i22.Future<_i18.PaymentCode>);
@ -1733,6 +1690,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
@override
_i22.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i18.PaymentCode? paymentCode,
required bool? isSegwit,
required _i14.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1742,6 +1700,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1750,9 +1709,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
_i22.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i22.Future<Map<String, dynamic>>);
@override
_i22.Future<_i16.Address> nextUnusedSendAddressFrom({
_i22.Future<_i17.Address> nextUnusedSendAddressFrom({
required _i18.PaymentCode? pCode,
required _i17.BIP32? privateKeyNode,
required bool? isSegwit,
required _i16.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1761,29 +1721,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i22.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i22.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i22.Future<_i16.Address>);
) as _i22.Future<_i17.Address>);
@override
_i22.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -1820,34 +1782,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
returnValue: _i22.Future<bool>.value(false),
) as _i22.Future<bool>);
@override
_i22.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i22.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i22.Future<_i18.PaymentCode?>.value(),
) as _i22.Future<_i18.PaymentCode?>);
@override
_i22.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i22.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i22.Future<_i18.PaymentCode?>.value(),
) as _i22.Future<_i18.PaymentCode?>);
@ -1892,103 +1844,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet {
returnValueForMissingStub: _i22.Future<void>.value(),
) as _i22.Future<void>);
@override
_i22.Future<void> restoreHistoryWith(
_i18.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i22.Future<void> restoreHistoryWith({
required _i18.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i22.Future<void>.value(),
returnValueForMissingStub: _i22.Future<void>.value(),
) as _i22.Future<void>);
@override
_i22.Future<_i16.Address> generatePaynymSendAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i26.DerivePathType? derivePathType,
required _i18.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i22.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i22.Future<_i16.Address>);
@override
_i22.Future<_i16.Address> generatePaynymReceivingAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i26.DerivePathType? derivePathType,
required _i18.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i22.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i22.Future<_i16.Address>);
@override
_i22.Future<_i16.Address> getMyNotificationAddress(
_i26.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i22.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i22.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i22.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i22.Future<_i16.Address>);
) as _i22.Future<_i17.Address>);
@override
_i22.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(
@ -2146,16 +2035,16 @@ class MockManager extends _i1.Mock implements _i6.Manager {
),
) as _i11.Balance);
@override
_i22.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i22.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i22.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i22.Future<List<_i16.Transaction>>);
_i22.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i22.Future<List<_i17.Transaction>>);
@override
_i22.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i22.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i22.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i22.Future<List<_i16.UTXO>>);
returnValue: _i22.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i22.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -2514,16 +2403,16 @@ class MockCoinServiceAPI extends _i1.Mock implements _i19.CoinServiceAPI {
),
) as _i11.Balance);
@override
_i22.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i22.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i22.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i22.Future<List<_i16.Transaction>>);
_i22.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i22.Future<List<_i17.Transaction>>);
@override
_i22.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i22.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i22.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i22.Future<List<_i16.UTXO>>);
returnValue: _i22.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i22.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i21;
import 'dart:typed_data' as _i28;
import 'dart:ui' as _i23;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip32/bip32.dart' as _i16;
import 'package:bip47/bip47.dart' as _i18;
import 'package:bitcoindart/bitcoindart.dart' as _i13;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i12;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9;
import 'package:stackwallet/models/balance.dart' as _i11;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8;
import 'package:stackwallet/models/signing_data.dart' as _i26;
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i24;
@ -192,8 +192,8 @@ class _FakeTuple2_13<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
_FakeAddress_14(
class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 {
_FakeBIP32_14(
Object parent,
Invocation parentInvocation,
) : super(
@ -202,8 +202,8 @@ class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
);
}
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -521,16 +521,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
returnValue: _i20.Coin.bitcoin,
) as _i20.Coin);
@override
_i21.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i21.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i21.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i21.Future<List<_i16.UTXO>>);
returnValue: _i21.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i21.Future<List<_i17.UTXO>>);
@override
_i21.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i21.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i21.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i21.Future<List<_i16.Transaction>>);
_i21.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i21.Future<List<_i17.Transaction>>);
@override
_i21.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -875,48 +875,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
)),
) as _i21.Future<_i9.ElectrumXNode>);
@override
_i21.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i25.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i21.Future<void>.value(),
returnValueForMissingStub: _i21.Future<void>.value(),
) as _i21.Future<void>);
@override
_i21.Future<void> addDerivations({
required int? chain,
required _i25.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i21.Future<void>.value(),
returnValueForMissingStub: _i21.Future<void>.value(),
) as _i21.Future<void>);
@override
_i21.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -981,7 +939,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -998,7 +956,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
));
@override
_i21.Future<List<_i26.SigningData>> fetchBuildTxData(
List<_i16.UTXO>? utxosToUse) =>
List<_i17.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1252,10 +1210,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i21.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>> parseTransaction(
_i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i16.Address>? myAddresses,
List<_i17.Address>? myAddresses,
_i20.Coin? coin,
int? minConfirms,
String? walletId,
@ -1273,8 +1231,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
],
),
returnValue:
_i21.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>.value(
_FakeTuple2_13<_i16.Transaction, _i16.Address>(
_i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_13<_i17.Transaction, _i17.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1288,7 +1246,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
],
),
)),
) as _i21.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>);
) as _i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1298,6 +1256,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
required _i12.MainDB? db,
required _i9.ElectrumX? electrumXClient,
required _i27.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i21.Future<String?> Function()? getMnemonicString,
@ -1316,18 +1275,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
})?
prepareSend,
required _i21.Future<int> Function({required String address})? getTxCount,
required _i21.Future<List<_i26.SigningData>> Function(List<_i16.UTXO>)?
required _i21.Future<List<_i26.SigningData>> Function(List<_i17.UTXO>)?
fetchBuildTxData,
required _i21.Future<void> Function()? refresh,
required _i21.Future<void> Function()? checkChangeAddressForTransactions,
required _i21.Future<void> Function({
required String address,
required int chain,
required _i25.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1341,6 +1292,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1354,34 +1306,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i21.Future<_i16.Address> currentReceivingPaynymAddress(
_i18.PaymentCode? sender) =>
_i21.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i21.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i21.Future<_i16.BIP32>);
@override
_i21.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i21.Future<_i28.Uint8List>.value(_i28.Uint8List(0)),
) as _i21.Future<_i28.Uint8List>);
@override
_i21.Future<_i17.Address> currentReceivingPaynymAddress({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i21.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i21.Future<_i16.Address>);
) as _i21.Future<_i17.Address>);
@override
_i21.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i18.PaymentCode? sender) =>
_i21.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i21.Future<void>.value(),
returnValueForMissingStub: _i21.Future<void>.value(),
@ -1397,73 +1394,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
returnValueForMissingStub: _i21.Future<void>.value(),
) as _i21.Future<void>);
@override
_i21.Future<_i17.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i21.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i21.Future<_i17.BIP32>.value(_FakeBIP32_15(
returnValue: _i21.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i21.Future<_i17.BIP32>);
) as _i21.Future<_i16.BIP32>);
@override
_i21.Future<_i17.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i21.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i21.Future<_i17.BIP32>);
@override
_i21.Future<_i18.PaymentCode> getPaymentCode(
_i25.DerivePathType? derivePathType) =>
_i21.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i21.Future<_i18.PaymentCode>.value(_FakePaymentCode_16(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i21.Future<_i18.PaymentCode>);
@ -1488,6 +1445,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
@override
_i21.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i18.PaymentCode? paymentCode,
required bool? isSegwit,
required _i14.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1497,6 +1455,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1505,9 +1464,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
_i21.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i21.Future<Map<String, dynamic>>);
@override
_i21.Future<_i16.Address> nextUnusedSendAddressFrom({
_i21.Future<_i17.Address> nextUnusedSendAddressFrom({
required _i18.PaymentCode? pCode,
required _i17.BIP32? privateKeyNode,
required bool? isSegwit,
required _i16.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1516,29 +1476,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i21.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i21.Future<_i16.Address>);
) as _i21.Future<_i17.Address>);
@override
_i21.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -1575,34 +1537,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
returnValue: _i21.Future<bool>.value(false),
) as _i21.Future<bool>);
@override
_i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i21.Future<_i18.PaymentCode?>.value(),
) as _i21.Future<_i18.PaymentCode?>);
@override
_i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i21.Future<_i18.PaymentCode?>.value(),
) as _i21.Future<_i18.PaymentCode?>);
@ -1647,103 +1599,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet {
returnValueForMissingStub: _i21.Future<void>.value(),
) as _i21.Future<void>);
@override
_i21.Future<void> restoreHistoryWith(
_i18.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i21.Future<void> restoreHistoryWith({
required _i18.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i21.Future<void>.value(),
returnValueForMissingStub: _i21.Future<void>.value(),
) as _i21.Future<void>);
@override
_i21.Future<_i16.Address> generatePaynymSendAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i25.DerivePathType? derivePathType,
required _i18.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i21.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i21.Future<_i16.Address>);
@override
_i21.Future<_i16.Address> generatePaynymReceivingAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i25.DerivePathType? derivePathType,
required _i18.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i21.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i21.Future<_i16.Address>);
@override
_i21.Future<_i16.Address> getMyNotificationAddress(
_i25.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i21.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i21.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i21.Future<_i16.Address>);
) as _i21.Future<_i17.Address>);
@override
_i21.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i23;
import 'dart:typed_data' as _i29;
import 'dart:ui' as _i25;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip32/bip32.dart' as _i16;
import 'package:bip47/bip47.dart' as _i18;
import 'package:bitcoindart/bitcoindart.dart' as _i13;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i12;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9;
import 'package:stackwallet/models/balance.dart' as _i11;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/node_model.dart' as _i30;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8;
import 'package:stackwallet/models/signing_data.dart' as _i28;
@ -193,8 +193,8 @@ class _FakeTuple2_13<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
_FakeAddress_14(
class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 {
_FakeBIP32_14(
Object parent,
Invocation parentInvocation,
) : super(
@ -203,8 +203,8 @@ class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
);
}
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -778,16 +778,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i22.Coin.bitcoin,
) as _i22.Coin);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -1132,48 +1132,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
)),
) as _i23.Future<_i9.ElectrumXNode>);
@override
_i23.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i27.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> addDerivations({
required int? chain,
required _i27.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -1238,7 +1196,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -1255,7 +1213,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
));
@override
_i23.Future<List<_i28.SigningData>> fetchBuildTxData(
List<_i16.UTXO>? utxosToUse) =>
List<_i17.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1509,10 +1467,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>> parseTransaction(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i16.Address>? myAddresses,
List<_i17.Address>? myAddresses,
_i22.Coin? coin,
int? minConfirms,
String? walletId,
@ -1530,8 +1488,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
returnValue:
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>.value(
_FakeTuple2_13<_i16.Transaction, _i16.Address>(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_13<_i17.Transaction, _i17.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1545,7 +1503,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
)),
) as _i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>);
) as _i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1555,6 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required _i12.MainDB? db,
required _i9.ElectrumX? electrumXClient,
required _i19.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i23.Future<String?> Function()? getMnemonicString,
@ -1573,18 +1532,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
})?
prepareSend,
required _i23.Future<int> Function({required String address})? getTxCount,
required _i23.Future<List<_i28.SigningData>> Function(List<_i16.UTXO>)?
required _i23.Future<List<_i28.SigningData>> Function(List<_i17.UTXO>)?
fetchBuildTxData,
required _i23.Future<void> Function()? refresh,
required _i23.Future<void> Function()? checkChangeAddressForTransactions,
required _i23.Future<void> Function({
required String address,
required int chain,
required _i27.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1598,6 +1549,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1611,34 +1563,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i23.Future<_i16.Address> currentReceivingPaynymAddress(
_i18.PaymentCode? sender) =>
_i23.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)),
) as _i23.Future<_i29.Uint8List>);
@override
_i23.Future<_i17.Address> currentReceivingPaynymAddress({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i18.PaymentCode? sender) =>
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
@ -1654,73 +1651,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i17.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i23.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i23.Future<_i17.BIP32>);
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i17.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i23.Future<_i17.BIP32>);
@override
_i23.Future<_i18.PaymentCode> getPaymentCode(
_i27.DerivePathType? derivePathType) =>
_i23.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i23.Future<_i18.PaymentCode>.value(_FakePaymentCode_16(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i23.Future<_i18.PaymentCode>);
@ -1745,6 +1702,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
@override
_i23.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i18.PaymentCode? paymentCode,
required bool? isSegwit,
required _i14.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1754,6 +1712,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1762,9 +1721,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
_i23.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i23.Future<Map<String, dynamic>>);
@override
_i23.Future<_i16.Address> nextUnusedSendAddressFrom({
_i23.Future<_i17.Address> nextUnusedSendAddressFrom({
required _i18.PaymentCode? pCode,
required _i17.BIP32? privateKeyNode,
required bool? isSegwit,
required _i16.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1773,29 +1733,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -1832,34 +1794,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i23.Future<bool>.value(false),
) as _i23.Future<bool>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@ -1904,103 +1856,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> restoreHistoryWith(
_i18.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i23.Future<void> restoreHistoryWith({
required _i18.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i16.Address> generatePaynymSendAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> generatePaynymReceivingAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> getMyNotificationAddress(
_i27.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i23.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(
@ -2358,16 +2247,16 @@ class MockManager extends _i1.Mock implements _i6.Manager {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -2726,16 +2615,16 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(

View file

@ -7,7 +7,7 @@ import 'dart:async' as _i23;
import 'dart:typed_data' as _i29;
import 'dart:ui' as _i25;
import 'package:bip32/bip32.dart' as _i17;
import 'package:bip32/bip32.dart' as _i16;
import 'package:bip47/bip47.dart' as _i18;
import 'package:bitcoindart/bitcoindart.dart' as _i13;
import 'package:flutter/foundation.dart' as _i4;
@ -17,7 +17,7 @@ import 'package:stackwallet/db/isar/main_db.dart' as _i12;
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10;
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9;
import 'package:stackwallet/models/balance.dart' as _i11;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16;
import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17;
import 'package:stackwallet/models/node_model.dart' as _i30;
import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8;
import 'package:stackwallet/models/signing_data.dart' as _i28;
@ -193,8 +193,8 @@ class _FakeTuple2_13<T1, T2> extends _i1.SmartFake
);
}
class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
_FakeAddress_14(
class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 {
_FakeBIP32_14(
Object parent,
Invocation parentInvocation,
) : super(
@ -203,8 +203,8 @@ class _FakeAddress_14 extends _i1.SmartFake implements _i16.Address {
);
}
class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 {
_FakeBIP32_15(
class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address {
_FakeAddress_15(
Object parent,
Invocation parentInvocation,
) : super(
@ -778,16 +778,16 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i22.Coin.bitcoin,
) as _i22.Coin);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<String> get currentReceivingAddress => (super.noSuchMethod(
Invocation.getter(#currentReceivingAddress),
@ -1132,48 +1132,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
)),
) as _i23.Future<_i9.ElectrumXNode>);
@override
_i23.Future<void> addDerivation({
required int? chain,
required String? address,
required String? pubKey,
required String? wif,
required _i27.DerivePathType? derivePathType,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivation,
[],
{
#chain: chain,
#address: address,
#pubKey: pubKey,
#wif: wif,
#derivePathType: derivePathType,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> addDerivations({
required int? chain,
required _i27.DerivePathType? derivePathType,
required Map<String, dynamic>? derivationsToAdd,
}) =>
(super.noSuchMethod(
Invocation.method(
#addDerivations,
[],
{
#chain: chain,
#derivePathType: derivePathType,
#derivationsToAdd: derivationsToAdd,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<List<Map<String, dynamic>>> fastFetch(
List<String>? allTxHashes) =>
(super.noSuchMethod(
@ -1238,7 +1196,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required bool? coinControl,
required bool? isSendAll,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
super.noSuchMethod(Invocation.method(
#coinSelection,
@ -1255,7 +1213,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
));
@override
_i23.Future<List<_i28.SigningData>> fetchBuildTxData(
List<_i16.UTXO>? utxosToUse) =>
List<_i17.UTXO>? utxosToUse) =>
(super.noSuchMethod(
Invocation.method(
#fetchBuildTxData,
@ -1509,10 +1467,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: null,
);
@override
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>> parseTransaction(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction(
Map<String, dynamic>? txData,
dynamic electrumxClient,
List<_i16.Address>? myAddresses,
List<_i17.Address>? myAddresses,
_i22.Coin? coin,
int? minConfirms,
String? walletId,
@ -1530,8 +1488,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
returnValue:
_i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>.value(
_FakeTuple2_13<_i16.Transaction, _i16.Address>(
_i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value(
_FakeTuple2_13<_i17.Transaction, _i17.Address>(
this,
Invocation.method(
#parseTransaction,
@ -1545,7 +1503,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
],
),
)),
) as _i23.Future<_i15.Tuple2<_i16.Transaction, _i16.Address>>);
) as _i23.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>);
@override
void initPaynymWalletInterface({
required String? walletId,
@ -1555,6 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
required _i12.MainDB? db,
required _i9.ElectrumX? electrumXClient,
required _i19.SecureStorageInterface? secureStorage,
required int? dustLimit,
required int? dustLimitP2PKH,
required int? minConfirms,
required _i23.Future<String?> Function()? getMnemonicString,
@ -1573,18 +1532,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
})?
prepareSend,
required _i23.Future<int> Function({required String address})? getTxCount,
required _i23.Future<List<_i28.SigningData>> Function(List<_i16.UTXO>)?
required _i23.Future<List<_i28.SigningData>> Function(List<_i17.UTXO>)?
fetchBuildTxData,
required _i23.Future<void> Function()? refresh,
required _i23.Future<void> Function()? checkChangeAddressForTransactions,
required _i23.Future<void> Function({
required String address,
required int chain,
required _i27.DerivePathType derivePathType,
required String pubKey,
required String wif,
})?
addDerivation,
}) =>
super.noSuchMethod(
Invocation.method(
@ -1598,6 +1549,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#db: db,
#electrumXClient: electrumXClient,
#secureStorage: secureStorage,
#dustLimit: dustLimit,
#dustLimitP2PKH: dustLimitP2PKH,
#minConfirms: minConfirms,
#getMnemonicString: getMnemonicString,
@ -1611,34 +1563,79 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
#refresh: refresh,
#checkChangeAddressForTransactions:
checkChangeAddressForTransactions,
#addDerivation: addDerivation,
},
),
returnValueForMissingStub: null,
);
@override
_i23.Future<_i16.Address> currentReceivingPaynymAddress(
_i18.PaymentCode? sender) =>
_i23.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod(
Invocation.method(
#getBip47BaseNode,
[],
),
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#getBip47BaseNode,
[],
),
)),
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({
required String? paymentCodeString,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#getPrivateKeyForPaynymReceivingAddress,
[],
{
#paymentCodeString: paymentCodeString,
#index: index,
},
),
returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)),
) as _i23.Future<_i29.Uint8List>);
@override
_i23.Future<_i17.Address> currentReceivingPaynymAddress({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#currentReceivingPaynymAddress,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions(
_i18.PaymentCode? sender) =>
_i23.Future<void> checkCurrentPaynymReceivingAddressForTransactions({
required _i18.PaymentCode? sender,
required bool? isSegwit,
}) =>
(super.noSuchMethod(
Invocation.method(
#checkCurrentPaynymReceivingAddressForTransactions,
[sender],
[],
{
#sender: sender,
#isSegwit: isSegwit,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
@ -1654,73 +1651,33 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i17.BIP32> deriveNotificationBip32Node({
required String? mnemonic,
required String? mnemonicPassphrase,
}) =>
(super.noSuchMethod(
_i23.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod(
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
returnValue: _i23.Future<_i16.BIP32>.value(_FakeBIP32_14(
this,
Invocation.method(
#deriveNotificationBip32Node,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
},
),
)),
) as _i23.Future<_i17.BIP32>);
) as _i23.Future<_i16.BIP32>);
@override
_i23.Future<_i17.BIP32> deriveReceivingPrivateKeyNode({
required String? mnemonic,
required String? mnemonicPassphrase,
required int? index,
}) =>
(super.noSuchMethod(
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15(
this,
Invocation.method(
#deriveReceivingPrivateKeyNode,
[],
{
#mnemonic: mnemonic,
#mnemonicPassphrase: mnemonicPassphrase,
#index: index,
},
),
)),
) as _i23.Future<_i17.BIP32>);
@override
_i23.Future<_i18.PaymentCode> getPaymentCode(
_i27.DerivePathType? derivePathType) =>
_i23.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) =>
(super.noSuchMethod(
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
returnValue: _i23.Future<_i18.PaymentCode>.value(_FakePaymentCode_16(
this,
Invocation.method(
#getPaymentCode,
[derivePathType],
[],
{#isSegwit: isSegwit},
),
)),
) as _i23.Future<_i18.PaymentCode>);
@ -1745,6 +1702,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
@override
_i23.Future<Map<String, dynamic>> preparePaymentCodeSend({
required _i18.PaymentCode? paymentCode,
required bool? isSegwit,
required _i14.Amount? amount,
Map<String, dynamic>? args,
}) =>
@ -1754,6 +1712,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#paymentCode: paymentCode,
#isSegwit: isSegwit,
#amount: amount,
#args: args,
},
@ -1762,9 +1721,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
_i23.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
) as _i23.Future<Map<String, dynamic>>);
@override
_i23.Future<_i16.Address> nextUnusedSendAddressFrom({
_i23.Future<_i17.Address> nextUnusedSendAddressFrom({
required _i18.PaymentCode? pCode,
required _i17.BIP32? privateKeyNode,
required bool? isSegwit,
required _i16.BIP32? privateKeyNode,
int? startIndex = 0,
}) =>
(super.noSuchMethod(
@ -1773,29 +1733,31 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#nextUnusedSendAddressFrom,
[],
{
#pCode: pCode,
#isSegwit: isSegwit,
#privateKeyNode: privateKeyNode,
#startIndex: startIndex,
},
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<Map<String, dynamic>> prepareNotificationTx({
required int? selectedTxFeeRate,
required String? targetPaymentCodeString,
int? additionalOutputs = 0,
List<_i16.UTXO>? utxos,
List<_i17.UTXO>? utxos,
}) =>
(super.noSuchMethod(
Invocation.method(
@ -1832,34 +1794,24 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValue: _i23.Future<bool>.value(false),
) as _i23.Future<bool>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransaction,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@override
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad({
required _i16.Transaction? transaction,
required _i16.Address? myNotificationAddress,
}) =>
_i23.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad(
{required _i17.Transaction? transaction}) =>
(super.noSuchMethod(
Invocation.method(
#unBlindedPaymentCodeFromTransactionBad,
[],
{
#transaction: transaction,
#myNotificationAddress: myNotificationAddress,
},
{#transaction: transaction},
),
returnValue: _i23.Future<_i18.PaymentCode?>.value(),
) as _i23.Future<_i18.PaymentCode?>);
@ -1904,103 +1856,40 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet {
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<void> restoreHistoryWith(
_i18.PaymentCode? other,
int? maxUnusedAddressGap,
int? maxNumberOfIndexesToCheck,
) =>
_i23.Future<void> restoreHistoryWith({
required _i18.PaymentCode? other,
required bool? checkSegwitAsWell,
required int? maxUnusedAddressGap,
required int? maxNumberOfIndexesToCheck,
}) =>
(super.noSuchMethod(
Invocation.method(
#restoreHistoryWith,
[
other,
maxUnusedAddressGap,
maxNumberOfIndexesToCheck,
],
[],
{
#other: other,
#checkSegwitAsWell: checkSegwitAsWell,
#maxUnusedAddressGap: maxUnusedAddressGap,
#maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
},
),
returnValue: _i23.Future<void>.value(),
returnValueForMissingStub: _i23.Future<void>.value(),
) as _i23.Future<void>);
@override
_i23.Future<_i16.Address> generatePaynymSendAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? toPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymSendAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#toPaymentCode: toPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> generatePaynymReceivingAddressFromKeyPair({
required _i13.ECPair? pair,
required int? derivationIndex,
required _i27.DerivePathType? derivePathType,
required _i18.PaymentCode? fromPaymentCode,
}) =>
(super.noSuchMethod(
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
this,
Invocation.method(
#generatePaynymReceivingAddressFromKeyPair,
[],
{
#pair: pair,
#derivationIndex: derivationIndex,
#derivePathType: derivePathType,
#fromPaymentCode: fromPaymentCode,
},
),
)),
) as _i23.Future<_i16.Address>);
@override
_i23.Future<_i16.Address> getMyNotificationAddress(
_i27.DerivePathType? derivePathType) =>
(super.noSuchMethod(
_i23.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod(
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
returnValue: _i23.Future<_i16.Address>.value(_FakeAddress_14(
returnValue: _i23.Future<_i17.Address>.value(_FakeAddress_15(
this,
Invocation.method(
#getMyNotificationAddress,
[derivePathType],
[],
),
)),
) as _i23.Future<_i16.Address>);
) as _i23.Future<_i17.Address>);
@override
_i23.Future<List<String>> lookupKey(String? paymentCodeString) =>
(super.noSuchMethod(
@ -2358,16 +2247,16 @@ class MockManager extends _i1.Mock implements _i6.Manager {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(
@ -2726,16 +2615,16 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI {
),
) as _i11.Balance);
@override
_i23.Future<List<_i16.Transaction>> get transactions => (super.noSuchMethod(
_i23.Future<List<_i17.Transaction>> get transactions => (super.noSuchMethod(
Invocation.getter(#transactions),
returnValue:
_i23.Future<List<_i16.Transaction>>.value(<_i16.Transaction>[]),
) as _i23.Future<List<_i16.Transaction>>);
_i23.Future<List<_i17.Transaction>>.value(<_i17.Transaction>[]),
) as _i23.Future<List<_i17.Transaction>>);
@override
_i23.Future<List<_i16.UTXO>> get utxos => (super.noSuchMethod(
_i23.Future<List<_i17.UTXO>> get utxos => (super.noSuchMethod(
Invocation.getter(#utxos),
returnValue: _i23.Future<List<_i16.UTXO>>.value(<_i16.UTXO>[]),
) as _i23.Future<List<_i16.UTXO>>);
returnValue: _i23.Future<List<_i17.UTXO>>.value(<_i17.UTXO>[]),
) as _i23.Future<List<_i17.UTXO>>);
@override
set walletName(String? newName) => super.noSuchMethod(
Invocation.setter(