From b9f5474b3ed6178406eecf81181cb137e98db32f Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Thu, 3 Aug 2023 07:44:59 +0000 Subject: [PATCH] Updates --- rln-js/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rln-js/index.js b/rln-js/index.js index dde8550..9acdbb1 100644 --- a/rln-js/index.js +++ b/rln-js/index.js @@ -12,7 +12,7 @@ import { RLNDecoder, RLNEncoder, RLNContract, -} from "https://unpkg.com/@waku/rln@0.1.0/bundle/index.js"; +} from "https://unpkg.com/@waku/rln@0.1.1/bundle/index.js"; import { ethers } from "https://unpkg.com/ethers@5.7.2/dist/ethers.esm.min.js"; const ContentTopic = "/toy-chat/2/luzhou/proto"; @@ -47,6 +47,7 @@ async function initRLN(ui) { const result = { encoder: undefined, rlnInstance: undefined, + contract: undefined, }; const provider = new ethers.providers.Web3Provider(window.ethereum, "any"); @@ -55,11 +56,14 @@ async function initRLN(ui) { const rlnInstance = await create(); ui.setRlnStatus("WASM Blob download in progress... done!"); - const rlnContract = new RLNContract({ + const rlnContract = new RLNContract( + rlnInstance, { address: rlnAddress, provider: provider.getSigner(), }); + result.contract = rlnContract; + // Wallet logic window.ethereum.on("accountsChanged", ui.setAccount); window.ethereum.on("chainChanged", (chainId) => { @@ -184,7 +188,7 @@ async function initWaku(ui, rln) { try { console.log("Verifying proof without roots"); console.time("proof_verify_timer"); - const res = message.verifyNoRoot(); + const res = message.verify(rln.contract.roots()); console.timeEnd("proof_verify_timer"); console.log("proof verified without roots", res); if (res === undefined) {