import Ganache from 'ganache-core' ; import { Callback , ErrorCallback } from '@0x/subproviders/lib/src/types' ; import { Subprovider } from '@0x/subproviders/lib/src/subproviders/subprovider' ; /**
 * This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
 * It intercepts all JSON RPC requests and relays them to an in-process ganache instance.
 */ export class GanacheSubprovider extends Subprovider { private readonly _ganacheProvider : any ; param opts constructor ( opts ) { super ( ) ; this . _ganacheProvider = Ganache . provider ( opts ) ; } param payload param _next param end public async handleRequest ( payload , _next , end ) { this . _ganacheProvider . sendAsync ( payload , ( err , result ) => { end ( err , result && result . result ) ; } ) ; } }