Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
provider: () => {
if (!testProviderStarted) {
// Within this function to not start the provider until it's needed
testProvider.addProvider(
new WebsocketProvider({ rpcUrl: 'http://localhost:7545' })
);
testProvider.start(err => {
testProviderStarted = true;
if (err !== undefined) {
// eslint-disable-next-line no-console
console.log('Failed to start provider', err);
process.exit(1);
}
});
}
return testProvider;
},
network_id: '*'
isVerbose: true,
ignoreFilesGlobs: [
// Proxies
'**/*Proxy.sol',
// Test contracts
'**/test/*.sol',
// Interfaces
'**/interfaces/*.sol',
],
})
coverageProvider.addProvider(global.coverageSubprovider)
coverageProvider.addProvider(
new WebsocketSubprovider({
rpcUrl: `http://localhost:${defaultConfig.port}`,
debug: false,
})
)
coverageProvider.start((err) => {
if (err !== undefined) {
// tslint:disable-next-line: no-console
console.error(err)
process.exit(1)
}
})
/**
* HACK: Truffle providers should have `send` function, while `ProviderEngine` creates providers with `sendAsync`,
* but it can be easily fixed by assigning `sendAsync` to `send`.
*/
defaultFromAddress,
{
isVerbose,
}
);
provider.addProvider(global.coverageSubprovider);
} else if (mode === "trace") {
const revertTraceSubprovider = new RevertTraceSubprovider(
artifactAdapter,
defaultFromAddress,
isVerbose
);
provider.addProvider(revertTraceSubprovider);
}
provider.addProvider(new WebsocketSubprovider({ rpcUrl: "http://localhost:8545" }))
}
provider.start(err => {
if (err !== undefined) {
console.log(err);
process.exit(1);
}
});
/**
* HACK: Truffle providers should have `send` function, while `ProviderEngine` creates providers with `sendAsync`,
* but it can be easily fixed by assigning `sendAsync` to `send`.
*/
provider.send = provider.sendAsync.bind(provider);
module.exports = {
networks: {
development: {
let rawTX = tx.serialize().toString('hex');
let signedTx = '0x' + signing.signTx(
vault,
this.pwDerivedKey,
rawTX,
txObject.from.toLowerCase()
);
cb(null, signedTx);
});
},
}));
//data sources
//this must come as the last component so it doesn't overshadow the wallet
this.engine.addProvider(new WebSocketSubprovider({
rpcUrl: 'ws://localhost:8546',
}));
//log new blocks
this.engine.on('block', (block) => {
let newPendTrans = [];
this.pendingTransactions.forEach(txObj => {
this.web3.eth.getTransactionReceipt(txObj.txid).then(receipt => {
if(receipt && receipt.blockHash) {
txObj.resolve(receipt);
}else {
newPendTrans.push(txObj);
}
});
});
this.pendingTransactions = newPendTrans;