Merge pull request #34 from embark-framework/feat/enable-regular-txs

feat(@embarkjs): Add console warning if using metamask and geth
This commit is contained in:
Iuri Matias 2018-12-21 12:49:38 -05:00 committed by GitHub
commit 0262ebe70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,11 +77,15 @@ Blockchain.connect = function(connectionList, opts, doneCb) {
}
}, function(_err, _connected) {
self.blockchainConnector.getAccounts((err, accounts) => {
if (opts.warnAboutMetamask) {
const currentProv = self.blockchainConnector.getCurrentProvider();
if (currentProv && currentProv.isMetaMask) {
console.warn("%cNote: Embark has detected you are in the development environment and using Metamask, please make sure Metamask is connected to your local node", "font-size: 2em");
const currentProv = self.blockchainConnector.getCurrentProvider();
if (opts.warnAboutMetamask && currentProv && currentProv.isMetaMask) {
// if we are using metamask, ask embark to turn on dev_funds
// embark will only do this if geth is our client and we are in
// dev mode
if(opts.blockchainClient === 'geth') {
console.warn("%cNote: There is a known issue with Geth that may cause transactions to get stuck when using Metamask. Please log in to the cockpit (http://localhost:8000/embark?enableRegularTxs=true) to enable a workaround. Once logged in, the workaround will automatically be enabled.", "font-size: 2em");
}
console.warn("%cNote: Embark has detected you are in the development environment and using Metamask, please make sure Metamask is connected to your local node", "font-size: 2em");
}
if (accounts) {
self.blockchainConnector.setDefaultAccount(accounts[0]);