(Update) Add netId and branch name for DAI shard
This commit is contained in:
parent
55c3e383aa
commit
7573000edc
|
@ -3,7 +3,8 @@ import moment from 'moment'
|
|||
import Socials from './Socials'
|
||||
|
||||
const Footer = ({ netId }) => {
|
||||
const footerClassName = netId === '77' ? 'sokol' : ''
|
||||
const isTestnet = netId === '77' || netId === '79'
|
||||
const footerClassName = isTestnet ? 'sokol' : ''
|
||||
|
||||
return (
|
||||
<footer className={`footer ${footerClassName}`}>
|
||||
|
|
|
@ -10,10 +10,11 @@ import NavigationLinks from './NavigationLinks'
|
|||
import MobileMenuLinks from './MobileMenuLinks'
|
||||
|
||||
const Header = ({ netId, onChange, injectedWeb3, showMobileMenu, onMenuToggle, baseRootPath, navigationData }) => {
|
||||
const headerClassName = netId === '77' ? 'sokol' : ''
|
||||
const logoImageName = netId === '77' ? logoSokol : logoBase
|
||||
const menuIcon = netId === '77' ? menuIconSokol : menuIconBase
|
||||
const menuOpenIcon = netId === '77' ? menuOpenIconSokol : menuOpenIconBase
|
||||
const isTestnet = netId === '77' || netId === '79'
|
||||
const headerClassName = isTestnet ? 'sokol' : ''
|
||||
const logoImageName = isTestnet ? logoSokol : logoBase
|
||||
const menuIcon = isTestnet ? menuIconSokol : menuIconBase
|
||||
const menuOpenIcon = isTestnet ? menuOpenIconSokol : menuOpenIconBase
|
||||
|
||||
let select
|
||||
|
||||
|
|
|
@ -10,8 +10,10 @@ const styles = netId => {
|
|||
|
||||
switch (netId) {
|
||||
case '77':
|
||||
case '79':
|
||||
return sokol
|
||||
case '99':
|
||||
case '100':
|
||||
return core
|
||||
default:
|
||||
return {}
|
||||
|
|
|
@ -15,9 +15,15 @@ export default web3Config => {
|
|||
case '77':
|
||||
branch = 'sokol'
|
||||
break
|
||||
case '79':
|
||||
branch = 'dai-test'
|
||||
break
|
||||
case '99':
|
||||
branch = 'core'
|
||||
break
|
||||
case '100':
|
||||
branch = 'dai'
|
||||
break
|
||||
default:
|
||||
branch = 'core'
|
||||
break
|
||||
|
|
|
@ -27,8 +27,12 @@ function getBranch(netId) {
|
|||
switch (netId) {
|
||||
case '77':
|
||||
return 'sokol'
|
||||
case '79':
|
||||
return 'dai-test'
|
||||
case '99':
|
||||
return 'core'
|
||||
case '100':
|
||||
return 'dai'
|
||||
default:
|
||||
return 'core'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import Web3 from 'web3'
|
||||
const POA_CORE = { RPC_URL: 'https://core.poa.network', netIdName: 'CORE', netId: '99' }
|
||||
const POA_SOKOL = { RPC_URL: 'https://sokol.poa.network', netIdName: 'SOKOL', netId: '77' }
|
||||
const POA_DAI = { RPC_URL: 'https://dai.poa.network', netIdName: 'DAI', netId: '100' }
|
||||
const POA_DAI_TEST = { RPC_URL: 'https://dai-test.poa.network', netIdName: 'DAI-TEST', netId: '79' }
|
||||
let getWeb3 = () => {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// Wait for loading completion to avoid race conditions with web3 injection timing.
|
||||
|
@ -17,10 +19,18 @@ let getWeb3 = () => {
|
|||
let netIdName
|
||||
console.log('netId', netId)
|
||||
switch (netId) {
|
||||
case '100':
|
||||
netIdName = 'Dai'
|
||||
console.log('This is Dai', netId)
|
||||
break
|
||||
case '99':
|
||||
netIdName = 'Core'
|
||||
console.log('This is Core', netId)
|
||||
break
|
||||
case '79':
|
||||
netIdName = 'Dai-Test'
|
||||
console.log('This is Dai-Test', netId)
|
||||
break
|
||||
case '77':
|
||||
netIdName = 'Sokol'
|
||||
console.log('This is Sokol', netId)
|
||||
|
@ -51,7 +61,16 @@ let getWeb3 = () => {
|
|||
} else {
|
||||
// Fallback to localhost if no web3 injection.
|
||||
|
||||
const network = window.location.host.indexOf('sokol') !== -1 ? POA_SOKOL : POA_CORE
|
||||
let network
|
||||
if (window.location.host.indexOf('sokol') !== -1) {
|
||||
network = POA_SOKOL
|
||||
} else if (window.location.host.indexOf('dai-test') !== -1) {
|
||||
network = POA_DAI_TEST
|
||||
} else if (window.location.host.indexOf('dai') !== -1) {
|
||||
network = POA_DAI
|
||||
} else {
|
||||
network = POA_CORE
|
||||
}
|
||||
|
||||
document.title = `${network.netIdName} - POA validators dApp`
|
||||
const provider = new Web3.providers.HttpProvider(network.RPC_URL)
|
||||
|
@ -78,9 +97,15 @@ const setWeb3 = netId => {
|
|||
case '77':
|
||||
network = POA_SOKOL
|
||||
break
|
||||
case '79':
|
||||
network = POA_DAI_TEST
|
||||
break
|
||||
case '99':
|
||||
network = POA_CORE
|
||||
break
|
||||
case '100':
|
||||
network = POA_DAI
|
||||
break
|
||||
default:
|
||||
network = POA_CORE
|
||||
break
|
||||
|
|
|
@ -214,7 +214,8 @@ class AppMainRouter extends Component {
|
|||
)
|
||||
}
|
||||
getNetIdClass() {
|
||||
return this.state.netId === '77' ? 'sokol' : ''
|
||||
const netId = this.state.netId
|
||||
return netId === '77' || netId === '79' ? 'sokol' : ''
|
||||
}
|
||||
onSearch(term) {
|
||||
this.setState({ searchTerm: term.target.value.toLowerCase() })
|
||||
|
|
Loading…
Reference in New Issue