Fixes for haven dependencies

This commit is contained in:
M
2022-04-07 12:19:10 +01:00
parent a4feab8e3d
commit 3e43ef9a0e
4 changed files with 34 additions and 15 deletions
+16 -4
View File
@@ -275,7 +275,8 @@ abstract class MoneroAccountList {
}
Future<void> generateHaven(bool hasImplementation) async {
final outputFile = File(moneroOutputPath);
final outputFile = File(havenOutputPath);
const havenCommonHeaders = """
import 'package:mobx/mobx.dart';
import 'package:flutter/foundation.dart';
@@ -288,7 +289,8 @@ import 'package:cw_core/balance.dart';
import 'package:cw_core/output_info.dart';
import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/wallet_service.dart';
import 'package:hive/hive.dart';""";
import 'package:hive/hive.dart';
import 'package:cw_core/crypto_currency.dart';""";
const havenCWHeaders = """
import 'package:cw_core/get_height_by_date.dart';
import 'package:cw_core/monero_amount_format.dart';
@@ -310,6 +312,7 @@ import 'package:cw_haven/mnemonics/portuguese.dart';
import 'package:cw_haven/mnemonics/french.dart';
import 'package:cw_haven/mnemonics/italian.dart';
import 'package:cw_haven/haven_transaction_creation_credentials.dart';
import 'package:cw_haven/api/balance_list.dart';
""";
const havenCwPart = "part 'cw_haven.dart';";
const havenContent = """
@@ -354,6 +357,13 @@ class HavenBalance extends Balance {
String get formattedAdditionalBalance => formattedFullBalance;
}
class AssetRate {
final String asset;
final int rate;
AssetRate(this.asset, this.rate);
}
abstract class HavenWalletDetails {
@observable
Account account;
@@ -399,6 +409,8 @@ abstract class Haven {
void onStartup();
int getTransactionInfoAccountId(TransactionInfo tx);
WalletService createHavenWalletService(Box<WalletInfo> walletInfoSource);
CryptoCurrency assetOfTransaction(TransactionInfo tx);
List<AssetRate> getAssetRate();
}
abstract class MoneroSubaddressList {
@@ -421,8 +433,8 @@ abstract class HavenAccountList {
}
""";
const havenEmptyDefinition = 'Monero monero;\n';
const havenCWDefinition = 'Monero monero = CWMonero();\n';
const havenEmptyDefinition = 'Haven haven;\n';
const havenCWDefinition = 'Haven haven = CWHaven();\n';
final output = '$havenCommonHeaders\n'
+ (hasImplementation ? '$havenCWHeaders\n' : '\n')