diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index 0474cec95..6f6e4e15e 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -1,7 +1,6 @@ const Web3 = require('web3'); const async = require('async'); const Provider = require('./provider.js'); -const http = require('http'); const BlockchainProcessLauncher = require('../processes/blockchainProcessLauncher'); const utils = require('../utils/utils'); const constants = require('../constants'); @@ -274,9 +273,17 @@ class Blockchain { Origin: origin }; } - - const req = http.get(options); - + let req; + // remove trailing api key from infura, ie rinkeby.infura.io/nmY8WtT4QfEwz2S7wTbl + if(options.host.indexOf('/') > -1){ + options.host = options.host.split('/')[0]; + } + if((self.contractsConfig.deployment.protocol || 'http') === 'https'){ + req = require('https').get(options); + }else{ + req = require('http').get(options); + } + req.on('error', (err) => { next(err); }); diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index 9a02f519e..ef9fb6514 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -137,7 +137,7 @@ class CodeGenerator { if (self.env === 'development') { web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true}); } else { - web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();'}); + web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true}); } }