Skip to content

Commit

Permalink
TS composite project
Browse files Browse the repository at this point in the history
  • Loading branch information
LogvinovLeon committed Feb 14, 2024
1 parent fb0cce2 commit b982543
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ts_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
echo '{ "abi": [], "bytecode": { "object": "" } }' > ethereum_history_api/contracts/out/UltraVerifier.sol/UltraVerifier.json
- name: Run TypeScript Build
run: yarn build:all
run: yarn build

- name: Run TypeScript format check
run: yarn format:all:ci
2 changes: 1 addition & 1 deletion .github/workflows/ts_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
run: forge build

- name: Run TypeScript Build
run: yarn build:all
run: yarn build

- name: Run Unit Tests
working-directory: ethereum_history_api/oracles
Expand Down
4 changes: 2 additions & 2 deletions ethereum_history_api/oracles/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "noir-ethereum-api-oracles",
"version": "1.0.0",
"main": "dist/oracles/src/main.js",
"types": "dist/oracles/src/main.d.ts",
"main": "dist/src/main.js",
"types": "dist/src/main.d.ts",
"type": "module",
"scripts": {
"test:unit": "vitest run --config vitest.unit.config.ts",
Expand Down
1 change: 0 additions & 1 deletion ethereum_history_api/oracles/src/ethereum/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion ethereum_history_api/oracles/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { incHexStr, assert, copy, updateNestedField } from './util/index.js';
export { verifyStorageProofInSolidity } from './ethereum/index.js';
export { encodeHexString } from './noir/noir_js/encode.js';
4 changes: 3 additions & 1 deletion ethereum_history_api/oracles/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.common.json",
"include": ["src/**/*", "test/fixtures/*.json", "test/helpers.ts", "package.json"],
"compilerOptions": {
"rootDirs": ["src", "test"],
"outDir": "dist"
}
}
3 changes: 2 additions & 1 deletion ethereum_history_api/tests/src/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { copy, updateNestedField, incHexStr, assert, verifyStorageProofInSolidity } from 'noir-ethereum-api-oracles';
import { copy, updateNestedField, incHexStr, assert } from 'noir-ethereum-api-oracles';
import { abiEncode, InputMap, WitnessMap } from '@noir-lang/noirc_abi';

import { Account, privateKeyToAccount } from 'viem/accounts';
import ultraVerifier from '../../contracts/out/UltraVerifier.sol/UltraVerifier.json';
import { Address, Hex } from 'viem';
import { createAnvilClient, AnvilClient } from './ethereum/anvilClient.js';
import { circuit, readInputMap, readProof, readWitnessMap } from './main.js';
import { verifyStorageProofInSolidity } from './verifier.js';

const PROOF_PATH = '../../proofs/ethereum_history_api.proof';
const INPUT_MAP_PATH = '../circuits/lib/Verifier.toml';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ultraVerifier from '../../../contracts/out/UltraVerifier.sol/UltraVerifier.json';
import { decodeHexString } from '../noir/noir_js/encode.js';
import ultraVerifier from '../../contracts/out/UltraVerifier.sol/UltraVerifier.json';
import { decodeHexString } from 'noir-ethereum-api-oracles/src/noir/noir_js/encode.js';
import { Account } from 'viem/accounts';
import { Address, Hash, WalletClient } from 'viem';
import { WitnessMap } from '@noir-lang/noirc_abi';
Expand Down
4 changes: 3 additions & 1 deletion ethereum_history_api/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.common.json",
"include": ["src/**/*"],
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"ethereum_history_api/tests"
],
"scripts": {
"check": "yarn format:all && yarn lint:all && yarn typecheck:all",
"build": "tsc --build --verbose",
"watch": "tsc --build --verbose --watch",
"check": "yarn format:all && yarn lint:all",
"lint:all": "yarn workspaces foreach --all --parallel --verbose run lint",
"build:all": "yarn workspaces foreach --all --topological --verbose run build",
"format:all": "yarn workspaces foreach --all --parallel --verbose run format",
"format:all:ci": "yarn workspaces foreach --all --parallel --verbose run format:ci"
},
Expand Down
20 changes: 20 additions & 0 deletions tsconfig.common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"allowJs": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"declaration": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"skipLibCheck": true,
"composite": true,
"incremental": true,
"tsBuildInfoFile": "./dist/.tsbuildinfo"
}
}
20 changes: 5 additions & 15 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
{
"compilerOptions": {
"target": "es2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"allowJs": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"declaration": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"skipLibCheck": true
}
"files": [],
"references": [
{ "path": "ethereum_history_api/oracles/tsconfig.json" },
{ "path": "ethereum_history_api/tests/tsconfig.json" }
]
}

0 comments on commit b982543

Please sign in to comment.