mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
Some todo clean up and re prioritization
This commit is contained in:
parent
e1a2cf85f3
commit
46d1310039
13 changed files with 46 additions and 87 deletions
|
@ -793,7 +793,7 @@ class _ConfirmTransactionViewState
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
// TODO: [prio=high] spark transaction specifics - better handling
|
// TODO: [prio=med] spark transaction specifics - better handling
|
||||||
widget.isPaynymTransaction
|
widget.isPaynymTransaction
|
||||||
? widget.txData.paynymAccountLite!.nymName
|
? widget.txData.paynymAccountLite!.nymName
|
||||||
: widget.txData.recipients?.first.address ??
|
: widget.txData.recipients?.first.address ??
|
||||||
|
|
|
@ -112,31 +112,6 @@ class _RestoringWalletCardState extends ConsumerState<RestoringWalletCard> {
|
||||||
restoringStatus: StackRestoringStatus.restoring);
|
restoringStatus: StackRestoringStatus.restoring);
|
||||||
|
|
||||||
try {
|
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);
|
await wallet.recover(isRescan: true);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
|
|
@ -36,6 +36,9 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.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/animated_text.dart';
|
||||||
import 'package:stackwallet/widgets/background.dart';
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
|
@ -316,33 +319,28 @@ class _WalletNetworkSettingsViewState
|
||||||
|
|
||||||
final coin = ref.watch(pWalletCoin(widget.walletId));
|
final coin = ref.watch(pWalletCoin(widget.walletId));
|
||||||
|
|
||||||
// TODO: [prio=high] sync percent for certain wallets
|
if (coin == Coin.monero) {
|
||||||
// if (coin == Coin.monero) {
|
double highestPercent =
|
||||||
// double highestPercent =
|
(ref.read(pWallets).getWallet(widget.walletId) as MoneroWallet)
|
||||||
// (ref.read(pWallets).getWallet(widget.walletId).wallet as MoneroWallet)
|
.highestPercentCached;
|
||||||
// .highestPercentCached;
|
if (_percent < highestPercent) {
|
||||||
// if (_percent < highestPercent) {
|
_percent = highestPercent.clamp(0.0, 1.0);
|
||||||
// _percent = highestPercent.clamp(0.0, 1.0);
|
}
|
||||||
// }
|
} else if (coin == Coin.wownero) {
|
||||||
// } else if (coin == Coin.wownero) {
|
double highestPercent =
|
||||||
// double highestPercent = (ref
|
(ref.watch(pWallets).getWallet(widget.walletId) as WowneroWallet)
|
||||||
// .watch(pWallets)
|
.highestPercentCached;
|
||||||
// .getWallet(widget.walletId)
|
if (_percent < highestPercent) {
|
||||||
// .wallet as WowneroWallet)
|
_percent = highestPercent.clamp(0.0, 1.0);
|
||||||
// .highestPercentCached;
|
}
|
||||||
// if (_percent < highestPercent) {
|
} else if (coin == Coin.epicCash) {
|
||||||
// _percent = highestPercent.clamp(0.0, 1.0);
|
double highestPercent =
|
||||||
// }
|
(ref.watch(pWallets).getWallet(widget.walletId) as EpiccashWallet)
|
||||||
// } else if (coin == Coin.epicCash) {
|
.highestPercent;
|
||||||
// double highestPercent = (ref
|
if (_percent < highestPercent) {
|
||||||
// .watch(pWallets)
|
_percent = highestPercent.clamp(0.0, 1.0);
|
||||||
// .getWallet(widget.walletId)
|
}
|
||||||
// .wallet as EpicCashWallet)
|
}
|
||||||
// .highestPercent;
|
|
||||||
// if (_percent < highestPercent) {
|
|
||||||
// _percent = highestPercent.clamp(0.0, 1.0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !isDesktop,
|
condition: !isDesktop,
|
||||||
|
|
|
@ -235,7 +235,7 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
|
||||||
final wallet = ref
|
final wallet = ref
|
||||||
.read(pWallets)
|
.read(pWallets)
|
||||||
.getWallet(widget.walletId);
|
.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) {
|
if (wallet is MnemonicInterface) {
|
||||||
final mnemonic =
|
final mnemonic =
|
||||||
await wallet.getMnemonicAsWords();
|
await wallet.getMnemonicAsWords();
|
||||||
|
|
|
@ -258,7 +258,7 @@ class _FiroRescanRecoveryErrorViewState
|
||||||
} else {
|
} else {
|
||||||
final wallet =
|
final wallet =
|
||||||
ref.read(pWallets).getWallet(widget.walletId);
|
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) {
|
if (wallet is MnemonicInterface) {
|
||||||
final mnemonic = await wallet.getMnemonicAsWords();
|
final mnemonic = await wallet.getMnemonicAsWords();
|
||||||
|
|
||||||
|
|
|
@ -493,7 +493,8 @@ class _TransactionDetailsViewState extends ConsumerState<AllTransactionsView> {
|
||||||
value: [widget.walletId],
|
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: [
|
// filter: [
|
||||||
// // todo
|
// // todo
|
||||||
// ],
|
// ],
|
||||||
|
|
|
@ -484,9 +484,6 @@ class _AllTransactionsV2ViewState extends ConsumerState<AllTransactionsV2View> {
|
||||||
final criteria =
|
final criteria =
|
||||||
ref.watch(transactionFilterProvider.state).state;
|
ref.watch(transactionFilterProvider.state).state;
|
||||||
|
|
||||||
//todo: check if print needed
|
|
||||||
// debugPrint("Consumer build called");
|
|
||||||
|
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: ref
|
future: ref
|
||||||
.watch(mainDBProvider)
|
.watch(mainDBProvider)
|
||||||
|
@ -499,7 +496,8 @@ class _AllTransactionsV2ViewState extends ConsumerState<AllTransactionsV2View> {
|
||||||
value: [widget.walletId],
|
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: [
|
// filter: [
|
||||||
// // todo
|
// // todo
|
||||||
// ],
|
// ],
|
||||||
|
|
|
@ -182,7 +182,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
_lelantusRescanRecovery = true;
|
_lelantusRescanRecovery = true;
|
||||||
_firoRescanRecovery();
|
_firoRescanRecovery();
|
||||||
// } else if (ref.read(managerProvider).rescanOnOpenVersion ==
|
// } else if (ref.read(managerProvider).rescanOnOpenVersion ==
|
||||||
// TODO: [prio=high]
|
// TODO: [prio=med]
|
||||||
// Constants.rescanV1) {
|
// Constants.rescanV1) {
|
||||||
// _rescanningOnOpen = true;
|
// _rescanningOnOpen = true;
|
||||||
// ref.read(managerProvider).fullRescan(20, 1000).then(
|
// ref.read(managerProvider).fullRescan(20, 1000).then(
|
||||||
|
|
|
@ -113,7 +113,8 @@ class _DesktopAttentionDeleteWallet
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final wallet =
|
final wallet =
|
||||||
ref.read(pWallets).getWallet(widget.walletId);
|
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) {
|
if (wallet is MnemonicInterface) {
|
||||||
final words = await wallet.getMnemonicAsWords();
|
final words = await wallet.getMnemonicAsWords();
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,8 @@ class _UnlockWalletKeysDesktopState
|
||||||
|
|
||||||
final wallet = ref.read(pWallets).getWallet(widget.walletId);
|
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) {
|
if (wallet is! MnemonicInterface) {
|
||||||
throw Exception("FIXME ~= see todo in code");
|
throw Exception("FIXME ~= see todo in code");
|
||||||
}
|
}
|
||||||
|
@ -303,7 +304,8 @@ class _UnlockWalletKeysDesktopState
|
||||||
final wallet =
|
final wallet =
|
||||||
ref.read(pWallets).getWallet(widget.walletId);
|
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) {
|
if (wallet is! MnemonicInterface) {
|
||||||
throw Exception("FIXME ~= see todo in code");
|
throw Exception("FIXME ~= see todo in code");
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,7 @@ class EpiccashWallet extends Bip39Wallet {
|
||||||
Map<String, String> txAddressInfo,
|
Map<String, String> txAddressInfo,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
var slatesToCommits = await _getSlatesToCommits();
|
final slatesToCommits = info.epicData?.slatesToCommits ?? {};
|
||||||
final from = txAddressInfo['from'];
|
final from = txAddressInfo['from'];
|
||||||
final to = txAddressInfo['to'];
|
final to = txAddressInfo['to'];
|
||||||
slatesToCommits[slateData.slateId] = {
|
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 {
|
Future<int> _getCurrentIndex() async {
|
||||||
try {
|
try {
|
||||||
final int receivingIndex = info.epicData!.receivingIndex;
|
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 {
|
Future<String> _getRealConfig() async {
|
||||||
String? config = await secureStorageInterface.read(
|
String? config = await secureStorageInterface.read(
|
||||||
key: '${walletId}_config',
|
key: '${walletId}_config',
|
||||||
|
@ -954,7 +938,7 @@ class EpiccashWallet extends Bip39Wallet {
|
||||||
|
|
||||||
final List<TransactionV2> txns = [];
|
final List<TransactionV2> txns = [];
|
||||||
|
|
||||||
final slatesToCommits = await _getSlatesToCommits();
|
final slatesToCommits = info.epicData?.slatesToCommits ?? {};
|
||||||
|
|
||||||
for (final tx in transactions) {
|
for (final tx in transactions) {
|
||||||
// Logging.instance.log("tx: $tx", level: LogLevel.Info);
|
// Logging.instance.log("tx: $tx", level: LogLevel.Info);
|
||||||
|
|
|
@ -187,7 +187,7 @@ class ParticlWallet extends Bip39HDWallet
|
||||||
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
||||||
as Map);
|
as Map);
|
||||||
|
|
||||||
final prevOut = fromElectrumXJsonParticl(
|
final prevOut = _parseOutput(
|
||||||
prevOutJson,
|
prevOutJson,
|
||||||
decimalPlaces: cryptoCurrency.fractionDigits,
|
decimalPlaces: cryptoCurrency.fractionDigits,
|
||||||
isFullAmountNotSats: true,
|
isFullAmountNotSats: true,
|
||||||
|
@ -227,7 +227,7 @@ class ParticlWallet extends Bip39HDWallet
|
||||||
// Parse outputs.
|
// Parse outputs.
|
||||||
final List<OutputV2> outputs = [];
|
final List<OutputV2> outputs = [];
|
||||||
for (final outputJson in txData["vout"] as List) {
|
for (final outputJson in txData["vout"] as List) {
|
||||||
OutputV2 output = fromElectrumXJsonParticl(
|
OutputV2 output = _parseOutput(
|
||||||
Map<String, dynamic>.from(outputJson as Map),
|
Map<String, dynamic>.from(outputJson as Map),
|
||||||
decimalPlaces: cryptoCurrency.fractionDigits,
|
decimalPlaces: cryptoCurrency.fractionDigits,
|
||||||
isFullAmountNotSats: true,
|
isFullAmountNotSats: true,
|
||||||
|
@ -462,7 +462,7 @@ class ParticlWallet extends Bip39HDWallet
|
||||||
}
|
}
|
||||||
|
|
||||||
/// OutputV2.fromElectrumXJson wrapper for Particl-specific outputs.
|
/// OutputV2.fromElectrumXJson wrapper for Particl-specific outputs.
|
||||||
static OutputV2 fromElectrumXJsonParticl(
|
OutputV2 _parseOutput(
|
||||||
Map<String, dynamic> json, {
|
Map<String, dynamic> json, {
|
||||||
// Other params just passed thru to fromElectrumXJson for transparent outs.
|
// Other params just passed thru to fromElectrumXJson for transparent outs.
|
||||||
required bool walletOwns,
|
required bool walletOwns,
|
||||||
|
|
|
@ -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({
|
static Wallet loadTokenWallet({
|
||||||
required EthereumWallet ethWallet,
|
required EthereumWallet ethWallet,
|
||||||
required EthContract contract,
|
required EthContract contract,
|
||||||
|
|
Loading…
Reference in a new issue