(Feature) Support POA network
This commit is contained in:
Victor Baranov 2018-07-19 23:52:49 +03:00 committed by GitHub
commit fe2af9b9b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 287 additions and 36 deletions

View File

@ -643,6 +643,9 @@
"rinkeby": {
"message": "Rinkeby Test Network"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten Test Network"
},
@ -661,6 +664,9 @@
"connectingToRinkeby": {
"message": "Připojuji se k Rinkeby Test Network"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "Připojuji se k neznámé síti"
},

View File

@ -384,7 +384,7 @@
"infoHelp": {
"message": "Info & Hilfe"
},
"insufficientFunds": {
"insufficientFunds": {
"message": "Nicht genügend Guthaben."
},
"insufficientTokens": {
@ -572,7 +572,7 @@
"description": "Wähle diesen Dateityp um damit einen Account zu importieren"
},
"privateKeyWarning": {
"message": "Warnung: Niemals jemanden deinen Private Key mitteilen. Jeder der im Besitz deines Private Keys ist, kann jegliches Guthaben deines Accounts stehlen."
"message": "Warnung: Niemals jemanden deinen Private Key mitteilen. Jeder der im Besitz deines Private Keys ist, kann jegliches Guthaben deines Accounts stehlen."
},
"privateNetwork": {
"message": "Privates Netzwerk"
@ -631,6 +631,9 @@
"rinkeby": {
"message": "Rinkeby Testnetzwerk"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten Testnetzwerk"
},
@ -649,6 +652,9 @@
"connectingToRinkeby": {
"message": " Verbinde zum Rinkeby Testnetzwerk"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "Verbinde zu einem unbekanntem Netzwerk"
},

View File

@ -736,6 +736,9 @@
"ropsten": {
"message": "Ropsten Test Network"
},
"poa": {
"message": "POA Network"
},
"rpc": {
"message": "Custom RPC"
},
@ -754,6 +757,9 @@
"connectingToRinkeby": {
"message": "Connecting to Rinkeby Test Network"
},
"connectingToPOA": {
"message": "Connecting to POA Network"
},
"connectingToUnknown": {
"message": "Connecting to Unknown Network"
},

View File

@ -122,6 +122,9 @@
"connectingToRinkeby": {
"message": "Conectando a la red de test Rinkeby"
},
"connectingToPOA": {
"message": "Conectando a la red POA"
},
"connectingToUnknown": {
"message": "Conectando a una red desconocida"
},
@ -655,6 +658,9 @@
"rinkeby": {
"message": "Red privada Rinkeby"
},
"poa": {
"message": "Red POA"
},
"ropsten": {
"message": "Red privada Ropsten"
},

View File

@ -472,6 +472,9 @@
"rinkeby": {
"message": "Réseau de test Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Réseau de test Ropsten"
},

View File

@ -173,7 +173,7 @@
},
"decimal": {
"message": "दशमलव परिशुद्धता"
},
},
"defaultNetwork": {
"message": "ईथर लेनदेन के लिए डिफ़ॉल्ट नेटवर्क मुख्य नेट है।"
},
@ -601,6 +601,9 @@
"rinkeby": {
"message": "रिचीव टेस्ट नेटवर्क"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "रॉप्स्टेन टेस्ट नेटवर्क"
},
@ -800,7 +803,7 @@
},
"visitWebSite": {
"message": "हमारी वेब साइट पर जाएं"
},
},
"warning": {
"message": "चेतावनी"
},

View File

@ -601,6 +601,9 @@
"rinkeby": {
"message": "Rete di test Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Rete di test Ropsten"
},
@ -816,4 +819,4 @@
"youSign": {
"message": "Ti stai connettendo"
}
}
}

View File

