mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
Flutter upgrade
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Account {
|
||||
Account({this.id, this.label});
|
||||
Account({required this.id, required this.label});
|
||||
|
||||
Account.fromMap(Map map)
|
||||
Account.fromMap(Map<String, Object> map)
|
||||
: this.id = map['id'] == null ? 0 : int.parse(map['id'] as String),
|
||||
this.label = (map['label'] ?? '') as String;
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ abstract class AccountList<T> {
|
||||
|
||||
List<T> getAll();
|
||||
|
||||
Future addAccount({String label});
|
||||
Future<void> addAccount({required String label});
|
||||
|
||||
Future setLabelAccount({int accountIndex, String label});
|
||||
Future<void> setLabelAccount({required int accountIndex, required String label});
|
||||
|
||||
void refresh();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
double cryptoAmountToDouble({num amount, num divider}) => amount / divider;
|
||||
double cryptoAmountToDouble({required num amount, required num divider}) => amount / divider;
|
||||
@@ -5,12 +5,17 @@ part 'crypto_currency.g.dart';
|
||||
|
||||
@HiveType(typeId: 0)
|
||||
class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
const CryptoCurrency({final String title, this.tag, this.name, this.iconPath, final int raw})
|
||||
const CryptoCurrency({
|
||||
String title = '',
|
||||
int raw = -1,
|
||||
this.name,
|
||||
this.iconPath,
|
||||
this.tag,})
|
||||
: super(title: title, raw: raw);
|
||||
|
||||
final String tag;
|
||||
final String name;
|
||||
final String iconPath;
|
||||
final String? tag;
|
||||
final String? name;
|
||||
final String? iconPath;
|
||||
|
||||
static const all = [
|
||||
CryptoCurrency.xmr,
|
||||
@@ -97,10 +102,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
static const zen = CryptoCurrency(title: 'ZEN', iconPath: 'assets/images/zen_icon.png', raw: 44);
|
||||
static const xvg = CryptoCurrency(title: 'XVG', name: 'Verge', iconPath: 'assets/images/xvg_icon.png', raw: 45);
|
||||
|
||||
|
||||
|
||||
|
||||
static CryptoCurrency deserialize({int raw}) {
|
||||
static CryptoCurrency deserialize({required int raw}) {
|
||||
switch (raw) {
|
||||
case 0:
|
||||
return CryptoCurrency.xmr;
|
||||
@@ -195,7 +197,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
case 45:
|
||||
return CryptoCurrency.xvg;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected token: $raw for CryptoCurrency deserialize');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +296,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
|
||||
case 'xvg':
|
||||
return CryptoCurrency.xvg;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected token: $raw for CryptoCurrency fromString');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ CryptoCurrency currencyForWalletType(WalletType type) {
|
||||
case WalletType.haven:
|
||||
return CryptoCurrency.xhv;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected wallet type: ${type.toString()} for CryptoCurrency currencyForWalletType');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
abstract class EnumerableItem<T> {
|
||||
const EnumerableItem({@required this.title, @required this.raw});
|
||||
const EnumerableItem({required this.title, required this.raw});
|
||||
|
||||
final T raw;
|
||||
final String title;
|
||||
@@ -11,6 +11,6 @@ abstract class EnumerableItem<T> {
|
||||
}
|
||||
|
||||
mixin Serializable<T> on EnumerableItem<T> {
|
||||
static Serializable deserialize<T>({T raw}) => null;
|
||||
static Serializable deserialize<T>({required T raw}) => throw Exception('Unimplemented');
|
||||
T serialize() => raw;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ final dates = {
|
||||
"2020-11": 2220000
|
||||
};
|
||||
|
||||
int getMoneroHeigthByDate({DateTime date}) {
|
||||
int getMoneroHeigthByDate({required DateTime date}) {
|
||||
final raw = '${date.year}' + '-' + '${date.month}';
|
||||
final lastHeight = dates.values.last;
|
||||
int startHeight;
|
||||
@@ -105,7 +105,7 @@ int getMoneroHeigthByDate({DateTime date}) {
|
||||
final daysHeight = (differenceInDays * heightPerDay).round();
|
||||
height = endHeight + daysHeight;
|
||||
} else {
|
||||
startHeight = dates[raw];
|
||||
startHeight = dates[raw]!;
|
||||
final index = dates.values.toList().indexOf(startHeight);
|
||||
endHeight = dates.values.toList()[index + 1];
|
||||
final heightPerDay = ((endHeight - startHeight) / 31).round();
|
||||
|
||||
@@ -16,14 +16,14 @@ List<String> extractKeys(String key) {
|
||||
return [_key, iv];
|
||||
}
|
||||
|
||||
Future<String> encode({encrypt.Key key, encrypt.IV iv, String data}) async {
|
||||
Future<String> encode({required encrypt.Key key, required encrypt.IV iv, required String data}) async {
|
||||
final encrypter = encrypt.Encrypter(encrypt.Salsa20(key));
|
||||
final encrypted = encrypter.encrypt(data, iv: iv);
|
||||
|
||||
return encrypted.base64;
|
||||
}
|
||||
|
||||
Future<String> decode({String password, String data}) async {
|
||||
Future<String> decode({required String password, required String data}) async {
|
||||
final keys = extractKeys(password);
|
||||
final key = encrypt.Key.fromBase64(keys.first);
|
||||
final iv = encrypt.IV.fromBase64(keys.last);
|
||||
|
||||
@@ -7,12 +7,12 @@ final moneroAmountFormat = NumberFormat()
|
||||
..maximumFractionDigits = moneroAmountLength
|
||||
..minimumFractionDigits = 1;
|
||||
|
||||
String moneroAmountToString({int amount}) => moneroAmountFormat
|
||||
String moneroAmountToString({required int amount}) => moneroAmountFormat
|
||||
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider))
|
||||
.replaceAll(',', '');
|
||||
|
||||
double moneroAmountToDouble({int amount}) =>
|
||||
double moneroAmountToDouble({required int amount}) =>
|
||||
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
||||
|
||||
int moneroParseAmount({String amount}) =>
|
||||
int moneroParseAmount({required String amount}) =>
|
||||
(double.parse(amount) * moneroAmountDivider).toInt();
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
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})
|
||||
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})
|
||||
{required this.formattedFullBalance,
|
||||
required this.formattedUnlockedBalance})
|
||||
: fullBalance = moneroParseAmount(amount: formattedFullBalance),
|
||||
unlockedBalance = moneroParseAmount(amount: formattedUnlockedBalance),
|
||||
super(moneroParseAmount(amount: formattedUnlockedBalance),
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_core/enumerable_item.dart';
|
||||
|
||||
class MoneroTransactionPriority extends TransactionPriority {
|
||||
const MoneroTransactionPriority({String title, int raw})
|
||||
const MoneroTransactionPriority({required String title, required int raw})
|
||||
: super(title: title, raw: raw);
|
||||
|
||||
static const all = [
|
||||
@@ -37,7 +37,7 @@ class MoneroTransactionPriority extends TransactionPriority {
|
||||
}
|
||||
}
|
||||
|
||||
static MoneroTransactionPriority deserialize({int raw}) {
|
||||
static MoneroTransactionPriority deserialize({required int raw}) {
|
||||
switch (raw) {
|
||||
case 0:
|
||||
return slow;
|
||||
@@ -50,7 +50,7 @@ class MoneroTransactionPriority extends TransactionPriority {
|
||||
case 4:
|
||||
return fastest;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected token: $raw for MoneroTransactionPriority deserialize');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class MoneroWalletKeys {
|
||||
const MoneroWalletKeys(
|
||||
{this.privateSpendKey,
|
||||
this.privateViewKey,
|
||||
this.publicSpendKey,
|
||||
this.publicViewKey});
|
||||
{required this.privateSpendKey,
|
||||
required this.privateViewKey,
|
||||
required this.publicSpendKey,
|
||||
required this.publicViewKey});
|
||||
|
||||
final String publicViewKey;
|
||||
final String privateViewKey;
|
||||
|
||||
+19
-18
@@ -1,7 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cw_core/keyable.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:hive/hive.dart';
|
||||
@@ -11,22 +9,26 @@ import 'package:http/io_client.dart' as ioc;
|
||||
part 'node.g.dart';
|
||||
|
||||
Uri createUriFromElectrumAddress(String address) =>
|
||||
Uri.tryParse('tcp://$address');
|
||||
Uri.tryParse('tcp://$address')!;
|
||||
|
||||
@HiveType(typeId: Node.typeId)
|
||||
class Node extends HiveObject with Keyable {
|
||||
Node(
|
||||
{@required String uri,
|
||||
@required WalletType type,
|
||||
this.login,
|
||||
{this.login,
|
||||
this.password,
|
||||
this.useSSL}) {
|
||||
uriRaw = uri;
|
||||
this.type = type;
|
||||
this.useSSL,
|
||||
String? uri,
|
||||
WalletType? type,}) {
|
||||
if (uri != null) {
|
||||
uriRaw = uri;
|
||||
}
|
||||
if (type != null) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
Node.fromMap(Map map)
|
||||
: uriRaw = map['uri'] as String ?? '',
|
||||
Node.fromMap(Map<String, Object?> map)
|
||||
: uriRaw = map['uri'] as String? ?? '',
|
||||
login = map['login'] as String,
|
||||
password = map['password'] as String,
|
||||
typeRaw = map['typeRaw'] as int,
|
||||
@@ -36,19 +38,19 @@ class Node extends HiveObject with Keyable {
|
||||
static const boxName = 'Nodes';
|
||||
|
||||
@HiveField(0)
|
||||
String uriRaw;
|
||||
late String uriRaw;
|
||||
|
||||
@HiveField(1)
|
||||
String login;
|
||||
String? login;
|
||||
|
||||
@HiveField(2)
|
||||
String password;
|
||||
String? password;
|
||||
|
||||
@HiveField(3)
|
||||
int typeRaw;
|
||||
late int typeRaw;
|
||||
|
||||
@HiveField(4)
|
||||
bool useSSL;
|
||||
bool? useSSL;
|
||||
|
||||
bool get isSSL => useSSL ?? false;
|
||||
|
||||
@@ -63,7 +65,7 @@ class Node extends HiveObject with Keyable {
|
||||
case WalletType.haven:
|
||||
return Uri.http(uriRaw, '');
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected type ${type.toString()} for Node uri');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +101,6 @@ class Node extends HiveObject with Keyable {
|
||||
}
|
||||
|
||||
Future<bool> requestMoneroNode() async {
|
||||
|
||||
final path = '/json_rpc';
|
||||
final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
|
||||
final realm = 'monero-rpc';
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
class OutputInfo {
|
||||
const OutputInfo(
|
||||
{this.fiatAmount,
|
||||
this.cryptoAmount,
|
||||
this.address,
|
||||
this.note,
|
||||
this.sendAll,
|
||||
this.extractedAddress,
|
||||
this.isParsedAddress,
|
||||
this.formattedCryptoAmount});
|
||||
{required this.address,
|
||||
required this.sendAll,
|
||||
required this.isParsedAddress,
|
||||
this.cryptoAmount,
|
||||
this.formattedCryptoAmount,
|
||||
this.fiatAmount,
|
||||
this.note,
|
||||
this.extractedAddress,});
|
||||
|
||||
final String fiatAmount;
|
||||
final String cryptoAmount;
|
||||
final String? fiatAmount;
|
||||
final String? cryptoAmount;
|
||||
final String address;
|
||||
final String note;
|
||||
final String extractedAddress;
|
||||
final String? note;
|
||||
final String? extractedAddress;
|
||||
final bool sendAll;
|
||||
final bool isParsedAddress;
|
||||
final int formattedCryptoAmount;
|
||||
final int? formattedCryptoAmount;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
Future<String> pathForWalletDir({@required String name, @required WalletType type}) async {
|
||||
Future<String> pathForWalletDir({required String name, required WalletType type}) async {
|
||||
final root = await getApplicationDocumentsDirectory();
|
||||
final prefix = walletTypeToString(type).toLowerCase();
|
||||
final walletsDir = Directory('${root.path}/wallets');
|
||||
@@ -16,11 +16,11 @@ Future<String> pathForWalletDir({@required String name, @required WalletType ty
|
||||
return walletDire.path;
|
||||
}
|
||||
|
||||
Future<String> pathForWallet({@required String name, @required WalletType type}) async =>
|
||||
Future<String> pathForWallet({required String name, required WalletType type}) async =>
|
||||
await pathForWalletDir(name: name, type: type)
|
||||
.then((path) => path + '/$name');
|
||||
|
||||
Future<String> outdatedAndroidPathForWalletDir({String name}) async {
|
||||
Future<String> outdatedAndroidPathForWalletDir({required String name}) async {
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
final pathDir = directory.path + '/$name';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const utils = const MethodChannel('com.cake_wallet/native_utils');
|
||||
|
||||
Future<Uint8List> secRandom(int count) async {
|
||||
try {
|
||||
return await utils.invokeMethod<Uint8List>('sec_random', {'count': count});
|
||||
return await utils.invokeMethod<Uint8List>('sec_random', {'count': count}) ?? Uint8List.fromList([]);
|
||||
} on PlatformException catch (_) {
|
||||
return Uint8List.fromList([]);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Subaddress {
|
||||
Subaddress({this.id, this.address, this.label});
|
||||
Subaddress({required this.id, required this.address, required this.label});
|
||||
|
||||
Subaddress.fromMap(Map map)
|
||||
Subaddress.fromMap(Map<String, Object?> 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;
|
||||
|
||||
@@ -2,16 +2,22 @@ enum TransactionDirection { incoming, outgoing }
|
||||
|
||||
TransactionDirection parseTransactionDirectionFromInt(int raw) {
|
||||
switch (raw) {
|
||||
case 0: return TransactionDirection.incoming;
|
||||
case 1: return TransactionDirection.outgoing;
|
||||
default: return null;
|
||||
case 0:
|
||||
return TransactionDirection.incoming;
|
||||
case 1:
|
||||
return TransactionDirection.outgoing;
|
||||
default:
|
||||
throw Exception('Unexpected token: raw for TransactionDirection parseTransactionDirectionFromInt');
|
||||
}
|
||||
}
|
||||
|
||||
TransactionDirection parseTransactionDirectionFromNumber(String raw) {
|
||||
switch (raw) {
|
||||
case "0": return TransactionDirection.incoming;
|
||||
case "1": return TransactionDirection.outgoing;
|
||||
default: return null;
|
||||
case "0":
|
||||
return TransactionDirection.incoming;
|
||||
case "1":
|
||||
return TransactionDirection.outgoing;
|
||||
default:
|
||||
throw Exception('Unexpected token: raw for TransactionDirection parseTransactionDirectionFromNumber');
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
|
||||
abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
|
||||
TransactionHistoryBase();
|
||||
// : _isUpdating = false;
|
||||
TransactionHistoryBase()
|
||||
: transactions = ObservableMap<String, TransactionType>();
|
||||
|
||||
@observable
|
||||
ObservableMap<String, TransactionType> transactions;
|
||||
|
||||
@@ -2,21 +2,21 @@ import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cw_core/keyable.dart';
|
||||
|
||||
abstract class TransactionInfo extends Object with Keyable {
|
||||
String id;
|
||||
int amount;
|
||||
int fee;
|
||||
TransactionDirection direction;
|
||||
bool isPending;
|
||||
DateTime date;
|
||||
int height;
|
||||
int confirmations;
|
||||
late String id;
|
||||
late int amount;
|
||||
int? fee;
|
||||
late TransactionDirection direction;
|
||||
late bool isPending;
|
||||
late DateTime date;
|
||||
late int height;
|
||||
late int confirmations;
|
||||
String amountFormatted();
|
||||
String fiatAmount();
|
||||
String feeFormatted();
|
||||
String? feeFormatted();
|
||||
void changeFiatAmount(String amount);
|
||||
|
||||
@override
|
||||
dynamic get keyIndex => id;
|
||||
|
||||
Map<String, dynamic> additionalInfo;
|
||||
late Map<String, dynamic> additionalInfo;
|
||||
}
|
||||
@@ -2,5 +2,5 @@ import 'package:cw_core/enumerable_item.dart';
|
||||
|
||||
abstract class TransactionPriority extends EnumerableItem<int>
|
||||
with Serializable<int> {
|
||||
const TransactionPriority({String title, int raw}) : super(title: title, raw: raw);
|
||||
const TransactionPriority({required String title, required int raw}) : super(title: title, raw: raw);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ part 'unspent_coins_info.g.dart';
|
||||
@HiveType(typeId: UnspentCoinsInfo.typeId)
|
||||
class UnspentCoinsInfo extends HiveObject {
|
||||
UnspentCoinsInfo({
|
||||
this.walletId,
|
||||
this.hash,
|
||||
this.isFrozen,
|
||||
this.isSending,
|
||||
this.note});
|
||||
required this.walletId,
|
||||
required this.hash,
|
||||
required this.isFrozen,
|
||||
required this.isSending,
|
||||
required this.note});
|
||||
|
||||
static const typeId = 9;
|
||||
static const boxName = 'Unspent';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
|
||||
abstract class WalletAddresses {
|
||||
WalletAddresses(this.walletInfo) {
|
||||
addressesMap = {};
|
||||
}
|
||||
WalletAddresses(this.walletInfo)
|
||||
: addressesMap = {};
|
||||
|
||||
final WalletInfo walletInfo;
|
||||
|
||||
@@ -19,10 +18,6 @@ abstract class WalletAddresses {
|
||||
|
||||
Future<void> saveAddressesInBox() async {
|
||||
try {
|
||||
if (walletInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
walletInfo.address = address;
|
||||
walletInfo.addresses = addressesMap;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import 'package:cw_core/wallet_info.dart';
|
||||
abstract class WalletAddressesWithAccount<T> extends WalletAddresses {
|
||||
WalletAddressesWithAccount(WalletInfo walletInfo) : super(walletInfo);
|
||||
|
||||
T get account;
|
||||
// T get account;
|
||||
|
||||
set account(T account);
|
||||
// set account(T account);
|
||||
|
||||
AccountList<T> get accountList;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cw_core/balance.dart';
|
||||
import 'package:cw_core/transaction_info.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/wallet_addresses.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/pending_transaction.dart';
|
||||
import 'package:cw_core/transaction_history.dart';
|
||||
import 'package:cw_core/currency_for_wallet_type.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/sync_status.dart';
|
||||
@@ -48,15 +48,15 @@ abstract class WalletBase<
|
||||
|
||||
WalletAddresses get walletAddresses;
|
||||
|
||||
HistoryType transactionHistory;
|
||||
late HistoryType transactionHistory;
|
||||
|
||||
Future<void> connectToNode({@required Node node});
|
||||
Future<void> connectToNode({required Node node});
|
||||
|
||||
Future<void> startSync();
|
||||
|
||||
Future<PendingTransaction> createTransaction(Object credentials);
|
||||
|
||||
int calculateEstimatedFee(TransactionPriority priority, int amount);
|
||||
int calculateEstimatedFee(TransactionPriority priority, int? amount);
|
||||
|
||||
// void fetchTransactionsAsync(
|
||||
// void Function(TransactionType transaction) onTransactionLoaded,
|
||||
@@ -66,7 +66,7 @@ abstract class WalletBase<
|
||||
|
||||
Future<void> save();
|
||||
|
||||
Future<void> rescan({int height});
|
||||
Future<void> rescan({required int height});
|
||||
|
||||
void close();
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
|
||||
abstract class WalletCredentials {
|
||||
WalletCredentials({this.name, this.password, this.height, this.walletInfo});
|
||||
WalletCredentials({
|
||||
required this.name,
|
||||
this.height,
|
||||
this.walletInfo,
|
||||
this.password});
|
||||
|
||||
final String name;
|
||||
final int height;
|
||||
String password;
|
||||
WalletInfo walletInfo;
|
||||
final int? height;
|
||||
String? password;
|
||||
WalletInfo? walletInfo;
|
||||
}
|
||||
|
||||
@@ -13,20 +13,20 @@ class WalletInfo extends HiveObject {
|
||||
: _yatLastUsedAddressController = StreamController<String>.broadcast();
|
||||
|
||||
factory WalletInfo.external(
|
||||
{@required String id,
|
||||
@required String name,
|
||||
@required WalletType type,
|
||||
@required bool isRecovery,
|
||||
@required int restoreHeight,
|
||||
@required DateTime date,
|
||||
@required String dirPath,
|
||||
@required String path,
|
||||
@required String address,
|
||||
{required String id,
|
||||
required String name,
|
||||
required WalletType type,
|
||||
required bool isRecovery,
|
||||
required int restoreHeight,
|
||||
required DateTime date,
|
||||
required String dirPath,
|
||||
required String path,
|
||||
required String address,
|
||||
bool? showIntroCakePayCard,
|
||||
String yatEid ='',
|
||||
String yatLastUsedAddressRaw = '',
|
||||
bool showIntroCakePayCard}) {
|
||||
String yatLastUsedAddressRaw = ''}) {
|
||||
return WalletInfo(id, name, type, isRecovery, restoreHeight,
|
||||
date.millisecondsSinceEpoch ?? 0, dirPath, path, address,
|
||||
date.millisecondsSinceEpoch, dirPath, path, address,
|
||||
yatEid, yatLastUsedAddressRaw, showIntroCakePayCard);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class WalletInfo extends HiveObject {
|
||||
String address;
|
||||
|
||||
@HiveField(10)
|
||||
Map<String, String> addresses;
|
||||
Map<String, String>? addresses;
|
||||
|
||||
@HiveField(11)
|
||||
String yatEid;
|
||||
@@ -70,7 +70,7 @@ class WalletInfo extends HiveObject {
|
||||
String yatLastUsedAddressRaw;
|
||||
|
||||
@HiveField(13)
|
||||
bool showIntroCakePayCard;
|
||||
bool? showIntroCakePayCard;
|
||||
|
||||
String get yatLastUsedAddress => yatLastUsedAddressRaw;
|
||||
|
||||
@@ -85,7 +85,7 @@ class WalletInfo extends HiveObject {
|
||||
if(showIntroCakePayCard == null) {
|
||||
return type != WalletType.haven;
|
||||
}
|
||||
return showIntroCakePayCard;
|
||||
return showIntroCakePayCard!;
|
||||
}
|
||||
|
||||
DateTime get date => DateTime.fromMillisecondsSinceEpoch(timestamp);
|
||||
|
||||
@@ -55,7 +55,7 @@ WalletType deserializeFromInt(int raw) {
|
||||
case 3:
|
||||
return WalletType.haven;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected token: $raw for WalletType deserializeFromInt');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,6 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type) {
|
||||
case WalletType.haven:
|
||||
return CryptoCurrency.xhv;
|
||||
default:
|
||||
return null;
|
||||
throw Exception('Unexpected wallet type: ${type.toString()} for CryptoCurrency walletTypeToCryptoCurrency');
|
||||
}
|
||||
}
|
||||
|
||||
+94
-87
@@ -7,35 +7,35 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "14.0.0"
|
||||
version: "47.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.41.2"
|
||||
version: "4.7.0"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
version: "2.3.1"
|
||||
asn1lib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: asn1lib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.1"
|
||||
version: "1.1.1"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.9.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -49,42 +49,42 @@ packages:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.2"
|
||||
version: "2.3.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.6"
|
||||
version: "1.1.0"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.10"
|
||||
version: "3.1.0"
|
||||
build_resolvers:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_resolvers
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.3"
|
||||
version: "2.0.10"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.5"
|
||||
version: "2.2.1"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.10"
|
||||
version: "7.2.4"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -105,98 +105,77 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
version: "2.0.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.7.0"
|
||||
version: "4.3.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "3.0.2"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
version: "3.0.2"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.12"
|
||||
dartx:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dartx
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
version: "2.2.4"
|
||||
encrypt:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: encrypt
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
version: "5.0.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "2.0.1"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -222,12 +201,19 @@ packages:
|
||||
name: flutter_mobx
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0+2"
|
||||
version: "2.0.6+4"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -241,42 +227,42 @@ packages:
|
||||
name: graphs
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "2.1.0"
|
||||
hive:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.4+1"
|
||||
version: "2.2.3"
|
||||
hive_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: hive_generator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.2"
|
||||
version: "1.1.3"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.2"
|
||||
version: "0.13.5"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "3.2.1"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
version: "4.0.1"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -290,7 +276,7 @@ packages:
|
||||
name: io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
version: "1.0.3"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -304,7 +290,7 @@ packages:
|
||||
name: json_annotation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
version: "4.6.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -318,14 +304,21 @@ packages:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10"
|
||||
version: "0.12.12"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.5"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.8.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -339,63 +332,77 @@ packages:
|
||||
name: mobx
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1+4"
|
||||
version: "2.1.0"
|
||||
mobx_codegen:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: mobx_codegen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "2.0.7+3"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.3"
|
||||
version: "2.1.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.2"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.28"
|
||||
version: "2.0.11"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.20"
|
||||
path_provider_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_ios
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.11"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+2"
|
||||
version: "2.1.7"
|
||||
path_provider_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.4+8"
|
||||
version: "2.0.6"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.4"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.5"
|
||||
version: "2.1.3"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -416,14 +423,14 @@ packages:
|
||||
name: plugin_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "2.1.3"
|
||||
pointycastle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointycastle
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "3.6.2"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -451,21 +458,21 @@ packages:
|
||||
name: pubspec_parse
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.8"
|
||||
version: "1.2.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.9"
|
||||
version: "1.3.2"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.4+1"
|
||||
version: "1.0.2"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -477,14 +484,21 @@ packages:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+3"
|
||||
version: "1.2.3"
|
||||
source_helper:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_helper
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.3"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.9.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -512,35 +526,28 @@ packages:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
time:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: time
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
version: "0.4.12"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1+3"
|
||||
version: "1.0.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -554,7 +561,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.1.2"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -568,21 +575,21 @@ packages:
|
||||
name: web_socket_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.2.0"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "3.0.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
version: "0.2.0+2"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -591,5 +598,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
dart: ">=2.17.5 <3.0.0"
|
||||
flutter: ">=3.0.0"
|
||||
|
||||
+11
-11
@@ -6,26 +6,26 @@ author: Cake Wallet
|
||||
homepage: https://cakewallet.com
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
flutter: ">=1.17.0"
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: ^0.12.0+2
|
||||
path_provider: ^1.3.0
|
||||
mobx: ^1.2.1+2
|
||||
flutter_mobx: ^1.1.0+2
|
||||
http: ^0.13.4
|
||||
path_provider: ^2.0.11
|
||||
mobx: ^2.0.7+4
|
||||
flutter_mobx: ^2.0.6+1
|
||||
intl: ^0.17.0
|
||||
encrypt: ^4.0.0
|
||||
encrypt: ^5.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
build_runner: ^1.10.3
|
||||
build_resolvers: ^1.3.10
|
||||
mobx_codegen: ^1.1.0+1
|
||||
hive_generator: ^0.8.1
|
||||
build_runner: ^2.1.11
|
||||
build_resolvers: ^2.0.9
|
||||
mobx_codegen: ^2.0.7
|
||||
hive_generator: ^1.1.3
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
Reference in New Issue
Block a user