Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update both browser and node examples to v3.2.0 #98

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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