mirror of
https://github.com/anonklub/anonklub.git
synced 2026-01-09 18:07:55 -05:00
chore: replace prettier and eslint by biome (#422)
* chore: replace `prettier` and `eslint` by `biome` (#421) * chore: replace `prettier` and `eslint` by `biome` * chore: lint * changeset
This commit is contained in:
8
.changeset/nasty-ties-jump.md
Normal file
8
.changeset/nasty-ties-jump.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
"@anonklub/spartan-ecdsa-worker": patch
|
||||||
|
"@anonklub/merkle-tree-worker": patch
|
||||||
|
"@anonklub/proof": patch
|
||||||
|
"@anonklub/query": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
lint: use `type` imports
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
node_modules
|
|
||||||
pnpm-lock.yaml
|
|
||||||
|
|
||||||
# build dirs
|
|
||||||
dist
|
|
||||||
.next
|
|
||||||
.graphclient
|
|
||||||
wasm-pkg
|
|
||||||
|
|
||||||
# Jest
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# JetBrains IDE
|
|
||||||
.idea
|
|
||||||
|
|
||||||
# Generated code
|
|
||||||
generated
|
|
||||||
|
|
||||||
next-env.d.ts
|
|
||||||
next.config.js
|
|
||||||
|
|
||||||
public
|
|
||||||
|
|
||||||
.turbo
|
|
||||||
cache
|
|
||||||
queries
|
|
||||||
target
|
|
||||||
|
|
||||||
commitlint.config.js
|
|
||||||
.husky/*
|
|
||||||
.prettierignore
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
extends: ['@sripwoud/eslint-config-with-jest']
|
|
||||||
parserOptions:
|
|
||||||
project:
|
|
||||||
[
|
|
||||||
'circom/tsconfig.json',
|
|
||||||
'discord-bot/tsconfig.json',
|
|
||||||
'pkgs/merkle-tree-worker/tsconfig.json',
|
|
||||||
'pkgs/proof/tsconfig.json',
|
|
||||||
'pkgs/query/tsconfig.json',
|
|
||||||
'pkgs/spartan-ecdsa-worker/tsconfig.json',
|
|
||||||
'query-api/tsconfig.json',
|
|
||||||
'test/tsconfig.json',
|
|
||||||
'ui/tsconfig.json',
|
|
||||||
'tsconfig.json',
|
|
||||||
]
|
|
||||||
|
|
||||||
rules:
|
|
||||||
no-useless-constructor: off
|
|
||||||
|
|
||||||
overrides:
|
|
||||||
- files: ['*.ts', '*.tsx']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/await-thenable': error
|
|
||||||
- files: ['query-api/test/unit/DuneRepository.test.ts']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/no-dynamic-delete': off
|
|
||||||
- files: ['*.ts']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/dot-notation': off # because using noPropertyAccessFromIndexSignature tsc option
|
|
||||||
- files: ['test/jest-preset.js']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/no-var-requires': off
|
|
||||||
- files: ['pkgs/proof/test/ProofRequest.test.ts']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/dot-notation': off
|
|
||||||
- files:
|
|
||||||
[
|
|
||||||
'pkgs/cli/src/cli/index.ts',
|
|
||||||
'pkgs/proof/src/ProofRequest/index.ts',
|
|
||||||
'pkgs/proof/test/ProofRequest.test.ts',
|
|
||||||
]
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/restrict-template-expressions': off
|
|
||||||
- files:
|
|
||||||
[
|
|
||||||
'query-api/src/api/controllers/requests/getEthBalanceAnonSetQuery.ts',
|
|
||||||
'query-api/src/api/repositories/DuneRepository.ts',
|
|
||||||
]
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/no-inferrable-types': off
|
|
||||||
- files: ['*.tsx']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/no-misused-promises':
|
|
||||||
[error, { checksVoidReturn: { attributes: false } }]
|
|
||||||
- files:
|
|
||||||
[
|
|
||||||
'pkgs/cli/src/{,Cli/}index.ts',
|
|
||||||
'circom/scripts/*.ts',
|
|
||||||
'query-api/src/index.ts',
|
|
||||||
'ui/src/lib/config.ts',
|
|
||||||
'discord-bot/src/{index,events/{ClientReady,MessageCreate}}.ts',
|
|
||||||
]
|
|
||||||
rules:
|
|
||||||
no-console: off
|
|
||||||
- files: ['query-api/src/decorators/Logger.ts']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off'
|
|
||||||
- files:
|
|
||||||
[
|
|
||||||
'query-api/test/unit/QueryService.test.ts',
|
|
||||||
'query-api/src/decorators/Logger.ts',
|
|
||||||
]
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'off'
|
|
||||||
- files:
|
|
||||||
['circom/test/circuit.test.ts', 'query-api/test/unit/*Controller.test.ts']
|
|
||||||
rules:
|
|
||||||
jest/expect-expect: 'off'
|
|
||||||
- files: ['pkgs/cli/src/Prompt/index.ts']
|
|
||||||
rules:
|
|
||||||
'@typescript-eslint/naming-convention': off
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
CI=true NODE_ENV=production pnpm run githook:precommit
|
CI=true NODE_ENV=production pnpm lint-staged
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"*": "prettier -u -w",
|
"**/*.{json,jsonc,js,jsx,ts,tsx}": [
|
||||||
|
"pnpm biome lint --apply",
|
||||||
|
"pnpm biome format --write"
|
||||||
|
],
|
||||||
"**/*.rs": "rustfmt",
|
"**/*.rs": "rustfmt",
|
||||||
"**/*.{ts,tsx}": "tsc-files --noEmit",
|
"**/*.{ts,tsx}": "tsc-files --noEmit"
|
||||||
"**/*.{js,jsx,ts,tsx}": "eslint"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
node_modules
|
|
||||||
pnpm-lock.yaml
|
|
||||||
|
|
||||||
# build dirs
|
|
||||||
dist
|
|
||||||
.next
|
|
||||||
|
|
||||||
# Jest
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# JetBrains IDE
|
|
||||||
.idea
|
|
||||||
|
|
||||||
*.graphql
|
|
||||||
.graphclient
|
|
||||||
|
|
||||||
public
|
|
||||||
|
|
||||||
.turbo
|
|
||||||
|
|
||||||
cache
|
|
||||||
contracts/lib/forge-std
|
|
||||||
contracts/lib/openzeppelin-contracts
|
|
||||||
contracts/out
|
|
||||||
|
|
||||||
# after editing by the release/changeset workflow, these won't match the formatting rules
|
|
||||||
package.json
|
|
||||||
|
|
||||||
target
|
|
||||||
commitlint.config.js
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
'@sripwoud/prettier-config'
|
|
||||||
178
biome.jsonc
Normal file
178
biome.jsonc
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
|
||||||
|
"linter": {
|
||||||
|
"ignore": []
|
||||||
|
},
|
||||||
|
"formatter": {
|
||||||
|
"indentStyle": "space",
|
||||||
|
"indentWidth": 2,
|
||||||
|
"ignore": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/dist/**",
|
||||||
|
"**/out/**",
|
||||||
|
"**/.next/**",
|
||||||
|
"**/target/**",
|
||||||
|
"**/.turbo/**",
|
||||||
|
"**/coverage/**",
|
||||||
|
"**/*.graphql",
|
||||||
|
"**/.graphclient/**",
|
||||||
|
"**/cache/**",
|
||||||
|
"contracts/lib/forge-std/**",
|
||||||
|
"contracts/lib/openzeppelin-contracts/**",
|
||||||
|
"**/package.json"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"organizeImports": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"javascript": {
|
||||||
|
"formatter": {
|
||||||
|
"jsxQuoteStyle": "single",
|
||||||
|
"quoteStyle": "single",
|
||||||
|
"semicolons": "asNeeded"
|
||||||
|
},
|
||||||
|
"parser": {
|
||||||
|
"unsafeParameterDecoratorsEnabled": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"rules": {
|
||||||
|
"recommended": true
|
||||||
|
},
|
||||||
|
"ignore": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/dist/**",
|
||||||
|
"**/out/**",
|
||||||
|
"**/.next/**",
|
||||||
|
"**/target/**",
|
||||||
|
"**/generated/**",
|
||||||
|
"**/coverage/**",
|
||||||
|
"**/*.graphql",
|
||||||
|
"**/.graphclient/**",
|
||||||
|
"**/cache/**",
|
||||||
|
"contracts/lib/forge-std/**",
|
||||||
|
"contracts/lib/openzeppelin-contracts/**",
|
||||||
|
"**/package.json",
|
||||||
|
"ui/next.config.js",
|
||||||
|
"ui/next-env.d.ts",
|
||||||
|
"ui/public/**",
|
||||||
|
".turbo/**",
|
||||||
|
"queries/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"discord-bot/src/lib/decorators/tryCatch.ts",
|
||||||
|
"query-api/src/decorators/handle-dune-credits-error.ts",
|
||||||
|
"query-api/src/decorators/tryCatchReply.ts"
|
||||||
|
],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"complexity": { "useArrowFunction": "off" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": ["ui/src/**/*.tsx"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"a11y": {
|
||||||
|
"useButtonType": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// TODO: why a string literal was used to get the env var here?
|
||||||
|
"include": ["query-api/src/repositories/dune-client/index.ts"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"complexity": {
|
||||||
|
"useLiteralKeys": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"discord-bot/src/lib/decorators/*.ts",
|
||||||
|
"discord-bot/src/events/*.ts",
|
||||||
|
"pkgs/proof/src/poseidon.ts",
|
||||||
|
"pkgs/proof/src/ExcludableMerkleTree.ts",
|
||||||
|
"query-api/src/repositories/dune-client/types.ts",
|
||||||
|
"query-api/src/repositories/GraphRepository.ts",
|
||||||
|
"query-api/src/decorators/handle-dune-credits-error.ts",
|
||||||
|
"ui/src/components/ExternalLink.tsx",
|
||||||
|
"**/test/**"
|
||||||
|
],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"suspicious": {
|
||||||
|
"noExplicitAny": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": ["**/test/**"],
|
||||||
|
"linter": { "rules": { "suspicious": { "noImplicitAnyLet": "off" } } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": ["ui/src/components/*.tsx"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"a11y": {
|
||||||
|
"useValidAnchor": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": ["ui/src/app/**/error.tsx", "discord-bot/src/events/*.ts"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"suspicious": {
|
||||||
|
"noShadowRestrictedNames": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
"include": ["ui/src/**/*.tsx", "ui/src/**/*.ts"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"correctness": {
|
||||||
|
"useExhaustiveDependencies": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": ["pkgs/proof/src/MerkleTree.ts", "pkgs/proof/src/helpers.ts"],
|
||||||
|
"linter": { "rules": { "style": { "noParameterAssign": "off" } } }
|
||||||
|
},
|
||||||
|
// FIXME
|
||||||
|
{
|
||||||
|
"include": ["ui/src/**"],
|
||||||
|
"linter": { "rules": { "complexity": { "noUselessCatch": "warn" } } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"discord-bot/src/Client/index.ts",
|
||||||
|
"query-api/src/*.ts",
|
||||||
|
"discord-bot/src/*.ts"
|
||||||
|
],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
//FIXME
|
||||||
|
"complexity": { "noForEach": "warn" },
|
||||||
|
// using import type breaks typeDI Service/Container
|
||||||
|
"style": { "useImportType": "off" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
import inquirer, { DistinctQuestion, QuestionCollection } from 'inquirer'
|
import inquirer, {
|
||||||
|
type DistinctQuestion,
|
||||||
|
type QuestionCollection,
|
||||||
|
} from 'inquirer'
|
||||||
import inquirerFuzzyPath from 'inquirer-fuzzy-path'
|
import inquirerFuzzyPath from 'inquirer-fuzzy-path'
|
||||||
import { join } from 'path'
|
import { join } from 'node:path'
|
||||||
|
|
||||||
inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath)
|
inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath)
|
||||||
|
|
||||||
export const prompt =
|
export const prompt =
|
||||||
<T>(questions: QuestionCollection | DistinctQuestion) =>
|
<T>(questions: QuestionCollection | DistinctQuestion) =>
|
||||||
async (): Promise<T> => {
|
async (): Promise<T> => {
|
||||||
if (questions instanceof Array)
|
if (Array.isArray(questions))
|
||||||
return (await inquirer.prompt(questions as QuestionCollection)) as T
|
return (await inquirer.prompt(questions as QuestionCollection)) as T
|
||||||
|
|
||||||
const { name } = questions as DistinctQuestion
|
const { name } = questions as DistinctQuestion
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { execSync } from 'child_process'
|
import { execSync } from 'node:child_process'
|
||||||
import { groth16 } from 'snarkjs'
|
import { groth16 } from 'snarkjs'
|
||||||
import { askProofFile, askPublicSignalsFile } from './_prompt'
|
import { askProofFile, askPublicSignalsFile } from './_prompt'
|
||||||
import { wrapExec } from './_wrap'
|
import { wrapExec } from './_wrap'
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import { Point, sign } from '@noble/secp256k1'
|
|||||||
import { wasm as wasm_tester } from 'circom_tester'
|
import { wasm as wasm_tester } from 'circom_tester'
|
||||||
import { buildPoseidon } from 'circomlibjs'
|
import { buildPoseidon } from 'circomlibjs'
|
||||||
import { BigNumber, utils } from 'ethers'
|
import { BigNumber, utils } from 'ethers'
|
||||||
import { join } from 'path'
|
import { join } from 'node:path'
|
||||||
|
|
||||||
jest.setTimeout(10_000_000) // ~1 hour
|
jest.setTimeout(10_000_000) // ~1 hour
|
||||||
|
|
||||||
describe('Poseidon Merkle Tree', function () {
|
describe('Poseidon Merkle Tree', () => {
|
||||||
let poseidon
|
let poseidon
|
||||||
let F
|
let F
|
||||||
let circuit
|
let circuit
|
||||||
@@ -158,7 +158,7 @@ describe('Poseidon Merkle Tree', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('SetMembership', function () {
|
describe('SetMembership', () => {
|
||||||
let poseidon
|
let poseidon
|
||||||
let F
|
let F
|
||||||
let membershipCircuit
|
let membershipCircuit
|
||||||
@@ -177,7 +177,7 @@ describe('SetMembership', function () {
|
|||||||
).toBigInt(),
|
).toBigInt(),
|
||||||
)
|
)
|
||||||
|
|
||||||
beforeAll(async function () {
|
beforeAll(async () => {
|
||||||
membershipCircuit = await wasm_tester(
|
membershipCircuit = await wasm_tester(
|
||||||
join(__dirname, 'membership_test.circom'),
|
join(__dirname, 'membership_test.circom'),
|
||||||
)
|
)
|
||||||
@@ -248,7 +248,7 @@ describe('SetMembership', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('ECDSACheckPubKey', function () {
|
describe('ECDSACheckPubKey', () => {
|
||||||
const testCases: Array<[bigint, bigint]> = []
|
const testCases: Array<[bigint, bigint]> = []
|
||||||
const privkeys: bigint[] = [
|
const privkeys: bigint[] = [
|
||||||
88549154299169935420064281163296845505587953610183896504176354567359434168161n,
|
88549154299169935420064281163296845505587953610183896504176354567359434168161n,
|
||||||
@@ -263,19 +263,19 @@ describe('ECDSACheckPubKey', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let circuit: any
|
let circuit: any
|
||||||
beforeAll(async function () {
|
beforeAll(async () => {
|
||||||
circuit = await wasm_tester(
|
circuit = await wasm_tester(
|
||||||
join(__dirname, 'test_ecdsa_check_pub_key.circom'),
|
join(__dirname, 'test_ecdsa_check_pub_key.circom'),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const testECDSAVerify = function (testCase: [bigint, bigint]) {
|
const testECDSAVerify = (testCase: [bigint, bigint]) => {
|
||||||
const pub0 = testCase[0]
|
const pub0 = testCase[0]
|
||||||
const pub1 = testCase[1]
|
const pub1 = testCase[1]
|
||||||
|
|
||||||
const pub0Array: bigint[] = bigintToArray(64, 4, pub0)
|
const pub0Array: bigint[] = bigintToArray(64, 4, pub0)
|
||||||
const pub1Array: bigint[] = bigintToArray(64, 4, pub1)
|
const pub1Array: bigint[] = bigintToArray(64, 4, pub1)
|
||||||
it(`Testing valid pub key: pub0: ${pub0} pub1: ${pub1}`, async function () {
|
it(`Testing valid pub key: pub0: ${pub0} pub1: ${pub1}`, async () => {
|
||||||
const witness = await circuit.calculateWitness({
|
const witness = await circuit.calculateWitness({
|
||||||
pubkey: [pub0Array, pub1Array],
|
pubkey: [pub0Array, pub1Array],
|
||||||
})
|
})
|
||||||
@@ -286,9 +286,9 @@ describe('ECDSACheckPubKey', function () {
|
|||||||
testCases.forEach(testECDSAVerify)
|
testCases.forEach(testECDSAVerify)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Ordering', function () {
|
describe('Ordering', () => {
|
||||||
let orderingCircuit
|
let orderingCircuit
|
||||||
beforeAll(async function () {
|
beforeAll(async () => {
|
||||||
orderingCircuit = await wasm_tester(
|
orderingCircuit = await wasm_tester(
|
||||||
join(__dirname, 'is_ordered_test.circom'),
|
join(__dirname, 'is_ordered_test.circom'),
|
||||||
)
|
)
|
||||||
|
|||||||
22
package.json
22
package.json
@@ -6,14 +6,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@anonklub/test": "workspace:^",
|
"@anonklub/test": "workspace:^",
|
||||||
|
"@biomejs/biome": "1.6.3",
|
||||||
"@changesets/cli": "^2.26.2",
|
"@changesets/cli": "^2.26.2",
|
||||||
"@faker-js/faker": "^7.6.0",
|
"@faker-js/faker": "^7.6.0",
|
||||||
"@sripwoud/eslint-config-with-jest": "^1.0.2",
|
|
||||||
"@sripwoud/prettier-config": "^1.0.3",
|
|
||||||
"@types/jest": "^29.5.3",
|
"@types/jest": "^29.5.3",
|
||||||
"@types/node": "^18.11.15",
|
"@types/node": "^18.11.15",
|
||||||
"barrelsby": "^2.5.1",
|
"barrelsby": "^2.5.1",
|
||||||
"eslint-config-next": "^13.4.2",
|
|
||||||
"find-up-cli": "^5.0.0",
|
"find-up-cli": "^5.0.0",
|
||||||
"husky": "^9.0.10",
|
"husky": "^9.0.10",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
@@ -51,16 +49,16 @@
|
|||||||
"clean": "find . \\( -name 'node_modules' -o -name 'dist' -o -name 'next' \\) -type d -prune -exec rm -rf '{}' +",
|
"clean": "find . \\( -name 'node_modules' -o -name 'dist' -o -name 'next' \\) -type d -prune -exec rm -rf '{}' +",
|
||||||
"compile": "turbo _compile",
|
"compile": "turbo _compile",
|
||||||
"fix": "turbo _format.fix _lint.fix",
|
"fix": "turbo _format.fix _lint.fix",
|
||||||
"format": "turbo format.cargo format.forge format.prettier",
|
"format": "turbo format.cargo format.forge format.biome",
|
||||||
"format.fix": "turbo format.cargo.fix format.forge.fix format.prettier.fix",
|
"format.fix": "turbo format.cargo.fix format.forge.fix format.biome.fix",
|
||||||
"format.prettier": "prettier -c .",
|
"format.biome": "biome format .",
|
||||||
"format.prettier.fix": "prettier -w .",
|
"format.biome.fix": "biome format --write .",
|
||||||
"githook:precommit": "lint-staged",
|
"githook:precommit": "lint-staged",
|
||||||
"knip": "knip -c .knip.ts --production --strict",
|
"knip": "knip -c .knip.ts --production --strict",
|
||||||
"lint": "turbo lint.cargo lint.eslint lint.solhint",
|
"lint": "turbo lint.cargo lint.biome lint.solhint",
|
||||||
"lint.eslint": "NODE_OPTIONS='--max-old-space-size=4096' eslint . --ext .js,.jsx,.ts,.tsx",
|
"lint.biome": "biome lint --max-diagnostics 200 .",
|
||||||
"lint.eslint.fix": "eslint . --ext .js,.ts,.tsx --fix",
|
"lint.biome.fix": "biome lint --apply --max-diagnostics 200 .",
|
||||||
"lint.fix": "turbo lint.cargo.fix lint.eslint.fix lint.solhint.fix",
|
"lint.fix": "turbo lint.cargo.fix lint.biome.fix lint.solhint.fix",
|
||||||
"prepare": "is-ci || husky install",
|
"prepare": "is-ci || husky install",
|
||||||
"publish.pkgs": "pnpm build.pkgs && changeset version && changeset publish",
|
"publish.pkgs": "pnpm build.pkgs && changeset version && changeset publish",
|
||||||
"start.query-api": "pnpm --filter query-api start.dev",
|
"start.query-api": "pnpm --filter query-api start.dev",
|
||||||
@@ -71,7 +69,7 @@
|
|||||||
"test.coverage.html": "cargo llvm-cov --all-features --workspace --html --output-dir=target/llvm-cov/html",
|
"test.coverage.html": "cargo llvm-cov --all-features --workspace --html --output-dir=target/llvm-cov/html",
|
||||||
"test.coverage.summary": "cargo llvm-cov --all-features --workspace --summary-only",
|
"test.coverage.summary": "cargo llvm-cov --all-features --workspace --summary-only",
|
||||||
"typecheck": "turbo typecheck",
|
"typecheck": "turbo typecheck",
|
||||||
"validate": "turbo format.cargo format.forge format.prettier lint.cargo lint.eslint lint.solhint build _compile --cache-dir=.turbo"
|
"validate": "turbo format.cargo format.forge format.biome lint.cargo lint.biome lint.solhint build _compile --cache-dir=.turbo"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"contracts",
|
"contracts",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Remote, wrap } from 'comlink'
|
import { type Remote, wrap } from 'comlink'
|
||||||
import { IMerkleTreeWorker } from './interface'
|
import type { IMerkleTreeWorker } from './interface'
|
||||||
|
|
||||||
let MerkleTreeWorker: Remote<IMerkleTreeWorker>
|
let MerkleTreeWorker: Remote<IMerkleTreeWorker>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { expose } from 'comlink'
|
import { expose } from 'comlink'
|
||||||
import { IMerkleTreeWasm, IMerkleTreeWorker } from './interface'
|
import type { IMerkleTreeWasm, IMerkleTreeWorker } from './interface'
|
||||||
|
|
||||||
let merkleTreeWasm: IMerkleTreeWasm
|
let merkleTreeWasm: IMerkleTreeWasm
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class MerkleTree {
|
|||||||
levels: bigint[][]
|
levels: bigint[][]
|
||||||
|
|
||||||
constructor(elements: bigint[], depth: number, hashFunction, field) {
|
constructor(elements: bigint[], depth: number, hashFunction, field) {
|
||||||
if (elements.length > Math.pow(2, depth)) {
|
if (elements.length > 2 ** depth) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Merkle tree depth ${depth} is too small for ${elements.length} items`,
|
`Merkle tree depth ${depth} is too small for ${elements.length} items`,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { URLS } from '../CONSTANTS'
|
import { URLS } from '../CONSTANTS'
|
||||||
import { fetchJson } from '../fetch-json'
|
import { fetchJson } from '../fetch-json'
|
||||||
import {
|
import type {
|
||||||
EnsProposalVotersRequest,
|
EnsProposalVotersRequest,
|
||||||
Erc20BalanceAnonSetRequest,
|
Erc20BalanceAnonSetRequest,
|
||||||
EthBalanceAnonSetRequest,
|
EthBalanceAnonSetRequest,
|
||||||
} from '../requests'
|
} from '../requests'
|
||||||
import { Endpoint, Environment, Request, RequestClass } from '../types'
|
import {
|
||||||
import { AnonymitySetI } from './interface'
|
Endpoint,
|
||||||
|
Environment,
|
||||||
|
type Request,
|
||||||
|
type RequestClass,
|
||||||
|
} from '../types'
|
||||||
|
import type { AnonymitySetI } from './interface'
|
||||||
|
|
||||||
export class AnonymitySet implements AnonymitySetI {
|
export class AnonymitySet implements AnonymitySetI {
|
||||||
constructor(public env = Environment.PRODUCTION) {}
|
constructor(public env = Environment.PRODUCTION) {}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {
|
import type {
|
||||||
EnsProposalVotersRequest,
|
EnsProposalVotersRequest,
|
||||||
Erc20BalanceAnonSetRequest,
|
Erc20BalanceAnonSetRequest,
|
||||||
EthBalanceAnonSetRequest,
|
EthBalanceAnonSetRequest,
|
||||||
} from '../requests'
|
} from '../requests'
|
||||||
import { AnonSetResponse } from '../types'
|
import type { AnonSetResponse } from '../types'
|
||||||
|
|
||||||
export interface AnonymitySetI {
|
export interface AnonymitySetI {
|
||||||
fromEthBalance: ({
|
fromEthBalance: ({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AnonSetResponse } from './types'
|
import type { AnonSetResponse } from './types'
|
||||||
|
|
||||||
export const fetchJson = async (
|
export const fetchJson = async (
|
||||||
url: string,
|
url: string,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {
|
import type {
|
||||||
EnsProposalVotersRequest,
|
EnsProposalVotersRequest,
|
||||||
Erc20BalanceAnonSetRequest,
|
Erc20BalanceAnonSetRequest,
|
||||||
EthBalanceAnonSetRequest,
|
EthBalanceAnonSetRequest,
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ describe('AnonymitySet', () => {
|
|||||||
const { data } = await anonymitySet.fromEthBalance({ min })
|
const { data } = await anonymitySet.fromEthBalance({ min })
|
||||||
|
|
||||||
expect(data).toBeDefined()
|
expect(data).toBeDefined()
|
||||||
data?.forEach((address) => {
|
for (const address of data ?? []) {
|
||||||
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
||||||
})
|
}
|
||||||
expect(fetchMock).toHaveBeenCalledWith(
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
`${URLS[env]}/${Endpoint.EthBalance}?min=${min}`,
|
`${URLS[env]}/${Endpoint.EthBalance}?min=${min}`,
|
||||||
)
|
)
|
||||||
@@ -39,9 +39,9 @@ describe('AnonymitySet', () => {
|
|||||||
const { data } = await anonymitySet.fromErc20Balance({ min, tokenAddress })
|
const { data } = await anonymitySet.fromErc20Balance({ min, tokenAddress })
|
||||||
|
|
||||||
expect(data).toBeDefined()
|
expect(data).toBeDefined()
|
||||||
data?.forEach((address) => {
|
for (const address of data ?? []) {
|
||||||
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
||||||
})
|
}
|
||||||
expect(fetchMock).toHaveBeenCalledWith(
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
`${URLS[env]}/${Endpoint.Erc20Balance}?min=${min}&tokenAddress=${tokenAddress}`,
|
`${URLS[env]}/${Endpoint.Erc20Balance}?min=${min}&tokenAddress=${tokenAddress}`,
|
||||||
)
|
)
|
||||||
@@ -51,9 +51,9 @@ describe('AnonymitySet', () => {
|
|||||||
const { data } = await anonymitySet.fromCryptoPunkOwners()
|
const { data } = await anonymitySet.fromCryptoPunkOwners()
|
||||||
|
|
||||||
expect(data).toBeDefined()
|
expect(data).toBeDefined()
|
||||||
data?.forEach((address) => {
|
for (const address of data ?? []) {
|
||||||
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
||||||
})
|
}
|
||||||
expect(fetchMock).toHaveBeenCalledWith(
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
`${URLS[env]}/${Endpoint.CryptoPunks}`,
|
`${URLS[env]}/${Endpoint.CryptoPunks}`,
|
||||||
)
|
)
|
||||||
@@ -63,9 +63,9 @@ describe('AnonymitySet', () => {
|
|||||||
const { data } = await anonymitySet.fromBeaconDepositors()
|
const { data } = await anonymitySet.fromBeaconDepositors()
|
||||||
|
|
||||||
expect(data).toBeDefined()
|
expect(data).toBeDefined()
|
||||||
data?.forEach((address) => {
|
for (const address of data ?? []) {
|
||||||
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
||||||
})
|
}
|
||||||
expect(fetchMock).toHaveBeenCalledWith(
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
`${URLS[env]}/${Endpoint.BeaconDepositors}`,
|
`${URLS[env]}/${Endpoint.BeaconDepositors}`,
|
||||||
)
|
)
|
||||||
@@ -85,9 +85,9 @@ describe('AnonymitySet', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
expect(data).toBeDefined()
|
expect(data).toBeDefined()
|
||||||
data?.forEach((address) => {
|
for (const address of data ?? []) {
|
||||||
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
expect(address).toMatch(/^0x[0-9a-fA-F]{40}$/)
|
||||||
})
|
}
|
||||||
expect(fetchMock).toHaveBeenCalledWith(
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
`${URLS[env]}/${Endpoint.EnsProposalVoters}?choice=${
|
`${URLS[env]}/${Endpoint.EnsProposalVoters}?choice=${
|
||||||
choice as string
|
choice as string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Remote, wrap } from 'comlink'
|
import { type Remote, wrap } from 'comlink'
|
||||||
import { ISpartanEcdsaWorker } from './interface'
|
import type { ISpartanEcdsaWorker } from './interface'
|
||||||
|
|
||||||
let SpartanEcdsaWorker: Remote<ISpartanEcdsaWorker>
|
let SpartanEcdsaWorker: Remote<ISpartanEcdsaWorker>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type {
|
|||||||
prove_membership,
|
prove_membership,
|
||||||
verify_membership,
|
verify_membership,
|
||||||
} from '@anonklub/spartan-ecdsa-wasm'
|
} from '@anonklub/spartan-ecdsa-wasm'
|
||||||
import { Hex } from 'viem'
|
import type { Hex } from 'viem'
|
||||||
|
|
||||||
export interface MerkleProof {
|
export interface MerkleProof {
|
||||||
root: bigint
|
root: bigint
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { expose } from 'comlink'
|
import { expose } from 'comlink'
|
||||||
import { hashMessage, hexToBytes, hexToSignature } from 'viem'
|
import { hashMessage, hexToBytes, hexToSignature } from 'viem'
|
||||||
import { ISpartanEcdsaWasm, ISpartanEcdsaWorker } from './interface'
|
import type { ISpartanEcdsaWasm, ISpartanEcdsaWorker } from './interface'
|
||||||
import { calculateSigRecovery } from './utils'
|
import { calculateSigRecovery } from './utils'
|
||||||
|
|
||||||
let spartanEcdsaWasm: ISpartanEcdsaWasm
|
let spartanEcdsaWasm: ISpartanEcdsaWasm
|
||||||
|
|||||||
1399
pnpm-lock.yaml
generated
1399
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -47,19 +47,19 @@ export class AnonsetService {
|
|||||||
|
|
||||||
@HandleDuneCreditsError()
|
@HandleDuneCreditsError()
|
||||||
async getBeaconDepositors() {
|
async getBeaconDepositors() {
|
||||||
this.logger.log(`getBeaconDepositors`)
|
this.logger.log('getBeaconDepositors')
|
||||||
return this.duneRepository.getBeaconDepositors().then(({ result }) => {
|
return this.duneRepository.getBeaconDepositors().then(({ result }) => {
|
||||||
return result.rows.map((row) => row.address) ?? []
|
return result.rows.map((row) => row.address) ?? []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEnsProposalVoters(dto: GetEnsProposalVotersDto) {
|
async getEnsProposalVoters(dto: GetEnsProposalVotersDto) {
|
||||||
this.logger.log(`getEnsProposalVoters: ${dto.choice} ${dto.id}`)
|
this.logger.log('getEnsProposalVoters: ${dto.choice} ${dto.id}')
|
||||||
return this.graphRepository.getEnsProposalVoters(dto)
|
return this.graphRepository.getEnsProposalVoters(dto)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCryptopunkOwners() {
|
async getCryptopunkOwners() {
|
||||||
this.logger.log(`getCryptopunkOwners`)
|
this.logger.log('getCryptopunkOwners')
|
||||||
return this.graphRepository.getCryptopunkOwners()
|
return this.graphRepository.getCryptopunkOwners()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger'
|
import { ApiProperty } from '@nestjs/swagger'
|
||||||
import { IsDefined, IsIn, IsNumberString, Length } from 'class-validator'
|
import { IsDefined, IsIn, IsNumberString, Length } from 'class-validator'
|
||||||
import { VoteChoice } from '../repositories'
|
import type { VoteChoice } from '../repositories'
|
||||||
|
|
||||||
export class GetEnsProposalVotersDto {
|
export class GetEnsProposalVotersDto {
|
||||||
@IsDefined()
|
@IsDefined()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common'
|
import { type ArgumentsHost, Catch, type ExceptionFilter } from '@nestjs/common'
|
||||||
import { Response } from 'express'
|
import type { Response } from 'express'
|
||||||
import { OutOfDuneCreditsException } from './out-of-dune-credits.exception'
|
import { OutOfDuneCreditsException } from './out-of-dune-credits.exception'
|
||||||
|
|
||||||
@Catch(OutOfDuneCreditsException)
|
@Catch(OutOfDuneCreditsException)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ValidationPipe } from '@nestjs/common'
|
import { ValidationPipe } from '@nestjs/common'
|
||||||
import { NestFactory } from '@nestjs/core'
|
import { NestFactory } from '@nestjs/core'
|
||||||
import { NestExpressApplication } from '@nestjs/platform-express'
|
import type { NestExpressApplication } from '@nestjs/platform-express'
|
||||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
||||||
import { join } from 'path'
|
import { join } from 'node:path'
|
||||||
import { AnonsetModule } from './anonset.module'
|
import { AnonsetModule } from './anonset.module'
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import {
|
import {
|
||||||
execute,
|
execute,
|
||||||
Punk,
|
type Punk,
|
||||||
PunkOwnersDocument,
|
PunkOwnersDocument,
|
||||||
Scalars,
|
type Scalars,
|
||||||
Vote,
|
type Vote,
|
||||||
VoteChoice,
|
type VoteChoice,
|
||||||
VotersPerProposalDocument,
|
VotersPerProposalDocument,
|
||||||
} from './graph-client'
|
} from './graph-client'
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import ms from 'ms'
|
import ms from 'ms'
|
||||||
import {
|
import {
|
||||||
ApiError,
|
type ApiError,
|
||||||
DuneClientI,
|
type DuneClientI,
|
||||||
ExecuteOk,
|
type ExecuteOk,
|
||||||
GetQueryResultsOk,
|
type GetQueryResultsOk,
|
||||||
GetQueryStatusOk,
|
type GetQueryStatusOk,
|
||||||
Query as DuneQuery,
|
Query as DuneQuery,
|
||||||
QueryState,
|
QueryState,
|
||||||
} from './types'
|
} from './types'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const tsJestPreset = require('ts-jest/jest-preset')
|
const tsJestPreset = require('ts-jest/jest-preset')
|
||||||
const { join } = require('path')
|
const { join } = require('node:path')
|
||||||
|
|
||||||
const projects = [
|
const projects = [
|
||||||
...['proof', 'query'].map((name) => `pkgs/${name}`),
|
...['proof', 'query'].map((name) => `pkgs/${name}`),
|
||||||
|
|||||||
20
turbo.json
20
turbo.json
@@ -8,11 +8,12 @@
|
|||||||
"!{pkgs/query,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
"!{pkgs/query,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"//#format.prettier": {
|
"//#format.biome": {
|
||||||
|
"cache": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"*.{cjs,js,jsx,ts,tsx,yaml,yml,json,md,mdx,css,html,graphql}",
|
"*.{cjs,js,jsx,ts,tsx,json,jsonc}",
|
||||||
"{.github,pkgs,circom,discord-bot,query-api,test,ui}/**/*.{cjs,js,jsx,ts,tsx,yaml,yml,json,md,mdx,css,html,graphql}",
|
"{.github,pkgs,circom,discord-bot,query-api,ui}/**/*.{cjs,js,jsx,ts,tsx,json,jsonc}",
|
||||||
"!{pkgs,circom,discord-bot,query-api,test,ui}/**/{build,dist,node_modules,.next}/**"
|
"!{pkgs,circom,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"format.cargo": {
|
"format.cargo": {
|
||||||
@@ -31,10 +32,11 @@
|
|||||||
"cache": false,
|
"cache": false,
|
||||||
"inputs": ["contracts/{script,src,test}/**/*.sol"]
|
"inputs": ["contracts/{script,src,test}/**/*.sol"]
|
||||||
},
|
},
|
||||||
"//#format.prettier.fix": {
|
"//#format.biome.fix": {
|
||||||
|
"cache": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"*.{cjs,js,jsx,ts,tsx,yaml,yml,json,md,mdx,css,html,graphql}",
|
"*.{cjs,js,jsx,ts,tsx,json,jsonc}",
|
||||||
"{.github,pkgs,circom,discord-bot,query-api,ui}/**/*.{cjs,js,jsx,ts,tsx,yaml,yml,json,md,mdx,css,html,graphql}",
|
"{.github,pkgs,circom,discord-bot,query-api,ui}/**/*.{cjs,js,jsx,ts,tsx,json,jsonc}",
|
||||||
"!{pkgs,circom,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
"!{pkgs,circom,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -61,14 +63,14 @@
|
|||||||
"cache": false,
|
"cache": false,
|
||||||
"inputs": ["pkgs/{merkle-tree,spartan-ecdsa}-wasm/src/**/*.rs"]
|
"inputs": ["pkgs/{merkle-tree,spartan-ecdsa}-wasm/src/**/*.rs"]
|
||||||
},
|
},
|
||||||
"//#lint.eslint": {
|
"//#lint.biome": {
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"*.{cjs,js,jsx,ts,tsx}",
|
"*.{cjs,js,jsx,ts,tsx}",
|
||||||
"{pkgs,circom,discord-bot,query-api,test,ui}/**/*.{cjs,js,jsx,ts,tsx}",
|
"{pkgs,circom,discord-bot,query-api,test,ui}/**/*.{cjs,js,jsx,ts,tsx}",
|
||||||
"!{pkgs,circom,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
"!{pkgs,circom,discord-bot,query-api,ui}/**/{build,dist,node_modules,.next}/**"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"//#lint.eslint.fix": {
|
"//#lint.biome.fix": {
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"*.{cjs,js,jsx,ts,tsx}",
|
"*.{cjs,js,jsx,ts,tsx}",
|
||||||
"{pkgs,circom,discord-bot,query-api,test,ui}/**/*.{cjs,js,jsx,ts,tsx}",
|
"{pkgs,circom,discord-bot,query-api,test,ui}/**/*.{cjs,js,jsx,ts,tsx}",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const nextConfig = {
|
|||||||
ignoreDuringBuilds: true,
|
ignoreDuringBuilds: true,
|
||||||
},
|
},
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
webpack: function (config, options) {
|
webpack: (config, options) => {
|
||||||
if (!options.isServer) {
|
if (!options.isServer) {
|
||||||
config.resolve.fallback.fs = false
|
config.resolve.fallback.fs = false
|
||||||
config.resolve.fallback.readline = false
|
config.resolve.fallback.readline = false
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import '../globals.css'
|
|||||||
import 'tailwindcss/tailwind.css'
|
import 'tailwindcss/tailwind.css'
|
||||||
import { Bubble } from '@typebot.io/nextjs'
|
import { Bubble } from '@typebot.io/nextjs'
|
||||||
import { StoreProvider } from 'easy-peasy'
|
import { StoreProvider } from 'easy-peasy'
|
||||||
import { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
import { WagmiConfig } from 'wagmi'
|
import { WagmiConfig } from 'wagmi'
|
||||||
import { config, wagmiConfig } from '#'
|
import { config, wagmiConfig } from '#'
|
||||||
import { store } from '@/store'
|
import { store } from '@/store'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function Page() {
|
|||||||
<div className='flex flex-col items-end space-y-4'>
|
<div className='flex flex-col items-end space-y-4'>
|
||||||
{anonSet !== null && (
|
{anonSet !== null && (
|
||||||
<Link href='/prove/submit'>
|
<Link href='/prove/submit'>
|
||||||
<button className='btn btn-secondary'>
|
<button type='button' className='btn btn-secondary'>
|
||||||
{NAVIGATION.PREPARE_PROOF_REQUEST}
|
{NAVIGATION.PREPARE_PROOF_REQUEST}
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -42,10 +42,18 @@ export default function Page() {
|
|||||||
<div className='text-grey'>{ellipsify(fullProof.toString(), 100)}</div>
|
<div className='text-grey'>{ellipsify(fullProof.toString(), 100)}</div>
|
||||||
{copySuccess}
|
{copySuccess}
|
||||||
<div className='buttons-row'>
|
<div className='buttons-row'>
|
||||||
<button onClick={copyToClipboard} className='btn btn-primary'>
|
<button
|
||||||
|
type='button'
|
||||||
|
onClick={copyToClipboard}
|
||||||
|
className='btn btn-primary'
|
||||||
|
>
|
||||||
Copy to Clipboard
|
Copy to Clipboard
|
||||||
</button>
|
</button>
|
||||||
<button onClick={downloadTextFile} className='btn btn-primary'>
|
<button
|
||||||
|
type='button'
|
||||||
|
onClick={downloadTextFile}
|
||||||
|
className='btn btn-primary'
|
||||||
|
>
|
||||||
Download as Text File
|
Download as Text File
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function Page() {
|
|||||||
className='input text-center'
|
className='input text-center'
|
||||||
value={min}
|
value={min}
|
||||||
onChange={({ target }) => {
|
onChange={({ target }) => {
|
||||||
setMin(parseInt(target.value))
|
setMin(Number.parseInt(target.value))
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -38,12 +38,13 @@ export default function Page() {
|
|||||||
className='input text-center'
|
className='input text-center'
|
||||||
value={min}
|
value={min}
|
||||||
onChange={({ target }) => {
|
onChange={({ target }) => {
|
||||||
setMin(parseInt(target.value))
|
setMin(Number.parseInt(target.value))
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
type='button'
|
||||||
className={`btn self-center ${
|
className={`btn self-center ${
|
||||||
canFetch ? 'btn-primary' : 'is-disabled'
|
canFetch ? 'btn-primary' : 'is-disabled'
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { NAVIGATION } from '#'
|
import { NAVIGATION } from '#'
|
||||||
import { JSONValue, ScrollableJsonContainer } from '@components'
|
import { type JSONValue, ScrollableJsonContainer } from '@components'
|
||||||
import { useStore } from '@hooks'
|
import { useStore } from '@hooks'
|
||||||
|
|
||||||
export function AnonSetResults({
|
export function AnonSetResults({
|
||||||
@@ -25,7 +25,7 @@ export function AnonSetResults({
|
|||||||
<h3>Results</h3>
|
<h3>Results</h3>
|
||||||
</div>
|
</div>
|
||||||
<Link href='/prove/submit'>
|
<Link href='/prove/submit'>
|
||||||
<button className='btn btn-secondary'>
|
<button type='button' className='btn btn-secondary'>
|
||||||
{NAVIGATION.PREPARE_PROOF_REQUEST}
|
{NAVIGATION.PREPARE_PROOF_REQUEST}
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -34,7 +34,12 @@ export function ConnectButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return hasMounted ? (
|
return hasMounted ? (
|
||||||
<button className='btn btn-secondary' onClick={onClick} disabled={loading}>
|
<button
|
||||||
|
type='button'
|
||||||
|
className='btn btn-secondary'
|
||||||
|
onClick={onClick}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
{loading ? 'Loading...' : label}
|
{loading ? 'Loading...' : label}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const ErrorContainer = ({ message }) => {
|
|||||||
<div className='error-container'>
|
<div className='error-container'>
|
||||||
<h2 className='mb-4 text-4xl font-bold'>Something went wrong!</h2>
|
<h2 className='mb-4 text-4xl font-bold'>Something went wrong!</h2>
|
||||||
<p className='mb-8 text-red'>{message}</p>
|
<p className='mb-8 text-red'>{message}</p>
|
||||||
<button className='btn btn-error' onClick={goBack}>
|
<button type='button' className='btn btn-error' onClick={goBack}>
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
export enum Links {
|
export enum Links {
|
||||||
Twitter = 'https://twitter.com/PrivacyScaling',
|
Twitter = 'https://twitter.com/PrivacyScaling',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const HelpModal = () => {
|
|||||||
return (
|
return (
|
||||||
helpText !== null && (
|
helpText !== null && (
|
||||||
<div>
|
<div>
|
||||||
<button className='btn btn-secondary' onClick={open}>
|
<button type='button' className='btn btn-secondary' onClick={open}>
|
||||||
?
|
?
|
||||||
</button>
|
</button>
|
||||||
<Modal ref={ref}>
|
<Modal ref={ref}>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export function JsonFileInput({
|
|||||||
className='hidden'
|
className='hidden'
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
/>
|
/>
|
||||||
<button className='btn btn-primary' onClick={onClick}>
|
<button type='button' className='btn btn-primary' onClick={onClick}>
|
||||||
<div className='flex flex-row items-center'>
|
<div className='flex flex-row items-center'>
|
||||||
<ArrowUpOnSquareIcon className='w-[40px]' />
|
<ArrowUpOnSquareIcon className='w-[40px]' />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function Loader() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-40 flex flex-row justify-center'>
|
<div className='mt-40 flex flex-row justify-center'>
|
||||||
<progress value={progress} max='100'></progress>
|
<progress value={progress} max='100' />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { forwardRef, ReactNode, RefObject } from 'react'
|
import { forwardRef, type ReactNode, type RefObject } from 'react'
|
||||||
import { modal } from '#'
|
import { modal } from '#'
|
||||||
|
|
||||||
const Modal = forwardRef(
|
const Modal = forwardRef(
|
||||||
@@ -15,7 +15,11 @@ const Modal = forwardRef(
|
|||||||
<form method='dialog' className='space-y-5'>
|
<form method='dialog' className='space-y-5'>
|
||||||
{children}
|
{children}
|
||||||
<menu className='dialog-menu flex flex-row justify-center'>
|
<menu className='dialog-menu flex flex-row justify-center'>
|
||||||
<button className='btn btn-secondary' onClick={close}>
|
<button
|
||||||
|
type='button'
|
||||||
|
className='btn btn-secondary'
|
||||||
|
onClick={close}
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { JSONValue } from './JsonFileInput'
|
import type { JSONValue } from './JsonFileInput'
|
||||||
|
|
||||||
export function ScrollableJsonContainer({
|
export function ScrollableJsonContainer({
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ export function SubmitProofRequest() {
|
|||||||
/>
|
/>
|
||||||
{warningWasRead ? (
|
{warningWasRead ? (
|
||||||
<Link href='/prove/result'>
|
<Link href='/prove/result'>
|
||||||
<button className='btn btn-secondary'>
|
<button type='button' className='btn btn-secondary'>
|
||||||
{NAVIGATION.SUBMIT_PROOF}
|
{NAVIGATION.SUBMIT_PROOF}
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<button className='btn btn-secondary is-disabled'>
|
<button type='button' className='btn btn-secondary is-disabled'>
|
||||||
{NAVIGATION.SUBMIT_PROOF}
|
{NAVIGATION.SUBMIT_PROOF}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
@@ -74,6 +74,7 @@ export function SubmitProofRequest() {
|
|||||||
</div>
|
</div>
|
||||||
<div className='flex flex-row items-end justify-evenly'>
|
<div className='flex flex-row items-end justify-evenly'>
|
||||||
<button
|
<button
|
||||||
|
type='button'
|
||||||
className={`btn ${canSign ? 'btn-primary' : 'is-disabled'}`}
|
className={`btn ${canSign ? 'btn-primary' : 'is-disabled'}`}
|
||||||
onClick={() => signMessage()}
|
onClick={() => signMessage()}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
export function Text({ lines }: { lines: string[] }) {
|
export function Text({ lines }: { lines: string[] }) {
|
||||||
return (
|
return (
|
||||||
<div className='text-center'>
|
<div className='text-center'>
|
||||||
{lines.map((line, i) => (
|
{lines.map((line) => (
|
||||||
<p key={i}>{line}</p>
|
<p key={line}>{line}</p>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const WarningModal = ({ content }: { content: string[] }) => {
|
|||||||
<Text lines={content} />
|
<Text lines={content} />
|
||||||
<menu className='dialog-menu flex flex-row justify-center'>
|
<menu className='dialog-menu flex flex-row justify-center'>
|
||||||
<button
|
<button
|
||||||
|
type='button'
|
||||||
className='btn btn-secondary'
|
className='btn btn-secondary'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setWarningWasRead(true)
|
setWarningWasRead(true)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import useSWR, { Fetcher } from 'swr'
|
import useSWR, { type Fetcher } from 'swr'
|
||||||
import { useBlockNumber } from 'wagmi'
|
import { useBlockNumber } from 'wagmi'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ActionCreator } from 'easy-peasy'
|
import type { ActionCreator } from 'easy-peasy'
|
||||||
import { ChangeEvent } from 'react'
|
import type { ChangeEvent } from 'react'
|
||||||
import { readJsonFile } from '#'
|
import { readJsonFile } from '#'
|
||||||
import { useStoreActions } from '@hooks'
|
import { useStoreActions } from '@hooks'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
GenerateMerkleProofFn,
|
type GenerateMerkleProofFn,
|
||||||
MerkleTreeWorker,
|
MerkleTreeWorker,
|
||||||
} from '@anonklub/merkle-tree-worker'
|
} from '@anonklub/merkle-tree-worker'
|
||||||
import { useWorker } from '@/hooks'
|
import { useWorker } from '@/hooks'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useAsync } from 'react-use'
|
import { useAsync } from 'react-use'
|
||||||
import { Hex } from 'viem'
|
import type { Hex } from 'viem'
|
||||||
import { useStore } from '@hooks'
|
import { useStore } from '@hooks'
|
||||||
import { useSpartanEcdsaWorker } from './useSpartanEcdsaWorker'
|
import { useSpartanEcdsaWorker } from './useSpartanEcdsaWorker'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
ProveMembershipFn,
|
type ProveMembershipFn,
|
||||||
SpartanEcdsaWorker,
|
SpartanEcdsaWorker,
|
||||||
VerifyMembershipFn,
|
type VerifyMembershipFn,
|
||||||
} from '@anonklub/spartan-ecdsa-worker'
|
} from '@anonklub/spartan-ecdsa-worker'
|
||||||
import { useWorker } from '@/hooks'
|
import { useWorker } from '@/hooks'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createTypedHooks } from 'easy-peasy'
|
import { createTypedHooks } from 'easy-peasy'
|
||||||
import { StoreModel } from '@/store'
|
import type { StoreModel } from '@/store'
|
||||||
|
|
||||||
const typedHooks = createTypedHooks<StoreModel>()
|
const typedHooks = createTypedHooks<StoreModel>()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { MerkleTreeWorker } from '@anonklub/merkle-tree-worker'
|
import type { MerkleTreeWorker } from '@anonklub/merkle-tree-worker'
|
||||||
import { SpartanEcdsaWorker } from '@anonklub/spartan-ecdsa-worker'
|
import type { SpartanEcdsaWorker } from '@anonklub/spartan-ecdsa-worker'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
export const useWorker = (
|
export const useWorker = (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Chain } from 'wagmi'
|
import type { Chain } from 'wagmi'
|
||||||
import { sepolia } from 'wagmi/chains'
|
import { sepolia } from 'wagmi/chains'
|
||||||
|
|
||||||
interface Config {
|
interface Config {
|
||||||
@@ -16,17 +16,16 @@ interface Config {
|
|||||||
// https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#loading-environment-variables
|
// https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#loading-environment-variables
|
||||||
const walletConnectProjectId =
|
const walletConnectProjectId =
|
||||||
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID ?? ''
|
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID ?? ''
|
||||||
|
if (walletConnectProjectId === '') {
|
||||||
;[[walletConnectProjectId, 'NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID']].forEach(
|
// this means next build will fail
|
||||||
([value, name]) => {
|
if (process.env.NEXT_PHASE === 'phase-production-build')
|
||||||
if (value === '') {
|
throw new Error(
|
||||||
// this means next build will fail
|
'Missing environment variable NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID',
|
||||||
if (process.env.NEXT_PHASE === 'phase-production-build')
|
)
|
||||||
throw new Error(`Missing environment variable ${name}`)
|
console.warn(
|
||||||
else console.warn(`Missing environment variable ${name}`)
|
'Missing environment variable NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID',
|
||||||
}
|
)
|
||||||
},
|
}
|
||||||
)
|
|
||||||
|
|
||||||
export const config: Config = {
|
export const config: Config = {
|
||||||
appTitle: 'Anonklub',
|
appTitle: 'Anonklub',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { RefObject } from 'react'
|
import type { RefObject } from 'react'
|
||||||
|
|
||||||
export const modal = (ref: RefObject<HTMLDialogElement>) => {
|
export const modal = (ref: RefObject<HTMLDialogElement>) => {
|
||||||
const open = () => {
|
const open = () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ProofRequest } from '@anonklub/proof'
|
import type { ProofRequest } from '@anonklub/proof'
|
||||||
import { action, Action, createStore } from 'easy-peasy'
|
import { action, type Action, createStore } from 'easy-peasy'
|
||||||
|
|
||||||
export interface StoreModel {
|
export interface StoreModel {
|
||||||
anonSet: {
|
anonSet: {
|
||||||
|
|||||||
Reference in New Issue
Block a user