Some todo clean up and re prioritization

This commit is contained in:
julian 2024-01-13 11:09:37 -06:00
parent e1a2cf85f3
commit 46d1310039
13 changed files with 46 additions and 87 deletions

View file

@ -793,7 +793,7 @@ class _ConfirmTransactionViewState
height: 2,
),
SelectableText(
// TODO: [prio=high] spark transaction specifics - better handling
// TODO: [prio=med] spark transaction specifics - better handling
widget.isPaynymTransaction
? widget.txData.paynymAccountLite!.nymName
: widget.txData.recipients?.first.address ??

View file

@ -112,31 +112,6 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
restoringStatus: StackRestoringStatus.restoring);
try {
// TODO: [prio=high] handle non mnemonic based wallets
// final mnemonicList = await (wallet as MnemonicBasedWallet)
// .getMnemonicAsWords();
// int maxUnusedAddressGap = 20;
// if (coin == Coin.firo) {
// maxUnusedAddressGap = 50;
// }
// const maxNumberOfIndexesToCheck = 1000;
//
// if (mnemonicList.isEmpty) {
// await manager.recoverFromMnemonic(
// mnemonic: ref.read(provider).mnemonic!,
// mnemonicPassphrase:
// ref.read(provider).mnemonicPassphrase!,
// maxUnusedAddressGap: maxUnusedAddressGap,
// maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck,
// height: ref.read(provider).height ?? 0,
// );
// } else {
// await manager.fullRescan(
// maxUnusedAddressGap,
// maxNumberOfIndexesToCheck,
// );
// }
await wallet.recover(isRescan: true);
if (mounted) {

View file

@ -36,6 +36,9 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
import 'package:stackwallet/wallets/wallet/impl/epiccash_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/monero_wallet.dart';
import 'package:stackwallet/wallets/wallet/impl/wownero_wallet.dart';
import 'package:stackwallet/widgets/animated_text.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
@ -316,33 +319,28 @@ class _WalletNetworkSettingsViewState
final coin = ref.watch(pWalletCoin(widget.walletId));
// TODO: [prio=high] sync percent for certain wallets
// if (coin == Coin.monero) {
// double highestPercent =
// (ref.read(pWallets).getWallet(widget.walletId).wallet as MoneroWallet)
// .highestPercentCached;
// if (_percent < highestPercent) {
// _percent = highestPercent.clamp(0.0, 1.0);
// }
// } else if (coin == Coin.wownero) {
// double highestPercent = (ref
// .watch(pWallets)
// .getWallet(widget.walletId)
// .wallet as WowneroWallet)
// .highestPercentCached;
// if (_percent < highestPercent) {
// _percent = highestPercent.clamp(0.0, 1.0);
// }
// } else if (coin == Coin.epicCash) {
// double highestPercent = (ref
// .watch(pWallets)
// .getWallet(widget.walletId)
// .wallet as EpicCashWallet)
// .highestPercent;
// if (_percent < highestPercent) {
// _percent = highestPercent.clamp(0.0, 1.0);
// }
// }
if (coin == Coin.monero) {
double highestPercent =
(ref.read(pWallets).getWallet(widget.walletId) as MoneroWallet)
.highestPercentCached;
if (_percent < highestPercent) {
_percent = highestPercent.clamp(0.0, 1.0);
}
} else if (coin == Coin.wownero) {
double highestPercent =
(ref.watch(pWallets).getWallet(widget.walletId) as WowneroWallet)
.highestPercentCached;
if (_percent < highestPercent) {
_percent = highestPercent.clamp(0.0, 1.0);
}
} else if (coin == Coin.epicCash) {
double highestPercent =
(ref.watch(pWallets).getWallet(widget.walletId) as EpiccashWallet)
.highestPercent;
if (_percent < highestPercent) {
_percent = highestPercent.clamp(0.0, 1.0);
}
}
return ConditionalParent(
condition: !isDesktop,

View file

@ -235,7 +235,7 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
final wallet = ref
.read(pWallets)
.getWallet(widget.walletId);
// TODO: [prio=high] take wallets that don't have amnemonic into account
// TODO: [prio=frost] take wallets that don't have a mnemonic into account
if (wallet is MnemonicInterface) {
final mnemonic =
await wallet.getMnemonicAsWords();

View file

@ -258,7 +258,7 @@ class _FiroRescanRecoveryErrorViewState
} else {
final wallet =
ref.read(pWallets).getWallet(widget.walletId);
// TODO: [prio=high] take wallets that don't have amnemonic into account
// TODO: [prio=low] take wallets that don't have a mnemonic into account
if (wallet is MnemonicInterface) {
final mnemonic = await wallet.getMnemonicAsWords();

View file

@ -493,7 +493,8 @@ class _TransactionDetailsViewState extends ConsumerState<AllTransactionsView> {
value: [widget.walletId],
)
],
// TODO: [prio=high] add filters to wallet or cryptocurrency class
// TODO: [prio=med] add filters to wallet or cryptocurrency class
// Might not be needed (yet)?
// filter: [
// // todo
// ],

View file

@ -484,9 +484,6 @@ class _AllTransactionsV2ViewState extends ConsumerState<AllTransactionsV2View> {
final criteria =
ref.watch(transactionFilterProvider.state).state;
//todo: check if print needed
// debugPrint("Consumer build called");
return FutureBuilder(
future: ref
.watch(mainDBProvider)
@ -499,7 +496,8 @@ class _AllTransactionsV2ViewState extends ConsumerState<AllTransactionsV2View> {
value: [widget.walletId],
)
],
// TODO: [prio=high] add filters to wallet or cryptocurrency class
// TODO: [prio=med] add filters to wallet or cryptocurrency class
// Might not be needed (yet)?
// filter: [
// // todo
// ],

View file

@ -182,7 +182,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
_lelantusRescanRecovery = true;
_firoRescanRecovery();
// } else if (ref.read(managerProvider).rescanOnOpenVersion ==
// TODO: [prio=high]
// TODO: [prio=med]
// Constants.rescanV1) {
// _rescanningOnOpen = true;
// ref.read(managerProvider).fullRescan(20, 1000).then(

View file

@ -113,7 +113,8 @@ class _DesktopAttentionDeleteWallet
onPressed: () async {
final wallet =
ref.read(pWallets).getWallet(widget.walletId);
// TODO: [prio=high] handle other types wallet deletion
// TODO: [prio=med] handle other types wallet deletion
// All wallets currently are mnemonic based
if (wallet is MnemonicInterface) {
final words = await wallet.getMnemonicAsWords();

View file

@ -81,7 +81,8 @@ class _UnlockWalletKeysDesktopState
final wallet = ref.read(pWallets).getWallet(widget.walletId);
// TODO: [prio=high] handle wallets that don't have a mnemonic
// TODO: [prio=med] handle wallets that don't have a mnemonic
// All wallets currently are mnemonic based
if (wallet is! MnemonicInterface) {
throw Exception("FIXME ~= see todo in code");
}
@ -303,7 +304,8 @@ class _UnlockWalletKeysDesktopState
final wallet =
ref.read(pWallets).getWallet(widget.walletId);
// TODO: [prio=high] handle wallets that don't have a mnemonic
// TODO: [prio=low] handle wallets that don't have a mnemonic
// All wallets currently are mnemonic based
if (wallet is! MnemonicInterface) {
throw Exception("FIXME ~= see todo in code");
}

View file

@ -296,7 +296,7 @@ class EpiccashWallet extends Bip39Wallet {
Map<String, String> txAddressInfo,
) async {
try {
var slatesToCommits = await _getSlatesToCommits();
final slatesToCommits = info.epicData?.slatesToCommits ?? {};
final from = txAddressInfo['from'];
final to = txAddressInfo['to'];
slatesToCommits[slateData.slateId] = {
@ -318,22 +318,6 @@ class EpiccashWallet extends Bip39Wallet {
}
}
// TODO: [prio=high] this isn't needed. Condense to `info.epicData?.slatesToCommits ?? {}` where needed
Future<Map<dynamic, dynamic>> _getSlatesToCommits() async {
try {
var slatesToCommits = info.epicData?.slatesToCommits;
if (slatesToCommits == null) {
slatesToCommits = <dynamic, dynamic>{};
} else {
slatesToCommits = slatesToCommits;
}
return slatesToCommits;
} catch (e, s) {
Logging.instance.log("$e $s", level: LogLevel.Error);
return {};
}
}
Future<int> _getCurrentIndex() async {
try {
final int receivingIndex = info.epicData!.receivingIndex;
@ -455,7 +439,7 @@ class EpiccashWallet extends Bip39Wallet {
);
}
// TODO: [prio=high] what is the point of this???
// As opposed to fake config?
Future<String> _getRealConfig() async {
String? config = await secureStorageInterface.read(
key: '${walletId}_config',
@ -954,7 +938,7 @@ class EpiccashWallet extends Bip39Wallet {
final List<TransactionV2> txns = [];
final slatesToCommits = await _getSlatesToCommits();
final slatesToCommits = info.epicData?.slatesToCommits ?? {};
for (final tx in transactions) {
// Logging.instance.log("tx: $tx", level: LogLevel.Info);

View file

@ -187,7 +187,7 @@ class ParticlWallet extends Bip39HDWallet
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
as Map);
final prevOut = fromElectrumXJsonParticl(
final prevOut = _parseOutput(
prevOutJson,
decimalPlaces: cryptoCurrency.fractionDigits,
isFullAmountNotSats: true,
@ -227,7 +227,7 @@ class ParticlWallet extends Bip39HDWallet
// Parse outputs.
final List<OutputV2> outputs = [];
for (final outputJson in txData["vout"] as List) {
OutputV2 output = fromElectrumXJsonParticl(
OutputV2 output = _parseOutput(
Map<String, dynamic>.from(outputJson as Map),
decimalPlaces: cryptoCurrency.fractionDigits,
isFullAmountNotSats: true,
@ -462,7 +462,7 @@ class ParticlWallet extends Bip39HDWallet
}
/// OutputV2.fromElectrumXJson wrapper for Particl-specific outputs.
static OutputV2 fromElectrumXJsonParticl(
OutputV2 _parseOutput(
Map<String, dynamic> json, {
// Other params just passed thru to fromElectrumXJson for transparent outs.
required bool walletOwns,

View file

@ -206,7 +206,7 @@ abstract class Wallet<T extends CryptoCurrency> {
);
}
// TODO: [prio=med] refactor to more generalized token rather than eth specific
// TODO: [prio=low] refactor to more generalized token rather than eth specific
static Wallet loadTokenWallet({
required EthereumWallet ethWallet,
required EthContract contract,