wallet delete ui bugfix for desktop

This commit is contained in:
julian 2023-01-16 17:17:35 -06:00
parent 880c82ba72
commit 90870c7563
3 changed files with 13 additions and 11 deletions

View file

@ -110,13 +110,17 @@ class MainDB {
//
Future<void> deleteWalletBlockchainData(String walletId) async {
final transactionCount = await getTransactions(walletId).count();
final addressCount = await getAddresses(walletId).count();
final utxoCount = await getUTXOs(walletId).count();
final inputCount = await getInputs(walletId).count();
final outputCount = await getOutputs(walletId).count();
await isar.writeTxn(() async {
const paginateLimit = 50;
// transactions
for (int i = 0;
i < getTransactions(walletId).countSync();
i += paginateLimit) {
for (int i = 0; i < transactionCount; i += paginateLimit) {
final txns = await getTransactions(walletId)
.offset(i)
.limit(paginateLimit)
@ -126,9 +130,7 @@ class MainDB {
}
// addresses
for (int i = 0;
i < getAddresses(walletId).countSync();
i += paginateLimit) {
for (int i = 0; i < addressCount; i += paginateLimit) {
final addresses = await getAddresses(walletId)
.offset(i)
.limit(paginateLimit)
@ -138,7 +140,7 @@ class MainDB {
}
// utxos
for (int i = 0; i < getUTXOs(walletId).countSync(); i += paginateLimit) {
for (int i = 0; i < utxoCount; i += paginateLimit) {
final utxos =
await getUTXOs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.utxos
@ -146,7 +148,7 @@ class MainDB {
}
// inputs
for (int i = 0; i < getInputs(walletId).countSync(); i += paginateLimit) {
for (int i = 0; i < inputCount; i += paginateLimit) {
final inputs =
await getInputs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.inputs
@ -154,9 +156,7 @@ class MainDB {
}
// outputs
for (int i = 0;
i < getOutputs(walletId).countSync();
i += paginateLimit) {
for (int i = 0; i < outputCount; i += paginateLimit) {
final outputs =
await getOutputs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.outputs

View file

@ -40,6 +40,7 @@ class CoinWalletsTable extends ConsumerWidget {
children: [
for (int i = 0; i < walletIds.length; i++)
Column(
key: Key("${coin.name}_$runtimeType${walletIds[i]}_key"),
children: [
if (i != 0)
const SizedBox(

View file

@ -37,6 +37,7 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
rows: [
for (int i = 0; i < providersByCoin.length; i++)
Builder(
key: Key("${providersByCoin[i].key.name}_${runtimeType}_key"),
builder: (context) {
final providers = ref.watch(walletsChangeNotifierProvider.select(
(value) => value