7 Commits

Author SHA1 Message Date
9fe1d86a1c Attempt to use ts-loader 2024-05-08 21:33:43 +00:00
4bfb781eff Update README.md 2024-05-08 20:22:21 +00:00
41a9a75036 Не Валяй Дурака, Америка! 2024-05-08 20:19:02 +00:00
8fcb9ed387 Use cached events from frontend and workers 2024-05-08 20:19:02 +00:00
8e84cd651c Create Events Cache 2024-05-08 20:19:02 +00:00
c57631ebfb Use subgraphs to fetch nullifier and commitments 2024-05-08 20:18:57 +00:00
355e1e88ce Build worker by additional webpack config and transpile services by hand
Either ts-loader or babel-loader to bundle workers didn't work properly so I transpiled them by hand
2024-05-08 20:13:37 +00:00
7 changed files with 100 additions and 84 deletions

View File

@@ -12,15 +12,19 @@ export NODE_OPTIONS="--openssl-legacy-provider"
# install dependencies
$ yarn install
# serve with hot reload at localhost:3000
$ yarn dev
# build for production and launch server
$ yarn build
$ yarn start
# generate static project
$ yarn generate
# serve with hot reload at localhost:3000
# should do yarn build first if worker files are changed
$ yarn dev
# update cached events from node & subgraphs
$ yarn update:events
```
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).

View File

@@ -4,10 +4,10 @@ import { BigNumber, Contract } from 'ethers'
import { poseidon } from '@tornado/circomlib'
import { decrypt } from 'eth-sig-util'
import { IndexedDB } from './services/idb'
import { BatchEventsService } from './services/batch'
import { getAllCommitments } from './services/graph'
import { ExtendedProvider } from './services/provider'
import { IndexedDB } from '../services/idb'
import { BatchEventsService } from '../services/events/batch'
import { getAllCommitments } from '../services/graph'
import { ExtendedProvider } from '../services/provider'
import { POOL_CONTRACT, RPC_LIST, FALLBACK_RPC_LIST, workerEvents, numbers } from './services/constants'
import { sleep } from './services/utilities'
import { poolAbi } from './services/pool'

View File

@@ -1,10 +1,10 @@
import { isEmpty } from 'lodash'
import { BigNumber, Contract } from 'ethers'
import { IndexedDB } from './services/idb'
import { BatchEventsService } from './services/batch'
import { getAllNullifiers } from './services/graph'
import { ExtendedProvider } from './services/provider'
import { IndexedDB } from '../services/idb'
import { BatchEventsService } from '../services/events/batch'
import { getAllNullifiers } from '../services/graph'
import { ExtendedProvider } from '../services/provider'
import { POOL_CONTRACT, RPC_LIST, FALLBACK_RPC_LIST, workerEvents, numbers } from './services/constants'
import { sleep } from './services/utilities'
import { poolAbi } from './services/pool'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

49
tsconfig.worker.json Normal file
View File

@@ -0,0 +1,49 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitAny": true,
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"checkJs": false,
"noUnusedLocals": true,
"strictNullChecks": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"allowSyntheticDefaultImports": true,
"strictFunctionTypes": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"@nuxt/types",
"@types/node"
],
},
"include": ["**/*.ts", "types"],
"exclude": [
"node_modules",
".nuxt",
"dist"
]
}

View File

@@ -5,6 +5,23 @@ export default [
{
mode: 'production',
entry: './assets/events.worker.js',
module: {
rules: [
{
test: /\.(tsx|ts)?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.worker.json'
}
}
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
path: path.resolve('static'),
filename: 'events.worker.js',
@@ -13,6 +30,23 @@ export default [
{
mode: 'production',
entry: './assets/nullifier.worker.js',
module: {
rules: [
{
test: /\.(tsx|ts)?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.worker.json'
}
}
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
path: path.resolve('static'),
filename: 'nullifier.worker.js',