mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
ebeb2668ea
* mock gas price api * fix error * full url * remove duplicated packages * full url * customise mock per test * customise mock per test * enable mocking * enable mocking * enable mocking by default * duplicated packages * update mockttp * pass through * pass through
31 lines
658 B
JavaScript
31 lines
658 B
JavaScript
const ganache = require('ganache');
|
|
|
|
const defaultOptions = {
|
|
blockTime: 2,
|
|
network_id: 1337,
|
|
mnemonic:
|
|
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent',
|
|
port: 8545,
|
|
vmErrorsOnRPCResponse: false,
|
|
hardfork: 'muirGlacier',
|
|
quiet: true,
|
|
};
|
|
|
|
class Ganache {
|
|
async start(opts) {
|
|
const options = { ...defaultOptions, ...opts };
|
|
const { port } = options;
|
|
this._server = ganache.server(options);
|
|
await this._server.listen(port);
|
|
}
|
|
|
|
async quit() {
|
|
if (!this._server) {
|
|
throw new Error('Server not running yet');
|
|
}
|
|
await this._server.close();
|
|
}
|
|
}
|
|
|
|
module.exports = Ganache;
|