mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
CW-1035: Solana New Fixes (#2205)
* fix: Error while restoring Solana Wallet with PrivateKey * fix: Enhance Solana Error Messages, especially for ATA Creation Errors * - Optimize Solana Transaction History, now more smoother and faster - fix bug with transactions history not being displayed in real time until next reload
This commit is contained in:
@@ -161,8 +161,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
FilterItem(
|
||||
value: () => tradeFilterStore.displaySwapTrade,
|
||||
caption: ExchangeProviderDescription.swapTrade.title,
|
||||
onChanged: () => tradeFilterStore
|
||||
.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
|
||||
onChanged: () =>
|
||||
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
|
||||
]
|
||||
},
|
||||
subname = '',
|
||||
@@ -272,9 +272,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
_transactionDisposer?.reaction.dispose();
|
||||
_transactionDisposer = reaction(
|
||||
(_) => appStore.wallet!.transactionHistory.transactions.length *
|
||||
appStore.wallet!.transactionHistory.transactions.values.first.confirmations,
|
||||
_transactionDisposerCallback
|
||||
(_) => appStore.wallet!.transactionHistory.transactions.length,
|
||||
_transactionDisposerCallback,
|
||||
);
|
||||
|
||||
if (hasSilentPayments) {
|
||||
@@ -289,24 +288,22 @@ abstract class DashboardViewModelBase with Store {
|
||||
reaction((_) => settingsStore.mwebAlwaysScan, (bool value) => _checkMweb());
|
||||
}
|
||||
|
||||
|
||||
bool _isTransactionDisposerCallbackRunning = false;
|
||||
|
||||
|
||||
void _transactionDisposerCallback(int _) async {
|
||||
// Simple check to prevent the callback from being called multiple times in the same frame
|
||||
if (_isTransactionDisposerCallbackRunning) return;
|
||||
_isTransactionDisposerCallbackRunning = true;
|
||||
await Future.delayed(Duration.zero);
|
||||
|
||||
|
||||
try {
|
||||
final currentAccountId = wallet.type == WalletType.monero
|
||||
final currentAccountId = wallet.type == WalletType.monero
|
||||
? monero!.getCurrentAccount(wallet).id
|
||||
: wallet.type == WalletType.wownero
|
||||
? wow.wownero!.getCurrentAccount(wallet).id
|
||||
: wallet.type == WalletType.wownero
|
||||
? wow.wownero!.getCurrentAccount(wallet).id
|
||||
: null;
|
||||
final List<TransactionInfo> relevantTxs = [];
|
||||
|
||||
|
||||
for (final tx in appStore.wallet!.transactionHistory.transactions.values) {
|
||||
bool isRelevant = true;
|
||||
if (wallet.type == WalletType.monero) {
|
||||
@@ -314,7 +311,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
} else if (wallet.type == WalletType.wownero) {
|
||||
isRelevant = wow.wownero!.getTransactionInfoAccountId(tx) == currentAccountId;
|
||||
}
|
||||
|
||||
|
||||
if (isRelevant) {
|
||||
relevantTxs.add(tx);
|
||||
}
|
||||
@@ -323,11 +320,11 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
transactions.clear();
|
||||
transactions.addAll(relevantTxs.map((tx) => TransactionListItem(
|
||||
transaction: tx,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
)));
|
||||
transaction: tx,
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
)));
|
||||
} finally {
|
||||
_isTransactionDisposerCallbackRunning = false;
|
||||
}
|
||||
@@ -475,7 +472,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
// to not cause work duplication, this will do the job as well, it will be slightly less precise
|
||||
// about what happened - but still enough.
|
||||
// if (keys['privateSpendKey'] == List.generate(64, (index) => "0").join("")) "Private spend key is 0",
|
||||
if (keys['privateViewKey'] == List.generate(64, (index) => "0").join("") && !wallet.isHardwareWallet)
|
||||
if (keys['privateViewKey'] == List.generate(64, (index) => "0").join("") &&
|
||||
!wallet.isHardwareWallet)
|
||||
"private view key is 0",
|
||||
// if (keys['publicSpendKey'] == List.generate(64, (index) => "0").join("")) "public spend key is 0",
|
||||
if (keys['publicViewKey'] == List.generate(64, (index) => "0").join(""))
|
||||
@@ -576,7 +574,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
disableBackgroundSync();
|
||||
return;
|
||||
}
|
||||
final resp = await FlutterDaemon().startBackgroundSync(settingsStore.currentSyncMode.frequency.inMinutes);
|
||||
final resp = await FlutterDaemon()
|
||||
.startBackgroundSync(settingsStore.currentSyncMode.frequency.inMinutes);
|
||||
printV("Background sync enabled: $resp");
|
||||
backgroundSyncEnabled = true;
|
||||
}
|
||||
@@ -600,8 +599,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
spread = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.dark)
|
||||
spread = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled)
|
||||
spread = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled) spread = 0;
|
||||
return spread;
|
||||
}
|
||||
|
||||
@@ -614,8 +612,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
blur = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.dark)
|
||||
blur = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled)
|
||||
blur = 0;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled) blur = 0;
|
||||
return blur;
|
||||
}
|
||||
|
||||
@@ -810,11 +807,8 @@ abstract class DashboardViewModelBase with Store {
|
||||
|
||||
_transactionDisposer?.reaction.dispose();
|
||||
|
||||
_transactionDisposer = reaction(
|
||||
(_) => appStore.wallet!.transactionHistory.transactions.length *
|
||||
appStore.wallet!.transactionHistory.transactions.values.first.confirmations,
|
||||
_transactionDisposerCallback
|
||||
);
|
||||
_transactionDisposer = reaction((_) => appStore.wallet!.transactionHistory.transactions.length,
|
||||
_transactionDisposerCallback);
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -738,7 +738,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
}
|
||||
|
||||
if (error is CreateAssociatedTokenAccountException) {
|
||||
return "${S.current.solana_create_associated_token_account_exception}\n\n${error.errorMessage}";
|
||||
return "${S.current.solana_create_associated_token_account_exception} ${S.current.added_message_for_ata_error}\n\n${error.errorMessage}";
|
||||
}
|
||||
|
||||
if (error is SignSPLTokenTransactionRentException) {
|
||||
|
||||
Reference in New Issue
Block a user