Skip to content

Commit

Permalink
@0x/dev-utils: Add chainId opt to Web3Config and set the defaul…
Browse files Browse the repository at this point in the history
…t chainId/networkId to 1337
  • Loading branch information
merklejerk committed Jan 26, 2021
1 parent aa7460d commit 732dda1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
9 changes: 9 additions & 0 deletions dev-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "4.2.0",
"changes": [
{
"note": "Add `chainId` option to `Web3Config`",
"pr": 20
}
]
},
{
"timestamp": 1610044030,
"version": "4.1.6",
Expand Down
7 changes: 5 additions & 2 deletions dev-utils/src/web3_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import * as fs from 'fs';
import { constants } from './constants';
import { env, EnvVars } from './env';

// tslint:disable: custom-no-magic-numbers

export interface Web3Config {
total_accounts?: number; // default: 10
hasAddresses?: boolean; // default: true
Expand All @@ -26,6 +28,7 @@ export interface Web3Config {
unlocked_accounts?: string[];
hardfork?: string; // default: istanbul
gasLimit?: number;
chainId?: number;
}

export const web3Factory = {
Expand Down Expand Up @@ -65,7 +68,6 @@ export const web3Factory = {
const shouldThrowErrorsOnGanacheRPCResponse =
config.shouldThrowErrorsOnGanacheRPCResponse === undefined ||
config.shouldThrowErrorsOnGanacheRPCResponse;

provider.addProvider(
new GanacheSubprovider({
total_accounts: config.total_accounts,
Expand All @@ -76,7 +78,8 @@ export const web3Factory = {
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),
port: 8545,
network_id: 50,
network_id: config.chainId === undefined ? 1337 : config.chainId,
_chainId: config.chainId === undefined ? 1337 : config.chainId,
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
fork: config.fork,
blockTime: config.blockTime,
Expand Down
2 changes: 1 addition & 1 deletion subproviders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ethereum-types": "^3.4.0",
"ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1",
"ganache-core": "^2.10.2",
"ganache-core": "^2.13.2",
"hdkey": "^0.7.1",
"json-rpc-error": "2.0.0",
"lodash": "^4.17.11",
Expand Down
2 changes: 1 addition & 1 deletion web3-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ganache-core": "^2.10.2",
"ganache-core": "^2.13.2",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
Expand Down
30 changes: 11 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5550,10 +5550,10 @@ eth-query@^2.0.2, eth-query@^2.1.0, eth-query@^2.1.2:
json-rpc-random-id "^1.0.0"
xtend "^4.0.1"

eth-sig-util@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-2.3.0.tgz#c54a6ac8e8796f7e25f59cf436982a930e645231"
integrity sha512-ugD1AvaggvKaZDgnS19W5qOfepjGc7qHrt7TrAaL54gJw9SHvgIXJ3r2xOMW30RWJZNP+1GlTOy5oye7yXA4xA==
eth-sig-util@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-3.0.0.tgz#75133b3d7c20a5731af0690c385e184ab942b97e"
integrity sha512-4eFkMOhpGbTxBQ3AMzVf0haUX2uTur7DpWiHzWyTURa28BVJJtOkcb9Ok5TV0YvEPG61DODPW7ZUATbJTslioQ==
dependencies:
buffer "^5.2.1"
elliptic "^6.4.0"
Expand Down Expand Up @@ -5642,15 +5642,7 @@ ethereumjs-abi@0.6.5:
bn.js "^4.10.0"
ethereumjs-util "^4.3.0"

ethereumjs-abi@0.6.7:
version "0.6.7"
resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.7.tgz#d1d1c5cdb8d910a7d97645ba9e93be5d153bba2e"
integrity sha512-EMLOA8ICO5yAaXDhjVEfYjsJIXYutY8ufTE93eEKwsVtp2usQreKwsDTJ9zvam3omYqNuffr8IONIqb2uUslGQ==
dependencies:
bn.js "^4.11.8"
ethereumjs-util "^6.0.0"

"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git":
ethereumjs-abi@0.6.8, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git":
version "0.6.8"
resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#1ce6a1d64235fabe2aaf827fd606def55693508f"
dependencies:
Expand Down Expand Up @@ -6477,10 +6469,10 @@ ganache-cli@6.8.0-istanbul.0:
source-map-support "0.5.12"
yargs "13.2.4"

ganache-core@^2.10.2:
version "2.13.0"
resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.13.0.tgz#e211d995eb806a1cd792096a989cf624417f0f7c"
integrity sha512-yTSsesDBwPh+34ZN2w5SZoPNVbR0Gn75InvQc2D1zUdy9prED6R2sVbefSyiXFR/uwZK9NrIVS1+HcEtgQVb9Q==
ganache-core@^2.13.2:
version "2.13.2"
resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.13.2.tgz#27e6fc5417c10e6e76e2e646671869d7665814a3"
integrity sha512-tIF5cR+ANQz0+3pHWxHjIwHqFXcVo0Mb+kcsNhglNFALcYo49aQpnS9dqHartqPfMFjiHh/qFoD3mYK0d/qGgw==
dependencies:
abstract-leveldown "3.0.0"
async "2.6.2"
Expand All @@ -6489,8 +6481,8 @@ ganache-core@^2.10.2:
clone "2.1.2"
debug "3.2.6"
encoding-down "5.0.4"
eth-sig-util "2.3.0"
ethereumjs-abi "0.6.7"
eth-sig-util "3.0.0"
ethereumjs-abi "0.6.8"
ethereumjs-account "3.0.0"
ethereumjs-block "2.2.2"
ethereumjs-common "1.5.0"
Expand Down

0 comments on commit 732dda1

Please sign in to comment.