From 0a3c00184546057d79136e3d33d3e7162d72bf74 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 18 Jan 2023 17:20:23 -0600 Subject: [PATCH] fix all own addresses query --- lib/services/coins/bitcoin/bitcoin_wallet.dart | 10 +++++++--- .../coins/bitcoincash/bitcoincash_wallet.dart | 10 +++++++--- lib/services/coins/dogecoin/dogecoin_wallet.dart | 10 +++++++--- lib/services/coins/firo/firo_wallet.dart | 10 +++++++--- lib/services/coins/litecoin/litecoin_wallet.dart | 10 +++++++--- lib/services/coins/namecoin/namecoin_wallet.dart | 10 +++++++--- lib/services/coins/particl/particl_wallet.dart | 11 ++++++++--- 7 files changed, 50 insertions(+), 21 deletions(-) diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index f0ca06915..e0d9a1e72 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -1319,9 +1319,13 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); // final List allAddresses = []; // final receivingAddresses = DB.instance.get( diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index b3fc5b4b5..94cc16139 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -1274,9 +1274,13 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); // for (var i = 0; i < receivingAddressesP2PKH.length; i++) { diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index bc799530a..01d148c51 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -1152,9 +1152,13 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); return allAddresses; } diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index b679f203f..259420ac2 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -3232,9 +3232,13 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); // final List allAddresses = []; // final receivingAddresses = diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index 7604d3811..1a019eacb 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -1335,9 +1335,13 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); // final List allAddresses = []; // final receivingAddresses = DB.instance.get( diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index fe064fe7f..70d3e85ed 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -1324,9 +1324,13 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); // final List allAddresses = []; // final receivingAddresses = DB.instance.get( diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 59e9e718e..a0448630b 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -1255,10 +1255,15 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB { final allAddresses = await db .getAddresses(walletId) .filter() - .subTypeEqualTo(isar_models.AddressSubType.receiving) - .or() - .subTypeEqualTo(isar_models.AddressSubType.change) + .not() + .typeEqualTo(isar_models.AddressType.nonWallet) + .and() + .group((q) => q + .subTypeEqualTo(isar_models.AddressSubType.receiving) + .or() + .subTypeEqualTo(isar_models.AddressSubType.change)) .findAll(); + // final List allAddresses = []; // final receivingAddresses = DB.instance.get( // boxName: walletId, key: 'receivingAddressesP2WPKH') as List;