From 9edd889f3931f96d0046a11745c065e7bc89ad1f Mon Sep 17 00:00:00 2001 From: ymekuria Date: Thu, 19 Sep 2024 16:08:03 -0700 Subject: [PATCH] feat(index.page.tsx): check if wallet is installed in setup method --- .../04-zkapp-browser-ui/ui/src/pages/index.page.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx index b5bda35df..c3fb2d78e 100644 --- a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx +++ b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx @@ -40,15 +40,19 @@ export default function Home() { setState(prev => ({ ...prev, zkappWorkerClient })); const setup = async () => { - setState(prev => ({ ...prev, displayText: 'Loading web worker...' })); + setDisplayText('Loading web worker...'); + console.log('Loading web worker...'); await zkappWorkerClient.setActiveInstanceToDevnet(); - + const mina = (window as any).mina; + if (!mina) { + setState(prev => ({ ...prev, hasWallet: false })); + return; + } }; // (async () => { // if (!state.hasBeenSetup) { - // setDisplayText('Loading web worker...'); - // console.log('Loading web worker...'); + // const zkappWorkerClient = new ZkappWorkerClient(); // await timeout(5);