Sp enhancements (#1672)

* fix: enhance regex, fix multiline

* feat: improve scan msg, fix missing txs, use date api

* feat: node fixes, enhance send modal, TX list tag & filter, refactors

* fix: continuous scanning

* fix: missing close

* fix: resubscribe tweaks

* feat: use mempool api setting toggle

* handle any failure of height API and fallback to the old method [skip ci]

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Rafael
2024-09-20 17:24:25 +03:00
committed by GitHub
co-authored by OmarHatem
parent b6bc3df622
commit 3a391f10a3
61 changed files with 872 additions and 531 deletions
@@ -88,6 +88,11 @@ abstract class DashboardViewModelBase with Store {
value: () => transactionFilterStore.displayOutgoing,
caption: S.current.outgoing,
onChanged: transactionFilterStore.toggleOutgoing),
FilterItem(
value: () => transactionFilterStore.displaySilentPayments,
caption: S.current.silent_payments,
onChanged: transactionFilterStore.toggleSilentPayments,
),
// FilterItem(
// value: () => false,
// caption: S.current.transactions_by_date,
@@ -376,12 +381,15 @@ 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("")) "private view key is 0",
if (keys['privateViewKey'] == List.generate(64, (index) => "0").join(""))
"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("")) "public view key is 0",
if (keys['publicViewKey'] == List.generate(64, (index) => "0").join(""))
"public view key is 0",
// if (wallet.seed == null) "wallet seed is null",
// if (wallet.seed == "") "wallet seed is empty",
if (monero!.getSubaddressList(wallet).getAll(wallet)[0].address == "41d7FXjswpK1111111111111111111111111111111111111111111111111111111111111111111111111111112KhNi4")
if (monero!.getSubaddressList(wallet).getAll(wallet)[0].address ==
"41d7FXjswpK1111111111111111111111111111111111111111111111111111111111111111111111111111112KhNi4")
"primary address is invalid, you won't be able to receive / spend funds",
];
return errors;
+4
View File
@@ -29,6 +29,10 @@ abstract class RescanViewModelBase with Store {
@computed
bool get isSilentPaymentsScan => wallet.type == WalletType.bitcoin;
@computed
Future<bool> get isBitcoinMempoolAPIEnabled async =>
wallet.type == WalletType.bitcoin && await bitcoin!.checkIfMempoolAPIIsEnabled(wallet);
@action
Future<void> rescanCurrentWallet({required int restoreHeight}) async {
state = RescanWalletState.rescaning;
+11 -8
View File
@@ -79,6 +79,9 @@ abstract class OutputBase with Store {
bool get isParsedAddress =>
parsedAddress.parseFrom != ParseFrom.notParsed && parsedAddress.name.isNotEmpty;
@observable
String? stealthAddress;
@computed
int get formattedCryptoAmount {
int amount = 0;
@@ -134,9 +137,8 @@ abstract class OutputBase with Store {
final trc20EstimatedFee = tron!.getTronTRC20EstimatedFee(_wallet) ?? 0;
return double.parse(trc20EstimatedFee.toString());
}
}
if (_wallet.type == WalletType.solana) {
return solana!.getEstimateFees(_wallet) ?? 0.0;
}
@@ -145,16 +147,16 @@ abstract class OutputBase with Store {
_settingsStore.priority[_wallet.type]!, formattedCryptoAmount);
if (_wallet.type == WalletType.bitcoin) {
if (_settingsStore.priority[_wallet.type] == bitcoin!.getBitcoinTransactionPriorityCustom()) {
fee = bitcoin!.getEstimatedFeeWithFeeRate(_wallet,
_settingsStore.customBitcoinFeeRate,formattedCryptoAmount);
if (_settingsStore.priority[_wallet.type] ==
bitcoin!.getBitcoinTransactionPriorityCustom()) {
fee = bitcoin!.getEstimatedFeeWithFeeRate(
_wallet, _settingsStore.customBitcoinFeeRate, formattedCryptoAmount);
}
return bitcoin!.formatterBitcoinAmountToDouble(amount: fee);
}
if (_wallet.type == WalletType.litecoin ||
_wallet.type == WalletType.bitcoinCash) {
if (_wallet.type == WalletType.litecoin || _wallet.type == WalletType.bitcoinCash) {
return bitcoin!.formatterBitcoinAmountToDouble(amount: fee);
}
@@ -249,7 +251,8 @@ abstract class OutputBase with Store {
try {
final fiat = calculateFiatAmount(
price: _fiatConversationStore.prices[cryptoCurrencyHandler()]!,
cryptoAmount: sendAll ? cryptoFullBalance.replaceAll(",", ".") : cryptoAmount.replaceAll(',', '.'));
cryptoAmount:
sendAll ? cryptoFullBalance.replaceAll(",", ".") : cryptoAmount.replaceAll(',', '.'));
if (fiatAmount != fiat) {
fiatAmount = fiat;
}
+9 -2
View File
@@ -375,6 +375,15 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
throw Exception("THORChain does not support Taproot addresses");
}
}
if (wallet.type == WalletType.bitcoin) {
final updatedOutputs = bitcoin!.updateOutputs(pendingTransaction!, outputs);
if (outputs.length == updatedOutputs.length) {
outputs = ObservableList.of(updatedOutputs);
}
}
state = ExecutedSuccessfullyState();
return pendingTransaction;
} catch (e) {
@@ -414,8 +423,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
Future<void> _executeReplaceByFee(TransactionInfo tx, String newFee) async {
clearOutputs();
final output = outputs.first;
output.address = tx.outputAddresses?.first ?? '';