From 974575b695108dd70f4b165f6789f71c3647c2b1 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 14 May 2018 20:01:18 +0200 Subject: Make sol-cov work with truffle and other artifact adapters --- packages/dev-utils/src/coverage.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts index 6f7640835..caf04672f 100644 --- a/packages/dev-utils/src/coverage.ts +++ b/packages/dev-utils/src/coverage.ts @@ -1,4 +1,4 @@ -import { CoverageSubprovider } from '@0xproject/sol-cov'; +import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; import * as _ from 'lodash'; import { constants } from './constants'; @@ -16,6 +16,7 @@ export const coverage = { const artifactsPath = '../migrations/artifacts/1.0.0'; const contractsPath = 'src/contracts'; const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress); + const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, contractsPath); + return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); }, }; -- cgit v1.2.3 From b86248f13fcb8f326098252beee6ca557e0175e7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 15 May 2018 11:29:52 +0200 Subject: Add CHANGELOG entries --- packages/dev-utils/CHANGELOG.json | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 3f70a93cc..72ecdbabb 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -2,6 +2,10 @@ { "version": "0.4.2", "changes": [ + { + "note": "Pass ZeroExArtifactsAdapter to CoverageSubprovider", + "pr": 589 + }, { "note": "Move callbackErrorReporter over from 0x.js", "pr": 579 -- cgit v1.2.3 From 1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 15 May 2018 15:14:36 +0200 Subject: Remove web3Factory.create and remove dev-tools dependency on sol-cov --- packages/dev-utils/package.json | 1 - packages/dev-utils/src/coverage.ts | 22 ---------------------- packages/dev-utils/src/index.ts | 1 - packages/dev-utils/src/web3_factory.ts | 20 +------------------- 4 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 packages/dev-utils/src/coverage.ts (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 49964c82a..9dd3750c5 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -44,7 +44,6 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/sol-cov": "^0.0.10", "@0xproject/subproviders": "^0.10.1", "@0xproject/types": "^0.6.3", "@0xproject/typescript-typings": "^0.3.1", diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts deleted file mode 100644 index caf04672f..000000000 --- a/packages/dev-utils/src/coverage.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; -import * as _ from 'lodash'; - -import { constants } from './constants'; - -let coverageSubprovider: CoverageSubprovider; - -export const coverage = { - getCoverageSubproviderSingleton(): CoverageSubprovider { - if (_.isUndefined(coverageSubprovider)) { - coverageSubprovider = coverage._getCoverageSubprovider(); - } - return coverageSubprovider; - }, - _getCoverageSubprovider(): CoverageSubprovider { - const artifactsPath = '../migrations/artifacts/1.0.0'; - const contractsPath = 'src/contracts'; - const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS; - const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, contractsPath); - return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); - }, -}; diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts index 9124f3e28..d4c19f1bf 100644 --- a/packages/dev-utils/src/index.ts +++ b/packages/dev-utils/src/index.ts @@ -1,6 +1,5 @@ export { BlockchainLifecycle } from './blockchain_lifecycle'; export { web3Factory } from './web3_factory'; export { constants as devConstants } from './constants'; -export { coverage } from './coverage'; export { env, EnvVars } from './env'; export { callbackErrorReporter } from './callback_error_reporter'; diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 4cd343c44..5b32d3930 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -13,16 +13,8 @@ import * as _ from 'lodash'; import * as process from 'process'; import { constants } from './constants'; -import { coverage } from './coverage'; import { env, EnvVars } from './env'; -// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang -// because they are using the wrong XHR package. -// importing web3 after subproviders fixes this issue -// Filed issue: https://github.com/ethereum/web3.js/issues/844 -// tslint:disable-next-line:ordered-imports -import * as Web3 from 'web3'; - export interface Web3Config { hasAddresses?: boolean; // default: true shouldUseInProcessGanache?: boolean; // default: false @@ -30,18 +22,8 @@ export interface Web3Config { } export const web3Factory = { - create(config: Web3Config = {}): Web3 { - const provider = this.getRpcProvider(config); - const web3 = new Web3(); - web3.setProvider(provider); - return web3; - }, - getRpcProvider(config: Web3Config = {}): Provider { + getRpcProvider(config: Web3Config = {}): ProviderEngine { const provider = new ProviderEngine(); - const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); - if (isCoverageEnabled) { - provider.addProvider(coverage.getCoverageSubproviderSingleton()); - } const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses; if (!hasAddresses) { provider.addProvider(new EmptyWalletSubprovider()); -- cgit v1.2.3 From f8c628b0c7b750e1096dcc507190525feb8bd572 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:16:38 -0700 Subject: Updated CHANGELOGS --- packages/dev-utils/CHANGELOG.json | 3 ++- packages/dev-utils/CHANGELOG.md | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 72ecdbabb..4f6f7bd76 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Move callbackErrorReporter over from 0x.js", "pr": 579 } - ] + ], + "timestamp": 1527008544 }, { "timestamp": 1525477860, diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index ab824c898..8e2f007d2 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.4.1 - _May 5, 2018_ +## v0.4.2 - _May 22, 2018_ + + * Move callbackErrorReporter over from 0x.js (#579) + +## v0.4.1 - _May 4, 2018_ * Dependencies updated -- cgit v1.2.3 From 84a1b5612de3b22bbe6b8b01a997234771d98005 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:26:47 -0700 Subject: Publish - 0x.js@0.38.0 - @0xproject/abi-gen@0.3.0 - @0xproject/assert@0.2.10 - @0xproject/base-contract@0.3.2 - @0xproject/connect@0.6.13 - @0xproject/contract-wrappers@0.0.2 - contracts@2.1.29 - @0xproject/dev-utils@0.4.2 - @0xproject/fill-scenarios@0.0.2 - @0xproject/json-schemas@0.7.24 - @0xproject/metacoin@0.0.7 - @0xproject/migrations@0.0.6 - @0xproject/monorepo-scripts@0.1.20 - @0xproject/order-utils@0.0.5 - @0xproject/order-watcher@0.0.2 - @0xproject/react-docs-example@0.0.12 - @0xproject/react-docs@0.0.12 - @0xproject/react-shared@0.1.7 - @0xproject/sol-compiler@0.5.0 - @0xproject/sol-cov@0.0.11 - @0xproject/sol-resolver@0.0.5 - @0xproject/sra-report@0.1.0 - @0xproject/subproviders@0.10.2 - @0xproject/testnet-faucets@1.0.30 - @0xproject/tslint-config@0.4.18 - @0xproject/types@0.7.0 - @0xproject/typescript-typings@0.3.2 - @0xproject/utils@0.6.2 - @0xproject/web3-wrapper@0.6.4 - @0xproject/website@0.0.33 --- packages/dev-utils/package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 9dd3750c5..0b11029f6 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "0.4.1", + "version": "0.4.2", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "chai": "^4.0.1", @@ -44,10 +44,10 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/subproviders": "^0.10.1", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/web3-wrapper": "^0.6.4", "lodash": "^4.17.4", "web3": "^0.20.0", "web3-provider-engine": "^14.0.4" -- cgit v1.2.3 From ebc750d5bf95da76424da81550a88e6b74de8c36 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 17:41:48 -0700 Subject: Address feedback --- packages/dev-utils/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/dev-utils') diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 4f6f7bd76..ecb43a42e 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "0.4.2", "changes": [ { - "note": "Pass ZeroExArtifactsAdapter to CoverageSubprovider", + "note": "Pass SolCompilerArtifactAdapter to CoverageSubprovider", "pr": 589 }, { -- cgit v1.2.3