From e3d9d81356963416e456f0dcd3ad8d049d1ed2d8 Mon Sep 17 00:00:00 2001 From: CryptoFish <13164589+KingGorrin@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:11:50 +0100 Subject: [PATCH] Delete web3 cache by deactivating pairings --- lib/screens/splash_screen.dart | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart index 2c324573..f00648df 100644 --- a/lib/screens/splash_screen.dart +++ b/lib/screens/splash_screen.dart @@ -122,13 +122,10 @@ class _SplashScreenState extends State Future _deleteWeb3Cache() async { try { - final web3Store = - sl().getWeb3Wallet().pairingTopics.storage; - await Future.forEach( - web3Store.keys.map((prefixedKey) => - prefixedKey.substring(web3Store.storagePrefix.length)), - (key) async => await web3Store.delete(key), - ); + final web3WalletService = sl(); + for (var pairing in web3WalletService.pairings.value) { + await web3WalletService.deactivatePairing(topic: pairing.topic); + } } catch (e, stackTrace) { Logger('SplashScreen') .log(Level.WARNING, '_deleteWeb3Cache', e, stackTrace);