Skip to content

Commit adedbe8

Browse files
authored
Merge pull request #53 from yann300/add_new_deps
add merkle & circom
2 parents d11de2a + dffeb50 commit adedbe8

File tree

8 files changed

+1018
-255
lines changed

8 files changed

+1018
-255
lines changed

build/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<head>
55
<meta charset="utf-8">
66
<meta http-equiv="X-UA-Compatible" content="chrome=1">
7-
<script src="snarkjs.min.js"></script>
87
<script src="script-runner.js"></script>
98
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
109
</head>

build/script-runner.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/script-runner.js.LICENSE.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* [js-sha512]{@link https://github.com/emn178/js-sha512}
3+
*
4+
* @version 0.8.0
5+
* @author Chen, Yi-Cyuan [[email protected]]
6+
* @copyright Chen, Yi-Cyuan 2014-2018
7+
* @license MIT
8+
*/
9+
110
/*
211
object-assign
312
(c) Sindre Sorhus
@@ -599,14 +608,44 @@ PERFORMANCE OF THIS SOFTWARE.
599608

600609
/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
601610

611+
/*! https://mths.be/punycode v1.4.1 by @mathias */
612+
602613
/*! https://mths.be/utf8js v3.0.0 by @mathias */
603614

604615
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
605616

617+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
618+
606619
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
607620

608621
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
609622

623+
/**
624+
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
625+
* @author Matthew Eernisse <[email protected]>
626+
* @author Tiancheng "Timothy" Gu <[email protected]>
627+
* @project EJS
628+
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
629+
*/
630+
631+
/**
632+
* @module @semaphore-protocol/group
633+
* @version 3.11.0
634+
* @file A library to create and manage Semaphore groups.
635+
* @copyright Ethereum Foundation 2022
636+
* @license MIT
637+
* @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/group}
638+
*/
639+
640+
/**
641+
* @module @zk-kit/incremental-merkle-tree
642+
* @version 1.1.0
643+
* @file Incremental Merkle tree implementation in TypeScript.
644+
* @copyright Cedoor 2023
645+
* @license MIT
646+
* @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/incremental-merkle-tree}
647+
*/
648+
610649
/**
611650
* [js-sha3]{@link https://github.com/emn178/js-sha3}
612651
*

build/snarkjs.min.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"build": "webpack --config webpack.config.js && cp ./node_modules/snarkjs/build/snarkjs.min.js ./build"
8+
"build": "webpack --config webpack.config.js"
99
},
1010
"dependencies": {
1111
"@babel/core": "^7.4.5",
@@ -19,17 +19,28 @@
1919
"@ethereum-waffle/chai": "^3.4.4",
2020
"@remixproject/plugin": "^0.3.1",
2121
"@remixproject/plugin-iframe": "^0.3.1",
22+
"@semaphore-protocol/contracts": "^3.11.0",
23+
"@semaphore-protocol/group": "^3.11.0",
24+
"@semaphore-protocol/identity": "^3.11.0",
25+
"@semaphore-protocol/proof": "^3.11.0",
26+
"@zk-kit/incremental-merkle-tree": "^1.1.0",
2227
"babelify": "^10.0.0",
2328
"chai": "^4.3.6",
29+
"circomlibjs": "^0.0.8",
30+
"constants-browserify": "^1.0.0",
31+
"crypto-browserify": "^3.12.0",
2432
"ethers": "^5.4.7",
2533
"fast-async": "^7.0.6",
34+
"https-browserify": "^1.0.0",
2635
"mocha": "^9.2.0",
2736
"multihashes": "^4.0.3",
37+
"node-polyfill-webpack-plugin": "^2.0.1",
2838
"path-browserify": "^1.0.1",
2939
"process": "^0.11.10",
40+
"snarkjs": "0.7.0",
3041
"starknet": "^3.15.0",
3142
"stream-browserify": "^3.0.0",
32-
"swarmgw": "^0.3.1",
43+
"stream-http": "^3.2.0",
3344
"typescript": "^4.6.2",
3445
"web3": "^1.5.3",
3546
"webpack": "^5.74.0",

src/script-runner.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,35 @@ import * as ethersJs from 'ethers' // eslint-disable-line
77
import multihash from 'multihashes'
88
import * as web3Js from 'web3'
99
import Web3 from 'web3'
10-
import swarmgw_fn from 'swarmgw'
1110
import { waffleChai } from "@ethereum-waffle/chai";
1211
import * as starknet from 'starknet'
1312
import * as zokratesJs from 'zokrates-js';
13+
import * as circomlibjs from 'circomlibjs';
14+
const snarkjs = require('snarkjs');
15+
import * as zkkitIncrementalMerkleTree from '@zk-kit/incremental-merkle-tree';
16+
import * as semaphoreProtocolProof from '@semaphore-protocol/proof'
17+
// import * as semaphoreProtocolContracts from '@semaphore-protocol/contracts'
18+
import * as semaphoreProtocolGroup from '@semaphore-protocol/group'
19+
import * as semaphoreProtocolIdentity from '@semaphore-protocol/identity'
1420
import './runWithMocha'
1521
import * as path from 'path'
1622
import * as hhEtherMethods from './hardhat-ethers/methods'
1723
const chai = require('chai')
1824
chai.use(waffleChai)
1925

20-
window.swarmgw = swarmgw_fn()
2126
window.starknet = starknet
2227
window.chai = chai
2328
window.ethers = ethersJs
2429
window.multihashes = multihash
2530
window['zokrates-js'] = zokratesJs
2631
window['snarkjs'] = snarkjs
32+
window['circomlibjs'] = circomlibjs
33+
window['@zk-kit/incremental-merkle-tree'] = zkkitIncrementalMerkleTree
34+
35+
window['@semaphore-protocol/proof'] = semaphoreProtocolProof
36+
// window['@semaphore-protocol/contracts'] = semaphoreProtocolContracts
37+
window['@semaphore-protocol/group'] = semaphoreProtocolGroup
38+
window['@semaphore-protocol/identity'] = semaphoreProtocolIdentity
2739

2840
const scriptReturns = {} // keep track of modules exported values
2941
const fileContents = {} // keep track of file content

webpack.config.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,31 @@ module.exports = {
99
path: path.resolve(__dirname, 'build')
1010
},
1111
resolve: {
12-
alias: {
12+
fallback: {
13+
assert: false,
1314
path: require.resolve("path-browserify"),
1415
stream: require.resolve("stream-browserify"),
15-
process: "process/browser",
16+
'process/browser': require.resolve("process/browser"),
1617
buffer: require.resolve("buffer"),
18+
fs: false,
19+
os: false,
20+
crypto: require.resolve("crypto-browserify"),
21+
constants: require.resolve("constants-browserify"),
22+
http: require.resolve("stream-http"),
23+
https: require.resolve("https-browserify"),
24+
zlib: false
25+
},
26+
alias: {
27+
process: 'process/browser',
1728
}
1829
},
1930
experiments: {
2031
syncWebAssembly: true
2132
},
2233
plugins: [
2334
new webpack.ProvidePlugin({
24-
process: 'process/browser',
25-
Buffer: ["buffer", "Buffer"],
26-
})
27-
]
35+
Buffer: ["buffer", "Buffer"],
36+
process: 'process/browser',
37+
})
38+
]
2839
};

0 commit comments

Comments
 (0)