2020-06-01 18:13:56 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/wallet_info.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
import 'package:cake_wallet/core/pending_transaction.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/core/transaction_history.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/currency_for_wallet_type.dart';
|
|
|
|
import 'package:cake_wallet/entities/transaction_priority.dart';
|
|
|
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
|
|
|
import 'package:cake_wallet/entities/sync_status.dart';
|
|
|
|
import 'package:cake_wallet/entities/node.dart';
|
|
|
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
2020-09-15 20:35:49 +00:00
|
|
|
|
2020-06-01 18:13:56 +00:00
|
|
|
abstract class WalletBase<BalaceType> {
|
2020-09-15 20:35:49 +00:00
|
|
|
WalletBase(this.walletInfo);
|
|
|
|
|
|
|
|
static String idFor(String name, WalletType type) =>
|
|
|
|
walletTypeToString(type).toLowerCase() + '_' + name;
|
|
|
|
|
|
|
|
WalletInfo walletInfo;
|
|
|
|
|
|
|
|
WalletType get type => walletInfo.type;
|
2020-06-01 18:13:56 +00:00
|
|
|
|
2020-09-15 20:35:49 +00:00
|
|
|
CryptoCurrency get currency => currencyForWalletType(type);
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-09-15 20:35:49 +00:00
|
|
|
String get id => walletInfo.id;
|
2020-06-01 18:13:56 +00:00
|
|
|
|
2020-09-15 20:35:49 +00:00
|
|
|
String get name => walletInfo.name;
|
2020-06-01 18:13:56 +00:00
|
|
|
|
2020-09-15 20:35:49 +00:00
|
|
|
String get address;
|
2020-06-01 18:13:56 +00:00
|
|
|
|
2020-09-15 20:35:49 +00:00
|
|
|
set address(String address);
|
|
|
|
|
|
|
|
BalaceType get balance;
|
|
|
|
|
|
|
|
SyncStatus get syncStatus;
|
|
|
|
|
|
|
|
set syncStatus(SyncStatus status);
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
String get seed;
|
|
|
|
|
|
|
|
Object get keys;
|
|
|
|
|
2020-06-20 07:10:00 +00:00
|
|
|
TransactionHistoryBase transactionHistory;
|
|
|
|
|
2020-06-01 18:13:56 +00:00
|
|
|
Future<void> connectToNode({@required Node node});
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-06-01 18:13:56 +00:00
|
|
|
Future<void> startSync();
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
Future<PendingTransaction> createTransaction(Object credentials);
|
|
|
|
|
|
|
|
double calculateEstimatedFee(TransactionPriority priority);
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-06-01 18:13:56 +00:00
|
|
|
Future<void> save();
|
2020-09-21 11:50:26 +00:00
|
|
|
|
|
|
|
Future<void> rescan({int height});
|
2020-06-20 07:10:00 +00:00
|
|
|
}
|