Skip to content

Commit

Permalink
update config for absolute path import
Browse files Browse the repository at this point in the history
  • Loading branch information
phn210 committed Mar 7, 2024
1 parent f51013e commit 4373d4c
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/Bit255.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provable, Reducer, Scalar, SmartContract, method } from 'o1js';
import { Bit255 } from './Bit255.js';
import { Bit255 } from 'src/Bit255.js';

describe('Bit255', () => {
it('Should be provable', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Bit255.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Bool, Field, Poseidon, Provable, Scalar, Struct } from 'o1js';
import { CustomScalar } from './CustomScalar.js';
import { CustomScalar } from 'src/CustomScalar.js';

// WARNING - Convert between Scalar and Bit255 does not preserve bigint value
export class Bit255 extends Struct({
Expand Down
2 changes: 1 addition & 1 deletion src/CustomScalar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Scalar } from 'o1js';
import { CustomScalar } from './CustomScalar.js';
import { CustomScalar } from 'src/CustomScalar.js';

describe('CustomScalar', () => {
it('Should convert correctly', async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/DynamicArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
GroupDynamicArray,
PublicKeyDynamicArray,
ScalarDynamicArray,
} from './DynamicArray.js';
import { CustomScalar } from './CustomScalar.js';
import { Bit255 } from './Bit255.js';
} from 'src/DynamicArray.js';
import { CustomScalar } from 'src/CustomScalar.js';
import { Bit255 } from 'src/Bit255.js';

describe('DynamicArray', () => {
const MAX_HEIGHT = 5;
Expand Down
6 changes: 3 additions & 3 deletions src/DynamicArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
Struct,
} from 'o1js';

import { Bit255 } from './Bit255.js';
import { CustomScalar } from './CustomScalar.js';
import { hashable } from './Hashable.js';
import { Bit255 } from 'src/Bit255.js';
import { CustomScalar } from 'src/CustomScalar.js';
import { hashable } from 'src/Hashable.js';

export {
Bit255DynamicArray,
Expand Down
2 changes: 1 addition & 1 deletion src/IPFSHash.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provable } from 'o1js';
import { IpfsHash } from './IpfsHash.js';
import { IpfsHash } from 'src/IpfsHash.js';

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 2 in src/IPFSHash.test.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

describe('IpfsHash', () => {
it('Should be provable code', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/IPFSHash.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Encoding } from 'o1js';
import { FieldDynamicArray } from './DynamicArray.js';
import { FieldDynamicArray } from 'src/DynamicArray.js';

export class IpfsHash extends FieldDynamicArray(3) {
static fromString(s: string): IpfsHash {
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { Bit255 } from './Bit255.js';
export { Bit255 } from 'src/Bit255.js';

export { CustomScalar } from './CustomScalar.js';
export { CustomScalar } from 'src/CustomScalar.js';

export {
Bit255DynamicArray,
Expand All @@ -10,8 +10,8 @@ export {
ScalarDynamicArray,
PublicKeyDynamicArray,
DynamicArray,
} from './DynamicArray.js';
} from 'src/DynamicArray.js';

export { IpfsHash } from './IpfsHash.js';
export { IpfsHash } from 'src/IpfsHash.js';

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

Check failure on line 15 in src/index.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'src/IpfsHash.js' or its corresponding type declarations.

export * as Utils from './utils/index.js';
export * as Utils from 'src/utils/index.js';
2 changes: 1 addition & 1 deletion src/utils/benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import fs from 'fs';
import { Profiler } from './constants';
import { Profiler } from 'src/utils/constants.js';

export { getProfiler, getMemoryUsage };

Expand Down
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs/promises';
import { PrivateKey, PublicKey } from 'o1js';
import { Base58Key, Config, Key, ZkApp } from './constants.js';
import { Base58Key, Config, Key, ZkApp } from 'src/utils/constants.js';

export { readConfig, readZkAppConfig, readUserConfig };

Expand Down
14 changes: 9 additions & 5 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export { getProfiler, getMemoryUsage } from './benchmark.js';
export { getProfiler, getMemoryUsage } from 'src/utils/benchmark.js';

export { readConfig, readZkAppConfig, readUserConfig } from './config.js';
export {
readConfig,
readZkAppConfig,
readUserConfig,
} from 'src/utils/config.js';

export {
Profiler,
Expand All @@ -14,7 +18,7 @@ export {
TxResult,
FetchedActions,
FetchedEvents,
} from './constants.js';
} from 'src/utils/constants.js';

export {
randomAccounts,
Expand All @@ -26,7 +30,7 @@ export {
fetchActions,
fetchEvents,
fetchZkAppState,
} from './network.js';
} from 'src/utils/network.js';

export {
updateActionState,
Expand All @@ -35,4 +39,4 @@ export {
buildAssertMessage,
requireSignature,
requireCaller,
} from './zkApp.js';
} from 'src/utils/zkApp.js';
4 changes: 2 additions & 2 deletions src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
UInt32,
fetchAccount,
} from 'o1js';
import { getMemoryUsage } from './benchmark.js';
import { getMemoryUsage } from 'src/utils/benchmark.js';
import {
FeePayer,
FetchedActions,
Expand All @@ -21,7 +21,7 @@ import {
Program,
TxResult,
ZkApp,
} from './constants.js';
} from 'src/utils/constants.js';

export {
randomAccounts,
Expand Down
46 changes: 25 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"compilerOptions": {
"target": "es2020",
"module": "es2022",
"lib": ["dom", "esnext"],
"outDir": "./build/esm",
"rootDir": ".",
"strict": true,
"strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowJs": true,
"declaration": true,
"sourceMap": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
},
"include": ["./src"]
"compilerOptions": {
"paths": {
"src/*": ["./src/*"]
},
"target": "es2020",
"module": "es2022",
"lib": ["dom", "esnext"],
"outDir": "./build/esm",
"rootDir": ".",
"strict": true,
"strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue
"skipLibCheck": true,
"forceConsistentCasingInFileNames": false,
"esModuleInterop": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowJs": true,
"declaration": true,
"preserveSymlinks": true,
"sourceMap": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/*.ts"]
}

0 comments on commit 4373d4c

Please sign in to comment.