Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
matchesNetwork: async function(network_id, network_options, callback) {
const provider = Provider.create(network_options);
const first = network_id + "";
const second = network_options.network_id + "";
if (first === second) return callback(null, true);
const isFirstANumber = isNaN(parseInt(network_id)) === false;
const isSecondANumber =
isNaN(parseInt(network_options.network_id)) === false;
// If both network ids are numbers, then they don't match, and we should quit.
if (isFirstANumber && isSecondANumber) return callback(null, false);
const interfaceAdapter = new InterfaceAdapter();
const web3 = new Web3Shim({
provider,
function setOuterConfigKeys(config, api, id){
try {
config.network_id = id;
config.port = api.port;
config.host = api.host;
config.provider = TruffleProvider.create(config);
} catch (err){}
}
get() {
if (!configObject.network) {
return null;
}
const options = configObject.network_config;
options.verboseRpc = configObject.verboseRpc;
return Provider.create(options);
},
set() {
public getProvider() {
if (!this._cachedProvider) {
const web3Provider = this.eth.currentProvider;
const truffleProviderOptions = {
provider: () => {
return web3Provider;
},
};
this._cachedProvider = truffleProvider.create(truffleProviderOptions);
}
return this._cachedProvider;
}
(network_name, finished) => {
const provider = Provider.create(options.networks[network_name]);
BlockchainUtils.asURI(provider, (err, uri) => {
if (err) {
result.failed.push(network_name);
} else {
result.uris[network_name] = uri;
}
finished();
});
},
error => {