mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
@@ -0,0 +1,10 @@
|
||||
class Account {
|
||||
Account({this.id, this.label});
|
||||
|
||||
Account.fromMap(Map map)
|
||||
: this.id = map['id'] == null ? 0 : int.parse(map['id'] as String),
|
||||
this.label = (map['label'] ?? '') as String;
|
||||
|
||||
final int id;
|
||||
final String label;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
abstract class AccountList<T> {
|
||||
|
||||
ObservableList<T> get accounts;
|
||||
|
||||
void update();
|
||||
|
||||
List<T> getAll();
|
||||
|
||||
Future addAccount({String label});
|
||||
|
||||
Future setLabelAccount({int accountIndex, String label});
|
||||
|
||||
void refresh();
|
||||
}
|
||||
@@ -23,7 +23,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
CryptoCurrency.usdt,
|
||||
CryptoCurrency.usdterc20,
|
||||
CryptoCurrency.xlm,
|
||||
CryptoCurrency.xrp
|
||||
CryptoCurrency.xrp,
|
||||
CryptoCurrency.xhv
|
||||
];
|
||||
static const xmr = CryptoCurrency(title: 'XMR', raw: 0);
|
||||
static const ada = CryptoCurrency(title: 'ADA', raw: 1);
|
||||
@@ -41,6 +42,21 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
static const usdterc20 = CryptoCurrency(title: 'USDTERC20', raw: 13);
|
||||
static const xlm = CryptoCurrency(title: 'XLM', raw: 14);
|
||||
static const xrp = CryptoCurrency(title: 'XRP', raw: 15);
|
||||
static const xhv = CryptoCurrency(title: 'XHV', raw: 16);
|
||||
|
||||
static const xag = CryptoCurrency(title: 'XAG', raw: 17);
|
||||
static const xau = CryptoCurrency(title: 'XAU', raw: 18);
|
||||
static const xaud = CryptoCurrency(title: 'XAUD', raw: 19);
|
||||
static const xbtc = CryptoCurrency(title: 'XBTC', raw: 20);
|
||||
static const xcad = CryptoCurrency(title: 'XCAD', raw: 21);
|
||||
static const xchf = CryptoCurrency(title: 'XCHF', raw: 22);
|
||||
static const xcny = CryptoCurrency(title: 'XCNY', raw: 23);
|
||||
static const xeur = CryptoCurrency(title: 'XEUR', raw: 24);
|
||||
static const xgbp = CryptoCurrency(title: 'XGBP', raw: 25);
|
||||
static const xjpy = CryptoCurrency(title: 'XJPY', raw: 26);
|
||||
static const xnok = CryptoCurrency(title: 'XNOK', raw: 27);
|
||||
static const xnzd = CryptoCurrency(title: 'XNZD', raw: 28);
|
||||
static const xusd = CryptoCurrency(title: 'XUSD', raw: 29);
|
||||
|
||||
static CryptoCurrency deserialize({int raw}) {
|
||||
switch (raw) {
|
||||
@@ -76,6 +92,34 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
return CryptoCurrency.xlm;
|
||||
case 15:
|
||||
return CryptoCurrency.xrp;
|
||||
case 16:
|
||||
return CryptoCurrency.xhv;
|
||||
case 17:
|
||||
return CryptoCurrency.xag;
|
||||
case 18:
|
||||
return CryptoCurrency.xau;
|
||||
case 19:
|
||||
return CryptoCurrency.xaud;
|
||||
case 20:
|
||||
return CryptoCurrency.xbtc;
|
||||
case 21:
|
||||
return CryptoCurrency.xcad;
|
||||
case 22:
|
||||
return CryptoCurrency.xchf;
|
||||
case 23:
|
||||
return CryptoCurrency.xcny;
|
||||
case 24:
|
||||
return CryptoCurrency.xeur;
|
||||
case 25:
|
||||
return CryptoCurrency.xgbp;
|
||||
case 26:
|
||||
return CryptoCurrency.xjpy;
|
||||
case 27:
|
||||
return CryptoCurrency.xnok;
|
||||
case 28:
|
||||
return CryptoCurrency.xnzd;
|
||||
case 29:
|
||||
return CryptoCurrency.xusd;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -115,6 +159,34 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
return CryptoCurrency.xlm;
|
||||
case 'xrp':
|
||||
return CryptoCurrency.xrp;
|
||||
case 'xhv':
|
||||
return CryptoCurrency.xhv;
|
||||
case 'xag':
|
||||
return CryptoCurrency.xag;
|
||||
case 'xau':
|
||||
return CryptoCurrency.xau;
|
||||
case 'xaud':
|
||||
return CryptoCurrency.xaud;
|
||||
case 'xbtc':
|
||||
return CryptoCurrency.xbtc;
|
||||
case 'xcad':
|
||||
return CryptoCurrency.xcad;
|
||||
case 'xchf':
|
||||
return CryptoCurrency.xchf;
|
||||
case 'xcny':
|
||||
return CryptoCurrency.xcny;
|
||||
case 'xeur':
|
||||
return CryptoCurrency.xeur;
|
||||
case 'xgbp':
|
||||
return CryptoCurrency.xgbp;
|
||||
case 'xjpy':
|
||||
return CryptoCurrency.xjpy;
|
||||
case 'xnok':
|
||||
return CryptoCurrency.xnok;
|
||||
case 'xnzd':
|
||||
return CryptoCurrency.xnzd;
|
||||
case 'xusd':
|
||||
return CryptoCurrency.xusd;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ CryptoCurrency currencyForWalletType(WalletType type) {
|
||||
return CryptoCurrency.xmr;
|
||||
case WalletType.litecoin:
|
||||
return CryptoCurrency.ltc;
|
||||
case WalletType.haven:
|
||||
return CryptoCurrency.xhv;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
// FIXME: Hardcoded values; Works only for monero
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM');
|
||||
final dates = {
|
||||
"2014-5": 18844,
|
||||
"2014-6": 65406,
|
||||
"2014-7": 108882,
|
||||
"2014-8": 153594,
|
||||
"2014-9": 198072,
|
||||
"2014-10": 241088,
|
||||
"2014-11": 285305,
|
||||
"2014-12": 328069,
|
||||
"2015-1": 372369,
|
||||
"2015-2": 416505,
|
||||
"2015-3": 456631,
|
||||
"2015-4": 501084,
|
||||
"2015-5": 543973,
|
||||
"2015-6": 588326,
|
||||
"2015-7": 631187,
|
||||
"2015-8": 675484,
|
||||
"2015-9": 719725,
|
||||
"2015-10": 762463,
|
||||
"2015-11": 806528,
|
||||
"2015-12": 849041,
|
||||
"2016-1": 892866,
|
||||
"2016-2": 936736,
|
||||
"2016-3": 977691,
|
||||
"2016-4": 1015848,
|
||||
"2016-5": 1037417,
|
||||
"2016-6": 1059651,
|
||||
"2016-7": 1081269,
|
||||
"2016-8": 1103630,
|
||||
"2016-9": 1125983,
|
||||
"2016-10": 1147617,
|
||||
"2016-11": 1169779,
|
||||
"2016-12": 1191402,
|
||||
"2017-1": 1213861,
|
||||
"2017-2": 1236197,
|
||||
"2017-3": 1256358,
|
||||
"2017-4": 1278622,
|
||||
"2017-5": 1300239,
|
||||
"2017-6": 1322564,
|
||||
"2017-7": 1344225,
|
||||
"2017-8": 1366664,
|
||||
"2017-9": 1389113,
|
||||
"2017-10": 1410738,
|
||||
"2017-11": 1433039,
|
||||
"2017-12": 1454639,
|
||||
"2018-1": 1477201,
|
||||
"2018-2": 1499599,
|
||||
"2018-3": 1519796,
|
||||
"2018-4": 1542067,
|
||||
"2018-5": 1562861,
|
||||
"2018-6": 1585135,
|
||||
"2018-7": 1606715,
|
||||
"2018-8": 1629017,
|
||||
"2018-9": 1651347,
|
||||
"2018-10": 1673031,
|
||||
"2018-11": 1695128,
|
||||
"2018-12": 1716687,
|
||||
"2019-1": 1738923,
|
||||
"2019-2": 1761435,
|
||||
"2019-3": 1781681,
|
||||
"2019-4": 1803081,
|
||||
"2019-5": 1824671,
|
||||
"2019-6": 1847005,
|
||||
"2019-7": 1868590,
|
||||
"2019-8": 1890552,
|
||||
"2019-9": 1912212,
|
||||
"2019-10": 1932200,
|
||||
"2019-11": 1957040,
|
||||
"2019-12": 1978090,
|
||||
"2020-1": 2001290,
|
||||
"2020-2": 2022688,
|
||||
"2020-3": 2043987,
|
||||
"2020-4": 2066536,
|
||||
"2020-5": 2090797,
|
||||
"2020-6": 2111633,
|
||||
"2020-7": 2131433,
|
||||
"2020-8": 2153983,
|
||||
"2020-9": 2176466,
|
||||
"2020-10": 2198453,
|
||||
"2020-11": 2220000
|
||||
};
|
||||
|
||||
int getMoneroHeigthByDate({DateTime date}) {
|
||||
final raw = '${date.year}' + '-' + '${date.month}';
|
||||
final lastHeight = dates.values.last;
|
||||
int startHeight;
|
||||
int endHeight;
|
||||
int height = 0;
|
||||
|
||||
try {
|
||||
if ((dates[raw] == null)||(dates[raw] == lastHeight)) {
|
||||
startHeight = dates.values.toList()[dates.length - 2];
|
||||
endHeight = dates.values.toList()[dates.length - 1];
|
||||
final heightPerDay = (endHeight - startHeight) / 31;
|
||||
final endDateRaw = dates.keys.toList()[dates.length - 1].split('-');
|
||||
final endYear = int.parse(endDateRaw[0]);
|
||||
final endMonth = int.parse(endDateRaw[1]);
|
||||
final endDate = DateTime(endYear, endMonth);
|
||||
final differenceInDays = date.difference(endDate).inDays;
|
||||
final daysHeight = (differenceInDays * heightPerDay).round();
|
||||
height = endHeight + daysHeight;
|
||||
} else {
|
||||
startHeight = dates[raw];
|
||||
final index = dates.values.toList().indexOf(startHeight);
|
||||
endHeight = dates.values.toList()[index + 1];
|
||||
final heightPerDay = ((endHeight - startHeight) / 31).round();
|
||||
final daysHeight = (date.day - 1) * heightPerDay;
|
||||
height = startHeight + daysHeight - heightPerDay;
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:cw_core/crypto_amount_format.dart';
|
||||
|
||||
const moneroAmountLength = 12;
|
||||
const moneroAmountDivider = 1000000000000;
|
||||
final moneroAmountFormat = NumberFormat()
|
||||
..maximumFractionDigits = moneroAmountLength
|
||||
..minimumFractionDigits = 1;
|
||||
|
||||
String moneroAmountToString({int amount}) => moneroAmountFormat
|
||||
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider))
|
||||
.replaceAll(',', '');
|
||||
|
||||
double moneroAmountToDouble({int amount}) =>
|
||||
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
||||
|
||||
int moneroParseAmount({String amount}) =>
|
||||
(double.parse(amount) * moneroAmountDivider).toInt();
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cw_core/monero_amount_format.dart';
|
||||
|
||||
class MoneroBalance extends Balance {
|
||||
MoneroBalance({@required this.fullBalance, @required this.unlockedBalance})
|
||||
: formattedFullBalance = moneroAmountToString(amount: fullBalance),
|
||||
formattedUnlockedBalance =
|
||||
moneroAmountToString(amount: unlockedBalance),
|
||||
super(unlockedBalance, fullBalance);
|
||||
|
||||
MoneroBalance.fromString(
|
||||
{@required this.formattedFullBalance,
|
||||
@required this.formattedUnlockedBalance})
|
||||
: fullBalance = moneroParseAmount(amount: formattedFullBalance),
|
||||
unlockedBalance = moneroParseAmount(amount: formattedUnlockedBalance),
|
||||
super(moneroParseAmount(amount: formattedUnlockedBalance),
|
||||
moneroParseAmount(amount: formattedFullBalance));
|
||||
|
||||
final int fullBalance;
|
||||
final int unlockedBalance;
|
||||
final String formattedFullBalance;
|
||||
final String formattedUnlockedBalance;
|
||||
|
||||
@override
|
||||
String get formattedAvailableBalance => formattedUnlockedBalance;
|
||||
|
||||
@override
|
||||
String get formattedAdditionalBalance => formattedFullBalance;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
//import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cw_core/enumerable_item.dart';
|
||||
|
||||
class MoneroTransactionPriority extends TransactionPriority {
|
||||
const MoneroTransactionPriority({String title, int raw})
|
||||
: super(title: title, raw: raw);
|
||||
|
||||
static const all = [
|
||||
MoneroTransactionPriority.slow,
|
||||
MoneroTransactionPriority.regular,
|
||||
MoneroTransactionPriority.medium,
|
||||
MoneroTransactionPriority.fast,
|
||||
MoneroTransactionPriority.fastest
|
||||
];
|
||||
static const slow = MoneroTransactionPriority(title: 'Slow', raw: 0);
|
||||
static const regular = MoneroTransactionPriority(title: 'Regular', raw: 1);
|
||||
static const medium = MoneroTransactionPriority(title: 'Medium', raw: 2);
|
||||
static const fast = MoneroTransactionPriority(title: 'Fast', raw: 3);
|
||||
static const fastest = MoneroTransactionPriority(title: 'Fastest', raw: 4);
|
||||
static const standard = slow;
|
||||
|
||||
|
||||
static List<MoneroTransactionPriority> forWalletType(WalletType type) {
|
||||
switch (type) {
|
||||
case WalletType.monero:
|
||||
return MoneroTransactionPriority.all;
|
||||
case WalletType.bitcoin:
|
||||
return [
|
||||
MoneroTransactionPriority.slow,
|
||||
MoneroTransactionPriority.regular,
|
||||
MoneroTransactionPriority.fast
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
static MoneroTransactionPriority deserialize({int raw}) {
|
||||
switch (raw) {
|
||||
case 0:
|
||||
return slow;
|
||||
case 1:
|
||||
return regular;
|
||||
case 2:
|
||||
return medium;
|
||||
case 3:
|
||||
return fast;
|
||||
case 4:
|
||||
return fastest;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (this) {
|
||||
case MoneroTransactionPriority.slow:
|
||||
return 'Slow'; // S.current.transaction_priority_slow;
|
||||
case MoneroTransactionPriority.regular:
|
||||
return 'Regular'; // S.current.transaction_priority_regular;
|
||||
case MoneroTransactionPriority.medium:
|
||||
return 'Medium'; // S.current.transaction_priority_medium;
|
||||
case MoneroTransactionPriority.fast:
|
||||
return 'Fast'; // S.current.transaction_priority_fast;
|
||||
case MoneroTransactionPriority.fastest:
|
||||
return 'Fastest'; // S.current.transaction_priority_fastest;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class MoneroWalletKeys {
|
||||
const MoneroWalletKeys(
|
||||
{this.privateSpendKey,
|
||||
this.privateViewKey,
|
||||
this.publicSpendKey,
|
||||
this.publicViewKey});
|
||||
|
||||
final String publicViewKey;
|
||||
final String privateViewKey;
|
||||
final String publicSpendKey;
|
||||
final String privateSpendKey;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import 'dart:io';
|
||||
import 'package:cw_core/pathForWallet.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
String backupFileName(String originalPath) {
|
||||
final pathParts = originalPath.split('/');
|
||||
final newName = '#_${pathParts.last}';
|
||||
pathParts.removeLast();
|
||||
pathParts.add(newName);
|
||||
return pathParts.join('/');
|
||||
}
|
||||
|
||||
Future<void> backupWalletFiles(String name) async {
|
||||
final path = await pathForWallet(name: name, type: WalletType.monero);
|
||||
final cacheFile = File(path);
|
||||
final keysFile = File('$path.keys');
|
||||
final addressListFile = File('$path.address.txt');
|
||||
final newCacheFilePath = backupFileName(cacheFile.path);
|
||||
final newKeysFilePath = backupFileName(keysFile.path);
|
||||
final newAddressListFilePath = backupFileName(addressListFile.path);
|
||||
|
||||
if (cacheFile.existsSync()) {
|
||||
await cacheFile.copy(newCacheFilePath);
|
||||
}
|
||||
|
||||
if (keysFile.existsSync()) {
|
||||
await keysFile.copy(newKeysFilePath);
|
||||
}
|
||||
|
||||
if (addressListFile.existsSync()) {
|
||||
await addressListFile.copy(newAddressListFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> restoreWalletFiles(String name) async {
|
||||
final walletDirPath = await pathForWalletDir(name: name, type: WalletType.monero);
|
||||
final cacheFilePath = '$walletDirPath/$name';
|
||||
final keysFilePath = '$walletDirPath/$name.keys';
|
||||
final addressListFilePath = '$walletDirPath/$name.address.txt';
|
||||
final backupCacheFile = File(backupFileName(cacheFilePath));
|
||||
final backupKeysFile = File(backupFileName(keysFilePath));
|
||||
final backupAddressListFile = File(backupFileName(addressListFilePath));
|
||||
|
||||
if (backupCacheFile.existsSync()) {
|
||||
await backupCacheFile.copy(cacheFilePath);
|
||||
}
|
||||
|
||||
if (backupKeysFile.existsSync()) {
|
||||
await backupKeysFile.copy(keysFilePath);
|
||||
}
|
||||
|
||||
if (backupAddressListFile.existsSync()) {
|
||||
await backupAddressListFile.copy(addressListFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> backupWalletFilesExists(String name) async {
|
||||
final walletDirPath = await pathForWalletDir(name: name, type: WalletType.monero);
|
||||
final cacheFilePath = '$walletDirPath/$name';
|
||||
final keysFilePath = '$walletDirPath/$name.keys';
|
||||
final addressListFilePath = '$walletDirPath/$name.address.txt';
|
||||
final backupCacheFile = File(backupFileName(cacheFilePath));
|
||||
final backupKeysFile = File(backupFileName(keysFilePath));
|
||||
final backupAddressListFile = File(backupFileName(addressListFilePath));
|
||||
|
||||
return backupCacheFile.existsSync()
|
||||
&& backupKeysFile.existsSync()
|
||||
&& backupAddressListFile.existsSync();
|
||||
}
|
||||
|
||||
Future<void> removeCache(String name) async {
|
||||
final path = await pathForWallet(name: name, type: WalletType.monero);
|
||||
final cacheFile = File(path);
|
||||
|
||||
if (cacheFile.existsSync()) {
|
||||
cacheFile.deleteSync();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> restoreOrResetWalletFiles(String name) async {
|
||||
final backupsExists = await backupWalletFilesExists(name);
|
||||
|
||||
if (backupsExists) {
|
||||
await restoreWalletFiles(name);
|
||||
}
|
||||
|
||||
removeCache(name);
|
||||
}
|
||||
@@ -60,6 +60,8 @@ class Node extends HiveObject with Keyable {
|
||||
return createUriFromElectrumAddress(uriRaw);
|
||||
case WalletType.litecoin:
|
||||
return createUriFromElectrumAddress(uriRaw);
|
||||
case WalletType.haven:
|
||||
return Uri.http(uriRaw, '');
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:cw_core/wallet_addresses.dart';
|
||||
import 'package:cw_core/account_list.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
|
||||
abstract class WalletAddressesWithAccount<T> extends WalletAddresses {
|
||||
WalletAddressesWithAccount(WalletInfo walletInfo) : super(walletInfo);
|
||||
|
||||
T get account;
|
||||
|
||||
set account(T account);
|
||||
|
||||
AccountList<T> get accountList;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
@@ -35,7 +36,7 @@ abstract class WalletBase<
|
||||
|
||||
//set address(String address);
|
||||
|
||||
BalanceType get balance;
|
||||
ObservableMap<CryptoCurrency, BalanceType> get balance;
|
||||
|
||||
SyncStatus get syncStatus;
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ part 'wallet_type.g.dart';
|
||||
const walletTypes = [
|
||||
WalletType.monero,
|
||||
WalletType.bitcoin,
|
||||
WalletType.litecoin
|
||||
WalletType.litecoin,
|
||||
WalletType.haven
|
||||
];
|
||||
const walletTypeTypeId = 5;
|
||||
|
||||
@@ -22,7 +23,10 @@ enum WalletType {
|
||||
bitcoin,
|
||||
|
||||
@HiveField(3)
|
||||
litecoin
|
||||
litecoin,
|
||||
|
||||
@HiveField(4)
|
||||
haven
|
||||
}
|
||||
|
||||
int serializeToInt(WalletType type) {
|
||||
@@ -33,6 +37,8 @@ int serializeToInt(WalletType type) {
|
||||
return 1;
|
||||
case WalletType.litecoin:
|
||||
return 2;
|
||||
case WalletType.haven:
|
||||
return 3;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -46,6 +52,8 @@ WalletType deserializeFromInt(int raw) {
|
||||
return WalletType.bitcoin;
|
||||
case 2:
|
||||
return WalletType.litecoin;
|
||||
case 3:
|
||||
return WalletType.haven;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -59,6 +67,8 @@ String walletTypeToString(WalletType type) {
|
||||
return 'Bitcoin';
|
||||
case WalletType.litecoin:
|
||||
return 'Litecoin';
|
||||
case WalletType.haven:
|
||||
return 'Haven';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -72,6 +82,8 @@ String walletTypeToDisplayName(WalletType type) {
|
||||
return 'Bitcoin (Electrum)';
|
||||
case WalletType.litecoin:
|
||||
return 'Litecoin (Electrum)';
|
||||
case WalletType.haven:
|
||||
return 'Haven';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -85,6 +97,8 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type) {
|
||||
return CryptoCurrency.btc;
|
||||
case WalletType.litecoin:
|
||||
return CryptoCurrency.ltc;
|
||||
case WalletType.haven:
|
||||
return CryptoCurrency.xhv;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user