From 3e2eb2a7c7275af025cddb72e078fb38a04db0b4 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 9 Oct 2023 11:44:17 -0600 Subject: [PATCH] ensure only wallet owned p2pkh addresses are passed in --- lib/services/mixins/fusion_wallet_interface.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/services/mixins/fusion_wallet_interface.dart b/lib/services/mixins/fusion_wallet_interface.dart index f33485955..f9f340f6b 100644 --- a/lib/services/mixins/fusion_wallet_interface.dart +++ b/lib/services/mixins/fusion_wallet_interface.dart @@ -80,9 +80,19 @@ mixin FusionWalletInterface { // set _uiState states } - /// Returns a list of all addresses in the wallet. + /// Returns a list of all owned p2pkh addresses in the wallet. Future> getFusionAddresses() async { - List
_addresses = await _db.getAddresses(_walletId).findAll(); + List
_addresses = await _db + .getAddresses(_walletId) + .filter() + .typeEqualTo(AddressType.p2pkh) + .and() + .group((q) => q + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.change)) + .findAll(); + return _addresses.map((address) => address.toFusionAddress()).toList(); }