mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-16 15:47:25 +00:00
fix(@embark/proxy): only up event listeners on available providers
Only the Ganache provider has the setMaxListener
This commit is contained in:
parent
e5b15c3342
commit
caae92281d
@ -42,8 +42,9 @@ export class Proxy {
|
|||||||
_createWeb3RequestManager(provider) {
|
_createWeb3RequestManager(provider) {
|
||||||
const manager = new Web3RequestManager.Manager(provider);
|
const manager = new Web3RequestManager.Manager(provider);
|
||||||
// Up max listener because the default 10 limit is too low for all the events the proxy handles
|
// Up max listener because the default 10 limit is too low for all the events the proxy handles
|
||||||
// Warning mostly appeared in tests
|
// Warning mostly appeared in tests. The warning is also only with the Ganache provider
|
||||||
manager.provider.setMaxListeners(100);
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
manager.provider?.setMaxListeners?.(100);
|
||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ export class Proxy {
|
|||||||
// Using net_version instead of eth_accounts, because eth_accounts can fail if EIP1102 is not approved first
|
// Using net_version instead of eth_accounts, because eth_accounts can fail if EIP1102 is not approved first
|
||||||
await reqMgr.send({ method: 'net_version' });
|
await reqMgr.send({ method: 'net_version' });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
this.logger.debug(e);
|
||||||
throw new Error(__(`Unable to connect to the blockchain endpoint`));
|
throw new Error(__(`Unable to connect to the blockchain endpoint`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user