@ -16,7 +16,7 @@
},
"addCustomToken": {
"message": "カスタムトークンを追加"
},
},
"addToken": {
"message": "トークンを追加"
},
@ -161,7 +161,7 @@
},
"decimal": {
"message": "小数点桁数"
},
},
"defaultNetwork": {
"message": "デフォルトのEther送受信ネットワークはメインネットです。"
},
@ -553,6 +553,9 @@
"rinkeby": {
"message": "Rinkebyテストネットワーク"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropstenテストネットワーク"
},

View File

@ -472,6 +472,9 @@
"rinkeby": {
"message": "Rinkeby 테스트넷"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten 테스트넷"
},

View File

@ -601,6 +601,9 @@
"rinkeby": {
"message": "Rinkeby testnetwerk"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten testnetwerk"
},

View File

@ -268,7 +268,7 @@
"message": "i-click ito",
"description": "tulad ng -i-click dito- para sa mas maraming impormasyon (kasama ng troubleTokenBalances)"
},
"hide": {
"hide": {
"message": "Itago"
},
"hideToken": {
@ -472,6 +472,9 @@
"rinkeby": {
"message": "Rinkeby Test Network"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten Test Network"
},

View File

@ -173,7 +173,7 @@
},
"decimal": {
"message": "Precisão em Decimais"
},
},
"defaultNetwork": {
"message": "A rede pré definida para transações em Ether é a Main Net."
},
@ -601,6 +601,9 @@
"rinkeby": {
"message": "Rede de Teste Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Rede de Teste Ropsten"
},
@ -800,7 +803,7 @@
},
"visitWebSite": {
"message": "Visite o nosso site"
},
},
"warning": {
"message": "Aviso"
},

View File

@ -637,6 +637,9 @@
"rinkeby": {
"message": "Тестовая сеть Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Тестовая сеть Ropsten"
},
@ -655,6 +658,9 @@
"connectingToRinkeby": {
"message": "Соединение с тестовой сетью Rinkeby"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "Соединение с неизвестной сетью"
},

View File

@ -173,7 +173,7 @@
},
"decimal": {
"message": "Decimalke natančnosti"
},
},
"defaultNetwork": {
"message": "Privzeto omrežje za transakcije je Main Net."
},
@ -601,6 +601,9 @@
"rinkeby": {
"message": "Testno omrežje Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Testno omrežje Ropsten"
},
@ -800,7 +803,7 @@
},
"visitWebSite": {
"message": "Obiščite našo spletno stran"
},
},
"warning": {
"message": "Opozorilo"
},

View File

@ -601,6 +601,9 @@
"rinkeby": {
"message": "เครือข่ายทดสอบ Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "เครือข่ายทดสอบ Ropsten"
},

View File

@ -643,6 +643,9 @@
"rinkeby": {
"message": "ரிங்கெப்ய டெஸ்ட் நெட்வொர்க்"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "ரொப்ஸ்டென் டெஸ்ட் நெட்வொர்க்"
},
@ -661,6 +664,9 @@
"connectingToRinkeby": {
"message": "ரிங்கெப்ய டெஸ்ட் நெட்வொர்க்குடன் இணைக்கிறது"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "தெரியாத நெட்வொர்க்குடன் இணைக்கிறது"
},

View File

@ -643,6 +643,9 @@
"rinkeby": {
"message": "Rinkeby Test Ağı"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten Test Ağı"
},
@ -661,6 +664,9 @@
"connectingToRinkeby": {
"message": "Rinkeby Test Ağına bağlanıyor"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "Bilinmeyen Ağa bağlanıyor"
},
@ -909,4 +915,4 @@
"youSign": {
"message": "İmzalıyorsunuz"
}
}
}

View File

@ -472,6 +472,9 @@
"rinkeby": {
"message": "Mạng thử nghiệm Rinkeby"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Mạng thử nghiệm Ropsten"
},

View File

@ -667,6 +667,9 @@
"rinkeby": {
"message": "Rinkeby 测试网络"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten 测试网络"
},
@ -685,6 +688,9 @@
"connectingToRinkeby": {
"message": "正在连接到Rinkeby测试网络"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "正在连接到未知网络"
},

