Skip to content

Commit

Permalink
update both browser and node examples to v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mhchia committed Sep 1, 2023
1 parent f054816 commit 71f5702
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 52 deletions.
119 changes: 95 additions & 24 deletions examples/browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"rollup-plugin-polyfill-node": "^0.12.0",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-visualizer": "^5.9.0",
"rlnjs": "^3.1.5"
"rlnjs": "^3.2.0"
}
}
12 changes: 6 additions & 6 deletions examples/browser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "ethers";
import { MemoryCache, RLN, Status } from "test-rlnjs";
import { MemoryCache, RLN, Status } from "rlnjs";
import { deployERC20, deployRLNContract, deployVerifier, treeDepth, url } from "./configs";


Expand Down Expand Up @@ -42,8 +42,8 @@ async function main() {
const rlnContractAtBlock = await provider.getBlockNumber()
console.log(`Deployed RLN contract at ${rlnContractAddress} at block ${rlnContractAtBlock}`)

function createRLNInstance() {
return RLN.createWithContractRegistry({
async function createRLNInstance() {
return await RLN.createWithContractRegistry({
/* Required */
rlnIdentifier,
provider,
Expand All @@ -58,7 +58,7 @@ async function main() {
provider.send("hardhat_mine", ["0x" + numBlocks.toString(16)])
}

const rln = createRLNInstance()
const rln = await createRLNInstance()
console.log(`rln created: identityCommitment=${rln.identityCommitment}`)
if (await rln.isRegistered()) {
throw new Error(`rln should not have yet registered`);
Expand Down Expand Up @@ -116,7 +116,7 @@ async function main() {
}
}
const resettableCache = new ResettableCache()
const rlnAnother = createRLNInstance()
const rlnAnother = await createRLNInstance()
rlnAnother.setCache(resettableCache)
console.log(`rlnAnother created: identityCommitment=${rlnAnother.identityCommitment}`)
class FaultyMessageIDCounter {
Expand Down Expand Up @@ -157,7 +157,7 @@ async function main() {
if (await rlnAnother.isRegistered()) {
throw new Error(`rlnAnother should have been slashed`);
}
console.log(`Successfully slashed rlnAnother`);
console.log(`Completed successfully`)
RLN.cleanUp()
}

Expand Down
1 change: 0 additions & 1 deletion examples/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"moduleResolution": "node",
"allowJs": true,
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": false,
"noImplicitReturns": true,
Expand Down
Loading

0 comments on commit 71f5702

Please sign in to comment.