Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

feat: add chainId option #787

Merged
merged 1 commit into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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