Skip to content

Commit

Permalink
Create package in infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Feb 9, 2021
1 parent 5d90a1b commit f985f52
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/tests/ts-tests/tests/withdrawal-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import './priority-ops';
import './change-pub-key';
import './withdrawal-helpers';

import { loadTestConfig } from '../../../../etc/reading-tool';
import { loadTestConfig } from 'reading-tool';

const TX_AMOUNT = utils.parseEther('1');
const DEPOSIT_AMOUNT = TX_AMOUNT.mul(200);
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ts-tests/tests/withdrawal-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Address } from 'zksync/build/types';
import { sleep } from 'zksync/build/utils';

import { RevertReceiveAccountFactory, RevertTransferERC20Factory } from '../../../../contracts/typechain';
import { loadTestConfig } from '../../../../etc/reading-tool';
import { loadTestConfig } from 'reading-tool';

const TEST_CONFIG = loadTestConfig();

Expand Down
1 change: 1 addition & 0 deletions infrastructure/reading-tool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
15 changes: 15 additions & 0 deletions infrastructure/reading-tool/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "reading-tool",
"version": "1.0.0",
"license": "MIT",
"main": "build/index.js",
"private": true,
"devDependencies": {
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
},
"scripts": {
"build": "tsc",
"watch": "tsc --watch"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';

function configPath(postfix: string) {
return `./test_config/${postfix}`;
return `${process.env.ZKSYNC_HOME}/etc/test_config/${postfix}`;
}

function loadConfig(path: string) {
Expand Down Expand Up @@ -39,7 +39,7 @@ export function loadTestVectorsConfig() {
}

export function getTokens(network: string) {
const configPath = `./tokens/${network}.json`;
const configPath = `${process.env.ZKSYNC_HOME}/etc/tokens/${network}.json`;
console.log(configPath);
return JSON.parse(
fs.readFileSync(configPath, {
Expand Down
16 changes: 16 additions & 0 deletions infrastructure/reading-tool/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",

"outDir": "./build",
"esModuleInterop": true,
"declaration": true,

"preserveSymlinks": true,
"preserveWatchOutput": true
},
"files": [
"./src/index.ts"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"infrastructure/explorer",
"infrastructure/zk",
"infrastructure/eth_transfer",
"infrastructure/reading-tool",
"core/tests/ts-tests"
],
"nohoist": [
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/tests/eip1271.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as ethers from 'ethers';
import { loadTestConfig } from '../../../etc/reading-tool';
import { loadTestConfig } from 'reading-tool';
import * as zkUtils from '../src/utils';

const testConfig = loadTestConfig();
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/tests/provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { Provider } from '../src/provider';
import { getTokens } from '../../../etc/reading-tool';
import { getTokens } from 'reading-tool';

describe('Provider tests', function () {
it('Update token set', async function () {
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/tests/vectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
parseHexWithPrefix
} from '../src/utils';
import { privateKeyFromSeed, signTransactionBytes } from '../src/crypto';
import { loadTestVectorsConfig } from '../../../etc/reading-tool';
import { loadTestVectorsConfig } from 'reading-tool';

const vectors = loadTestVectorsConfig();
const cryptoPrimitivesVectors = vectors['cryptoPrimitivesTest'];
Expand Down
2 changes: 1 addition & 1 deletion sdk/zksync.js/tests/wallet.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { BigNumber, ethers } from 'ethers';
import { Wallet } from '../src/wallet';
import { getTokens } from '../../../etc/reading-tool';
import { getTokens } from 'reading-tool';

import { Provider } from '../src/provider';

Expand Down

0 comments on commit f985f52

Please sign in to comment.