-
Notifications
You must be signed in to change notification settings - Fork 11
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
refactor: Centralise BigNumber imports #725
Conversation
Avoid importing BigNumber from ethers directly throughout the repository, and instead just re-export the standalone ethers BigNumber variant from src/utils/BigNumberUtils. This should make it easier to migrate away from ethers v5.
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.
This is awesome work! So now we only have a single Bn import from ethers?
Yeah, hopefully this achieves that. It's a bit tricky to be 100% sure but I've eliminated as many cases of importing directly from ethers as I could identify. If we implement a BigInt -> BigNumber shim then we might be able to play with v6. |
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.
This looks really tedious to have implemented. 👏
Looks good though I'd make one improvement, since we don't know how long it's going to take to move over to viem, we can maybe add an eslint rule to restrict importing BigNumber from ethers?
https://eslint.org/docs/latest/rules/no-restricted-imports#paths
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 work! I think this shouldn't break anything on the FE AFAICT. Also really like @gsteenkamp89 suggestion
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 one! this will help for sure :)
Avoid importing BigNumber from ethers directly throughout the repository, and instead just re-export the standalone ethers BigNumber variant from src/utils/BigNumberUtils. This should make it easier to migrate away from ethers v5.