-
Notifications
You must be signed in to change notification settings - Fork 91
chore: add utility function to check eip1559 compliance #1041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this log should be removed from the utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a hack you can do is to type it as providers.Provider, then cast it to JsonRpcProvider.
Not great, but still better than any ;)
alexandre-abrioux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
|
@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