1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/test/e2e/ganache.js

31 lines
658 B
JavaScript
Raw Normal View History

const ganache = require('ganache');
const defaultOptions = {
blockTime: 2,
network_id: 1337,
2020-11-03 00:41:28 +01:00
mnemonic:
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent',
port: 8545,
vmErrorsOnRPCResponse: false,
hardfork: 'muirGlacier',
quiet: true,
};
class Ganache {
2020-11-03 00:41:28 +01:00
async start(opts) {
const options = { ...defaultOptions, ...opts };
const { port } = options;
this._server = ganache.server(options);
await this._server.listen(port);
}
2020-11-03 00:41:28 +01:00
async quit() {
if (!this._server) {
throw new Error('Server not running yet');
}
await this._server.close();
}
}
module.exports = Ganache;