Skip to content

Commit

Permalink
♻️💄✨ Refactor components, adjust layout, define verify page (#161)
Browse files Browse the repository at this point in the history
* adjust margins

* can load anonset from json file

* fix from-on-chain page

* define AnonSet context to share anon set state

* fix: bump next to 13.4.3

Need bug fix related to multiple star re export
vercel/next.js#49468

* Render AnonKlub Home Link in a badge

* Adjust Layout (vertical margins)

* fix: reset AnonSet when going to upload file page

* rename <Help/> to <PopUpButton/>

* Rename ScrollableContainer to ScrollableJsonContainer

* Refactor AnonSetFileInput

* Refactor Modal Components

* define useAnonSet hook

* remove useReady hook

* refactor

* refactor Modal into a container

* refactor: include Star and Modal into <JsonFileInput />

* Define Verify Page Layout

* fix layout

* add circom generated data to ui static files

* format
  • Loading branch information
sripwoud committed May 22, 2023
1 parent faaea14 commit 1c6c9d2
Show file tree
Hide file tree
Showing 41 changed files with 1,171 additions and 355 deletions.
3 changes: 2 additions & 1 deletion .barrelsby.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"apis/query/src/api/services",
"apis/query/src/api/repositories",
"demo/src/cli/prompts",
"ui/src/components"
"ui/src/components",
"ui/src/hooks"
],
"delete": true,
"noSemicolon": true,
Expand Down
4 changes: 4 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ overrides:
- files: ['apis/prove/generated/generate_witness.js']
rules:
'@typescript-eslint/no-var-requires': off
- files: ['*.tsx']
rules:
'@typescript-eslint/no-misused-promises':
[error, { checksVoidReturn: { attributes: false } }]
- files: ['apis/prove/src/routes.ts']
rules:
'@typescript-eslint/no-misused-promises': off
Expand Down
1 change: 1 addition & 0 deletions demo/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const cli = async () => {
}
break
}

case AnonSetLocation.FILE: {
const path = await askAddressesFile()
const { default: _addresses } = await import(path)
Expand Down
513 changes: 289 additions & 224 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion ui/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
"author": "3pwd <me@3pwd.xyz>",
"license": "MIT",
"dependencies": {
"@anonset/membership": "workspace:^",
"@heroicons/react": "^2.0.18",
"@web3modal/ethereum": "^2.4.1",
"@web3modal/react": "^2.4.1",
"autoprefixer": "^10.4.14",
"nes.css": "^2.3.0",
"next": "^13.4.2",
"next": "^13.4.3",
"postcss": "^8.4.23",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
22 changes: 22 additions & 0 deletions ui/public/generated/generate_witness.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const wc = require('./witness_calculator.js')
const { readFileSync, writeFile } = require('fs')

if (process.argv.length != 5) {
console.log(
'Usage: node generate_witness.js <file.wasm> <input.json> <output.wtns>',
)
} else {
const input = JSON.parse(readFileSync(process.argv[3], 'utf8'))

const buffer = readFileSync(process.argv[2])
wc(buffer).then(async (witnessCalculator) => {
// const w= await witnessCalculator.calculateWitness(input,0);
// for (let i=0; i< w.length; i++){
// console.log(w[i]);
// }
const buff = await witnessCalculator.calculateWTNSBin(input, 0)
writeFile(process.argv[4], buff, function (err) {
if (err) throw err
})
})
}
Binary file added ui/public/generated/main.wasm
Binary file not shown.
105 changes: 105 additions & 0 deletions ui/public/generated/verification_key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"protocol": "groth16",
"curve": "bn128",
"nPublic": 5,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
["1", "0"]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
["1", "0"]
],
"vk_delta_2": [
[
"7557095872897644921759750309236066110681591963328276958365184487727942977384",
"2585261721879365932300297402926320099793018688169530309287082840487789731743"
],
[
"9689161368389106761777611967003662439915950766131105424166713268072538716933",
"21219585362573197963046338548656788412468519114640293735397923738407446979124"
],
["1", "0"]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"15378369537707264939263012273103364806213377581448269315521635172522072433169",
"8244706524651740812258441209265733043489087637457491139477547416234965412250",
"1"
],
[
"5268129217668546846176047734506919040398913361196690774171619214821302194328",
"20498558697224297068438830912114159918250085963563409522029547416501980743564",
"1"
],
[
"18267622522246942977993095729159783481216871499337636542083874298090901078680",
"18073186125325070112114279569374127154471967602121799425533714510160303267109",
"1"
],
[
"15097381742252683565102752741266011361607873201723190028580008973246746757824",
"3656879294956228684080223317008893793228491657300197015647614146542484614073",
"1"
],
[
"15079904671097387635239451225226304620736246954574123371221895853669801688488",
"16446309530230169021713718914880148092213363709571546199466064851457314405846",
"1"
],
[
"20815718287486358263204708897895389953308268671685097372687009787516053051191",
"14231404347608211118449829347751581876279288989746622009710573788582567415535",
"1"
]
]
}

0 comments on commit 1c6c9d2

Please sign in to comment.