-
Notifications
You must be signed in to change notification settings - Fork 94
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
base: master
Are you sure you want to change the base?
Conversation
}, | ||
"devDependencies": { | ||
"@types/node": "^14.11.2", | ||
"ethereum-abi-types-generator": "^1.0.6", | ||
"typescript": "^4.1.3" | ||
"typescript": "^5.3.0" |
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 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); |
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.
Previously ethers would default to ethereum mainnet, so just maintaining parity here
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.
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
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 theirBigNumber
instance, which causes headaches when trying to serialize. It was causing silent failures during thedeepClone
function, so I opted to use a bigint safe clone instructuredClone
, 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.