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/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/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..4922dfba2
--- /dev/null
+++ b/assets/litecoin_electrum_server_list.yml
@@ -0,0 +1,2 @@
+-
+ uri: 128.199.34.116: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/Podfile.lock b/ios/Podfile.lock
index 03302eab3..879041cac 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -157,7 +157,7 @@ SPEC CHECKSUMS:
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
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 7b8e304db..f51e0e3fe 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 37;
+ CURRENT_PROJECT_VERSION = 39;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -379,7 +379,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.7;
+ MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 37;
+ CURRENT_PROJECT_VERSION = 39;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -522,7 +522,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.7;
+ MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 37;
+ CURRENT_PROJECT_VERSION = 39;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -557,7 +557,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
- MARKETING_VERSION = 4.1.7;
+ 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">
-
-
-
-
+
+
-
-
[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_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