add network vs environment check + update livenet contract
This commit is contained in:
parent
bcfd61ff65
commit
9462466b7d
23
app/dapp.js
23
app/dapp.js
|
@ -3,6 +3,7 @@ import 'typeface-roboto'
|
||||||
import Toggle from 'react-toggle';
|
import Toggle from 'react-toggle';
|
||||||
import EmbarkJS from 'Embark/EmbarkJS';
|
import EmbarkJS from 'Embark/EmbarkJS';
|
||||||
import TestToken from 'Embark/contracts/TestToken';
|
import TestToken from 'Embark/contracts/TestToken';
|
||||||
|
import { startCase } from 'lodash';
|
||||||
import UsernameRegistrar from 'Embark/contracts/UsernameRegistrar';
|
import UsernameRegistrar from 'Embark/contracts/UsernameRegistrar';
|
||||||
import NameLookup from './components/ens/nameLookup';
|
import NameLookup from './components/ens/nameLookup';
|
||||||
import AdminMode from './components/AdminMode';
|
import AdminMode from './components/AdminMode';
|
||||||
|
@ -22,8 +23,17 @@ const symbols = {
|
||||||
'main': 'SNT'
|
'main': 'SNT'
|
||||||
}
|
}
|
||||||
|
|
||||||
const Web3RenderContent = ({ network, history, match }) => (
|
const isReady = (network, environment) => {
|
||||||
<Web3Render ready={network === 'ropsten'} network={'Ropsten'}>
|
if (!network || !environment) return;
|
||||||
|
const formattedNetwork = network.toLowerCase();
|
||||||
|
if (formattedNetwork.includes('main') || formattedNetwork.includes('live')) {
|
||||||
|
if (environment === 'livenet') return true
|
||||||
|
}
|
||||||
|
return formattedNetwork.inclues(environment.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
const Web3RenderContent = ({ network, history, match, environment }) => (
|
||||||
|
<Web3Render ready={isReady(network, environment)} network={startCase(environment)}>
|
||||||
<div>
|
<div>
|
||||||
<NameLookup {...{history, match}}/>
|
<NameLookup {...{history, match}}/>
|
||||||
<Hidden mdDown>
|
<Hidden mdDown>
|
||||||
|
@ -52,12 +62,15 @@ class App extends React.Component {
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
EmbarkJS.onReady((err) => {
|
EmbarkJS.onReady((err) => {
|
||||||
getNetworkType().then(network => { this.setState({ network })});
|
getNetworkType().then(network => {
|
||||||
|
const { environment } = EmbarkJS
|
||||||
|
this.setState({ network, environment })
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { admin, network } = this.state;
|
const { admin, network, environment } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HashRouter hashType="noslash">
|
<HashRouter hashType="noslash">
|
||||||
|
@ -71,7 +84,7 @@ class App extends React.Component {
|
||||||
|
|
||||||
<Route exact path="/" component={Welcome}/>
|
<Route exact path="/" component={Welcome}/>
|
||||||
<Route path="/search" render={({history, match}) => (
|
<Route path="/search" render={({history, match}) => (
|
||||||
<Web3RenderContent {...{history, match, network}} />
|
<Web3RenderContent {...{history, match, network, environment}} />
|
||||||
)}/>
|
)}/>
|
||||||
</div>
|
</div>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
|
|
|
@ -76,7 +76,7 @@ module.exports = {
|
||||||
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
|
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
|
||||||
},
|
},
|
||||||
"UsernameRegistrar": {
|
"UsernameRegistrar": {
|
||||||
"address": "0xDBf9038cf5Aaa030890790dB87E746E00Fc352b3"
|
"address": "0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49"
|
||||||
},
|
},
|
||||||
"MerkleProof": {
|
"MerkleProof": {
|
||||||
"address": "0x713ED9846463235df08D92B886938651105D3940"
|
"address": "0x713ED9846463235df08D92B886938651105D3940"
|
||||||
|
|
Loading…
Reference in New Issue