Changed way for generation of change address for electrum wallets. Remove some yats call.

This commit is contained in:
M
2022-01-12 15:20:43 +02:00
parent 862401147b
commit cfb82dd02d
8 changed files with 93 additions and 54 deletions
+21 -21
View File
@@ -17,34 +17,34 @@ import 'package:cake_wallet/store/yat/yat_store.dart';
ReactionDisposer _onCurrentWalletChangeReaction;
ReactionDisposer _onCurrentWalletChangeFiatRateUpdateReaction;
ReactionDisposer _onCurrentWalletAddressChangeReaction;
//ReactionDisposer _onCurrentWalletAddressChangeReaction;
void startCurrentWalletChangeReaction(AppStore appStore,
SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
_onCurrentWalletChangeReaction?.reaction?.dispose();
_onCurrentWalletChangeFiatRateUpdateReaction?.reaction?.dispose();
_onCurrentWalletAddressChangeReaction?.reaction?.dispose();
//_onCurrentWalletAddressChangeReaction?.reaction?.dispose();
_onCurrentWalletAddressChangeReaction = reaction((_) => appStore.wallet.walletAddresses.address,
(String address) async {
if (address == appStore.wallet.walletInfo.yatLastUsedAddress) {
return;
}
//_onCurrentWalletAddressChangeReaction = reaction((_) => appStore.wallet.walletAddresses.address,
//(String address) async {
//if (address == appStore.wallet.walletInfo.yatLastUsedAddress) {
// return;
//}
try {
final yatStore = getIt.get<YatStore>();
await updateEmojiIdAddress(
appStore.wallet.walletInfo.yatEmojiId,
appStore.wallet.walletAddresses.address,
yatStore.apiKey,
appStore.wallet.type
);
appStore.wallet.walletInfo.yatLastUsedAddress = address;
await appStore.wallet.walletInfo.save();
} catch (e) {
print(e.toString());
}
});
//try {
// final yatStore = getIt.get<YatStore>();
// await updateEmojiIdAddress(
// appStore.wallet.walletInfo.yatEmojiId,
// appStore.wallet.walletAddresses.address,
// yatStore.apiKey,
// appStore.wallet.type
// );
// appStore.wallet.walletInfo.yatLastUsedAddress = address;
// await appStore.wallet.walletInfo.save();
//} catch (e) {
// print(e.toString());
//}
//});
_onCurrentWalletChangeReaction = reaction((_) => appStore.wallet, (WalletBase<
Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>