This commit is contained in:
status-im-auto 2023-08-03 07:44:59 +00:00 committed by Jenkins
parent f79b1a22d2
commit b9f5474b3e
1 changed files with 7 additions and 3 deletions

View File

@ -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) {