diff --git a/README.md b/README.md index 463fadfbc..1e7ebb458 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Cake Wallet -The project description, motivation, build scripts, instructions, tests will be added soon (Spring 2020); +The project description, motivation, build scripts, instructions, tests will be added soon (Spring 202X); Copyright (c) 2020 Cake Technologies LLC. diff --git a/android/app/build.gradle b/android/app/build.gradle index 878eb27cf..7f3990150 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -41,7 +41,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cakewallet.cake_wallet" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index bee0fa2b6..4513c32f6 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,17 +1,13 @@ - - + + + + + + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background" + /> + + diff --git a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java index 2d7ea1db7..b78897919 100644 --- a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java +++ b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java @@ -1,13 +1,15 @@ package com.cakewallet.cake_wallet; -import android.os.Bundle; -import io.flutter.app.FlutterFragmentActivity; +import androidx.annotation.NonNull; +import io.flutter.embedding.android.FlutterFragmentActivity; +import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugins.GeneratedPluginRegistrant; + public class MainActivity extends FlutterFragmentActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} + + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cakewallet/cake_wallet/MainActivity.kt b/android/app/src/main/kotlin/com/cakewallet/cake_wallet/MainActivity.kt index 3ea4c29ad..b5c933268 100644 --- a/android/app/src/main/kotlin/com/cakewallet/cake_wallet/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cakewallet/cake_wallet/MainActivity.kt @@ -1,6 +1,13 @@ package com.cakewallet.cake_wallet +import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.android.FlutterFragmentActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterActivity() { + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine){ + GeneratedPluginRegistrant.registerWith(flutterEngine); + } } diff --git a/android/settings_aar.gradle b/android/settings_aar.gradle new file mode 100644 index 000000000..e7b4def49 --- /dev/null +++ b/android/settings_aar.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/assets/fonts/Lato-Bold.ttf b/assets/fonts/Lato-Bold.ttf index ef5ae3b43..59c48434c 100644 Binary files a/assets/fonts/Lato-Bold.ttf and b/assets/fonts/Lato-Bold.ttf differ diff --git a/assets/fonts/Lato-Medium.ttf b/assets/fonts/Lato-Medium.ttf new file mode 100644 index 000000000..a208b9912 Binary files /dev/null and b/assets/fonts/Lato-Medium.ttf differ diff --git a/assets/fonts/Lato-Regular.ttf b/assets/fonts/Lato-Regular.ttf index adbfc467d..f01f55892 100644 Binary files a/assets/fonts/Lato-Regular.ttf and b/assets/fonts/Lato-Regular.ttf differ diff --git a/assets/fonts/Lato-Semibold.ttf b/assets/fonts/Lato-Semibold.ttf index 60ac82d65..0b95c6430 100644 Binary files a/assets/fonts/Lato-Semibold.ttf and b/assets/fonts/Lato-Semibold.ttf differ diff --git a/assets/fonts/Montserrat-Bold.ttf b/assets/fonts/Montserrat-Bold.ttf deleted file mode 100644 index eadb3b67b..000000000 Binary files a/assets/fonts/Montserrat-Bold.ttf and /dev/null differ diff --git a/assets/fonts/Montserrat-Regular.ttf b/assets/fonts/Montserrat-Regular.ttf deleted file mode 100644 index 211828ab7..000000000 Binary files a/assets/fonts/Montserrat-Regular.ttf and /dev/null differ diff --git a/assets/fonts/Montserrat-SemiBold.ttf b/assets/fonts/Montserrat-SemiBold.ttf deleted file mode 100644 index ada91a1c2..000000000 Binary files a/assets/fonts/Montserrat-SemiBold.ttf and /dev/null differ diff --git a/assets/fonts/Poppins-Bold.ttf b/assets/fonts/Poppins-Bold.ttf deleted file mode 100644 index b94d47f3a..000000000 Binary files a/assets/fonts/Poppins-Bold.ttf and /dev/null differ diff --git a/assets/fonts/Poppins-Medium.ttf b/assets/fonts/Poppins-Medium.ttf deleted file mode 100644 index e90e87ed6..000000000 Binary files a/assets/fonts/Poppins-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Poppins-Regular.ttf b/assets/fonts/Poppins-Regular.ttf deleted file mode 100644 index be06e7fdc..000000000 Binary files a/assets/fonts/Poppins-Regular.ttf and /dev/null differ diff --git a/assets/fonts/Poppins-SemiBold.ttf b/assets/fonts/Poppins-SemiBold.ttf deleted file mode 100644 index dabf7c242..000000000 Binary files a/assets/fonts/Poppins-SemiBold.ttf and /dev/null differ diff --git a/cw_monero/android/src/main/kotlin/com/cakewallet/monero/CwMoneroPlugin.kt b/cw_monero/android/src/main/kotlin/com/cakewallet/monero/CwMoneroPlugin.kt index 593627078..37684a16a 100644 --- a/cw_monero/android/src/main/kotlin/com/cakewallet/monero/CwMoneroPlugin.kt +++ b/cw_monero/android/src/main/kotlin/com/cakewallet/monero/CwMoneroPlugin.kt @@ -4,7 +4,7 @@ import android.app.Activity import android.os.AsyncTask import android.os.Looper import android.os.Handler -import android.os.Process +import android.os.Process import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel @@ -22,10 +22,10 @@ class doAsync(val handler: () -> Unit) : AsyncTask() { class CwMoneroPlugin: MethodCallHandler { companion object { - val moneroApi = MoneroApi() +// val moneroApi = MoneroApi() val main = Handler(Looper.getMainLooper()); - init { + init { System.loadLibrary("cw_monero") } @@ -43,31 +43,31 @@ class CwMoneroPlugin: MethodCallHandler { val password = call.argument("password") ?: "" val useSSL = false val isLightWallet = false - doAsync { - try { - moneroApi.setNodeAddressJNI(uri, login, password, useSSL, isLightWallet) - main.post({ - result.success(true) - }); - } catch(e: Throwable) { - main.post({ - result.error("CONNECTION_ERROR", e.message, null) - }); - } - }.execute() +// doAsync { +// try { +// moneroApi.setNodeAddressJNI(uri, login, password, useSSL, isLightWallet) +// main.post({ +// result.success(true) +// }); +// } catch(e: Throwable) { +// main.post({ +// result.error("CONNECTION_ERROR", e.message, null) +// }); +// } +// }.execute() } if (call.method == "startSync") { - doAsync { - moneroApi.startSyncJNI() - main.post({ - result.success(true) - }); - }.execute() +// doAsync { +// moneroApi.startSyncJNI() +// main.post({ +// result.success(true) +// }); +// }.execute() } if (call.method == "loadWallet") { val path = call.argument("path") ?: "" val password = call.argument("password") ?: "" - moneroApi.loadWalletJNI(path, password) +// moneroApi.loadWalletJNI(path, password) result.success(true) } } diff --git a/cw_monero/android/src/main/kotlin/com/cakewallet/monero/MoneroApi.kt b/cw_monero/android/src/main/kotlin/com/cakewallet/monero/MoneroApi.kt deleted file mode 100644 index 071577ad3..000000000 --- a/cw_monero/android/src/main/kotlin/com/cakewallet/monero/MoneroApi.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.cakewallet.monero - -class MoneroApi { - external fun setNodeAddressJNI(uri: String, login: String, password: String, use_ssl: Boolean, is_light_wallet: Boolean) - external fun connectToNodeJNI() - external fun startSyncJNI() - external fun loadWalletJNI(path: String, password: String) - - companion object { - init { - System.loadLibrary("cw_monero") - } - } -} \ No newline at end of file diff --git a/cw_monero/ios/Classes/monero_api.cpp b/cw_monero/ios/Classes/monero_api.cpp index aa96d7656..2dfd8a0ae 100644 --- a/cw_monero/ios/Classes/monero_api.cpp +++ b/cw_monero/ios/Classes/monero_api.cpp @@ -87,7 +87,7 @@ extern "C" void updated() { - m_need_to_refresh = true; + m_new_transaction = true; } void refreshed() @@ -351,13 +351,11 @@ extern "C" uint64_t get_full_balance(uint32_t account_index) { -// return 0; return get_current_wallet()->balance(account_index); } uint64_t get_unlocked_balance(uint32_t account_index) { -// return 0; return get_current_wallet()->unlockedBalance(account_index); } @@ -373,6 +371,7 @@ extern "C" bool connect_to_node(char *error) { + nice(19); bool is_connected = get_current_wallet()->connectToDaemon(); if (!is_connected) @@ -385,6 +384,7 @@ extern "C" bool setup_node(char *address, char *login, char *password, bool use_ssl, bool is_light_wallet, char *error) { + nice(19); Monero::Wallet *wallet = get_current_wallet(); std::string _login = ""; @@ -437,7 +437,7 @@ extern "C" { store_mutex.lock(); get_current_wallet()->store(std::string(path)); - store_mutex.unlock(); + store_mutex.unlock(); } bool transaction_create(char *address, char *payment_id, char *amount, @@ -472,7 +472,9 @@ extern "C" return false; } - m_listener->m_new_transaction = true; + if (m_listener != nullptr) { + m_listener->m_new_transaction = true; + } pendingTransaction = PendingTransactionRaw(transaction); return true; @@ -485,7 +487,7 @@ extern "C" if (!committed) { error = Utf8Box(strdup(transaction->transaction->errorString().c_str())); - } else { + } else if (m_listener != nullptr) { m_listener->m_new_transaction = true; } @@ -508,9 +510,8 @@ extern "C" } uint64_t height = m_listener->height(); - uint64_t node_height = get_node_height_or_update(height); - if (height <= 1 || node_height <= 0) { + if (height <= 1) { return 0; } @@ -529,10 +530,8 @@ extern "C" } bool should_refresh = m_listener->isNeedToRefresh(); - uint64_t node_height = get_node_height_or_update(m_last_known_wallet_height); - if (should_refresh || (node_height - m_last_known_wallet_height < MONERO_BLOCK_SIZE)) - { + if (should_refresh) { m_listener->resetNeedToRefresh(); } @@ -561,7 +560,7 @@ extern "C" if (m_listener != nullptr) { - // free(m_listener); + free(m_listener); } m_listener = new MoneroWalletListener(); diff --git a/cw_monero/lib/account_list.dart b/cw_monero/lib/account_list.dart index bf5618a1b..6e84f5931 100644 --- a/cw_monero/lib/account_list.dart +++ b/cw_monero/lib/account_list.dart @@ -26,7 +26,18 @@ final accountSetLabelNative = moneroApi .lookup>('account_set_label_row') .asFunction(); -void refreshAccounts() => accountRefreshNative(); +bool isUpdating = false; + +void refreshAccounts() { + try { + isUpdating = true; + accountRefreshNative(); + isUpdating = false; + } catch (e) { + isUpdating = false; + rethrow; + } +} List getAllAccount() { final size = accountSizeNative(); @@ -63,4 +74,4 @@ Future addAccount({String label}) async => compute(_addAccount, label); Future setLabelForAccount({int accountIndex, String label}) async => compute( - _setLabelForAccount, {'accountIndex': accountIndex, 'label': label}); + _setLabelForAccount, {'accountIndex': accountIndex, 'label': label}); \ No newline at end of file diff --git a/cw_monero/lib/subaddress_list.dart b/cw_monero/lib/subaddress_list.dart index 933899e0c..97a307040 100644 --- a/cw_monero/lib/subaddress_list.dart +++ b/cw_monero/lib/subaddress_list.dart @@ -26,8 +26,18 @@ final subaddrressSetLabelNative = moneroApi .lookup>('subaddress_set_label') .asFunction(); -void refreshSubaddresses({int accountIndex}) => +bool isUpdating = false; + +void refreshSubaddresses({@required int accountIndex}) { + try { + isUpdating = true; subaddressRefreshNative(accountIndex); + isUpdating = false; + } catch (e) { + isUpdating = false; + rethrow; + } +} List getAllSubaddresses() { final size = subaddressSizeNative(); @@ -48,7 +58,7 @@ void addSubaddressSync({int accountIndex, String label}) { void setLabelForSubaddressSync( {int accountIndex, int addressIndex, String label}) { final labelPointer = Utf8.toUtf8(label); - + subaddrressSetLabelNative(accountIndex, addressIndex, labelPointer); free(labelPointer); } @@ -70,7 +80,8 @@ void _setLabelForSubaddress(Map args) { } Future addSubaddress({int accountIndex, String label}) async => - compute, void>(_addSubaddress, {'accountIndex': accountIndex, 'label': label}); + compute, void>( + _addSubaddress, {'accountIndex': accountIndex, 'label': label}); Future setLabelForSubaddress( {int accountIndex, int addressIndex, String label}) => diff --git a/cw_monero/lib/wallet.dart b/cw_monero/lib/wallet.dart index c42cd3523..5c239dd99 100644 --- a/cw_monero/lib/wallet.dart +++ b/cw_monero/lib/wallet.dart @@ -11,8 +11,6 @@ import 'package:flutter/services.dart'; int _boolToInt(bool value) => value ? 1 : 0; -final moneroAPIChannel = const MethodChannel('cw_monero'); - final getFileNameNative = moneroApi .lookup>('get_filename') .asFunction(); @@ -114,6 +112,8 @@ final rescanBlockchainAsyncNative = moneroApi .lookup>('rescan_blockchain') .asFunction(); +bool isStoring = false; + int getSyncingHeight() => getSyncingHeightNative(); bool isNeededToRefresh() => isNeededToRefreshNative() != 0; @@ -209,20 +209,23 @@ String getSecretSpendKey() => String getPublicSpendKey() => convertUTF8ToString(pointer: getPublicSpendKeyNative()); -class SyncListner { - SyncListner({this.onNewBlock, this.onNeedToRefresh, this.onNewTransaction}); +class SyncListener { + SyncListener(this.onNewBlock, this.onNewTransaction) { + _cachedBlockchainHeight = 0; + _lastKnownBlockHeight = 0; + _initialSyncHeight = 0; + } void Function(int, int, double) onNewBlock; - void Function() onNeedToRefresh; void Function() onNewTransaction; Timer _updateSyncInfoTimer; - int _cachedBlockchainHeight = 0; - int _lastKnownBlockHeight = 0; - int _initialSyncHeight = 0; + int _cachedBlockchainHeight; + int _lastKnownBlockHeight; + int _initialSyncHeight; Future getNodeHeightOrUpdate(int baseHeight) async { - if (_cachedBlockchainHeight < baseHeight) { + if (_cachedBlockchainHeight < baseHeight || _cachedBlockchainHeight == 0) { _cachedBlockchainHeight = await getNodeHeight(); } @@ -234,54 +237,68 @@ class SyncListner { _lastKnownBlockHeight = 0; _initialSyncHeight = 0; _updateSyncInfoTimer ??= - Timer.periodic(Duration(milliseconds: 200), (_) async { - final syncHeight = getSyncingHeight(); - final needToRefresh = isNeededToRefresh(); - final newTransactionExist = isNewTransactionExist(); - final bchHeight = await getNodeHeightOrUpdate(syncHeight); - - if (_lastKnownBlockHeight != syncHeight && syncHeight != null) { - if (_initialSyncHeight <= 0) { - _initialSyncHeight = syncHeight; - } - - _lastKnownBlockHeight = syncHeight; - final line = bchHeight - _initialSyncHeight; - final diff = line - (bchHeight - syncHeight); - final ptc = diff <= 0 ? 0.0 : diff / line; - final left = bchHeight - syncHeight; - // 1. Actual new height; 2. Blocks left to finish; 3. Progress in percents; - onNewBlock(syncHeight, left, ptc); - } - - if (newTransactionExist) { + Timer.periodic(Duration(milliseconds: 1200), (_) async { + if (isNewTransactionExist()) { onNewTransaction?.call(); } - if (needToRefresh) { - onNeedToRefresh?.call(); + var syncHeight = getSyncingHeight(); + + if (syncHeight <= 0) { + syncHeight = getCurrentHeight(); } + + if (_initialSyncHeight <= 0) { + _initialSyncHeight = syncHeight; + } + + final bchHeight = await getNodeHeightOrUpdate(syncHeight); + + if (_lastKnownBlockHeight == syncHeight || syncHeight == null) { + return; + } + + _lastKnownBlockHeight = syncHeight; + final track = bchHeight - _initialSyncHeight; + final diff = track - (bchHeight - syncHeight); + final ptc = diff <= 0 ? 0.0 : diff / track; + final left = bchHeight - syncHeight; + + if (syncHeight < 0 || left < 0) { + return; + } + + // 1. Actual new height; 2. Blocks left to finish; 3. Progress in percents; + onNewBlock?.call(syncHeight, left, ptc); }); } void stop() => _updateSyncInfoTimer?.cancel(); } -SyncListner setListeners(void Function(int, int, double) onNewBlock, - void Function() onNeedToRefresh, void Function() onNewTransaction) { - final listener = SyncListner( - onNewBlock: onNewBlock, - onNeedToRefresh: onNeedToRefresh, - onNewTransaction: onNewTransaction); - +SyncListener setListeners(void Function(int, int, double) onNewBlock, + void Function() onNewTransaction) { + final listener = SyncListener(onNewBlock, onNewTransaction); setListenerNative(); - return listener; } void onStartup() => onStartupNative(); -void _storeSync(Object _) => storeSync(); +void _storeSync(Object _) { + if (isStoring) { + return; + } + + try { + isStoring = true; + storeSync(); + isStoring = false; + } catch (e) { + isStoring = false; + rethrow; + } +} bool _setupNodeSync(Map args) { final address = args['address'] as String; diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78a..cb6be3098 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 97e09ec63..091116f43 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -362,6 +362,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -370,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.8; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -493,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -501,6 +502,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -509,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.8; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -526,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 10; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -534,6 +536,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -542,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.8; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/core/address_validator.dart b/lib/core/address_validator.dart index e043e3b1e..ccc8b83ab 100644 --- a/lib/core/address_validator.dart +++ b/lib/core/address_validator.dart @@ -60,7 +60,7 @@ class AddressValidator extends TextValidator { case CryptoCurrency.bnb: return [42]; case CryptoCurrency.btc: - return [34, 42]; + return [33, 34, 42]; case CryptoCurrency.dai: return [42]; case CryptoCurrency.dash: diff --git a/lib/core/node_address_validator.dart b/lib/core/node_address_validator.dart index 676a768ea..0e034dabc 100644 --- a/lib/core/node_address_validator.dart +++ b/lib/core/node_address_validator.dart @@ -6,5 +6,5 @@ class NodeAddressValidator extends TextValidator { : super( errorMessage: S.current.error_text_node_address, pattern: - '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$|^[0-9a-zA-Z.]+\$'); + '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$|^[0-9a-zA-Z.\-]+\$'); } diff --git a/lib/core/node_port_validator.dart b/lib/core/node_port_validator.dart index b7a2f0221..16be00dde 100644 --- a/lib/core/node_port_validator.dart +++ b/lib/core/node_port_validator.dart @@ -6,7 +6,7 @@ class NodePortValidator extends TextValidator { NodePortValidator() : super( errorMessage: S.current.error_text_node_port, - minLength: 1, + minLength: 0, maxLength: 5, pattern: '^[0-9]'); } diff --git a/lib/core/pending_transaction.dart b/lib/core/pending_transaction.dart index c7adb4478..c7f9b77d5 100644 --- a/lib/core/pending_transaction.dart +++ b/lib/core/pending_transaction.dart @@ -1,4 +1,5 @@ mixin PendingTransaction { + String get id; String get amountFormatted; String get feeFormatted; diff --git a/lib/di.dart b/lib/di.dart index 26d291cfd..1571c925b 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -2,10 +2,14 @@ import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart'; import 'package:cake_wallet/core/wallet_service.dart'; import 'package:cake_wallet/entities/biometric_auth.dart'; import 'package:cake_wallet/entities/contact_record.dart'; +import 'package:cake_wallet/entities/load_current_wallet.dart'; +import 'package:cake_wallet/entities/transaction_description.dart'; +import 'package:cake_wallet/entities/transaction_info.dart'; import 'package:cake_wallet/monero/monero_wallet_service.dart'; import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/node.dart'; import 'package:cake_wallet/exchange/trade.dart'; +import 'package:cake_wallet/reactions/on_authentication_state_change.dart'; import 'package:cake_wallet/src/screens/contact/contact_list_page.dart'; import 'package:cake_wallet/src/screens/contact/contact_page.dart'; @@ -22,6 +26,7 @@ import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/change_language.dart'; import 'package:cake_wallet/src/screens/settings/settings.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; +import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart'; @@ -91,7 +96,8 @@ Future setup( Box contactSource, Box tradesSource, Box