Fix ens enabled

This commit is contained in:
Anthony Laibe 2018-08-29 10:22:43 +01:00
parent b9944b18d2
commit deb433c0fb
4 changed files with 8 additions and 9 deletions

View File

@ -20,6 +20,7 @@ class RunCode {
if (varName === 'web3') { if (varName === 'web3') {
global.web3 = code; global.web3 = code;
} }
this.context["global"][varName] = code;
this.context[varName] = code; this.context[varName] = code;
} }

View File

@ -379,6 +379,7 @@ class CodeGenerator {
}, },
function getImports(web3Location, next) { function getImports(web3Location, next) {
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
code += "\nimport Web3 from '" + web3Location + "';\n";
code += "\nglobal.Web3 = Web3;\n"; code += "\nglobal.Web3 = Web3;\n";
code += "\n if (typeof web3 === 'undefined') {"; code += "\n if (typeof web3 === 'undefined') {";
@ -389,6 +390,7 @@ class CodeGenerator {
let providerCode = self.generateProvider(false); let providerCode = self.generateProvider(false);
code += providerCode; code += providerCode;
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n"; code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
code += "\nexport default web3;\n";
next(null, code); next(null, code);
} }
], cb); ], cb);

View File

@ -146,7 +146,7 @@ class ENS extends React.Component {
</FormGroup> </FormGroup>
</Form> </Form>
<h3>Register subdomain for embark</h3> <h3>Register subdomain for eth</h3>
<Form inline onKeyDown={(e) => this.checkEnter(e, this.registerSubDomain)}> <Form inline onKeyDown={(e) => this.checkEnter(e, this.registerSubDomain)}>
<FormGroup> <FormGroup>
{this.state.responseRegister && {this.state.responseRegister &&

View File

@ -21,8 +21,7 @@ class App extends React.Component {
error: null, error: null,
activeKey: 1, activeKey: 1,
whisperEnabled: false, whisperEnabled: false,
storageEnabled: false, storageEnabled: false
ensEnabled: false
}; };
} }
@ -56,10 +55,6 @@ class App extends React.Component {
}).catch(() => { }).catch(() => {
this.setState({storageEnabled: false}); this.setState({storageEnabled: false});
}); });
this.setState({
ensEnabled: EmbarkJS.Names.isAvailable()
});
}); });
} }
@ -76,6 +71,7 @@ class App extends React.Component {
} }
render() { render() {
const ensEnabled = EmbarkJS.Names.currentNameSystems && EmbarkJS.Names.isAvailable();
if (this.state.error) { if (this.state.error) {
return (<div> return (<div>
<div>Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:</div> <div>Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:</div>
@ -94,8 +90,8 @@ class App extends React.Component {
<Tab eventKey={3} title={this._renderStatus('P2P communication (Whisper)', this.state.whisperEnabled)}> <Tab eventKey={3} title={this._renderStatus('P2P communication (Whisper)', this.state.whisperEnabled)}>
<Whisper enabled={this.state.whisperEnabled}/> <Whisper enabled={this.state.whisperEnabled}/>
</Tab> </Tab>
<Tab eventKey={4} title={this._renderStatus('Naming (ENS)', this.state.ensEnabled)}> <Tab eventKey={4} title={this._renderStatus('Naming (ENS)', ensEnabled)}>
<ENS enabled={this.state.ensEnabled}/> <ENS enabled={ensEnabled}/>
</Tab> </Tab>
</Tabs> </Tabs>
</div>); </div>);