Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ignoreFilesGlobs: ['**/node_modules/**']
}
if (ignoreFiles) {
ignoreFiles = ignoreFiles.split(',')
ignoreFiles = ignoreFiles.map(file => "**/" + file)
coverageSubproviderConfig.ignoreFilesGlobs = coverageSubproviderConfig.ignoreFilesGlobs.concat(ignoreFiles)
}
global.coverageSubprovider = new CoverageSubprovider(
artifactAdapter,
defaultFromAddress,
coverageSubproviderConfig
);
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${port}` }));
global.provider = provider;
// start pulling blocks
provider.start();
return provider
}
// filters
engine.addProvider(new FilterSubprovider())
// vm
engine.addProvider(new VmSubprovider())
// id mgmt
engine.addProvider(new HookedWalletSubprovider({
getAccounts: opts.getAccounts,
approveTx: opts.approveTx,
signTransaction: opts.signTransaction,
}))
// data source
engine.addProvider(new RpcSubprovider({
rpcUrl: opts.rpcUrl,
}))
// log new blocks
engine.on('block', function(block){
// console.log('================================')
console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex'))
// console.log('================================')
})
// start polling for blocks
engine.start()
return engine
}
eth_hashrate: '0x0',
eth_mining: false,
eth_syncing: true,
}))
// cache
engine.addProvider(new CacheSubprovider())
// filters - e.g.: eth_newBlockFilter
engine.addProvider(new FilterSubprovider())
// vm - e.g.: eth_call
engine.addProvider(new VmSubprovider())
// data source - e.g.: eth_getBalance
engine.addProvider(new RpcSubprovider({
rpcUrl: opts.rpcUrl || 'https://rpc.metamask.io/',
}))
engine.on('block', function(block){
console.log('================================')
console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex'))
console.log('================================')
})
// start polling for blocks
engine.start()
return engine
}
const QRProvider = require('./uportQRProvider.js');
const ProviderEngine = require('web3-provider-engine');
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js')
const Web3 = require('web3');
const engine = new ProviderEngine();
const web3 = new Web3(engine);
const qrImage = require('qr-image');
if (process.argv.length != 6) {
process.exit();
}
// Set web3
web3.eth.defaultAccount = '0xB42E70a3c6dd57003f4bFe7B06E370d21CDA8087'
engine.addProvider(new QRProvider());
engine.addProvider(new RpcSubprovider({
rpcUrl: configObject.ethereumNodeURL,
}));
configObject.web3 = web3;
engine.start();
let marketAddress = process.argv[4];
let marketHash = process.argv[2];
let outcomeIndex = new BigNumber(process.argv[3]);
let userPrice = new BigNumber(process.argv[5]).mul(new BigNumber('1e18'));
gnosis.contracts.marketFactory.getMarketsProcessed(
[marketHash],
configObject,
marketAddress
).then((response) => {
let globalResponse = {};
Uport.prototype.getUportProvider = function(rpcUrl) {
var engine = new ProviderEngine();
engine.addProvider(this.subprovider);
// default url for now
if (!rpcUrl) rpcUrl = INFURA_CONSENSYSNET;
// data source
var rpcSubprovider = new RpcSubprovider({
rpcUrl: rpcUrl
});
engine.addProvider(rpcSubprovider);
// start polling
engine.start();
engine.stop();
return engine;
}
const ProviderEngine = require('web3-provider-engine');
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js')
const Web3 = require('web3');
const engine = new ProviderEngine();
const web3 = new Web3(engine);
const filters = {
tags: "twitter, Twitter",
include_whitelisted_oracles: true,
oracle_addresses: "0x0"
};
// Set web3
web3.eth.defaultAccount = '0xB42E70a3c6dd57003f4bFe7B06E370d21CDA8087'
engine.addProvider(new RpcSubprovider({
rpcUrl: configObject.ethereumNodeURL,
}));
configObject.web3 = web3;
engine.start();
gnosis.config.initialize(
configObject
)
.then(
(config) => {
gnosis.api.getContracts({}, config)
.then(
(addresses) => {
let offChainOracles = addresses.data.offChainOracles.map(oracle => oracle.address);
gnosis.state.updateEventDescriptions(config, filters)
.then(
it('Should set the right localNodeProvider if the deployer is runned from coverage command', () => {
const provider = new ProviderEngine();
global.coverageSubprovider = new CoverageSubprovider();
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${config.alternativePort}` }));
global.provider = provider;
const deployer = new etherlime.JSONRPCPrivateKeyDeployer(config.randomPrivateKey, config.alternativeNodeUrl, defaultConfigs);
assert.deepEqual(global.provider._providers[1].rpcUrl, config.alternativeNodeUrl, "The stored provider url does not match the inputted one");
assert.deepEqual(global.provider._providers[1].rpcUrl, deployer.provider.connection.url, "The stored connection url does not match the inputted one");
})
it('Should set the right localNodeProvider if the deployer is runned from coverage command', () => {
const provider = new ProviderEngine();
global.coverageSubprovider = new CoverageSubprovider();
provider.addProvider(global.coverageSubprovider);
provider.addProvider(new RpcProvider({ rpcUrl: `http://localhost:${config.alternativePort}` }));
global.provider = provider;
const deployer = new etherlime.JSONRPCPrivateKeyDeployer(config.randomPrivateKey, config.alternativeNodeUrl, defaultConfigs);
assert.deepEqual(global.provider._providers[1].rpcUrl, config.alternativeNodeUrl, "The stored provider url does not match the inputted one");
assert.deepEqual(global.provider._providers[1].rpcUrl, deployer.provider.connection.url, "The stored connection url does not match the inputted one");
})
},
approveTransaction: function(txParams, cb) {
cb(null, true);
},
signTransaction: function(txData, cb) {
txData.gasPrice = parseInt(txData.gasPrice, 16);
txData.nonce = parseInt(txData.nonce, 16);
txData.gasLimit = txData.gas;
var tx = wallet.txutils.createContractTx(addr, txData);
var signed = wallet.signing.signTx(ks, pwDerivedKey, tx.tx, addr);
cb(null, signed);
}
}));
}
engine.addProvider(new RpcSubprovider({
rpcUrl: rpcUrl,
}));
engine.start();
this.web3 = web3;
this.address = addr;
}
export const transmuteWeb3 = (config: ITransmuteWeb3Config, experimental = false) => {
const engine = new ProviderEngine();
if (config.wallet) {
engine.addProvider(new WalletSubprovider(config.wallet, {}));
}
engine.addProvider(
new RpcSubprovider({
rpcUrl: config.providerUrl
})
);
const web3 = new Web3(engine);
engine.start();
return web3;
};