Add support for infura network hosts with api key.
Fix bug with non-development code generation.
This commit is contained in:
parent
b56def7c57
commit
ba66d763fe
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue