Skip to content

Commit

Permalink
feat(index.page.tsx): add state for zkappWorkerClient to manage web w…
Browse files Browse the repository at this point in the history
…orker client instance
  • Loading branch information
ymekuria committed Sep 23, 2024
1 parent d1302c0 commit 28d3de9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default function Home() {
zkappPublicKeyBase58: '',
creatingTransaction: false,
});


const [zkappWorkerClient, setZkappWorkerClient] = useState<null | ZkappWorkerClient>(null);
const [displayText, setDisplayText] = useState('');
const [transactionlink, setTransactionLink] = useState('');

Expand All @@ -33,6 +34,8 @@ export default function Home() {
setDisplayText('Loading web worker...');
console.log('Loading web worker...');
const zkappWorkerClient = new ZkappWorkerClient();
setZkappWorkerClient(zkappWorkerClient);

await new Promise((resolve) => setTimeout(resolve, 5000));

setDisplayText('Done loading web worker');
Expand Down Expand Up @@ -84,7 +87,6 @@ export default function Home() {

setState({
...state,
zkappWorkerClient,
hasWallet: true,
hasBeenSetup: true,
publicKeyBase58,
Expand Down

0 comments on commit 28d3de9

Please sign in to comment.