chore: add utility function to check eip1559 compliance#1041
Conversation
packages/utils/src/providers.ts
Outdated
| return provider; | ||
| }; | ||
|
|
||
| const isEip1559Supported = async (provider: any, logger: LogTypes.ILogger): Promise<boolean> => { |
There was a problem hiding this comment.
As soon as I try to use the correct type providers.JsonRpcProvider it raises the following TS error:
The inferred type of 'default' cannot be named without a reference to 'ethers/node_modules/@ethersproject/providers'. This is likely not portable. A type annotation is necessary.
The only solution I found to make this go away is to have a separate file dedicated to this function only. Not sure it's worth it.
There was a problem hiding this comment.
a hack you can do is to type it as providers.Provider, then cast it to JsonRpcProvider.
Not great, but still better than any ;)
packages/utils/src/providers.ts
Outdated
| logger.warn( | ||
| 'This RPC provider does not support the "eth_feeHistory" method: switching to legacy gas price', | ||
| ); |
There was a problem hiding this comment.
I think this log should be removed from the utility
There was a problem hiding this comment.
I kept it there but made it optional.
packages/utils/src/providers.ts
Outdated
| return provider; | ||
| }; | ||
|
|
||
| const isEip1559Supported = async (provider: any, logger: LogTypes.ILogger): Promise<boolean> => { |
There was a problem hiding this comment.
a hack you can do is to type it as providers.Provider, then cast it to JsonRpcProvider.
Not great, but still better than any ;)
|
@benjlevesque this does not work. As soon as the type of the parameter is related to the |
OK, so maybe #1023 will solve it... |
Description of the changes
Small refacto to regroup logic related to eip1559 compliance
Asana task