diff --git a/cw_nano/lib/nano_wallet.dart b/cw_nano/lib/nano_wallet.dart index ffe26ce43..ea6ab816e 100644 --- a/cw_nano/lib/nano_wallet.dart +++ b/cw_nano/lib/nano_wallet.dart @@ -238,6 +238,7 @@ abstract class NanoWalletBase _isTransactionUpdating = true; final transactions = await fetchTransactions(); + transactionHistory.clear(); transactionHistory.addMany(transactions); await transactionHistory.save(); _isTransactionUpdating = false; diff --git a/lib/view_model/contact_list/contact_list_view_model.dart b/lib/view_model/contact_list/contact_list_view_model.dart index c99984ebc..5abb4674f 100644 --- a/lib/view_model/contact_list/contact_list_view_model.dart +++ b/lib/view_model/contact_list/contact_list_view_model.dart @@ -13,25 +13,29 @@ import 'package:cw_core/crypto_currency.dart'; part 'contact_list_view_model.g.dart'; -class ContactListViewModel = ContactListViewModelBase - with _$ContactListViewModel; +class ContactListViewModel = ContactListViewModelBase with _$ContactListViewModel; abstract class ContactListViewModelBase with Store { - ContactListViewModelBase(this.contactSource, this.walletInfoSource, - this._currency, this.settingsStore) + ContactListViewModelBase( + this.contactSource, this.walletInfoSource, this._currency, this.settingsStore) : contacts = ObservableList(), walletContacts = [] { walletInfoSource.values.forEach((info) { if (info.addresses?.isNotEmpty ?? false) { info.addresses?.forEach((address, label) { final name = label.isNotEmpty ? info.name + ' ($label)' : info.name; - walletContacts.add(WalletContact( address, name, walletTypeToCryptoCurrency(info.type), )); }); + } else if (info.address != null) { + walletContacts.add(WalletContact( + info.address, + info.name, + walletTypeToCryptoCurrency(info.type), + )); } }); @@ -57,14 +61,12 @@ abstract class ContactListViewModelBase with Store { Future delete(ContactRecord contact) async => contact.original.delete(); @computed - List get contactsToShow => contacts - .where((element) => _isValidForCurrency(element)) - .toList(); + List get contactsToShow => + contacts.where((element) => _isValidForCurrency(element)).toList(); @computed - List get walletContactsToShow => walletContacts - .where((element) => _isValidForCurrency(element)) - .toList(); + List get walletContactsToShow => + walletContacts.where((element) => _isValidForCurrency(element)).toList(); bool _isValidForCurrency(ContactBase element) { return _currency == null || element.type == _currency || element.type.title == _currency!.tag;