Fix usage of WebSocketProvider and absence of pollingInterval#41
Fix usage of WebSocketProvider and absence of pollingInterval#41jacobmakarsky wants to merge 6 commits intomainfrom
Conversation
…ider in FallbackProvider as it defaults to polling which defeats purpose of WebSocketProvider
| const providerURL = config.provider; | ||
| // Ensure providerURL exists and is a string | ||
| if (!isDefined(providerURL)) { | ||
| throw new Error('provider is required for single provider configuration'); |
There was a problem hiding this comment.
Just as a reminder, lets try to make this errors look similar to #38
There was a problem hiding this comment.
Could you provide an example? Not clear what change is being asked for
| } catch (cause) { | ||
| if (!(cause instanceof Error)) { | ||
| throw new Error( | ||
| 'Non-error thrown from createFallbackProviderFromJsonConfig', |
There was a problem hiding this comment.
Might this be a typo!? this error message is createFallbackProviderFromJsonConfig, but the function is named createProviderFromJsonConfig, is this intended ?
| @@ -0,0 +1,117 @@ | |||
| import { FallbackProvider, JsonRpcProvider, WebSocketProvider } from 'ethers'; | |||
| import { FallbackProviderConfig } from 'ethers/lib.commonjs/providers/provider-fallback'; | |||
There was a problem hiding this comment.
I've did not notice we were importing this type from the internal structure of ethers!, given that any update on this might be a breaking change for us, is there any better way we can handle this type ? Mirroring this type with an interface of ours probably ?? or inferring the type.. idk 🤣
bhflm
left a comment
There was a problem hiding this comment.
Overall looks good to me, just some comments regarding types imports and misc things
Problem
FallbackProvider should never allow a WebSocketProvider, as it will use polling which defeats the purpose of the
eth_subscribelistener. See WebSocketProvider in FallbackProvider causes polling ethers-io/ethers.js#4932FallbackProvider creation currently doesn't allow passing the pollingInterval from wallet.
Solution