Skip to content

Commit 629cdf0

Browse files
committed
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into Integrate-Seed-Verification-Flow-To-Integration-Tests
2 parents 26506a9 + 526796e commit 629cdf0

File tree

124 files changed

+2538
-1615
lines changed

Some content is hidden

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

124 files changed

+2538
-1615
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Please include a summary of the changes and which issue is fixed / feature is ad
1111
- [ ] Format code
1212
- [ ] Look for code duplication
1313
- [ ] Clear naming for variables and methods
14+
- [ ] Manual tests in accessibility mode (TalkBack on Android) passed

.github/workflows/pr_test_build_linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ jobs:
284284
xmessage -timeout 30 "restore_wallet_through_seeds_flow_test" &
285285
rm -rf ~/.local/share/com.example.cake_wallet/ ~/Documents/cake_wallet/ ~/cake_wallet
286286
exec timeout --signal=SIGKILL 900 flutter drive --driver=test_driver/integration_test.dart --target=integration_test/test_suites/restore_wallet_through_seeds_flow_test.dart
287+
- name: Test [cw_monero]
288+
timeout-minutes: 2
289+
run: cd cw_monero && flutter test
287290
- name: Stop screen recording, encrypt and upload
288291
if: always()
289292
run: |

android/app/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ android {
7474
release {
7575
signingConfig signingConfigs.release
7676

77-
shrinkResources false
78-
minifyEnabled false
79-
8077
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
8178
}
8279
debug {

android/app/proguard-rules.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
-keep class io.flutter.view.** { *; }
66
-keep class io.flutter.** { *; }
77
-keep class io.flutter.plugins.** { *; }
8-
-dontwarn io.flutter.embedding.**
8+
-dontwarn io.flutter.embedding.**
9+
-dontwarn com.google.android.play.core.splitcompat.SplitCompatApplication
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
UI/UX enhancements
2-
Performance improvements
1+
Monero 12-word seed support (Wallet Groups support as well)
2+
Integrate DFX's OpenCryptoPay
3+
Exchange flow enhancements
4+
Hardware Wallets flow enhancements
5+
Minor UI enhancements
36
Bug fixes

assets/text/Release_Notes.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
New App Logo
2-
UI/UX enhancements
3-
Performance improvements
1+
Monero 12-word seed support (Wallet Groups support as well)
2+
Integrate DFX's OpenCryptoPay
3+
Exchange flow enhancements
4+
Hardware Wallets flow enhancements
5+
Minor UI enhancements
46
Bug fixes

cw_bitcoin/lib/litecoin_wallet.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
329329
try {
330330
await subscribeForUpdates();
331331
} catch (e) {
332-
printV("failed to subcribe for updates: $e");
332+
printV("failed to subscribe for updates: $e");
333333
}
334334
updateFeeRates();
335335
_feeRatesTimer?.cancel();
@@ -601,7 +601,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
601601
}
602602
_utxoStream = responseStream.listen(
603603
(Utxo sUtxo) async {
604-
// we're processing utxos, so our balance could still be innacurate:
604+
// we're processing utxos, so our balance could still be inaccurate:
605605
if (mwebSyncStatus is! SyncronizingSyncStatus && mwebSyncStatus is! SyncingSyncStatus) {
606606
mwebSyncStatus = SyncronizingSyncStatus();
607607
processingUtxos = true;

cw_core/lib/monero_wallet_utils.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Future<void> backupWalletFiles(String name) async {
1919
final newKeysFilePath = backupFileName(keysFile.path);
2020
final newAddressListFilePath = backupFileName(addressListFile.path);
2121

22-
if (cacheFile.existsSync()) {
22+
if (cacheFile.existsSync() && !File(newCacheFilePath).existsSync()) {
2323
await cacheFile.copy(newCacheFilePath);
2424
}
2525

26-
if (keysFile.existsSync()) {
26+
if (keysFile.existsSync() && !File(newKeysFilePath).existsSync()) {
2727
await keysFile.copy(newKeysFilePath);
2828
}
2929

30-
if (addressListFile.existsSync()) {
30+
if (addressListFile.existsSync() && !File(newAddressListFilePath).existsSync()) {
3131
await addressListFile.copy(newAddressListFilePath);
3232
}
3333
}
@@ -83,18 +83,22 @@ Future<bool> backupWalletFilesExists(String name) async {
8383
Future<void> removeCache(String name) async {
8484
final path = await pathForWallet(name: name, type: WalletType.monero);
8585
final cacheFile = File(path);
86-
86+
final backgroundCacheFile = File(path + ".background");
8787
if (cacheFile.existsSync()) {
8888
cacheFile.deleteSync();
8989
}
90+
if (backgroundCacheFile.existsSync()) {
91+
backgroundCacheFile.deleteSync();
92+
}
9093
}
9194

9295
Future<void> restoreOrResetWalletFiles(String name) async {
9396
final backupsExists = await backupWalletFilesExists(name);
9497

9598
if (backupsExists) {
9699
await removeCache(name);
97-
100+
// TODO(mrcyjanek): is this needed?
101+
// If we remove cache then wallet should be restored from .keys file.
98102
await restoreWalletFiles(name);
99103
}
100104
}

cw_core/lib/wallet_type.dart

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,38 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type, {bool isTestnet = fal
247247
'Unexpected wallet type: ${type.toString()} for CryptoCurrency walletTypeToCryptoCurrency');
248248
}
249249
}
250+
251+
WalletType? cryptoCurrencyToWalletType(CryptoCurrency type) {
252+
switch (type) {
253+
case CryptoCurrency.xmr:
254+
return WalletType.monero;
255+
case CryptoCurrency.btc:
256+
return WalletType.bitcoin;
257+
case CryptoCurrency.ltc:
258+
return WalletType.litecoin;
259+
case CryptoCurrency.xhv:
260+
return WalletType.haven;
261+
case CryptoCurrency.eth:
262+
return WalletType.ethereum;
263+
case CryptoCurrency.bch:
264+
return WalletType.bitcoinCash;
265+
case CryptoCurrency.nano:
266+
return WalletType.nano;
267+
case CryptoCurrency.banano:
268+
return WalletType.banano;
269+
case CryptoCurrency.maticpoly:
270+
return WalletType.polygon;
271+
case CryptoCurrency.sol:
272+
return WalletType.solana;
273+
case CryptoCurrency.trx:
274+
return WalletType.tron;
275+
case CryptoCurrency.wow:
276+
return WalletType.wownero;
277+
case CryptoCurrency.zano:
278+
return WalletType.zano;
279+
case CryptoCurrency.dcr:
280+
return WalletType.decred;
281+
default:
282+
return null;
283+
}
284+
}

cw_decred/lib/wallet.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ abstract class DecredWalletBase
222222

223223
Future<bool> checkSync() async {
224224
final syncStatusJSON = await _libwallet.syncStatus(walletInfo.name);
225-
final decoded = json.decode(syncStatusJSON);
225+
final decoded = json.decode(syncStatusJSON.isEmpty ? "{}" : syncStatusJSON);
226226

227227
final syncStatusCode = decoded["syncstatuscode"] ?? 0;
228228
// final syncStatusStr = decoded["syncstatus"] ?? "";
@@ -710,14 +710,18 @@ abstract class DecredWalletBase
710710
// walletBirthdayBlockHeight checks if the wallet birthday is set and returns
711711
// it. Returns -1 if not.
712712
Future<int> walletBirthdayBlockHeight() async {
713-
final res = await _libwallet.birthState(walletInfo.name);
714-
final decoded = json.decode(res);
715-
// Having these values set indicates that sync has not reached the birthday
716-
// yet, so no birthday is set.
717-
if (decoded["setfromheight"] == true || decoded["setfromtime"] == true) {
718-
return -1;
713+
try {
714+
final res = await _libwallet.birthState(walletInfo.name);
715+
final decoded = json.decode(res);
716+
// Having these values set indicates that sync has not reached the birthday
717+
// yet, so no birthday is set.
718+
if (decoded["setfromheight"] == true || decoded["setfromtime"] == true) {
719+
return -1;
720+
}
721+
return decoded["height"] ?? 0;
722+
} on FormatException catch (_) {
723+
return 0;
719724
}
720-
return decoded["height"] ?? 0;
721725
}
722726

723727
Future<bool> verifyMessage(String message, String signature, {String? address = null}) async {

0 commit comments

Comments
 (0)