mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-18 09:54:01 +01:00
Merge redesign part 7.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cake_wallet/src/domain/common/wallet_info.dart';
|
||||
import 'package:cake_wallet/core/pending_transaction.dart';
|
||||
import 'package:cake_wallet/core/transaction_history.dart';
|
||||
import 'package:cake_wallet/src/domain/common/transaction_priority.dart';
|
||||
@@ -7,18 +8,43 @@ import 'package:cake_wallet/src/domain/common/sync_status.dart';
|
||||
import 'package:cake_wallet/src/domain/common/node.dart';
|
||||
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
|
||||
|
||||
// FIXME: Move me.
|
||||
CryptoCurrency currencyForWalletType(WalletType type) {
|
||||
switch (type) {
|
||||
case WalletType.bitcoin:
|
||||
return CryptoCurrency.btc;
|
||||
case WalletType.monero:
|
||||
return CryptoCurrency.xmr;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class WalletBase<BalaceType> {
|
||||
WalletType type;
|
||||
WalletBase(this.walletInfo);
|
||||
|
||||
CryptoCurrency currency;
|
||||
static String idFor(String name, WalletType type) =>
|
||||
walletTypeToString(type).toLowerCase() + '_' + name;
|
||||
|
||||
String get name;
|
||||
WalletInfo walletInfo;
|
||||
|
||||
String address;
|
||||
WalletType get type => walletInfo.type;
|
||||
|
||||
BalaceType balance;
|
||||
CryptoCurrency get currency => currencyForWalletType(type);
|
||||
|
||||
SyncStatus syncStatus;
|
||||
String get id => walletInfo.id;
|
||||
|
||||
String get name => walletInfo.name;
|
||||
|
||||
String get address;
|
||||
|
||||
set address(String address);
|
||||
|
||||
BalaceType get balance;
|
||||
|
||||
SyncStatus get syncStatus;
|
||||
|
||||
set syncStatus(SyncStatus status);
|
||||
|
||||
String get seed;
|
||||
|
||||
@@ -26,8 +52,6 @@ abstract class WalletBase<BalaceType> {
|
||||
|
||||
TransactionHistoryBase transactionHistory;
|
||||
|
||||
String get id => walletTypeToString(type).toLowerCase() + '_' + name;
|
||||
|
||||
Future<void> connectToNode({@required Node node});
|
||||
|
||||
Future<void> startSync();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -32,17 +33,7 @@ class WalletCreationService {
|
||||
|
||||
void changeWalletType({@required WalletType type}) {
|
||||
this.type = type;
|
||||
|
||||
switch (type) {
|
||||
case WalletType.monero:
|
||||
_service = MoneroWalletService();
|
||||
break;
|
||||
case WalletType.bitcoin:
|
||||
_service = BitcoinWalletService();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_service = getIt.get<WalletService>(param1: type);
|
||||
}
|
||||
|
||||
Future<void> create(WalletCredentials credentials) async {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'package:cake_wallet/src/domain/common/wallet_info.dart';
|
||||
|
||||
abstract class WalletCredentials {
|
||||
WalletCredentials({this.name, this.password});
|
||||
WalletCredentials({this.name, this.password, this.height});
|
||||
|
||||
final String name;
|
||||
final int height;
|
||||
String password;
|
||||
}
|
||||
WalletInfo walletInfo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user