From 73e23996a64f2d0b7f6da855e2c918496e0348f6 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 13 Apr 2018 13:16:30 +1000 Subject: Remove truffle-hdwallet from 0x.js tests --- packages/0x.js/package.json | 1 - packages/0x.js/test/artifacts_test.ts | 12 ++----- packages/dev-utils/src/web3_factory.ts | 6 +++- yarn.lock | 57 +++++++--------------------------- 4 files changed, 19 insertions(+), 57 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index cd339e770..37a321dbd 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -89,7 +89,6 @@ "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", - "truffle-hdwallet-provider": "^0.0.3", "tslint": "5.8.0", "typedoc": "0xProject/typedoc", "typescript": "2.7.1", diff --git a/packages/0x.js/test/artifacts_test.ts b/packages/0x.js/test/artifacts_test.ts index 17f068a2e..40c5983bd 100644 --- a/packages/0x.js/test/artifacts_test.ts +++ b/packages/0x.js/test/artifacts_test.ts @@ -1,5 +1,5 @@ +import { web3Factory } from '@0xproject/dev-utils'; import * as fs from 'fs'; -import HDWalletProvider = require('truffle-hdwallet-provider'); import { ZeroEx } from '../src'; @@ -14,10 +14,7 @@ const TIMEOUT = 10000; describe('Artifacts', () => { describe('contracts are deployed on kovan', () => { const kovanRpcUrl = constants.KOVAN_RPC_URL; - const packageJSONContent = fs.readFileSync('package.json', 'utf-8'); - const packageJSON = JSON.parse(packageJSONContent); - const mnemonic = packageJSON.config.mnemonic; - const provider = new HDWalletProvider(mnemonic, kovanRpcUrl); + const provider = web3Factory.create({ rpcUrl: kovanRpcUrl }).currentProvider; const config = { networkId: constants.KOVAN_NETWORK_ID, }; @@ -34,10 +31,7 @@ describe('Artifacts', () => { }); describe('contracts are deployed on ropsten', () => { const ropstenRpcUrl = constants.ROPSTEN_RPC_URL; - const packageJSONContent = fs.readFileSync('package.json', 'utf-8'); - const packageJSON = JSON.parse(packageJSONContent); - const mnemonic = packageJSON.config.mnemonic; - const provider = new HDWalletProvider(mnemonic, ropstenRpcUrl); + const provider = web3Factory.create({ rpcUrl: ropstenRpcUrl }).currentProvider; const config = { networkId: constants.ROPSTEN_NETWORK_ID, }; diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index f45c36930..5519bec2b 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -26,6 +26,7 @@ import * as Web3 from 'web3'; export interface Web3Config { hasAddresses?: boolean; // default: true shouldUseInProcessGanache?: boolean; // default: false + rpcUrl?: string; // default: localhost:8545 } export const web3Factory = { @@ -53,6 +54,9 @@ export const web3Factory = { }; const shouldUseInProcessGanache = !!config.shouldUseInProcessGanache; if (shouldUseInProcessGanache) { + if (_.isUndefined(config.rpcUrl)) { + throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider'); + } provider.addProvider( new GanacheSubprovider({ logger, @@ -65,7 +69,7 @@ export const web3Factory = { } else { provider.addProvider( new RpcSubprovider({ - rpcUrl: constants.RPC_URL, + rpcUrl: config.rpcUrl || constants.RPC_URL, }), ); } diff --git a/yarn.lock b/yarn.lock index 265b194e3..3e46ff248 100644 --- a/yarn.lock +++ b/yarn.lock @@ -55,6 +55,12 @@ version "1.0.2" resolved "https://registry.yarnpkg.com/@types/bintrees/-/bintrees-1.0.2.tgz#0dfdce4eeebdf90427bd35b0e79dc248b3d157a6" +"@types/bip39@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@types/bip39/-/bip39-2.4.0.tgz#eee31a14abc8ebbb41a1ff14575c447b18346cbc" + dependencies: + "@types/node" "*" + "@types/body-parser@*", "@types/body-parser@^1.16.1": version "1.16.8" resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.16.8.tgz#687ec34140624a3bec2b1a8ea9268478ae8f3be3" @@ -1374,10 +1380,6 @@ big.js@^3.1.3: version "3.2.0" resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" -"bignumber.js@git+https://github.com/debris/bignumber.js#master": - version "2.0.7" - resolved "git+https://github.com/debris/bignumber.js#c7a38de919ed75e6fb6ba38051986e294b328df9" - "bignumber.js@git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2": version "2.0.7" resolved "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" @@ -1402,7 +1404,7 @@ bintrees@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8" -bip39@^2.2.0: +bip39@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235" dependencies: @@ -3584,7 +3586,7 @@ ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: rlp "^2.0.0" secp256k1 "^3.0.1" -ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.3, ethereumjs-util@^5.1.5: +ethereumjs-util@^5.0.0, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.3, ethereumjs-util@^5.1.5: version "5.1.5" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.1.5.tgz#2f02575852627d45622426f25ee4a0b5f377f27a" dependencies: @@ -3612,7 +3614,7 @@ ethereumjs-vm@2.3.3, ethereumjs-vm@^2.0.2: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@^0.6.0, ethereumjs-wallet@~0.6.0: +ethereumjs-wallet@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" dependencies: @@ -5620,7 +5622,7 @@ isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" -isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.0, isomorphic-fetch@^2.2.1: +isomorphic-fetch@^2.1.1, isomorphic-fetch@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" dependencies: @@ -10435,15 +10437,6 @@ truffle-contract@2.0.1: truffle-contract-schema "0.0.5" web3 "^0.18.0" -truffle-hdwallet-provider@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/truffle-hdwallet-provider/-/truffle-hdwallet-provider-0.0.3.tgz#0e1de02104b73d3875e1cf7093305b4ea8a2d843" - dependencies: - bip39 "^2.2.0" - ethereumjs-wallet "^0.6.0" - web3 "^0.18.2" - web3-provider-engine "^8.4.0" - tslib@^1.0.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1: version "1.9.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" @@ -11280,25 +11273,6 @@ web3-provider-engine@^13.0.1, web3-provider-engine@^13.6.5: xhr "^2.2.0" xtend "^4.0.1" -web3-provider-engine@^8.4.0: - version "8.6.1" - resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.6.1.tgz#4d86e19e30caaf97df351511ec0f60136e5b30eb" - dependencies: - async "^2.1.2" - clone "^2.0.0" - ethereumjs-block "^1.2.2" - ethereumjs-tx "^1.2.0" - ethereumjs-util "^5.0.1" - ethereumjs-vm "^2.0.2" - isomorphic-fetch "^2.2.0" - request "^2.67.0" - semaphore "^1.0.3" - solc "^0.4.2" - tape "^4.4.0" - web3 "^0.16.0" - xhr "^2.2.0" - xtend "^4.0.1" - web3-providers-http@1.0.0-beta.33: version "1.0.0-beta.33" resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.0.0-beta.33.tgz#3b35ae00ee7df5b96b4934962ad4a86f2a5599c1" @@ -11349,16 +11323,7 @@ web3-utils@1.0.0-beta.33: underscore "1.8.3" utf8 "2.1.1" -web3@^0.16.0: - version "0.16.0" - resolved "https://registry.yarnpkg.com/web3/-/web3-0.16.0.tgz#a4554175cd462943035b1f1d39432f741c6b6019" - dependencies: - bignumber.js "git+https://github.com/debris/bignumber.js#master" - crypto-js "^3.1.4" - utf8 "^2.1.1" - xmlhttprequest "*" - -web3@^0.18.0, web3@^0.18.2: +web3@^0.18.0: version "0.18.4" resolved "https://registry.yarnpkg.com/web3/-/web3-0.18.4.tgz#81ec1784145491f2eaa8955b31c06049e07c5e7d" dependencies: -- cgit From 7b318b3cc20fa9185849db36429e307bbbf9d950 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 13 Apr 2018 13:39:32 +1000 Subject: Update the Changelog with pr number --- packages/0x.js/CHANGELOG.json | 9 +++++++++ packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/src/web3_factory.ts | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 9b5c52d00..a54550660 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "0.36.1", + "changes": [ + { + "note": "Remove truffle-hdwallet from artifact tests", + "pr": 524 + } + ], + }, { "version": "0.36.0", "changes": [ diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index b5dd3732d..8faf71d6a 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "0.3.6", + "changes": [ + { + "note": "Allow an rpcURL to be set in Web3Config (for testnet RPC endpoints)", + "pr": 524 + } + ] + }, { "timestamp": 1523462196, "version": "0.3.5", diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 5519bec2b..68348d671 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -54,7 +54,7 @@ export const web3Factory = { }; const shouldUseInProcessGanache = !!config.shouldUseInProcessGanache; if (shouldUseInProcessGanache) { - if (_.isUndefined(config.rpcUrl)) { + if (!_.isUndefined(config.rpcUrl)) { throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider'); } provider.addProvider( -- cgit From bc3c7a30c4d7f2c3abf9d4c3ec84c7d5cd1df767 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Sat, 14 Apr 2018 13:33:06 +1000 Subject: Prettier on CHANGELOG.json --- packages/0x.js/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index a54550660..fe74fb5f7 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -6,7 +6,7 @@ "note": "Remove truffle-hdwallet from artifact tests", "pr": 524 } - ], + ] }, { "version": "0.36.0", -- cgit From 0d02037a129a97b6afb724a5316d54730c93c0d8 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 17 Apr 2018 13:41:45 +1000 Subject: Change changelog note as it has no public impact --- packages/0x.js/CHANGELOG.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index fe74fb5f7..8be892215 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -3,8 +3,7 @@ "version": "0.36.1", "changes": [ { - "note": "Remove truffle-hdwallet from artifact tests", - "pr": 524 + "note": "Internal changes and refactoring" } ] }, -- cgit