diff --git a/cw_monero/lib/account.dart b/cw_core/lib/account.dart similarity index 59% rename from cw_monero/lib/account.dart rename to cw_core/lib/account.dart index 04b2f0f23..5bb002945 100644 --- a/cw_monero/lib/account.dart +++ b/cw_core/lib/account.dart @@ -1,5 +1,3 @@ -import 'package:cw_monero/api/structs/account_row.dart'; - class Account { Account({this.id, this.label}); @@ -7,10 +5,6 @@ class Account { : this.id = map['id'] == null ? 0 : int.parse(map['id'] as String), this.label = (map['label'] ?? '') as String; - Account.fromRow(AccountRow row) - : this.id = row.getId(), - this.label = row.getLabel(); - final int id; final String label; -} +} \ No newline at end of file diff --git a/cw_monero/lib/monero_amount_format.dart b/cw_core/lib/monero_amount_format.dart similarity index 100% rename from cw_monero/lib/monero_amount_format.dart rename to cw_core/lib/monero_amount_format.dart diff --git a/cw_monero/lib/monero_balance.dart b/cw_core/lib/monero_balance.dart similarity index 95% rename from cw_monero/lib/monero_balance.dart rename to cw_core/lib/monero_balance.dart index 00a66aa91..8f0ae610e 100644 --- a/cw_monero/lib/monero_balance.dart +++ b/cw_core/lib/monero_balance.dart @@ -1,6 +1,6 @@ import 'package:cw_core/balance.dart'; import 'package:flutter/foundation.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; class MoneroBalance extends Balance { MoneroBalance({@required this.fullBalance, @required this.unlockedBalance}) diff --git a/cw_monero/lib/monero_transaction_priority.dart b/cw_core/lib/monero_transaction_priority.dart similarity index 100% rename from cw_monero/lib/monero_transaction_priority.dart rename to cw_core/lib/monero_transaction_priority.dart diff --git a/cw_monero/lib/monero_wallet_keys.dart b/cw_core/lib/monero_wallet_keys.dart similarity index 100% rename from cw_monero/lib/monero_wallet_keys.dart rename to cw_core/lib/monero_wallet_keys.dart diff --git a/cw_monero/lib/monero_wallet_utils.dart b/cw_core/lib/monero_wallet_utils.dart similarity index 100% rename from cw_monero/lib/monero_wallet_utils.dart rename to cw_core/lib/monero_wallet_utils.dart diff --git a/cw_core/lib/subaddress.dart b/cw_core/lib/subaddress.dart new file mode 100644 index 000000000..0f884dfa4 --- /dev/null +++ b/cw_core/lib/subaddress.dart @@ -0,0 +1,12 @@ +class Subaddress { + Subaddress({this.id, this.address, this.label}); + + Subaddress.fromMap(Map map) + : this.id = map['id'] == null ? 0 : int.parse(map['id'] as String), + this.address = (map['address'] ?? '') as String, + this.label = (map['label'] ?? '') as String; + + final int id; + final String address; + final String label; +} diff --git a/cw_haven/lib/haven_account_list.dart b/cw_haven/lib/haven_account_list.dart index 58ece76a2..ad1cd2a7b 100644 --- a/cw_haven/lib/haven_account_list.dart +++ b/cw_haven/lib/haven_account_list.dart @@ -1,5 +1,5 @@ import 'package:mobx/mobx.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_core/account_list.dart'; import 'package:cw_haven/api/account_list.dart' as account_list; diff --git a/cw_haven/lib/haven_balance.dart b/cw_haven/lib/haven_balance.dart index 7ea9d558f..17172fa9c 100644 --- a/cw_haven/lib/haven_balance.dart +++ b/cw_haven/lib/haven_balance.dart @@ -1,5 +1,5 @@ import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_monero/monero_balance.dart'; +import 'package:cw_core/monero_balance.dart'; import 'package:cw_haven/api/balance_list.dart'; import 'package:cw_haven/api/structs/haven_balance_row.dart'; diff --git a/cw_haven/lib/haven_subaddress_list.dart b/cw_haven/lib/haven_subaddress_list.dart index 19cf085c1..b6213d784 100644 --- a/cw_haven/lib/haven_subaddress_list.dart +++ b/cw_haven/lib/haven_subaddress_list.dart @@ -2,7 +2,7 @@ import 'package:cw_haven/api/structs/subaddress_row.dart'; import 'package:flutter/services.dart'; import 'package:mobx/mobx.dart'; import 'package:cw_haven/api/subaddress_list.dart' as subaddress_list; -import 'package:cw_monero/subaddress.dart'; +import 'package:cw_core/subaddress.dart'; part 'haven_subaddress_list.g.dart'; diff --git a/cw_haven/lib/haven_transaction_creation_credentials.dart b/cw_haven/lib/haven_transaction_creation_credentials.dart index 8e2ac682c..88525f0fd 100644 --- a/cw_haven/lib/haven_transaction_creation_credentials.dart +++ b/cw_haven/lib/haven_transaction_creation_credentials.dart @@ -1,4 +1,4 @@ -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/output_info.dart'; class HavenTransactionCreationCredentials { diff --git a/cw_haven/lib/haven_transaction_info.dart b/cw_haven/lib/haven_transaction_info.dart index 19bfeb379..16f032541 100644 --- a/cw_haven/lib/haven_transaction_info.dart +++ b/cw_haven/lib/haven_transaction_info.dart @@ -1,5 +1,5 @@ import 'package:cw_core/transaction_info.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_haven/api/structs/transaction_info_row.dart'; import 'package:cw_core/parseBoolFromString.dart'; import 'package:cw_core/transaction_direction.dart'; diff --git a/cw_haven/lib/haven_wallet.dart b/cw_haven/lib/haven_wallet.dart index 64cc71e58..b409f3644 100644 --- a/cw_haven/lib/haven_wallet.dart +++ b/cw_haven/lib/haven_wallet.dart @@ -2,11 +2,11 @@ import 'dart:async'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cw_haven/haven_transaction_creation_credentials.dart'; -import 'package:cw_monero/monero_amount_format.dart'; -import 'package:cw_monero/monero_transaction_creation_exception.dart'; +import 'package:cw_core/monero_amount_format.dart'; +import 'package:cw_haven/haven_transaction_creation_exception.dart'; import 'package:cw_haven/haven_transaction_info.dart'; import 'package:cw_haven/haven_wallet_addresses.dart'; -import 'package:cw_monero/monero_wallet_utils.dart'; +import 'package:cw_core/monero_wallet_utils.dart'; import 'package:cw_haven/api/structs/pending_transaction.dart'; import 'package:flutter/foundation.dart'; import 'package:mobx/mobx.dart'; @@ -17,16 +17,16 @@ import 'package:cw_haven/api/wallet.dart' as haven_wallet; import 'package:cw_haven/api/transaction_history.dart' as transaction_history; import 'package:cw_haven/api/monero_output.dart'; import 'package:cw_haven/pending_haven_transaction.dart'; -import 'package:cw_monero/monero_wallet_keys.dart'; -import 'package:cw_monero/monero_balance.dart'; +import 'package:cw_core/monero_wallet_keys.dart'; +import 'package:cw_core/monero_balance.dart'; import 'package:cw_haven/haven_transaction_history.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_core/pending_transaction.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/sync_status.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/node.dart'; -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_haven/haven_balance.dart'; part 'haven_wallet.g.dart'; diff --git a/cw_haven/lib/haven_wallet_addresses.dart b/cw_haven/lib/haven_wallet_addresses.dart index f48c83316..7afad6205 100644 --- a/cw_haven/lib/haven_wallet_addresses.dart +++ b/cw_haven/lib/haven_wallet_addresses.dart @@ -1,9 +1,9 @@ import 'package:cw_core/wallet_addresses_with_account.dart'; import 'package:cw_core/wallet_info.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_haven/haven_account_list.dart'; import 'package:cw_haven/haven_subaddress_list.dart'; -import 'package:cw_monero/subaddress.dart'; +import 'package:cw_core/subaddress.dart'; import 'package:mobx/mobx.dart'; part 'haven_wallet_addresses.g.dart'; diff --git a/cw_haven/lib/haven_wallet_service.dart b/cw_haven/lib/haven_wallet_service.dart index 899245a86..333f03191 100644 --- a/cw_haven/lib/haven_wallet_service.dart +++ b/cw_haven/lib/haven_wallet_service.dart @@ -1,6 +1,6 @@ import 'dart:io'; import 'package:cw_core/wallet_base.dart'; -import 'package:cw_monero/monero_wallet_utils.dart'; +import 'package:cw_core/monero_wallet_utils.dart'; import 'package:hive/hive.dart'; import 'package:cw_haven/api/wallet_manager.dart' as haven_wallet_manager; import 'package:cw_haven/api/wallet.dart' as haven_wallet; diff --git a/cw_haven/lib/monero_transaction_creation_exception.dart b/cw_haven/lib/monero_transaction_creation_exception.dart new file mode 100644 index 000000000..768abe7fa --- /dev/null +++ b/cw_haven/lib/monero_transaction_creation_exception.dart @@ -0,0 +1,8 @@ +class HavenTransactionCreationException implements Exception { + HavenTransactionCreationException(this.message); + + final String message; + + @override + String toString() => message; +} \ No newline at end of file diff --git a/cw_haven/lib/update_haven_rate.dart b/cw_haven/lib/update_haven_rate.dart index a80529ff2..967247af5 100644 --- a/cw_haven/lib/update_haven_rate.dart +++ b/cw_haven/lib/update_haven_rate.dart @@ -1,6 +1,6 @@ //import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_haven/balance_list.dart'; //Future updateHavenRate(FiatConversionStore fiatConversionStore) async { diff --git a/cw_haven/pubspec.yaml b/cw_haven/pubspec.yaml index aa07c9841..a8d8417be 100644 --- a/cw_haven/pubspec.yaml +++ b/cw_haven/pubspec.yaml @@ -20,8 +20,6 @@ dependencies: intl: ^0.17.0 cw_core: path: ../cw_core - cw_monero: - path: ../cw_monero dev_dependencies: flutter_test: diff --git a/cw_monero/lib/monero_account_list.dart b/cw_monero/lib/monero_account_list.dart index 0d50c4f20..2fd937ced 100644 --- a/cw_monero/lib/monero_account_list.dart +++ b/cw_monero/lib/monero_account_list.dart @@ -1,5 +1,5 @@ import 'package:mobx/mobx.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_monero/api/account_list.dart' as account_list; part 'monero_account_list.g.dart'; @@ -44,7 +44,9 @@ abstract class MoneroAccountListBase with Store { List getAll() => account_list .getAllAccount() - .map((accountRow) => Account.fromRow(accountRow)) + .map((accountRow) => Account( + id: accountRow.getId(), + label: row.getLabel())) .toList(); Future addAccount({String label}) async { diff --git a/cw_monero/lib/monero_subaddress_list.dart b/cw_monero/lib/monero_subaddress_list.dart index f5796bece..e59052207 100644 --- a/cw_monero/lib/monero_subaddress_list.dart +++ b/cw_monero/lib/monero_subaddress_list.dart @@ -2,7 +2,7 @@ import 'package:cw_monero/api/structs/subaddress_row.dart'; import 'package:flutter/services.dart'; import 'package:mobx/mobx.dart'; import 'package:cw_monero/api/subaddress_list.dart' as subaddress_list; -import 'package:cw_monero/subaddress.dart'; +import 'package:cw_core/subaddress.dart'; part 'monero_subaddress_list.g.dart'; @@ -49,7 +49,13 @@ abstract class MoneroSubaddressListBase with Store { } return subaddresses - .map((subaddressRow) => Subaddress.fromRow(subaddressRow)) + .map((subaddressRow) => Subaddress( + id: subaddressRow.getId(), + address: subaddressRow.getAddress(), + label: subaddressRow.getId() == 0 && + subaddressRow.getLabel().toLowerCase() == 'Primary account'.toLowerCase() + ? 'Primary address' + : subaddressRow.getLabel())) .toList(); } diff --git a/cw_monero/lib/monero_transaction_creation_credentials.dart b/cw_monero/lib/monero_transaction_creation_credentials.dart index d0b4fba20..3f0051046 100644 --- a/cw_monero/lib/monero_transaction_creation_credentials.dart +++ b/cw_monero/lib/monero_transaction_creation_credentials.dart @@ -1,4 +1,4 @@ -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/output_info.dart'; class MoneroTransactionCreationCredentials { diff --git a/cw_monero/lib/monero_transaction_info.dart b/cw_monero/lib/monero_transaction_info.dart index 9677c1341..db393497a 100644 --- a/cw_monero/lib/monero_transaction_info.dart +++ b/cw_monero/lib/monero_transaction_info.dart @@ -1,5 +1,5 @@ import 'package:cw_core/transaction_info.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_monero/api/structs/transaction_info_row.dart'; import 'package:cw_core/parseBoolFromString.dart'; import 'package:cw_core/transaction_direction.dart'; diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index c6a737ad8..1d675cd8c 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -1,10 +1,10 @@ import 'dart:async'; import 'package:cw_core/transaction_priority.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_monero/monero_transaction_creation_exception.dart'; import 'package:cw_monero/monero_transaction_info.dart'; import 'package:cw_monero/monero_wallet_addresses.dart'; -import 'package:cw_monero/monero_wallet_utils.dart'; +import 'package:cw_core/monero_wallet_utils.dart'; import 'package:cw_monero/api/structs/pending_transaction.dart'; import 'package:flutter/foundation.dart'; import 'package:mobx/mobx.dart'; @@ -16,16 +16,16 @@ import 'package:cw_monero/api/transaction_history.dart' as transaction_history; import 'package:cw_monero/api/monero_output.dart'; import 'package:cw_monero/monero_transaction_creation_credentials.dart'; import 'package:cw_monero/pending_monero_transaction.dart'; -import 'package:cw_monero/monero_wallet_keys.dart'; -import 'package:cw_monero/monero_balance.dart'; +import 'package:cw_core/monero_wallet_keys.dart'; +import 'package:cw_core/monero_balance.dart'; import 'package:cw_monero/monero_transaction_history.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_core/pending_transaction.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/sync_status.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/node.dart'; -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/crypto_currency.dart'; part 'monero_wallet.g.dart'; diff --git a/cw_monero/lib/monero_wallet_addresses.dart b/cw_monero/lib/monero_wallet_addresses.dart index 7d67c1e6a..c84e8c8e4 100644 --- a/cw_monero/lib/monero_wallet_addresses.dart +++ b/cw_monero/lib/monero_wallet_addresses.dart @@ -1,9 +1,9 @@ import 'package:cw_core/wallet_addresses.dart'; import 'package:cw_core/wallet_info.dart'; -import 'package:cw_monero/account.dart'; +import 'package:cw_core/account.dart'; import 'package:cw_monero/monero_account_list.dart'; import 'package:cw_monero/monero_subaddress_list.dart'; -import 'package:cw_monero/subaddress.dart'; +import 'package:cw_core/subaddress.dart'; import 'package:mobx/mobx.dart'; part 'monero_wallet_addresses.g.dart'; diff --git a/cw_monero/lib/monero_wallet_service.dart b/cw_monero/lib/monero_wallet_service.dart index c8930ee2b..d0461de72 100644 --- a/cw_monero/lib/monero_wallet_service.dart +++ b/cw_monero/lib/monero_wallet_service.dart @@ -1,6 +1,6 @@ import 'dart:io'; import 'package:cw_core/wallet_base.dart'; -import 'package:cw_monero/monero_wallet_utils.dart'; +import 'package:cw_core/monero_wallet_utils.dart'; import 'package:hive/hive.dart'; import 'package:cw_monero/api/wallet_manager.dart' as monero_wallet_manager; import 'package:cw_monero/api/wallet.dart' as monero_wallet; diff --git a/cw_monero/lib/subaddress.dart b/cw_monero/lib/subaddress.dart deleted file mode 100644 index 79d289880..000000000 --- a/cw_monero/lib/subaddress.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:cw_monero/api/structs/subaddress_row.dart'; - -class Subaddress { - Subaddress({this.id, this.address, this.label}); - - Subaddress.fromMap(Map map) - : this.id = map['id'] == null ? 0 : int.parse(map['id'] as String), - this.address = (map['address'] ?? '') as String, - this.label = (map['label'] ?? '') as String; - - Subaddress.fromRow(SubaddressRow row) - : this.id = row.getId(), - this.address = row.getAddress(), - this.label = row.getId() == 0 && - row.getLabel().toLowerCase() == 'Primary account'.toLowerCase() - ? 'Primary address' - : row.getLabel(); - - final int id; - final String address; - final String label; -} diff --git a/lib/entities/update_haven_rate.dart b/lib/entities/update_haven_rate.dart index d356a469a..b6221f5f1 100644 --- a/lib/entities/update_haven_rate.dart +++ b/lib/entities/update_haven_rate.dart @@ -1,6 +1,6 @@ import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_monero/monero_amount_format.dart'; +import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_haven/api/balance_list.dart'; Future updateHavenRate(FiatConversionStore fiatConversionStore) async { diff --git a/lib/haven/haven.dart b/lib/haven/haven.dart index 0ae05c85a..691aced22 100644 --- a/lib/haven/haven.dart +++ b/lib/haven/haven.dart @@ -11,13 +11,13 @@ import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cw_core/wallet_service.dart'; import 'package:hive/hive.dart'; import 'package:cw_monero/get_height_by_date.dart'; -import 'package:cw_monero/monero_amount_format.dart'; -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_amount_format.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_haven/haven_wallet_service.dart'; import 'package:cw_haven/haven_wallet.dart'; import 'package:cw_haven/haven_transaction_info.dart'; import 'package:cw_haven/haven_transaction_history.dart'; -import 'package:cw_monero/account.dart' as monero_account; +import 'package:cw_core/account.dart' as monero_account; import 'package:cw_haven/api/wallet.dart' as monero_wallet_api; import 'package:cw_monero/mnemonics/english.dart'; import 'package:cw_monero/mnemonics/chinese_simplified.dart'; diff --git a/scripts/android/build_haven.sh b/scripts/android/build_haven.sh index 08e41bd29..40dff300d 100755 --- a/scripts/android/build_haven.sh +++ b/scripts/android/build_haven.sh @@ -14,7 +14,7 @@ for arch in "aarch" "aarch64" "i686" "x86_64" do FLAGS="" PREFIX=${WORKDIR}/prefix_${arch} -DEST_LIB_DIR=${PREFIX}/lib/monero +DEST_LIB_DIR=${PREFIX}/lib/haven DEST_INCLUDE_DIR=${PREFIX}/include export CMAKE_INCLUDE_PATH="${PREFIX}/include" export CMAKE_LIBRARY_PATH="${PREFIX}/lib" diff --git a/tool/configure.dart b/tool/configure.dart index d326a4385..02fc66fb8 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -126,14 +126,14 @@ import 'package:cw_core/wallet_service.dart'; import 'package:hive/hive.dart';"""; const moneroCWHeaders = """ import 'package:cw_monero/get_height_by_date.dart'; -import 'package:cw_monero/monero_amount_format.dart'; -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_amount_format.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_monero/monero_wallet_service.dart'; import 'package:cw_monero/monero_wallet.dart'; import 'package:cw_monero/monero_transaction_info.dart'; import 'package:cw_monero/monero_transaction_history.dart'; import 'package:cw_monero/monero_transaction_creation_credentials.dart'; -import 'package:cw_monero/account.dart' as monero_account; +import 'package:cw_core/account.dart' as monero_account; import 'package:cw_monero/api/wallet.dart' as monero_wallet_api; import 'package:cw_monero/mnemonics/english.dart'; import 'package:cw_monero/mnemonics/chinese_simplified.dart'; @@ -290,13 +290,13 @@ import 'package:cw_core/wallet_service.dart'; import 'package:hive/hive.dart';"""; const havenCWHeaders = """ import 'package:cw_monero/get_height_by_date.dart'; -import 'package:cw_monero/monero_amount_format.dart'; -import 'package:cw_monero/monero_transaction_priority.dart'; +import 'package:cw_core/monero_amount_format.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_haven/haven_wallet_service.dart'; import 'package:cw_haven/haven_wallet.dart'; import 'package:cw_haven/haven_transaction_info.dart'; import 'package:cw_haven/haven_transaction_history.dart'; -import 'package:cw_monero/account.dart' as monero_account; +import 'package:cw_core/account.dart' as monero_account; import 'package:cw_haven/api/wallet.dart' as monero_wallet_api; import 'package:cw_monero/mnemonics/english.dart'; import 'package:cw_monero/mnemonics/chinese_simplified.dart'; @@ -473,7 +473,7 @@ Future generatePubspec({bool hasMonero, bool hasBitcoin, bool hasHaven}) a } if (hasHaven) { - output += '\n$cwSharedExternal\n$cwHaven\n$cwMonero'; + output += '\n$cwSharedExternal\n$cwHaven'; } final outputLines = output.split('\n');