diff --git a/CHANGELOG.md b/CHANGELOG.md index 508d67fbd84..44bf5d49a06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/web3-eth/src/getNetworkType.js b/packages/web3-eth/src/getNetworkType.js index dea30b7679f..3be3a2027e6 100644 --- a/packages/web3-eth/src/getNetworkType.js +++ b/packages/web3-eth/src/getNetworkType.js @@ -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'; diff --git a/test/eth.net.getNetworkType.js b/test/eth.net.getNetworkType.js index 80ef08c6146..132f44056e3 100644 --- a/test/eth.net.getNetworkType.js +++ b/test/eth.net.getNetworkType.js @@ -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, @@ -27,7 +35,7 @@ var tests = [{ hash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3', id: 42, result: 'private' -}] +}]; describe('getNetworkType', function () { tests.forEach(function (test) {