Skip to content

Commit

Permalink
feat: add chainId option (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch authored Sep 15, 2020
1 parent 4e29e6e commit 61ba4e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions args.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ module.exports = exports = function(yargs, version, isDocker) {
defaultDescription: "System time at process start or Network ID of forked blockchain if configured.",
demandOption: false
})
.option('chainId', {
group: 'Chain:',
type: 'number',
describe: "The Chain ID ganache-cli will use for `eth_chainId` RPC and the `CHAINID` opcode.",
defaultDescription: "For legacy reasons, the default is currently `1337` for `eth_chainId` RPC and `1` for the `CHAINID` opcode. This will be fixed in the next major version of ganache-cli and ganache-core!",
demandOption: false
})
.option('g', {
group: 'Chain:',
alias: 'gasPrice',
Expand Down
5 changes: 4 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ var options = {
logger: logger,
allowUnlimitedContractSize: argv.allowUnlimitedContractSize,
time: argv.t,
keepAliveTimeout: argv.keepAliveTimeout
keepAliveTimeout: argv.keepAliveTimeout,
_chainId: argv.chainId,
// gross!
_chainIdRpc: argv.chainId
}

var server = ganache.server(options);
Expand Down

0 comments on commit 61ba4e3

Please sign in to comment.