mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 15:50:28 +01:00
30 lines
643 B
JavaScript
30 lines
643 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',
|
|
};
|
|
|
|
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;
|