mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-23 06:38:35 +02:00
feat: initial hive -> SQLite (#2502)
* feat: initial hive -> SQLite Includes migration script and initial work done to remove dependency on hive generators. Also contains some refactoring to make sync code async. Features new dev screen that lists all SQLite tables Aspects that need testing: - backups (from this version, and from previous versions as well) - wallet loading / wallet list - almost everything else - renaming - deletion - sorting in wallet list - wallet groups - wallet seed/keys - wallet switching - wallet creation / restore - all methods - wallet address page - hardware wallet connection (and prompts from mall screens) - contacts - advanced settings in wallet creation - derivation paths - some minor wownero fixes - base, hardware wallets * fix: build errors * fix: Bad state: No element in backup restore * address comments from review * fix: HardwareWalletType
This commit is contained in:
@@ -290,6 +290,8 @@ class ExceptionHandler {
|
||||
"core/key_service.dart:14",
|
||||
"Wallet is null",
|
||||
"Wrong Device Status: 0x5515 (UNKNOWN)",
|
||||
|
||||
"FocusScopeNode was used after being disposed",
|
||||
];
|
||||
|
||||
static Future<void> _addDeviceInfo(File file) async {
|
||||
|
||||
@@ -10,11 +10,10 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class TokenUtilities {
|
||||
static Future<List<Erc20Token>> loadAllUniqueEvmTokens(
|
||||
Box<WalletInfo> walletInfoSource,
|
||||
) async {
|
||||
final evmWallets = walletInfoSource.values.where(
|
||||
(w) => isEVMCompatibleChain(w.type),
|
||||
static Future<List<Erc20Token>> loadAllUniqueEvmTokens() async {
|
||||
final allWi = await WalletInfo.getAll();
|
||||
final evmWallets = allWi.where(
|
||||
(w) => isEVMCompatibleChain(w.type),
|
||||
);
|
||||
|
||||
final seen = <String>{};
|
||||
@@ -35,10 +34,9 @@ class TokenUtilities {
|
||||
return unique;
|
||||
}
|
||||
|
||||
static Future<List<SPLToken>> loadAllUniqueSolTokens(
|
||||
Box<WalletInfo> walletInfoSource,
|
||||
) async {
|
||||
final solWallets = walletInfoSource.values.where(
|
||||
static Future<List<SPLToken>> loadAllUniqueSolTokens() async {
|
||||
final allWi = await WalletInfo.getAll();
|
||||
final solWallets = allWi.where(
|
||||
(w) => w.type == WalletType.solana,
|
||||
);
|
||||
|
||||
@@ -57,10 +55,9 @@ class TokenUtilities {
|
||||
return unique;
|
||||
}
|
||||
|
||||
static Future<List<TronToken>> loadAllUniqueTronTokens(
|
||||
Box<WalletInfo> walletInfoSource,
|
||||
) async {
|
||||
final tronWallets = walletInfoSource.values.where(
|
||||
static Future<List<TronToken>> loadAllUniqueTronTokens() async {
|
||||
final allWi = await WalletInfo.getAll();
|
||||
final tronWallets = allWi.where(
|
||||
(w) => w.type == WalletType.tron,
|
||||
);
|
||||
|
||||
@@ -82,7 +79,6 @@ class TokenUtilities {
|
||||
/// - Tron: match by contractAddress
|
||||
static Future<CryptoCurrency?> findTokenByAddress({
|
||||
required WalletType walletType,
|
||||
required Box<WalletInfo> walletInfoSource,
|
||||
required String address,
|
||||
}) async {
|
||||
final lower = address.toLowerCase();
|
||||
@@ -90,19 +86,19 @@ class TokenUtilities {
|
||||
case WalletType.ethereum:
|
||||
case WalletType.polygon:
|
||||
case WalletType.base:
|
||||
final tokens = await loadAllUniqueEvmTokens(walletInfoSource);
|
||||
final tokens = await loadAllUniqueEvmTokens();
|
||||
for (final t in tokens) {
|
||||
if (t.contractAddress.toLowerCase() == lower) return t;
|
||||
}
|
||||
return null;
|
||||
case WalletType.solana:
|
||||
final solTokens = await loadAllUniqueSolTokens(walletInfoSource);
|
||||
final solTokens = await loadAllUniqueSolTokens();
|
||||
for (final t in solTokens) {
|
||||
if (t.mintAddress.toLowerCase() == lower) return t;
|
||||
}
|
||||
return null;
|
||||
case WalletType.tron:
|
||||
final tronTokens = await loadAllUniqueTronTokens(walletInfoSource);
|
||||
final tronTokens = await loadAllUniqueTronTokens();
|
||||
for (final t in tronTokens) {
|
||||
if (t.contractAddress.toLowerCase() == lower) return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user