Skip to content

Commit

Permalink
feat(Network): add support for net id of Goerli (web3#3095)
Browse files Browse the repository at this point in the history
* feat(Network): add support for net id of Goerli

* eth.net.getNetworkType test extended
  • Loading branch information
JayWelsh authored and nachomazzara committed Jun 4, 2020
1 parent 021faa5 commit f2ff293
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Released with 1.0.0-beta.37 code base.
### Added

- localStorage support detection added (#3031)
- getNetworkType method extended with Görli testnet (#3095)

### Fixed

Expand Down
4 changes: 4 additions & 0 deletions packages/web3-eth/src/getNetworkType.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ var getNetworkType = function (callback) {
id === 4) {
returnValue = 'rinkeby';
}
if (genesis.hash === '0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a' &&
id === 5) {
returnValue = 'goerli';
}
if (genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' &&
id === 42) {
returnValue = 'kovan';
Expand Down
22 changes: 15 additions & 7 deletions test/eth.net.getNetworkType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ var tests = [{
id: 1,
result: 'main'
},{
hash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
id: 1,
result: 'main'
hash: '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303',
id: 2,
result: 'morden'
},{
hash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
id: 1,
result: 'main'
hash: '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d',
id: 3,
result: 'ropsten'
},{
hash: '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177',
id: 4,
result: 'rinkeby'
},{
hash: '0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a',
id: 5,
result: 'goerli'
},{
hash: '0xffe56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
id: 42,
Expand All @@ -27,7 +35,7 @@ var tests = [{
hash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
id: 42,
result: 'private'
}]
}];

describe('getNetworkType', function () {
tests.forEach(function (test) {
Expand Down

0 comments on commit f2ff293

Please sign in to comment.