Merge pull request #284 from poanetwork/blockscout

(Feature) Blockscout links
This commit is contained in:
Victor Baranov 2019-06-06 21:43:03 +03:00 committed by GitHub
commit 9f1849a725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 61 deletions

View File

@ -1,12 +1,6 @@
const extension = require('extensionizer')
const explorerLinks = require('eth-net-props').explorerLinks
const { capitalizeFirstLetter } = require('../lib/util')
const {
POA_CODE,
DAI_CODE,
POA_SOKOL_CODE,
GOERLI_TESTNET_CODE,
CLASSIC_CODE } = require('../controllers/network/enums')
class ExtensionPlatform {
@ -130,17 +124,7 @@ class ExtensionPlatform {
}
_getExplorer (hash, networkId) {
let explorerName
if (networkId === POA_CODE ||
networkId === DAI_CODE ||
networkId === POA_SOKOL_CODE ||
networkId === GOERLI_TESTNET_CODE ||
networkId === CLASSIC_CODE
) {
explorerName = 'BlockScout'
} else {
explorerName = 'Etherscan'
}
const explorerName = 'BlockScout'
return {
explorerName: explorerName,

40
package-lock.json generated
View File

@ -10823,9 +10823,9 @@
}
},
"eth-net-props": {
"version": "1.0.22",
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.22.tgz",
"integrity": "sha512-xXXWwbnP60y/3dyRh3PgOXOna2Kd0kgFQle0tZ/1z2uavw96IEgEgQ30y2seb4lp/dbsbm9VrLnuUYeQP5Focg==",
"version": "1.0.23",
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.23.tgz",
"integrity": "sha512-hKed33ejnow+zleH8IVDWGwFrNnld5lKJ9D6trM9H7NtFen8j9n4q1ihK7pod0/0nxfQe0axnqrzb5gvbmvT+A==",
"requires": {
"chai": "^4.1.2"
}
@ -16390,23 +16390,6 @@
"requires": {
"bn.js": "^4.11.8",
"ethereumjs-util": "^6.0.0"
},
"dependencies": {
"ethereumjs-util": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz",
"integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==",
"dev": true,
"requires": {
"bn.js": "^4.11.0",
"create-hash": "^1.1.2",
"ethjs-util": "0.1.6",
"keccak": "^1.0.2",
"rlp": "^2.0.0",
"safe-buffer": "^5.1.1",
"secp256k1": "^3.0.1"
}
}
}
}
}
@ -19860,23 +19843,6 @@
"requires": {
"bn.js": "^4.11.8",
"ethereumjs-util": "^6.0.0"
},
"dependencies": {
"ethereumjs-util": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz",
"integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==",
"dev": true,
"requires": {
"bn.js": "^4.11.0",
"create-hash": "^1.1.2",
"ethjs-util": "0.1.6",
"keccak": "^1.0.2",
"rlp": "^2.0.0",
"safe-buffer": "^5.1.1",
"secp256k1": "^3.0.1"
}
}
}
}
}

View File

@ -118,7 +118,7 @@
"eth-keychain-controller": "github:vbaranov/KeyringController#simple-address",
"eth-ledger-bridge-keyring": "github:vbaranov/eth-ledger-bridge-keyring#0.1.0-clear-accounts-flag",
"eth-method-registry": "^1.0.0",
"eth-net-props": "^1.0.22",
"eth-net-props": "^1.0.23",
"eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2",
"eth-sig-util": "^2.0.2",

View File

@ -65,18 +65,18 @@ const addCustomToken = async (f, account1, account2) => {
assert.equal(await tokenBalance.getText(), token.supply + ' ' + token.ticker, 'balance is incorrect or not displayed')
})
it('click to token opens the etherscan', async () => {
it('click to token opens the Blockscout', async () => {
const link = await f.waitUntilShowUp(screens.main.tokens.token)
await link.click()
await f.delay(2000)
const allHandles = await f.driver.getAllWindowHandles()
console.log('allHandles.length ' + allHandles.length)
assert.equal(allHandles.length, 2, 'etherscan wasn\'t opened')
assert.equal(allHandles.length, 2, 'blockscout wasn\'t opened')
await f.switchToLastPage()
await f.delay(2000)
const title = await f.waitUntilCurrentUrl()
console.log(title)
assert.equal(title.includes('https://etherscan.io/token/'), true, 'etherscan wasn\'t opened')
assert.equal(title.includes('https://blockscout.com/poa/sokol/tokens/'), true, 'blockscout wasn\'t opened')
await f.switchToFirstPage()
})
})
@ -88,7 +88,7 @@ const addCustomToken = async (f, account1, account2) => {
await menu.click()
})
it('link \'View on blockexplorer...\' leads to correct page ', async () => {
it('link \'View on Blockscout...\' leads to correct page ', async () => {
const menu = await f.waitUntilShowUp(menus.token.view)
assert.notEqual(menu, false, 'item isn\'t displayed')
assert.equal(await menu.getText(), menus.token.viewText, 'incorrect name')
@ -96,12 +96,12 @@ const addCustomToken = async (f, account1, account2) => {
await f.delay(2000)
const allHandles = await f.driver.getAllWindowHandles()
console.log('allHandles.length ' + allHandles.length)
assert.equal(allHandles.length, 3, 'etherscan wasn\'t opened')
assert.equal(allHandles.length, 3, 'blockscout wasn\'t opened')
await f.switchToLastPage()
const title = await f.waitUntilCurrentUrl()
console.log(title)
assert.equal(title.includes('https://etherscan.io/token/'), true, 'etherscan wasn\'t opened')
assert.equal(title.includes('https://blockscout.com/poa/sokol/tokens/'), true, 'blockscout wasn\'t opened')
await f.switchToFirstPage()
})