From 249883ba623fd7c4463bd5b5478e5bfa2bd1832e Mon Sep 17 00:00:00 2001 From: ymekuria Date: Thu, 19 Sep 2024 23:50:31 -0700 Subject: [PATCH] refactor(zkappWorker.ts): simplify fetchAccount and initZkappInstance functions by directly passing PublicKey object instead of an object with publicKey58 property --- .../04-zkapp-browser-ui/ui/src/pages/zkappWorker.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/zkappWorker.ts b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/zkappWorker.ts index 04ca25c65..3f1472c1a 100644 --- a/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/zkappWorker.ts +++ b/examples/zkapps/04-zkapp-browser-ui/ui/src/pages/zkappWorker.ts @@ -31,12 +31,14 @@ const api = { compileContract: async (args: {}) => { await state.Add!.compile(); }, - fetchAccount: async (args: { publicKey58: string }) => { - const publicKey = PublicKey.fromBase58(args.publicKey58); - return await fetchAccount({ publicKey }); + fetchAccount: async (publicKey: PublicKey) => { + // console.log('args', args ) + // const publicKey = PublicKey.fromBase58(args.publicKey58); + return await fetchAccount(publicKey); }, - initZkappInstance: async (args: { publicKey58: string }) => { - const publicKey = PublicKey.fromBase58(args.publicKey58); + initZkappInstance: async (publicKey: PublicKey) => { + console.log(publicKey) + // const publicKey = PublicKey.fromBase58(args.publicKey58); state.zkapp = new state.Add!(publicKey); }, getNum: async (args: {}) => {