diff --git a/.gitignore b/.gitignore
index db43e964a..0580d006c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -96,3 +96,5 @@ vendor/
android/app/.cxx/**
ios/Flutter/.last_build_id
/lib/generated/**
+#**#
+/**/#**#
\ No newline at end of file
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 52f1e3224..d74761d26 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -25,7 +25,6 @@ linter:
- empty_constructor_bodies
- empty_statements
- hash_and_equals
- - implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- library_names
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 7efe1606c..074ce247f 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,10 +1,19 @@
package com.cakewallet.cake_wallet;
import androidx.annotation.NonNull;
+
import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
+import io.flutter.plugin.common.MethodCall;
+import io.flutter.plugin.common.MethodChannel;
+
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.Looper;
+
+import java.security.SecureRandom;
import com.unstoppabledomains.resolution.DomainResolution;
import com.unstoppabledomains.resolution.Resolution;
@@ -16,6 +25,8 @@ import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
public class MainActivity extends FlutterFragmentActivity {
+ final String UTILS_CHANNEL = "com.cake_wallet/native_utils";
+
final String UNSTOPPABLE_DOMAIN_CHANNEL = "com.cakewallet.cake_wallet/unstoppable-domain";
@Override
@@ -55,5 +66,29 @@ public class MainActivity extends FlutterFragmentActivity {
handler.post(() -> result.error("INVALID DOMAIN", e.getMessage(), null));
}
});
+
+ MethodChannel utilsChannel =
+ new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(),
+ UTILS_CHANNEL);
+
+ utilsChannel.setMethodCallHandler(this::handle);
+ }
+
+ private void handle(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
+ Handler handler = new Handler(Looper.getMainLooper());
+
+ try {
+ if (call.method.equals("sec_random")) {
+ int count = call.argument("count");
+ SecureRandom random = new SecureRandom();
+ byte bytes[] = new byte[count];
+ random.nextBytes(bytes);
+ handler.post(() -> result.success(bytes));
+ } else {
+ handler.post(() -> result.notImplemented());
+ }
+ } catch (Exception e) {
+ handler.post(() -> result.error("UNCAUGHT_ERROR", e.getMessage(), null));
+ }
}
}
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
deleted file mode 100644
index b5c933268..000000000
--- a/android/app/src/main/kotlin/com/cakewallet/cake_wallet/MainActivity.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-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/app/src/main/res/drawable/ic_launcher.png b/android/app/src/main/res/drawable/ic_launcher.png
new file mode 100755
index 000000000..a96724f1c
Binary files /dev/null and b/android/app/src/main/res/drawable/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 000000000..b2c4ad887
--- /dev/null
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index 5d9200d0a..b11806d56 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 83a98b56d..b76508e83 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index c8cbe84dd..1d32c2836 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index c4352f579..d5b7374a7 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 73fe04234..af40ea947 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/assets/electrum_server_list.yml b/assets/bitcoin_electrum_server_list.yml
similarity index 100%
rename from assets/electrum_server_list.yml
rename to assets/bitcoin_electrum_server_list.yml
diff --git a/assets/images/2.0x/cake_logo.png b/assets/images/2.0x/cake_logo.png
index c464cdcd4..277816813 100644
Binary files a/assets/images/2.0x/cake_logo.png and b/assets/images/2.0x/cake_logo.png differ
diff --git a/assets/images/3.0x/cake_logo.png b/assets/images/3.0x/cake_logo.png
index 5da47a539..87dd05ce2 100644
Binary files a/assets/images/3.0x/cake_logo.png and b/assets/images/3.0x/cake_logo.png differ
diff --git a/assets/images/app_logo.png b/assets/images/app_logo.png
index 4540659cf..bf6896ad2 100644
Binary files a/assets/images/app_logo.png and b/assets/images/app_logo.png differ
diff --git a/assets/images/cake_logo.png b/assets/images/cake_logo.png
index fb5267a79..8a85bf225 100644
Binary files a/assets/images/cake_logo.png and b/assets/images/cake_logo.png differ
diff --git a/assets/images/litecoin_icon.png b/assets/images/litecoin_icon.png
new file mode 100644
index 000000000..9cc47b6fb
Binary files /dev/null and b/assets/images/litecoin_icon.png differ
diff --git a/assets/images/litecoin_menu.png b/assets/images/litecoin_menu.png
new file mode 100644
index 000000000..d39aff717
Binary files /dev/null and b/assets/images/litecoin_menu.png differ
diff --git a/assets/images/monero_menu.png b/assets/images/monero_menu.png
index 2bb420a80..51b1e2240 100644
Binary files a/assets/images/monero_menu.png and b/assets/images/monero_menu.png differ
diff --git a/assets/litecoin_electrum_server_list.yml b/assets/litecoin_electrum_server_list.yml
new file mode 100644
index 000000000..e61d0996c
--- /dev/null
+++ b/assets/litecoin_electrum_server_list.yml
@@ -0,0 +1,2 @@
+-
+ uri: ltc-electrum.cakewallet.com:50002
\ 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 d0313a194..dd1ab3cbb 100644
--- a/cw_monero/ios/Classes/monero_api.cpp
+++ b/cw_monero/ios/Classes/monero_api.cpp
@@ -179,8 +179,6 @@ extern "C"
Monero::SubaddressAccount *m_account;
uint64_t m_last_known_wallet_height;
uint64_t m_cached_syncing_blockchain_height = 0;
- std::mutex store_mutex;
-
void change_current_wallet(Monero::Wallet *wallet)
{
@@ -451,9 +449,7 @@ extern "C"
void store(char *path)
{
- store_mutex.lock();
get_current_wallet()->store(std::string(path));
- store_mutex.unlock();
}
bool transaction_create(char *address, char *payment_id, char *amount,
diff --git a/cw_monero/ios/cw_monero.podspec b/cw_monero/ios/cw_monero.podspec
index 78416a9e7..ad8a94d04 100644
--- a/cw_monero/ios/cw_monero.podspec
+++ b/cw_monero/ios/cw_monero.podspec
@@ -5,20 +5,18 @@
Pod::Spec.new do |s|
s.name = 'cw_monero'
s.version = '0.0.2'
- s.summary = 'A new flutter plugin project.'
- s.description = <<-DESC
-A new flutter plugin project.
- DESC
- s.homepage = 'http://example.com'
+ s.summary = 'CW Monero'
+ s.description = 'Cake Wallet wrapper over Monero project.'
+ s.homepage = 'http://cakewallet.com'
s.license = { :file => '../LICENSE' }
- s.author = { 'Your Company' => 'email@example.com' }
+ s.author = { 'CakeWallet' => 'support@cakewallet.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h, Classes/*.h, External/ios/libs/monero/include/src/**/*.h, External/ios/libs/monero/include/contrib/**/*.h, External/ios/libs/monero/include/External/ios/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
s.swift_version = '4.0'
- s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS' => 'arm64' }
+ s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS' => 'arm64', 'ENABLE_BITCODE' => 'NO' }
s.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/Classes/*.h" }
s.subspec 'OpenSSL' do |openssl|
@@ -53,4 +51,4 @@ A new flutter plugin project.
lmdb.vendored_libraries = 'External/ios/libs/lmdb/liblmdb.a'
lmdb.libraries = 'lmdb'
end
-end
\ No newline at end of file
+end
diff --git a/cw_monero/lib/wallet_manager.dart b/cw_monero/lib/wallet_manager.dart
index e48055cf9..2400c5f3f 100644
--- a/cw_monero/lib/wallet_manager.dart
+++ b/cw_monero/lib/wallet_manager.dart
@@ -1,12 +1,12 @@
import 'dart:ffi';
-import 'package:cw_monero/exceptions/wallet_opening_exception.dart';
-import 'package:cw_monero/wallet.dart';
import 'package:ffi/ffi.dart';
import 'package:flutter/foundation.dart';
import 'package:cw_monero/convert_utf8_to_string.dart';
import 'package:cw_monero/signatures.dart';
import 'package:cw_monero/types.dart';
import 'package:cw_monero/monero_api.dart';
+import 'package:cw_monero/wallet.dart';
+import 'package:cw_monero/exceptions/wallet_opening_exception.dart';
import 'package:cw_monero/exceptions/wallet_creation_exception.dart';
import 'package:cw_monero/exceptions/wallet_restore_from_keys_exception.dart';
import 'package:cw_monero/exceptions/wallet_restore_from_seed_exception.dart';
diff --git a/cw_monero/pubspec.lock b/cw_monero/pubspec.lock
index 648dce288..d44aacc6b 100644
--- a/cw_monero/pubspec.lock
+++ b/cw_monero/pubspec.lock
@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.4.2"
+ version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.0"
+ version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.3"
+ version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.13"
+ version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
ffi:
dependency: "direct main"
description:
@@ -73,21 +73,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.8"
+ version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.8"
+ version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
path_provider:
dependency: "direct main"
description:
@@ -113,56 +113,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.5"
+ version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.17"
+ version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.8"
+ version: "2.1.0"
sdks:
- dart: ">=2.9.0-14.0.dev <3.0.0"
- flutter: ">=0.1.4 <2.0.0"
+ dart: ">=2.12.0-0.0 <3.0.0"
+ flutter: ">=0.1.4"
diff --git a/ios/CakeWallet/secRandom.swift b/ios/CakeWallet/secRandom.swift
new file mode 100644
index 000000000..c9b2e3593
--- /dev/null
+++ b/ios/CakeWallet/secRandom.swift
@@ -0,0 +1,12 @@
+import Foundation
+
+func secRandom(count: Int) -> Data? {
+ var bytes = [Int8](repeating: 0, count: count)
+ let status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
+
+ if status == errSecSuccess {
+ return Data(bytes: bytes, count: bytes.count)
+ }
+
+ return nil
+}
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index f627ed23f..95fa31cc4 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -169,7 +169,7 @@ SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
- cw_monero: 2e1f79929880cc2293b5bc1b25e28152e4d84649
+ cw_monero: 78f369253cc913efc23db9cf6be81a11eaf40fe1
devicelocale: b22617f40038496deffba44747101255cee005b0
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 6e3df44f7..79c69b9ed 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C44A7192518EF8000B570ED /* decrypt.swift */; };
+ 0C9D68C9264854B60011B691 /* secRandom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C9D68C8264854B60011B691 /* secRandom.swift */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
20ED0868E1BD7E12278C0CB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B26E3F56D69167FBB1DC160A /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
@@ -21,6 +22,7 @@
0C400E0F25B21ABB0025E469 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; };
0C44A7192518EF8000B570ED /* decrypt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = decrypt.swift; sourceTree = ""; };
0C9986A3251A932F00D566FD /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 0C9D68C8264854B60011B691 /* secRandom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = secRandom.swift; sourceTree = ""; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
20F67A1B2C2FCB2A3BB048C1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
@@ -65,6 +67,7 @@
isa = PBXGroup;
children = (
0C44A7192518EF8000B570ED /* decrypt.swift */,
+ 0C9D68C8264854B60011B691 /* secRandom.swift */,
);
path = CakeWallet;
sourceTree = "";
@@ -274,6 +277,7 @@
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ 0C9D68C9264854B60011B691 /* secRandom.swift in Sources */,
0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -358,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 34;
+ CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -375,7 +379,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.5;
+ MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -501,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 34;
+ CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -518,7 +522,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.5;
+ MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -536,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 34;
+ CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -553,7 +557,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.5;
+ MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index a28140cfd..fb2dffc49 100644
--- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
-
-
-
-
+
+
-
-
Bool {
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
+ let legacyMigrationChannel = FlutterMethodChannel(
+ name: "com.cakewallet.cakewallet/legacy_wallet_migration",
+ binaryMessenger: controller.binaryMessenger)
+ legacyMigrationChannel.setMethodCallHandler({
let batteryChannel = FlutterMethodChannel(name: "com.cakewallet.cakewallet/legacy_wallet_migration",
binaryMessenger: controller.binaryMessenger)
let unstoppableDomainChannel = FlutterMethodChannel(name: "com.cakewallet.cake_wallet/unstoppable-domain", binaryMessenger: controller.binaryMessenger)
-
+
batteryChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
@@ -58,7 +62,25 @@ import UnstoppableDomainsResolution
result(FlutterMethodNotImplemented)
}
})
-
+
+ let utilsChannel = FlutterMethodChannel(
+ name: "com.cake_wallet/native_utils",
+ binaryMessenger: controller.binaryMessenger)
+ utilsChannel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
+ switch call.method {
+ case "sec_random":
+ guard let args = call.arguments as? Dictionary,
+ let count = args["count"] as? Int else {
+ result(nil)
+ return
+ }
+
+ result(secRandom(count: count))
+ default:
+ result(FlutterMethodNotImplemented)
+ }
+ })
+
unstoppableDomainChannel.setMethodCallHandler({ [weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
switch call.method {
@@ -69,29 +91,29 @@ import UnstoppableDomainsResolution
result(nil)
return
}
-
+
guard let resolution = self?.resolution else {
result(nil)
return
}
-
+
resolution.addr(domain: domain, ticker: ticker) { addrResult in
var address : String = ""
-
+
switch addrResult {
case .success(let returnValue):
address = returnValue
case .failure(let error):
print("Expected Address, but got \(error)")
}
-
+
result(address)
}
default:
result(FlutterMethodNotImplemented)
}
})
-
+
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
index 6613d9583..6d834d4ee 100644
--- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -2,100 +2,100 @@
"images" : [
{
"idiom" : "iphone",
- "size" : "20x20",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "20x20"
},
{
"idiom" : "iphone",
- "size" : "20x20",
- "scale" : "3x"
+ "scale" : "3x",
+ "size" : "20x20"
},
{
"idiom" : "iphone",
- "size" : "29x29",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "29x29"
},
{
"idiom" : "iphone",
- "size" : "29x29",
- "scale" : "3x"
+ "scale" : "3x",
+ "size" : "29x29"
},
{
"idiom" : "iphone",
- "size" : "40x40",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "40x40"
},
{
"idiom" : "iphone",
- "size" : "40x40",
- "scale" : "3x"
+ "scale" : "3x",
+ "size" : "40x40"
},
{
- "size" : "60x60",
+ "filename" : "app_icon_120.png",
"idiom" : "iphone",
- "filename" : "cake_xmr_120.png",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "60x60"
},
{
- "size" : "60x60",
+ "filename" : "app_icon_180.png",
"idiom" : "iphone",
- "filename" : "cake_xmr_180.png",
- "scale" : "3x"
+ "scale" : "3x",
+ "size" : "60x60"
},
{
"idiom" : "ipad",
- "size" : "20x20",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "20x20"
},
{
"idiom" : "ipad",
- "size" : "20x20",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "20x20"
},
{
"idiom" : "ipad",
- "size" : "29x29",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "29x29"
},
{
"idiom" : "ipad",
- "size" : "29x29",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "29x29"
},
{
"idiom" : "ipad",
- "size" : "40x40",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "40x40"
},
{
"idiom" : "ipad",
- "size" : "40x40",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "40x40"
},
{
"idiom" : "ipad",
- "size" : "76x76",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "76x76"
},
{
"idiom" : "ipad",
- "size" : "76x76",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "76x76"
},
{
"idiom" : "ipad",
- "size" : "83.5x83.5",
- "scale" : "2x"
+ "scale" : "2x",
+ "size" : "83.5x83.5"
},
{
- "size" : "1024x1024",
+ "filename" : "app_icon_1024.png",
"idiom" : "ios-marketing",
- "filename" : "cake_xmr_1024.png",
- "scale" : "1x"
+ "scale" : "1x",
+ "size" : "1024x1024"
}
],
"info" : {
- "version" : 1,
- "author" : "xcode"
+ "author" : "xcode",
+ "version" : 1
}
-}
\ No newline at end of file
+}
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
new file mode 100644
index 000000000..268157627
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png
new file mode 100644
index 000000000..cc95df4ed
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png
new file mode 100644
index 000000000..71e2cadc1
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png
deleted file mode 100644
index 4540659cf..000000000
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png and /dev/null differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png
deleted file mode 100644
index 303625681..000000000
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png and /dev/null differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png
deleted file mode 100644
index a22c1f36d..000000000
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png and /dev/null differ
diff --git a/lib/bitcoin/address_to_output_script.dart b/lib/bitcoin/address_to_output_script.dart
index 2f6698ff0..01c7b67a5 100644
--- a/lib/bitcoin/address_to_output_script.dart
+++ b/lib/bitcoin/address_to_output_script.dart
@@ -1,25 +1,29 @@
import 'dart:typed_data';
+import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
import 'package:bs58check/bs58check.dart' as bs58check;
import 'package:bitcoin_flutter/src/utils/constants/op.dart';
import 'package:bitcoin_flutter/src/utils/script.dart' as bscript;
import 'package:bitcoin_flutter/src/address.dart';
-
Uint8List p2shAddressToOutputScript(String address) {
final decodeBase58 = bs58check.decode(address);
final hash = decodeBase58.sublist(1);
return bscript.compile([OPS['OP_HASH160'], hash, OPS['OP_EQUAL']]);
}
-Uint8List addressToOutputScript(String address) {
+Uint8List addressToOutputScript(
+ String address, bitcoin.NetworkType networkType) {
try {
// FIXME: improve validation for p2sh addresses
- if (address.startsWith('3')) {
+ // 3 for bitcoin
+ // m for litecoin
+ if (address.startsWith('3') || address.toLowerCase().startsWith('m')) {
return p2shAddressToOutputScript(address);
}
- return Address.addressToOutputScript(address);
- } catch (_) {
+ return Address.addressToOutputScript(address, networkType);
+ } catch (err) {
+ print(err);
return Uint8List(0);
}
-}
\ No newline at end of file
+}
diff --git a/lib/bitcoin/bitcoin_address_record.dart b/lib/bitcoin/bitcoin_address_record.dart
index af492de2d..5e3967308 100644
--- a/lib/bitcoin/bitcoin_address_record.dart
+++ b/lib/bitcoin/bitcoin_address_record.dart
@@ -1,14 +1,14 @@
import 'dart:convert';
-import 'package:quiver/core.dart';
class BitcoinAddressRecord {
- BitcoinAddressRecord(this.address, {this.index});
+ BitcoinAddressRecord(this.address, {this.index, bool isHidden})
+ : _isHidden = isHidden;
factory BitcoinAddressRecord.fromJSON(String jsonSource) {
final decoded = json.decode(jsonSource) as Map;
return BitcoinAddressRecord(decoded['address'] as String,
- index: decoded['index'] as int);
+ index: decoded['index'] as int, isHidden: decoded['isHidden'] as bool);
}
@override
@@ -16,10 +16,13 @@ class BitcoinAddressRecord {
o is BitcoinAddressRecord && address == o.address;
final String address;
+ bool get isHidden => _isHidden ?? false;
int index;
+ final bool _isHidden;
@override
int get hashCode => address.hashCode;
- String toJSON() => json.encode({'address': address, 'index': index});
+ String toJSON() =>
+ json.encode({'address': address, 'index': index, 'isHidden': isHidden});
}
diff --git a/lib/bitcoin/bitcoin_mnemonic.dart b/lib/bitcoin/bitcoin_mnemonic.dart
index 7f4bcd13c..4f56161e0 100644
--- a/lib/bitcoin/bitcoin_mnemonic.dart
+++ b/lib/bitcoin/bitcoin_mnemonic.dart
@@ -4,23 +4,11 @@ import 'dart:typed_data';
import 'package:crypto/crypto.dart';
import 'package:unorm_dart/unorm_dart.dart' as unorm;
import 'package:cryptography/cryptography.dart' as cryptography;
+import 'package:cake_wallet/core/sec_random_native.dart';
const segwit = '100';
final wordlist = englishWordlist;
-Uint8List randomBytes(int length, {bool secure = false}) {
- assert(length > 0);
-
- final random = secure ? Random.secure() : Random();
- final ret = Uint8List(length);
-
- for (var i = 0; i < length; i++) {
- ret[i] = random.nextInt(256);
- }
-
- return ret;
-}
-
double logBase(num x, num base) => log(x) / log(base);
String mnemonicEncode(int i) {
@@ -102,14 +90,15 @@ List prefixMatches(String source, List prefixes) {
return prefixes.map((prefix) => hx.startsWith(prefix.toLowerCase())).toList();
}
-String generateMnemonic({int strength = 132, String prefix = segwit}) {
+Future generateMnemonic(
+ {int strength = 264, String prefix = segwit}) async {
final wordBitlen = logBase(wordlist.length, 2).ceil();
final wordCount = strength / wordBitlen;
final byteCount = ((wordCount * wordBitlen).ceil() / 8).ceil();
var result = '';
do {
- final bytes = randomBytes(byteCount);
+ final bytes = await secRandom(byteCount);
maskBytes(bytes, strength);
result = encode(bytes);
} while (!prefixMatches(result, [prefix]).first);
@@ -134,7 +123,7 @@ bool matchesAnyPrefix(String mnemonic) =>
bool validateMnemonic(String mnemonic, {String prefix = segwit}) {
try {
return matchesAnyPrefix(mnemonic);
- } catch(e) {
+ } catch (e) {
return false;
}
}
diff --git a/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart b/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart
index 761b02601..5171a4f05 100644
--- a/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart
+++ b/lib/bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart
@@ -1,5 +1,5 @@
class BitcoinMnemonicIsIncorrectException implements Exception {
@override
String toString() =>
- 'Bitcoin mnemonic has incorrect format. Mnemonic should contain 12 words separated by space.';
+ 'Bitcoin mnemonic has incorrect format. Mnemonic should contain 24 words separated by space.';
}
diff --git a/lib/bitcoin/bitcoin_transaction_history.dart b/lib/bitcoin/bitcoin_transaction_history.dart
deleted file mode 100644
index 16171267c..000000000
--- a/lib/bitcoin/bitcoin_transaction_history.dart
+++ /dev/null
@@ -1,192 +0,0 @@
-import 'dart:convert';
-import 'package:flutter/foundation.dart';
-import 'package:mobx/mobx.dart';
-import 'package:cake_wallet/core/transaction_history.dart';
-import 'package:cake_wallet/bitcoin/file.dart';
-import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
-import 'package:cake_wallet/bitcoin/bitcoin_transaction_info.dart';
-import 'package:cake_wallet/bitcoin/electrum.dart';
-
-part 'bitcoin_transaction_history.g.dart';
-
-const _transactionsHistoryFileName = 'transactions.json';
-
-class BitcoinTransactionHistory = BitcoinTransactionHistoryBase
- with _$BitcoinTransactionHistory;
-
-abstract class BitcoinTransactionHistoryBase
- extends TransactionHistoryBase with Store {
- BitcoinTransactionHistoryBase(
- {this.eclient, String dirPath, @required String password})
- : path = '$dirPath/$_transactionsHistoryFileName',
- _password = password,
- _height = 0,
- _isUpdating = false {
- transactions = ObservableMap();
- }
-
- BitcoinWalletBase wallet;
- final ElectrumClient eclient;
- final String path;
- final String _password;
- int _height;
- bool _isUpdating;
-
- Future init() async {
- await _load();
- }
-
- @override
- Future update() async {
- if (_isUpdating) {
- return;
- }
-
- try {
- _isUpdating = true;
- final txs = await fetchTransactions();
- await add(txs);
- _isUpdating = false;
- } catch (_) {
- _isUpdating = false;
- rethrow;
- }
- }
-
- @override
- Future