From 5eee3f8313510f7313bec319b09fa0d24725611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bordalo?= Date: Wed, 20 Dec 2023 11:36:35 +0000 Subject: [PATCH 1/2] update on opening popup --- src/extension/wallet/home/index.tsx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/extension/wallet/home/index.tsx b/src/extension/wallet/home/index.tsx index a076f120..2b52806e 100644 --- a/src/extension/wallet/home/index.tsx +++ b/src/extension/wallet/home/index.tsx @@ -19,10 +19,19 @@ import { SendFlowStep } from '../../../domain/repository'; import type { Asset } from 'marina-provider'; import { networks } from 'liquidjs-lib'; import { useStorageContext } from '../../context/storage-context'; +import { UpdaterService } from '../../../application/updater'; +import zkp from '@vulpemventures/secp256k1-zkp'; const Home: React.FC = () => { const history = useHistory(); - const { appRepository, sendFlowRepository, cache } = useStorageContext(); + const { + walletRepository, + assetRepository, + blockHeadersRepository, + appRepository, + sendFlowRepository, + cache, + } = useStorageContext(); const [sortedAssets, setSortedAssets] = React.useState([]); useEffect(() => { @@ -61,6 +70,20 @@ const Home: React.FC = () => { const handleSend = () => history.push(SEND_SELECT_ASSET_ROUTE); + useEffect(() => { + (async () => { + const updater = new UpdaterService( + walletRepository, + appRepository, + blockHeadersRepository, + assetRepository, + await zkp() + ); + if (!cache?.network) throw new Error('Network not found'); + await updater.checkAndFixMissingTransactionsData(cache.network); + })().catch(console.error); + }, [cache?.authenticated]); + useEffect(() => { (async () => { const { isAuthenticated } = await appRepository.getStatus(); From 15f171e5c2e4ad1068b1ca3c42a5d44e94342f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bordalo?= Date: Wed, 20 Dec 2023 15:24:19 +0000 Subject: [PATCH 2/2] add comment --- src/extension/wallet/home/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extension/wallet/home/index.tsx b/src/extension/wallet/home/index.tsx index 771b8772..e262e4f2 100644 --- a/src/extension/wallet/home/index.tsx +++ b/src/extension/wallet/home/index.tsx @@ -65,12 +65,12 @@ const Home: React.FC = () => { }); }; - const handleReceive = () => { - history.push(RECEIVE_SELECT_ASSET_ROUTE); - }; + const handleReceive = () => history.push(RECEIVE_SELECT_ASSET_ROUTE); const handleSend = () => history.push(SEND_SELECT_ASSET_ROUTE); + // update everytime the user comes back to home + // this also works when user re-opens the wallet useEffect(() => { (async () => { const updater = new UpdaterService(