Move monero related out from haven

This commit is contained in:
M 2022-02-24 19:43:23 +03:00
parent 37f8823a2f
commit cf6eeae055
30 changed files with 73 additions and 75 deletions

View file

@ -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;
}
}

View file

@ -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})

View file

@ -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;
}

View file

@ -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;

View file

@ -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';

View file

@ -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';

View file

@ -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 {

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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;

View file

@ -0,0 +1,8 @@
class HavenTransactionCreationException implements Exception {
HavenTransactionCreationException(this.message);
final String message;
@override
String toString() => message;
}

View file

@ -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<void> updateHavenRate(FiatConversionStore fiatConversionStore) async {

View file

@ -20,8 +20,6 @@ dependencies:
intl: ^0.17.0
cw_core:
path: ../cw_core
cw_monero:
path: ../cw_monero
dev_dependencies:
flutter_test:

View file

@ -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<Account> getAll() => account_list
.getAllAccount()
.map((accountRow) => Account.fromRow(accountRow))
.map((accountRow) => Account(
id: accountRow.getId(),
label: row.getLabel()))
.toList();
Future addAccount({String label}) async {

View file

@ -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();
}

View file

@ -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 {

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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;

View file

@ -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;
}

View file

@ -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<void> updateHavenRate(FiatConversionStore fiatConversionStore) async {

View file

@ -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';

View file

@ -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"

View file

@ -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<void> 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');