Skip to content

Commit 69017bb

Browse files
authored
Merge pull request #52 from cypherstack/staging
Staging
2 parents 8ce09d7 + 691c4a7 commit 69017bb

File tree

61 files changed

+5020
-1560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5020
-1560
lines changed

README.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
[![codecov](https://codecov.io/gh/cypherstack/stack_wallet/branch/main/graph/badge.svg?token=PM1N56UTEW)](https://codecov.io/gh/cypherstack/stack_wallet)
22

33
# Stack Wallet
4-
put details here
4+
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.
55

66
[![Playstore](https://bluewallet.io/img/play-store-badge.svg)](https://play.google.com/store/apps/details?id=com.cypherstack.stackwallet)
77

88
## Feature List
9-
put features here
9+
10+
Highlights include:
11+
- 5 Different cryptocurrencies
12+
- All private keys and seeds stay on device and are never shared.
13+
- Easy backup and restore feature to save all the information that's important to you.
14+
- Trading cryptocurrencies through our partners.
15+
- Custom address book
16+
- Favorite wallets with fast syncing
17+
- Custom Nodes.
18+
- Open source software.
1019

1120
## Build and run
1221
### Prerequisites
13-
- Flutter 3.0.5
14-
- Flutter SDK Requirement (>=2.12.0, up until <3.0.0)
15-
- Android/iOS dev setup (Android Studio, xCode and subsequent dependencies)
22+
- The only OS supported for building is Ubuntu 20.04
23+
- A machine with at least 100 GB of Storage
24+
- Flutter 3.0.5 [(install manually or with git, do not install with snap)](https://docs.flutter.dev/get-started/install)
25+
- Dart SDK Requirement (>=2.17.0, up until <3.0.0)
26+
- Android setup ([Android Studio](https://developer.android.com/studio) and subsequent dependencies)
1627

1728
After that download the project and init the submodules
1829
```
@@ -21,35 +32,40 @@ cd stack_wallet
2132
git submodule update --init --recursive
2233
```
2334

24-
Building plugins for Android
25-
```
26-
cd crypto_plugins/flutter_liblelantus/scripts/android/
27-
// note if you are on a mac go one directory further to android_on_mac
28-
./build_all.sh
29-
// when finished go back to the root directory
30-
cd ../../../..
35+
You will need to install all dependencies listed in each of the plugins in the crypto_plugins folder. (eg. [Monero](https://github.com/cypherstack/flutter_libmonero), [Epic Cash](https://github.com/cypherstack/flutter_libepiccash) ) as of Sep 8th 2022 that is:
36+
37+
Install [Rust](https://www.rust-lang.org/tools/install)
3138
```
39+
cargo install cargo-ndk
40+
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
3241
33-
Building plugins for IOS
42+
sudo apt install libc6-dev-i386
43+
sudo apt install build-essential cmake git libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev pkg-config llvm
44+
sudo apt install build-essential debhelper cmake libclang-dev libncurses5-dev clang libncursesw5-dev cargo rustc opencl-headers libssl-dev pkg-config ocl-icd-opencl-dev
45+
sudo apt install unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake openjdk-8-jre-headless
46+
```
3447

48+
Building plugins for Android
3549
```
36-
cd crypto_plugins/flutter_liblelantus/scripts/ios/
50+
cd scripts/android/
3751
./build_all.sh
3852
// when finished go back to the root directory
39-
cd ../../../..
53+
cd ../..
4054
```
4155

4256
Building plugins for testing on Linux
4357

4458
```
45-
cd crypto_plugins/flutter_liblelantus/scripts/linux/
59+
cd scripts/linux/
4660
./build_all.sh
4761
// when finished go back to the root directory
48-
cd ../../../..
62+
cd ../..
4963
```
5064

5165
Finally, plug in your android device or use the emulator available via Android Studio and then run the following commands:
5266
```
5367
flutter pub get
5468
flutter run
5569
```
70+
71+
Note on Emulators: Only x86_64 emulators are supported, x86 emulators will not work

assets/svg/share-2.svg

Lines changed: 14 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Loading

assets/svg/tx-icon-anonymize.svg

Lines changed: 16 additions & 0 deletions
Loading

lib/electrumx_rpc/cached_electrumx.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
22
import 'package:stackwallet/hive/db.dart';
3+
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
34
import 'package:stackwallet/utilities/enums/coin_enum.dart';
45
import 'package:stackwallet/utilities/logger.dart';
56
import 'package:stackwallet/utilities/prefs.dart';
@@ -59,6 +60,20 @@ class CachedElectrumX {
5960
"setHash": "",
6061
"coins": <dynamic>[],
6162
};
63+
64+
// try up to 3 times
65+
for (int i = 0; i < 3; i++) {
66+
final result = await getInitialAnonymitySetCache(groupId);
67+
if (result != null) {
68+
set["setHash"] = result["setHash"];
69+
set["blockHash"] = result["blockHash"];
70+
set["coins"] = result["coins"];
71+
Logging.instance.log(
72+
"Populated initial anon set cache for group $groupId",
73+
level: LogLevel.Info);
74+
break;
75+
}
76+
}
6277
} else {
6378
set = Map<String, dynamic>.from(cachedSet);
6479
}

lib/hive/db.dart

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import 'package:stackwallet/models/trade_wallet_lookup.dart';
1010
import 'package:stackwallet/services/wallets_service.dart';
1111
import 'package:stackwallet/utilities/enums/coin_enum.dart';
1212

13+
import 'package:stackwallet/utilities/logger.dart';
14+
1315
class DB {
1416
static const String boxNameAddressBook = "addressBook";
1517
static const String boxNameDebugInfo = "debugInfoBox";
@@ -27,6 +29,7 @@ class DB {
2729
static const String boxNamePrefs = "prefs";
2830
static const String boxNameWalletsToDeleteOnStart = "walletsToDeleteOnStart";
2931
static const String boxNamePriceCache = "priceAPIPrice24hCache";
32+
static const String boxNameDBInfo = "dbInfo";
3033

3134
String boxNameTxCache({required Coin coin}) => "${coin.name}_txCache";
3235
String boxNameSetCache({required Coin coin}) =>
@@ -50,6 +53,7 @@ class DB {
5053
late final Box<xmr.WalletInfo> _walletInfoSource;
5154
late final Box<dynamic> _boxPrefs;
5255
late final Box<TradeWalletLookup> _boxTradeLookup;
56+
late final Box<dynamic> _boxDBInfo;
5357

5458
final Map<String, Box<dynamic>> _walletBoxes = {};
5559

@@ -80,13 +84,40 @@ class DB {
8084
// open hive boxes
8185
Future<void> init() async {
8286
if (!_initialized) {
87+
if (Hive.isBoxOpen(boxNameDBInfo)) {
88+
_boxDBInfo = Hive.box<dynamic>(boxNameDBInfo);
89+
} else {
90+
_boxDBInfo = await Hive.openBox<dynamic>(boxNameDBInfo);
91+
}
8392
await Hive.openBox<String>(boxNameWalletsToDeleteOnStart);
84-
_boxPrefs = await Hive.openBox<dynamic>(boxNamePrefs);
93+
94+
if (Hive.isBoxOpen(boxNamePrefs)) {
95+
_boxPrefs = Hive.box<dynamic>(boxNamePrefs);
96+
} else {
97+
_boxPrefs = await Hive.openBox<dynamic>(boxNamePrefs);
98+
}
99+
85100
_boxAddressBook = await Hive.openBox<dynamic>(boxNameAddressBook);
86101
_boxDebugInfo = await Hive.openBox<String>(boxNameDebugInfo);
87-
_boxNodeModels = await Hive.openBox<NodeModel>(boxNameNodeModels);
88-
_boxPrimaryNodes = await Hive.openBox<NodeModel>(boxNamePrimaryNodes);
89-
_boxAllWalletsData = await Hive.openBox<dynamic>(boxNameAllWalletsData);
102+
103+
if (Hive.isBoxOpen(boxNameNodeModels)) {
104+
_boxNodeModels = Hive.box<NodeModel>(boxNameNodeModels);
105+
} else {
106+
_boxNodeModels = await Hive.openBox<NodeModel>(boxNameNodeModels);
107+
}
108+
109+
if (Hive.isBoxOpen(boxNamePrimaryNodes)) {
110+
_boxPrimaryNodes = Hive.box<NodeModel>(boxNamePrimaryNodes);
111+
} else {
112+
_boxPrimaryNodes = await Hive.openBox<NodeModel>(boxNamePrimaryNodes);
113+
}
114+
115+
if (Hive.isBoxOpen(boxNameAllWalletsData)) {
116+
_boxAllWalletsData = Hive.box<dynamic>(boxNameAllWalletsData);
117+
} else {
118+
_boxAllWalletsData = await Hive.openBox<dynamic>(boxNameAllWalletsData);
119+
}
120+
90121
_boxNotifications =
91122
await Hive.openBox<NotificationModel>(boxNameNotifications);
92123
_boxWatchedTransactions =
@@ -112,12 +143,29 @@ class DB {
112143

113144
Future<void> _loadWalletBoxes() async {
114145
final names = _boxAllWalletsData.get("names") as Map? ?? {};
146+
names.removeWhere((name, dyn) {
147+
final jsonObject = Map<String, dynamic>.from(dyn as Map);
148+
try {
149+
Coin.values.byName(jsonObject["coin"] as String);
150+
return false;
151+
} catch (e, s) {
152+
Logging.instance.log(
153+
"Error, ${jsonObject["coin"]} does not exist, $name wallet cannot be loaded",
154+
level: LogLevel.Error);
155+
return true;
156+
}
157+
});
115158
final mapped = Map<String, dynamic>.from(names).map((name, dyn) => MapEntry(
116159
name, WalletInfo.fromJson(Map<String, dynamic>.from(dyn as Map))));
117160

118161
for (final entry in mapped.entries) {
119-
_walletBoxes[entry.value.walletId] =
120-
await Hive.openBox<dynamic>(entry.value.walletId);
162+
if (Hive.isBoxOpen(entry.value.walletId)) {
163+
_walletBoxes[entry.value.walletId] =
164+
Hive.box<dynamic>(entry.value.walletId);
165+
} else {
166+
_walletBoxes[entry.value.walletId] =
167+
await Hive.openBox<dynamic>(entry.value.walletId);
168+
}
121169
}
122170
}
123171

0 commit comments

Comments
 (0)