mirror of https://github.com/embarklabs/embark.git
template correction to check for development environment and whether metamask is engaged and log that it is
Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
parent
0858092306
commit
90b42bccb2
|
@ -27,6 +27,7 @@ class CodeGenerator {
|
|||
this.storageConfig = options.storageConfig || {};
|
||||
this.communicationConfig = options.communicationConfig || {};
|
||||
this.namesystemConfig = options.namesystemConfig || {};
|
||||
this.env = options.env;
|
||||
// TODO: this should also be removed and use events instead
|
||||
this.contractsManager = options.contractsManager;
|
||||
this.plugins = options.plugins;
|
||||
|
@ -159,8 +160,12 @@ class CodeGenerator {
|
|||
web3Load = Templates.define_web3_simple({url: connection, done: 'done();'});
|
||||
} else {
|
||||
let connectionList = "[" + this.contractsConfig.dappConnection.map((x) => '"' + x + '"').join(',') + "]";
|
||||
if (self.env === 'development') {
|
||||
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true});
|
||||
} else {
|
||||
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();'});
|
||||
}
|
||||
}
|
||||
|
||||
result += Templates.do_when_loaded({block: web3Load});
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ __reduce(<%- connectionList %>,function(prev, value, next) {
|
|||
}, function(err, _result) {
|
||||
__getAccounts(function(err, accounts) {
|
||||
web3.eth.defaultAccount = accounts[0];
|
||||
<% if (warnAboutMetaMask) { %>
|
||||
if (web3.eth.currentProvider.isMetamask === true) {
|
||||
console.log("Note: Embark has detected you are in the development environment and using Metamask, please make it's connecting to your local node");
|
||||
}
|
||||
<% } %>
|
||||
<%- done %>
|
||||
});
|
||||
});
|
||||
|
|
|
@ -175,7 +175,8 @@ class Engine {
|
|||
storageConfig: self.config.storageConfig,
|
||||
namesystemConfig: self.config.namesystemConfig,
|
||||
communicationConfig: self.config.communicationConfig,
|
||||
events: self.events
|
||||
events: self.events,
|
||||
env: self.env
|
||||
});
|
||||
this.codeGenerator.listenToCommands();
|
||||
|
||||
|
|
Loading…
Reference in New Issue