add eth-net-props dependency
This commit is contained in:
parent
ad2bce6ac5
commit
fa06c71beb
|
@ -1,5 +1,5 @@
|
|||
const extension = require('extensionizer')
|
||||
const explorerLink = require('etherscan-link').createExplorerLink
|
||||
const explorerLinks = require('eth-net-props').explorerLinks
|
||||
|
||||
class ExtensionPlatform {
|
||||
|
||||
|
@ -96,21 +96,16 @@ class ExtensionPlatform {
|
|||
}
|
||||
|
||||
_getExplorer (hash, networkId) {
|
||||
if (networkId === 99) {
|
||||
return {
|
||||
explorerName: 'POA explorer',
|
||||
url: `https://poaexplorer.com/txid/search/${hash}`,
|
||||
}
|
||||
} else if (networkId === 77) {
|
||||
return {
|
||||
explorerName: 'POA explorer',
|
||||
url: `https://sokol.poaexplorer.com/txid/search/${hash}`,
|
||||
}
|
||||
let explorerName
|
||||
if (networkId === 99 || networkId === 77) {
|
||||
explorerName = 'POA explorer'
|
||||
} else {
|
||||
return {
|
||||
explorerName: 'Etherscan',
|
||||
url: explorerLink(hash, networkId),
|
||||
}
|
||||
explorerName = 'Etherscan'
|
||||
}
|
||||
|
||||
return {
|
||||
explorerName: explorerName,
|
||||
url: explorerLinks.getExplorerTxLinkFor(hash, networkId),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ const Component = require('react').Component
|
|||
const PropTypes = require('prop-types')
|
||||
const h = require('react-hyperscript')
|
||||
const actions = require('../../../ui/app/actions')
|
||||
const genAccountLink = require('etherscan-link').createAccountLink
|
||||
const connect = require('react-redux').connect
|
||||
const Dropdown = require('./dropdown').Dropdown
|
||||
const DropdownMenuItem = require('./dropdown').DropdownMenuItem
|
||||
const Identicon = require('./identicon')
|
||||
const ethUtil = require('ethereumjs-util')
|
||||
const copyToClipboard = require('copy-to-clipboard')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
|
||||
class AccountDropdowns extends Component {
|
||||
constructor (props) {
|
||||
|
@ -161,19 +161,6 @@ class AccountDropdowns extends Component {
|
|||
)
|
||||
}
|
||||
|
||||
genPOAEplorerAccountLink (selected, network) {
|
||||
const isSokol = parseInt(network) === 77
|
||||
const isPOA = parseInt(network) === 99
|
||||
if (isSokol) {
|
||||
return `https://sokol.poaexplorer.com/address/search/${selected}`
|
||||
}
|
||||
if (isPOA) {
|
||||
return `https://poaexplorer.com/address/search/${selected}`
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
renderAccountOptions () {
|
||||
const { actions, network } = this.props
|
||||
const { optionsMenuActive } = this.state
|
||||
|
@ -207,7 +194,7 @@ class AccountDropdowns extends Component {
|
|||
closeMenu: () => {},
|
||||
onClick: () => {
|
||||
const { selected, network } = this.props
|
||||
const url = (isSokol || isPOA) ? this.genPOAEplorerAccountLink(selected, network) : genAccountLink(selected, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerAccountLinkFor(selected, network)
|
||||
global.platform.openWindow({ url })
|
||||
},
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ const Component = require('react').Component
|
|||
const h = require('react-hyperscript')
|
||||
const connect = require('react-redux').connect
|
||||
const vreme = new (require('vreme'))()
|
||||
const explorerLink = require('etherscan-link').createExplorerLink
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const actions = require('../../../ui/app/actions')
|
||||
const addressSummary = require('../util').addressSummary
|
||||
|
||||
|
@ -202,7 +202,7 @@ ShiftListItem.prototype.renderInfo = function () {
|
|||
}, 'Conversion in progress'),
|
||||
])
|
||||
case 'complete':
|
||||
var url = explorerLink(props.response.transaction, parseInt('1'))
|
||||
var url = ethNetProps.explorerLinks.getExplorerTxLinkFor(props.response.transaction, parseInt('1'))
|
||||
|
||||
return h('.flex-column.pointer', {
|
||||
style: {
|
||||
|
|
|
@ -2,7 +2,7 @@ const Component = require('react').Component
|
|||
const h = require('react-hyperscript')
|
||||
const inherits = require('util').inherits
|
||||
const Identicon = require('./identicon')
|
||||
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
|
||||
module.exports = TokenCell
|
||||
|
||||
|
@ -71,7 +71,7 @@ TokenCell.prototype.send = function (address, event) {
|
|||
}
|
||||
|
||||
TokenCell.prototype.view = function (address, userAddress, network, event) {
|
||||
const url = explorerLinkFor(address, userAddress, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerTokenLinkFor(address, userAddress, network)
|
||||
if (url) {
|
||||
navigateTo(url)
|
||||
}
|
||||
|
@ -81,16 +81,6 @@ function navigateTo (url) {
|
|||
global.platform.openWindow({ url })
|
||||
}
|
||||
|
||||
function explorerLinkFor (tokenAddress, address, network) {
|
||||
const prefix = prefixForNetwork(network)
|
||||
const POAnetwokIDs = [77, 99]
|
||||
if (POAnetwokIDs.includes(parseInt(network))) {
|
||||
return `https://${prefix}poaexplorer.com/address/search/${tokenAddress}`
|
||||
} else {
|
||||
return `https://${prefix}etherscan.io/token/${tokenAddress}?a=${address}`
|
||||
}
|
||||
}
|
||||
|
||||
function tokenFactoryFor (tokenAddress) {
|
||||
return `https://tokenfactory.surge.sh/#/token/${tokenAddress}`
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ const connect = require('react-redux').connect
|
|||
|
||||
const EthBalance = require('./eth-balance')
|
||||
const addressSummary = require('../util').addressSummary
|
||||
const explorerLink = require('etherscan-link').createExplorerLink
|
||||
const CopyButton = require('./copyButton')
|
||||
const vreme = new (require('vreme'))()
|
||||
const Tooltip = require('./tooltip')
|
||||
const numberToBN = require('number-to-bn')
|
||||
const actions = require('../../../ui/app/actions')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
|
||||
const TransactionIcon = require('./transaction-list-item-icon')
|
||||
const ShiftListItem = require('./shift-list-item')
|
||||
|
@ -46,19 +46,6 @@ TransactionListItem.prototype.showRetryButton = function () {
|
|||
return currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000
|
||||
}
|
||||
|
||||
const poaExplorerTxLink = (hash, network) => {
|
||||
const isSokol = network === 77
|
||||
const isPOA = network === 99
|
||||
if (isSokol) {
|
||||
return `https://sokol.poaexplorer.com/txid/search/${hash}`
|
||||
}
|
||||
if (isPOA) {
|
||||
return `https://poaexplorer.com/txid/search/${hash}`
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
TransactionListItem.prototype.render = function () {
|
||||
const { transaction, network, conversionRate, currentCurrency } = this.props
|
||||
const { status } = transaction
|
||||
|
@ -106,14 +93,7 @@ TransactionListItem.prototype.render = function () {
|
|||
}
|
||||
event.stopPropagation()
|
||||
if (!transaction.hash || !isLinkable) return
|
||||
const isSokol = numericNet === 77
|
||||
const isPOA = numericNet === 99
|
||||
let url
|
||||
if (isSokol || isPOA) {
|
||||
url = poaExplorerTxLink(transaction.hash, numericNet)
|
||||
} else {
|
||||
url = explorerLink(transaction.hash, numericNet)
|
||||
}
|
||||
const url = ethNetProps.explorerLinks.getExplorerTxLinkFor(transaction.hash, numericNet)
|
||||
global.platform.openWindow({ url })
|
||||
},
|
||||
style: {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
module.exports = function (network) {
|
||||
const net = parseInt(network)
|
||||
let prefix
|
||||
switch (net) {
|
||||
case 1: // main net
|
||||
prefix = ''
|
||||
break
|
||||
case 3: // ropsten test net
|
||||
prefix = 'ropsten.'
|
||||
break
|
||||
case 4: // rinkeby test net
|
||||
prefix = 'rinkeby.'
|
||||
break
|
||||
case 42: // kovan test net
|
||||
prefix = 'kovan.'
|
||||
break
|
||||
case 77: // Sokol test net
|
||||
prefix = 'sokol.'
|
||||
break
|
||||
case 99: // poa net
|
||||
console.warn('Do not use etherscan for POA Network')
|
||||
prefix = ''
|
||||
break
|
||||
default:
|
||||
prefix = ''
|
||||
}
|
||||
return prefix
|
||||
}
|
|
@ -5101,7 +5101,6 @@
|
|||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
|
||||
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"assertion-error": "^1.0.1",
|
||||
"check-error": "^1.0.1",
|
||||
|
@ -5170,8 +5169,7 @@
|
|||
"check-error": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||
"dev": true
|
||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
|
||||
},
|
||||
"checkpoint-store": {
|
||||
"version": "1.1.0",
|
||||
|
@ -6930,7 +6928,6 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"type-detect": "^4.0.0"
|
||||
}
|
||||
|
@ -8490,12 +8487,13 @@
|
|||
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-2.0.1.tgz",
|
||||
"integrity": "sha512-lxHZOQspexk3DaGj4RBbWy4C/qNOWRnxpaJzNnYD3WEmC8shcJ4tHs7Xv878rzvILfJnSFSCCiKQhng1m80oBQ==",
|
||||
"requires": {
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethereumjs-abi": {
|
||||
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
|
||||
"requires": {
|
||||
"bn.js": "^4.10.0",
|
||||
"ethereumjs-util": "^5.0.0"
|
||||
|
@ -8751,6 +8749,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"eth-net-props": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.0.tgz",
|
||||
"integrity": "sha512-3LCXji5dFr2fY295WyUX+HJ9dYvKOg7SIPlshorVnNleuNKYTRTV3PYVsiRs/vdp2Y1TZRXig/gyCYzVxFV8vg==",
|
||||
"requires": {
|
||||
"chai": "^4.1.2"
|
||||
}
|
||||
},
|
||||
"eth-phishing-detect": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/eth-phishing-detect/-/eth-phishing-detect-1.1.12.tgz",
|
||||
|
@ -8773,12 +8779,13 @@
|
|||
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
|
||||
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
|
||||
"requires": {
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethereumjs-abi": {
|
||||
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
|
||||
"requires": {
|
||||
"bn.js": "^4.10.0",
|
||||
"ethereumjs-util": "^5.0.0"
|
||||
|
@ -8820,12 +8827,14 @@
|
|||
"integrity": "sha512-lxHZOQspexk3DaGj4RBbWy4C/qNOWRnxpaJzNnYD3WEmC8shcJ4tHs7Xv878rzvILfJnSFSCCiKQhng1m80oBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethereumjs-abi": {
|
||||
"version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7",
|
||||
"from": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "^4.10.0",
|
||||
"ethereumjs-util": "^5.0.0"
|
||||
|
@ -8837,6 +8846,7 @@
|
|||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz",
|
||||
"integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "^4.11.0",
|
||||
"create-hash": "^1.1.2",
|
||||
|
@ -9372,11 +9382,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"etherscan-link": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/etherscan-link/-/etherscan-link-1.0.2.tgz",
|
||||
"integrity": "sha1-x7kULEtZUJsziiBLYyiupA3Txk4="
|
||||
},
|
||||
"ethjs": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ethjs/-/ethjs-0.4.0.tgz",
|
||||
|
@ -12767,8 +12772,7 @@
|
|||
"get-func-name": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||
"dev": true
|
||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
|
||||
},
|
||||
"get-own-enumerable-property-symbols": {
|
||||
"version": "2.0.1",
|
||||
|
@ -23506,8 +23510,7 @@
|
|||
"pathval": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
||||
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
|
||||
"dev": true
|
||||
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
|
||||
},
|
||||
"pause-stream": {
|
||||
"version": "0.0.11",
|
||||
|
@ -31000,8 +31003,7 @@
|
|||
"type-detect": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.5.tgz",
|
||||
"integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-N9IvkQslUGYGC24RkJk1ba99foK6TkwC2FHAEBlQFBP0RxQZS8ZpJuAZcwiY/w9ZJHFQb1aOXBI60OdxhTrwEQ=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.15",
|
||||
|
@ -31021,6 +31023,7 @@
|
|||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
|
||||
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
|
@ -32044,6 +32047,7 @@
|
|||
"resolved": "https://registry.npmjs.org/web3/-/web3-0.20.3.tgz",
|
||||
"integrity": "sha1-yqRDc9yIFayHZ73ba6cwc5ZMqos=",
|
||||
"requires": {
|
||||
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
||||
"crypto-js": "^3.1.4",
|
||||
"utf8": "^2.1.1",
|
||||
"xhr2": "*",
|
||||
|
@ -32052,7 +32056,7 @@
|
|||
"dependencies": {
|
||||
"bignumber.js": {
|
||||
"version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
||||
"from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934"
|
||||
"from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -32551,7 +32555,8 @@
|
|||
"dev": true,
|
||||
"requires": {
|
||||
"underscore": "1.8.3",
|
||||
"web3-core-helpers": "1.0.0-beta.34"
|
||||
"web3-core-helpers": "1.0.0-beta.34",
|
||||
"websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
|
||||
},
|
||||
"dependencies": {
|
||||
"underscore": {
|
||||
|
@ -32562,7 +32567,8 @@
|
|||
},
|
||||
"websocket": {
|
||||
"version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2",
|
||||
"from": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2",
|
||||
"from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^2.2.0",
|
||||
"nan": "^2.3.3",
|
||||
|
@ -33918,7 +33924,8 @@
|
|||
"yaeti": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz",
|
||||
"integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc="
|
||||
"integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=",
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "2.1.2",
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
"eth-json-rpc-filters": "^1.2.6",
|
||||
"eth-json-rpc-infura": "^3.0.0",
|
||||
"eth-method-registry": "^1.0.0",
|
||||
"eth-net-props": "^1.0.0",
|
||||
"eth-phishing-detect": "^1.1.4",
|
||||
"eth-query": "^2.1.2",
|
||||
"eth-sig-util": "^1.4.2",
|
||||
|
@ -118,7 +119,6 @@
|
|||
"ethereumjs-tx": "^1.3.0",
|
||||
"ethereumjs-util": "github:ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9",
|
||||
"ethereumjs-wallet": "^0.6.0",
|
||||
"etherscan-link": "^1.0.2",
|
||||
"ethjs": "^0.4.0",
|
||||
"ethjs-contract": "^0.2.3",
|
||||
"ethjs-ens": "^2.0.0",
|
||||
|
|
|
@ -2,7 +2,7 @@ const Component = require('react').Component
|
|||
const PropTypes = require('prop-types')
|
||||
const h = require('react-hyperscript')
|
||||
const actions = require('../actions')
|
||||
const genAccountLink = require('etherscan-link').createAccountLink
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const connect = require('react-redux').connect
|
||||
const Dropdown = require('./dropdown').Dropdown
|
||||
const DropdownMenuItem = require('./dropdown').DropdownMenuItem
|
||||
|
@ -188,7 +188,7 @@ class AccountDropdowns extends Component {
|
|||
closeMenu: () => {},
|
||||
onClick: () => {
|
||||
const { selected, network } = this.props
|
||||
const url = genAccountLink(selected, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerAccountLinkFor(selected, network)
|
||||
global.platform.openWindow({ url })
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ const Component = require('react').Component
|
|||
const PropTypes = require('prop-types')
|
||||
const h = require('react-hyperscript')
|
||||
const actions = require('../../../actions')
|
||||
const genAccountLink = require('../../../../lib/account-link.js')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const connect = require('react-redux').connect
|
||||
const Dropdown = require('./dropdown').Dropdown
|
||||
const DropdownMenuItem = require('./dropdown').DropdownMenuItem
|
||||
|
@ -295,7 +295,7 @@ class AccountDropdowns extends Component {
|
|||
closeMenu: () => {},
|
||||
onClick: () => {
|
||||
const { selected, network } = this.props
|
||||
const url = genAccountLink(selected, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerAccountLinkFor(selected, network)
|
||||
global.platform.openWindow({ url })
|
||||
},
|
||||
style: Object.assign(
|
||||
|
|
|
@ -4,7 +4,7 @@ const h = require('react-hyperscript')
|
|||
const inherits = require('util').inherits
|
||||
const connect = require('react-redux').connect
|
||||
const actions = require('../../actions')
|
||||
const genAccountLink = require('etherscan-link').createAccountLink
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const copyToClipboard = require('copy-to-clipboard')
|
||||
const { Menu, Item, CloseArea } = require('./components/menu')
|
||||
|
||||
|
@ -67,7 +67,7 @@ TokenMenuDropdown.prototype.render = function () {
|
|||
h(Item, {
|
||||
onClick: (e) => {
|
||||
e.stopPropagation()
|
||||
const url = genAccountLink(this.props.token.address, this.props.network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerAccountLinkFor(this.props.token.address, this.props.network)
|
||||
global.platform.openWindow({ url })
|
||||
this.props.onClose()
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ const connect = require('react-redux').connect
|
|||
const actions = require('../../actions')
|
||||
const AccountModalContainer = require('./account-modal-container')
|
||||
const { getSelectedIdentity } = require('../../selectors')
|
||||
const genAccountLink = require('../../../lib/account-link.js')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const QrView = require('../qr-code')
|
||||
const EditableLabel = require('../editable-label')
|
||||
|
||||
|
@ -69,7 +69,7 @@ AccountDetailsModal.prototype.render = function () {
|
|||
h('div.account-modal-divider'),
|
||||
|
||||
h('button.btn-primary.account-modal__button', {
|
||||
onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }),
|
||||
onClick: () => global.platform.openWindow({ url: ethNetProps.explorerLinks.getExplorerAccountLinkFor(address, network) }),
|
||||
}, this.context.t('etherscanView')),
|
||||
|
||||
// Holding on redesign for Export Private Key functionality
|
||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||
import Button from '../../button'
|
||||
import { addressSummary } from '../../../util'
|
||||
import Identicon from '../../identicon'
|
||||
import genAccountLink from '../../../../lib/account-link'
|
||||
import ethNetProps from 'eth-net-props'
|
||||
|
||||
class ConfirmRemoveAccount extends Component {
|
||||
static propTypes = {
|
||||
|
@ -43,7 +43,7 @@ class ConfirmRemoveAccount extends Component {
|
|||
<div className="modal-container__account__link">
|
||||
<a
|
||||
className=""
|
||||
href={genAccountLink(identity.address, this.props.network)}
|
||||
href={ethNetProps.explorerLinks.getExplorerAccountLinkFor(identity.address, this.props.network)}
|
||||
target={'_blank'}
|
||||
title={this.context.t('etherscanView')}
|
||||
>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { Component } = require('react')
|
||||
const PropTypes = require('prop-types')
|
||||
const h = require('react-hyperscript')
|
||||
const genAccountLink = require('../../../../../lib/account-link.js')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
|
||||
class AccountList extends Component {
|
||||
constructor (props, context) {
|
||||
|
@ -45,7 +45,7 @@ class AccountList extends Component {
|
|||
h(
|
||||
'a.hw-account-list__item__link',
|
||||
{
|
||||
href: genAccountLink(a.address, this.props.network),
|
||||
href: ethNetProps.explorerLinks.getExplorerAccountLinkFor(a.address, this.props.network),
|
||||
target: '_blank',
|
||||
title: this.context.t('etherscanView'),
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@ const PropTypes = require('prop-types')
|
|||
const h = require('react-hyperscript')
|
||||
const connect = require('react-redux').connect
|
||||
const vreme = new (require('vreme'))()
|
||||
const explorerLink = require('etherscan-link').createExplorerLink
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const actions = require('../actions')
|
||||
const addressSummary = require('../util').addressSummary
|
||||
|
||||
|
@ -175,7 +175,7 @@ ShiftListItem.prototype.renderInfo = function () {
|
|||
}, formatDate(props.time)),
|
||||
])
|
||||
case 'complete':
|
||||
var url = explorerLink(props.response.transaction, parseInt('1'))
|
||||
var url = ethNetProps.explorerLinks.getExplorerTxLinkFor(props.response.transaction, parseInt('1'))
|
||||
|
||||
return h('.flex-column.pointer', {
|
||||
style: {
|
||||
|
|
|
@ -3,7 +3,7 @@ const h = require('react-hyperscript')
|
|||
const inherits = require('util').inherits
|
||||
const connect = require('react-redux').connect
|
||||
const Identicon = require('./identicon')
|
||||
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const selectors = require('../selectors')
|
||||
const actions = require('../actions')
|
||||
const { conversionUtil, multiplyCurrencies } = require('../conversion-util')
|
||||
|
@ -143,7 +143,7 @@ TokenCell.prototype.send = function (address, event) {
|
|||
}
|
||||
|
||||
TokenCell.prototype.view = function (address, userAddress, network, event) {
|
||||
const url = etherscanLinkFor(address, userAddress, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerTokenLinkFor(address, userAddress, network)
|
||||
if (url) {
|
||||
navigateTo(url)
|
||||
}
|
||||
|
@ -153,11 +153,6 @@ function navigateTo (url) {
|
|||
global.platform.openWindow({ url })
|
||||
}
|
||||
|
||||
function etherscanLinkFor (tokenAddress, address, network) {
|
||||
const prefix = prefixForNetwork(network)
|
||||
return `https://${prefix}etherscan.io/token/${tokenAddress}?a=${address}`
|
||||
}
|
||||
|
||||
function tokenFactoryFor (tokenAddress) {
|
||||
return `https://tokenfactory.surge.sh/#/token/${tokenAddress}`
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ const PropTypes = require('prop-types')
|
|||
const connect = require('react-redux').connect
|
||||
const h = require('react-hyperscript')
|
||||
const inherits = require('util').inherits
|
||||
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
|
||||
const ethNetProps = require('eth-net-props')
|
||||
const selectors = require('../selectors')
|
||||
const TxListItem = require('./tx-list-item')
|
||||
const ShiftListItem = require('./shift-list-item')
|
||||
|
@ -139,7 +139,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
|
|||
}
|
||||
|
||||
TxList.prototype.view = function (txHash, network) {
|
||||
const url = etherscanLinkFor(txHash, network)
|
||||
const url = ethNetProps.explorerLinks.getExplorerTxLinkFor(txHash, network)
|
||||
if (url) {
|
||||
navigateTo(url)
|
||||
}
|
||||
|
@ -148,8 +148,3 @@ TxList.prototype.view = function (txHash, network) {
|
|||
function navigateTo (url) {
|
||||
global.platform.openWindow({ url })
|
||||
}
|
||||
|
||||
function etherscanLinkFor (txHash, network) {
|
||||
const prefix = prefixForNetwork(network)
|
||||
return `https://${prefix}etherscan.io/tx/${txHash}`
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
module.exports = function (address, network) {
|
||||
const net = parseInt(network)
|
||||
let link
|
||||
switch (net) {
|
||||
case 1: // main net
|
||||
link = `https://etherscan.io/address/${address}`
|
||||
break
|
||||
case 2: // morden test net
|
||||
link = `https://morden.etherscan.io/address/${address}`
|
||||
break
|
||||
case 3: // ropsten test net
|
||||
link = `https://ropsten.etherscan.io/address/${address}`
|
||||
break
|
||||
case 4: // rinkeby test net
|
||||
link = `https://rinkeby.etherscan.io/address/${address}`
|
||||
break
|
||||
case 42: // kovan test net
|
||||
link = `https://kovan.etherscan.io/address/${address}`
|
||||
break
|
||||
case 77: // sokol test net
|
||||
link = `https://sokol.poaexplorer.com/account/${address}`
|
||||
break
|
||||
case 99: // poa net
|
||||
link = `https://poaexplorer.com/account/${address}`
|
||||
break
|
||||
default:
|
||||
link = ''
|
||||
break
|
||||
}
|
||||
|
||||
return link
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
module.exports = function (network) {
|
||||
const net = parseInt(network)
|
||||
let prefix
|
||||
switch (net) {
|
||||
case 1: // main net
|
||||
prefix = ''
|
||||
break
|
||||
case 3: // ropsten test net
|
||||
prefix = 'ropsten.'
|
||||
break
|
||||
case 4: // rinkeby test net
|
||||
prefix = 'rinkeby.'
|
||||
break
|
||||
case 42: // kovan test net
|
||||
prefix = 'kovan.'
|
||||
break
|
||||
case 99: // poa net
|
||||
console.warn('Do not use etherscan for POA Netowrk')
|
||||
prefix = ''
|
||||
break
|
||||
default:
|
||||
prefix = ''
|
||||
}
|
||||
return prefix
|
||||
}
|
Loading…
Reference in New Issue