View File

@ -643,6 +643,9 @@
"rinkeby": {
"message": "Rinkeby 測試網路"
},
"poa": {
"message": "[Not translated]"
},
"ropsten": {
"message": "Ropsten 測試網路"
},
@ -661,6 +664,9 @@
"connectingToRinkeby": {
"message": "連線到 Rinkeby 測試網路"
},
"connectingToPOA": {
"message": "[Not translated]"
},
"connectingToUnknown": {
"message": "連線到未知網路"
},

View File

@ -2,19 +2,22 @@ const ROPSTEN = 'ropsten'
const RINKEBY = 'rinkeby'
const KOVAN = 'kovan'
const MAINNET = 'mainnet'
const LOCALHOST = 'localhost'
const POA_SOKOL = 'sokol'
const POA = 'poa'
const LOCALHOST = 'localhost'
const MAINNET_CODE = 1
const ROPSTEN_CODE = 3
const RINKEYBY_CODE = 4
const KOVAN_CODE = 42
const POA_SOKOL_CODE = 77
const POA_CODE = 99
const ROPSTEN_DISPLAY_NAME = 'Ropsten'
const RINKEBY_DISPLAY_NAME = 'Rinkeby'
const KOVAN_DISPLAY_NAME = 'Kovan'
const POA_SOKOL_DISPLAY_NAME = 'Sokol'
const POA_DISPLAY_NAME = 'POA Network'
const MAINNET_DISPLAY_NAME = 'Main Ethereum Network'
module.exports = {
@ -22,16 +25,19 @@ module.exports = {
RINKEBY,
KOVAN,
MAINNET,
LOCALHOST,
POA_SOKOL,
POA,
LOCALHOST,
MAINNET_CODE,
ROPSTEN_CODE,
RINKEYBY_CODE,
KOVAN_CODE,
POA_SOKOL_CODE,
POA_CODE,
ROPSTEN_DISPLAY_NAME,
RINKEBY_DISPLAY_NAME,
KOVAN_DISPLAY_NAME,
MAINNET_DISPLAY_NAME,
POA_SOKOL_DISPLAY_NAME,
POA_DISPLAY_NAME,
}

View File

@ -16,8 +16,10 @@ const {
MAINNET,
LOCALHOST,
POA_SOKOL,
POA,
} = require('./enums')
const LOCALHOST_RPC_URL = 'http://localhost:8545'
const POA_RPC_URL = 'https://core.poa.network'
const SOKOL_RPC_URL = 'https://sokol.poa.network'
const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET]
@ -26,7 +28,7 @@ const METAMASK_DEBUG = process.env.METAMASK_DEBUG
const testMode = (METAMASK_DEBUG || env === 'test')
const defaultProviderConfig = {
type: testMode ? POA_SOKOL : MAINNET,
type: testMode ? POA_SOKOL : POA,
}
module.exports = class NetworkController extends EventEmitter {
@ -96,7 +98,7 @@ module.exports = class NetworkController extends EventEmitter {
async setProviderType (type) {
assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`)
assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST || type === POA_SOKOL, `NetworkController - Unknown rpc type "${type}"`)
assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST || type === POA_SOKOL || type === POA, `NetworkController - Unknown rpc type "${type}"`)
const providerConfig = { type }
this.providerConfig = providerConfig
}
@ -131,11 +133,13 @@ module.exports = class NetworkController extends EventEmitter {
if (isInfura) {
this._configureInfuraProvider(opts)
// other type-based rpc endpoints
} else if (type === POA) {
this._configureStandardProvider({ rpcUrl: POA_RPC_URL })
} else if (type === POA_SOKOL) {
this._configureStandardProvider({ rpcUrl: SOKOL_RPC_URL })
} else if (type === LOCALHOST) {
this._configureStandardProvider({ rpcUrl: LOCALHOST_RPC_URL })
// url-based rpc endpoints
} else if (type === POA_SOKOL) {
this._configureStandardProvider({ rpcUrl: SOKOL_RPC_URL })
} else if (type === 'rpc') {
this._configureStandardProvider({ rpcUrl: rpcTarget })
} else {

View File

@ -1,5 +1,6 @@
const {
POA_SOKOL,
POA,
ROPSTEN,
RINKEBY,
KOVAN,
@ -8,15 +9,18 @@ const {
ROPSTEN_CODE,
RINKEYBY_CODE,
KOVAN_CODE,
POA_CODE,
POA_SOKOL_DISPLAY_NAME,
ROPSTEN_DISPLAY_NAME,
RINKEBY_DISPLAY_NAME,
KOVAN_DISPLAY_NAME,
MAINNET_DISPLAY_NAME,
POA_DISPLAY_NAME,
} = require('./enums')
const networkToNameMap = {
[POA_SOKOL]: POA_SOKOL_DISPLAY_NAME,
[POA]: POA_SOKOL_DISPLAY_NAME,
[ROPSTEN]: ROPSTEN_DISPLAY_NAME,
[RINKEBY]: RINKEBY_DISPLAY_NAME,
[KOVAN]: KOVAN_DISPLAY_NAME,
@ -25,6 +29,7 @@ const networkToNameMap = {
[ROPSTEN_CODE]: ROPSTEN_DISPLAY_NAME,
[RINKEYBY_CODE]: RINKEBY_DISPLAY_NAME,
[KOVAN_CODE]: KOVAN_DISPLAY_NAME,
[POA_CODE]: POA_DISPLAY_NAME,
}
const getNetworkDisplayName = key => networkToNameMap[key]

View File

@ -33,6 +33,10 @@ function getBuyEthUrl ({ network, amount, address }) {
case '77':
url = 'https://faucet-sokol.herokuapp.com/'
break
case '99':
url = 'https://poa.network/'
break
}
return url
}

View File

@ -6,6 +6,7 @@ const {
KOVAN_RPC_URL,
RINKEBY_RPC_URL,
POA_SOKOL_RPC_URL,
POA_RPC_URL,
} = require('../controllers/network/enums')
/* The config-manager is a convenience object
@ -156,9 +157,6 @@ ConfigManager.prototype.getCurrentRpcAddress = function () {
case 'mainnet':
return MAINNET_RPC_URL
case 'sokol':
return POA_SOKOL_RPC_URL
case 'ropsten':
return ROPSTEN_RPC_URL
@ -168,6 +166,12 @@ ConfigManager.prototype.getCurrentRpcAddress = function () {
case 'rinkeby':
return RINKEBY_RPC_URL
case 'sokol':
return POA_SOKOL_RPC_URL
case 'poa':
return POA_RPC_URL
default:
return provider && provider.rpcTarget ? provider.rpcTarget : POA_SOKOL_RPC_URL
}

View File

@ -260,17 +260,17 @@ App.prototype.renderNetworkDropdown = function () {
h(
DropdownMenuItem,
{
key: 'main',
key: 'poa',
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }),
onClick: () => props.dispatch(actions.setProviderType('mainnet')),
onClick: () => props.dispatch(actions.setProviderType('poa')),
style: {
fontSize: '18px',
},
},
[
h('.menu-icon.diamond'),
'Main Ethereum Network',
providerType === 'mainnet' ? h('.check', '✓') : null,
h('.menu-icon.purple-square'),
'POA Network',
providerType === 'poa' ? h('.check', '✓') : null,
]
),
@ -291,6 +291,23 @@ App.prototype.renderNetworkDropdown = function () {
]
),
h(
DropdownMenuItem,
{
key: 'main',
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }),
onClick: () => props.dispatch(actions.setProviderType('mainnet')),
style: {
fontSize: '18px',
},
},
[
h('.menu-icon.diamond'),
'Main Ethereum Network',
providerType === 'mainnet' ? h('.check', '✓') : null,
]
),
h(
DropdownMenuItem,
{
@ -669,6 +686,8 @@ App.prototype.getNetworkName = function () {
name = 'Kovan Test Network'
} else if (providerName === 'rinkeby') {
name = 'Rinkeby Test Network'
} else if (providerName === 'poa') {
name = 'POA Network'
} else {
name = 'Unknown Private Network'
}

View File

@ -164,9 +164,13 @@ 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 ''
}
@ -176,7 +180,8 @@ class AccountDropdowns extends Component {
const { optionsMenuActive } = this.state
const isSokol = parseInt(network) === 77
const explorerStr = isSokol ? 'POA explorer' : 'Etherscan'
const isPOA = parseInt(network) === 99
const explorerStr = (isSokol || isPOA) ? 'POA explorer' : 'Etherscan'
return h(
Dropdown,
@ -201,7 +206,7 @@ class AccountDropdowns extends Component {
closeMenu: () => {},
onClick: () => {
const { selected, network } = this.props
const url = isSokol ? this.genPOAEplorerAccountLink(selected, network) : genAccountLink(selected, network)
const url = (isSokol || isPOA) ? this.genPOAEplorerAccountLink(selected, network) : genAccountLink(selected, network)
global.platform.openWindow({ url })
},
},

View File

@ -48,7 +48,8 @@ BuyButtonSubview.prototype.headerSubview = function () {
const { network } = props
const isLoading = props.isSubLoading
const isSokol = parseInt(network) === 77
const coinName = isSokol ? 'SPOA' : 'ETH'
const isPOA = parseInt(network) === 99
const coinName = isPOA ? 'POA' : isSokol ? 'SPOA' : 'ETH'
return (
h('.flex-column', {
@ -142,13 +143,14 @@ BuyButtonSubview.prototype.primarySubview = function () {
case '1':
return this.mainnetSubview()
// Ropsten, Rinkeby, Kovan
// Ropsten, Rinkeby, Kovan, Sokol, POA
case '3':
case '4':
case '42':
case '77':
case '99':
const networkName = getNetworkDisplayName(network)
const label = `${networkName} Test Faucet`
const label = network === '99' ? 'POA Network' : `${networkName} Test Faucet`
return (
h('div.flex-column', {
style: {

View File

@ -58,6 +58,9 @@ Network.prototype.render = function () {
} else if (providerName === 'rinkeby') {
hoverText = 'Rinkeby Test Network'
iconName = 'rinkeby-test-network'
} else if (providerName === 'poa') {
hoverText = 'POA Network'
iconName = 'poa-network'
} else {
hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
@ -122,6 +125,16 @@ Network.prototype.render = function () {
'Rinkeby Test Net'),
props.onClick && h('i.fa.fa-caret-down.fa-lg'),
])
case 'poa-network':
return h('.network-indicator', [
h('.menu-icon.purple-square'),
h('.network-name', {
style: {
color: '#5c34a2',
}},
'POA Network'),
props.onClick && h('i.fa.fa-caret-down.fa-lg'),
])
default:
return h('.network-indicator', [
h('i.fa.fa-question-circle.fa-lg', {

View File

@ -48,9 +48,13 @@ TransactionListItem.prototype.showRetryButton = function () {
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 ''
}
@ -65,7 +69,7 @@ TransactionListItem.prototype.render = function () {
let isLinkable = false
const numericNet = parseInt(network)
isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 4 || numericNet === 42 || numericNet === 77
isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 4 || numericNet === 42 || numericNet === 77 || numericNet === 99
var isMsg = ('msgParams' in transaction)
var isTx = ('txParams' in transaction)
@ -89,8 +93,9 @@ TransactionListItem.prototype.render = function () {
event.stopPropagation()
if (!transaction.hash || !isLinkable) return
const isSokol = numericNet === 77
const isPOA = numericNet === 99
let url
if (isSokol) {
if (isSokol || isPOA) {
url = poaExplorerTxLink(transaction.hash, numericNet)
} else {
url = explorerLink(transaction.hash, numericNet)

View File

@ -254,6 +254,11 @@ function currentProviderDisplay (metamaskState) {
value = 'Rinkeby Test Network'
break
case 'poa':
title = 'Current Network'
value = 'POA Network'
break
default:
title = 'Current RPC'
value = metamaskState.provider.rpcTarget

View File

@ -199,6 +199,10 @@ hr.horizontal-line {
background: #EBB33F;
}
.purple-square {
background: #5c34a2;
}
.pending-dot {
background: red;
left: 14px;

View File

@ -662,6 +662,9 @@ hr.horizontal-line {
.golden-square {
background: #ebb33f; }
.purple-square {
background: #5c34a2; }
.pending-dot {
background: #f00;
left: 14px;
@ -1184,6 +1187,10 @@ h2.page-subtitle {
border-color: #ebb33f; }
.network-component.pointer.rinkeby-test-network .menu-icon-circle div {
background-color: rgba(235, 179, 63, 0.7) !important; }
.network-component.pointer.poa-network {
border-color: #5c34a2; }
.network-component.pointer.poa-network .menu-icon-circle div {
background-color: #5c34a2 !important; }
.dropdown-menu-item .menu-icon-circle,
.dropdown-menu-item .menu-icon-circle--active {

View File

@ -104,7 +104,8 @@ function parseBalance (balance) {
// Its "formatted" property is what we generally use to render values.
function formatBalance (balance, decimalsToKeep, needsParse = true, network) {
const isSokol = parseInt(network) === 77
const coinName = isSokol ? 'SPOA' : 'ETH'
const isPOA = parseInt(network) === 99
const coinName = isPOA ? 'POA' : isSokol ? 'SPOA' : 'ETH'
var parsed = needsParse ? parseBalance(balance) : balance.split('.')
var beforeDecimal = parsed[0]
var afterDecimal = parsed[1]

View File

@ -14,6 +14,10 @@ module.exports = function (network) {
case 42: // kovan test net
prefix = 'kovan.'
break
case 99: // poa net
console.warn('Do not use etherscan for POA Network')
prefix = ''
break
default:
prefix = ''
}

View File

@ -231,6 +231,8 @@ class App extends Component {
name = this.context.t('connectingToRopsten')
} else if (providerName === 'rinkeby') {
name = this.context.t('connectingToRinkeby')
} else if (providerName === 'poa') {
name = this.context.t('connectingToPOA')
} else {
name = this.context.t('connectingToUnknown')
}
@ -252,6 +254,8 @@ class App extends Component {
name = this.context.t('kovan')
} else if (providerName === 'rinkeby') {
name = this.context.t('rinkeby')
} else if (providerName === 'poa') {
name = this.context.t('poa')
} else {
name = this.context.t('unknownNetwork')
}

View File

@ -144,10 +144,11 @@ BuyButtonSubview.prototype.primarySubview = function () {
case '1':
return this.mainnetSubview()
// Ropsten, Rinkeby, Kovan
// Ropsten, Rinkeby, Kovan, POA
case '3':
case '4':
case '42':
case '99':
const networkName = getNetworkDisplayName(network)
const label = `${networkName} ${this.context.t('testFaucet')}`
return (

View File

@ -200,6 +200,28 @@ NetworkDropdown.prototype.render = function () {
]
),
h(
DropdownMenuItem,
{
key: 'poa',
closeMenu: () => this.props.hideNetworkDropdown(),
onClick: () => props.setProviderType('poa'),
style: dropdownMenuItemStyle,
},
[
providerType === 'poa' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
h(NetworkDropdownIcon, {
backgroundColor: '#5c34a2', // $saffron
isSelected: providerType === 'poa',
}),
h('span.network-name-item', {
style: {
color: providerType === 'poa' ? '#ffffff' : '#9b9b9b',
},
}, this.context.t('poa')),
]
),
h(
DropdownMenuItem,
{
@ -264,6 +286,8 @@ NetworkDropdown.prototype.getNetworkName = function () {
name = this.context.t('kovan')
} else if (providerName === 'rinkeby') {
name = this.context.t('rinkeby')
} else if (providerName === 'poa') {
name = this.context.t('poa')
} else {
name = this.context.t('unknownNetwork')
}

View File

@ -23,6 +23,10 @@
&--rinkeby {
background-color: lighten($tulip-tree, 35%);
}
&--poa {
background-color: lighten(#5c34a2, 45%);
}
}
&__name {
@ -50,5 +54,9 @@
&--rinkeby {
background-color: $tulip-tree;
}
&--poa {
background-color: #5c34a2;
}
}
}

View File

@ -6,6 +6,7 @@ import {
ROPSTEN_CODE,
RINKEYBY_CODE,
KOVAN_CODE,
POA_CODE,
} from '../../../../app/scripts/controllers/network/enums'
const networkToClassHash = {
@ -13,6 +14,7 @@ const networkToClassHash = {
[ROPSTEN_CODE]: 'ropsten',
[RINKEYBY_CODE]: 'rinkeby',
[KOVAN_CODE]: 'kovan',
[POA_CODE]: 'poa',
}
export default class NetworkDisplay extends Component {

View File

@ -63,6 +63,9 @@ Network.prototype.render = function () {
} else if (providerName === 'rinkeby') {
hoverText = context.t('rinkeby')
iconName = 'rinkeby-test-network'
} else if (providerName === 'poa') {
hoverText = context.t('poa')
iconName = 'poa-network'
} else {
hoverText = context.t('unknownNetwork')
iconName = 'unknown-private-network'
@ -76,6 +79,7 @@ Network.prototype.render = function () {
'ropsten-test-network': providerName === 'ropsten' || parseInt(networkNumber) === 3,
'kovan-test-network': providerName === 'kovan',
'rinkeby-test-network': providerName === 'rinkeby',
'poa-network': providerName === 'poa',
}),
title: hoverText,
onClick: (event) => {
@ -122,6 +126,15 @@ Network.prototype.render = function () {
h('.network-name', context.t('rinkeby')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'),
])
case 'poa-network':
return h('.network-indicator', [
h(NetworkDropdownIcon, {
backgroundColor: '#5c34a2', // $tulip-tree
nonSelectBackgroundColor: '#5c34a2',
}),
h('.network-name', context.t('poa')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'),
])
default:
return h('.network-indicator', [
h('i.fa.fa-question-circle.fa-lg', {

View File

@ -142,6 +142,12 @@ class Settings extends Component {
color = '#ebb33f'
break
case 'poa':
title = this.context.t('currentNetwork')
value = this.context.t('poa')
color = '#5c34a2'
break
default:
title = this.context.t('currentRpc')
value = provider.rpcTarget

View File

@ -29,6 +29,10 @@
&.rinkeby-test-network .menu-icon-circle div {
background-color: rgba(235, 179, 63, .7) !important;
}
&.poa-network .menu-icon-circle div {
background-color: #5c34a2 !important;
}
}
.dropdown-menu-item {

View File

@ -213,6 +213,10 @@ hr.horizontal-line {
background: #ebb33f;
}
.purple-square {
background: #5c34a2;
}
.pending-dot {
background: $red;
left: 14px;

View File

@ -17,6 +17,12 @@ module.exports = function (address, network) {
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

View File

@ -14,6 +14,10 @@ module.exports = function (network) {
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 = ''
}