Skip to content
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

Upgrade to ethers 6 #72

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bradens
Copy link

@bradens bradens commented Nov 27, 2023

This includes an upgrade to ethers 6.

Mostly following the migration guide here: https://docs.ethers.org/v6/migrating/

It's a pretty big change API wise. I'm not sure if the intention was to maintain support for both 5.x and 6.x at the same time.

The biggest change here is that ethers 6 has bigint types instead of their BigNumber instance, which causes headaches when trying to serialize. It was causing silent failures during the deepClone function, so I opted to use a bigint safe clone in structuredClone, which is included in nodejs 17+, and almost all browsers.

https://nodejs.org/en/about/previous-releases

If we need to, there are structuredClone polyfills that could be added.

},
"devDependencies": {
"@types/node": "^14.11.2",
"ethereum-abi-types-generator": "^1.0.6",
"typescript": "^4.1.3"
"typescript": "^5.3.0"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I upgraded typescript since I was running into build errors after installing 6.6, and it was set to 4.1 which is quite old.

customProvider.nodeUrl
);
} else {
ethersProvider = ethers.getDefaultProvider();
ethersProvider = ethers.getDefaultProvider(1);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously ethers would default to ethereum mainnet, so just maintaining parity here

Copy link
Owner

@joshstevens19 joshstevens19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good PR thanks a lot but we need to keep support for ethers v5 as well you can work out if its v6 or v5 in the code itself when they pass in the provider using the missing objects or defined objects of the provider passed in; we should basically do it similar on how we split web3 and ethers and take it down the correct route so if you try to make it follow how it does web3 and ethers routes then it would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants