diff --git a/lib/core/modules/coderunner/runCode.js b/lib/core/modules/coderunner/runCode.js index 4dcac3a69..ce269d8b9 100644 --- a/lib/core/modules/coderunner/runCode.js +++ b/lib/core/modules/coderunner/runCode.js @@ -20,6 +20,7 @@ class RunCode { if (varName === 'web3') { global.web3 = code; } + this.context["global"][varName] = code; this.context[varName] = code; } diff --git a/lib/modules/code_generator/index.js b/lib/modules/code_generator/index.js index 966fc51cb..cd5dfdf81 100644 --- a/lib/modules/code_generator/index.js +++ b/lib/modules/code_generator/index.js @@ -379,6 +379,7 @@ class CodeGenerator { }, function getImports(web3Location, next) { web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes + code += "\nimport Web3 from '" + web3Location + "';\n"; code += "\nglobal.Web3 = Web3;\n"; code += "\n if (typeof web3 === 'undefined') {"; @@ -389,6 +390,7 @@ class CodeGenerator { let providerCode = self.generateProvider(false); code += providerCode; code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n"; + code += "\nexport default web3;\n"; next(null, code); } ], cb); diff --git a/templates/demo/app/components/ens.js b/templates/demo/app/components/ens.js index 64e5a4e2a..b5dd7c223 100644 --- a/templates/demo/app/components/ens.js +++ b/templates/demo/app/components/ens.js @@ -146,7 +146,7 @@ class ENS extends React.Component { -

Register subdomain for embark

+

Register subdomain for eth

this.checkEnter(e, this.registerSubDomain)}> {this.state.responseRegister && diff --git a/templates/demo/app/dapp.js b/templates/demo/app/dapp.js index 2117558b3..87f5c4a06 100644 --- a/templates/demo/app/dapp.js +++ b/templates/demo/app/dapp.js @@ -21,8 +21,7 @@ class App extends React.Component { error: null, activeKey: 1, whisperEnabled: false, - storageEnabled: false, - ensEnabled: false + storageEnabled: false }; } @@ -56,10 +55,6 @@ class App extends React.Component { }).catch(() => { this.setState({storageEnabled: false}); }); - - this.setState({ - ensEnabled: EmbarkJS.Names.isAvailable() - }); }); } @@ -76,6 +71,7 @@ class App extends React.Component { } render() { + const ensEnabled = EmbarkJS.Names.currentNameSystems && EmbarkJS.Names.isAvailable(); if (this.state.error) { return (
Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:
@@ -94,8 +90,8 @@ class App extends React.Component { - - + +
);