-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: ethers/ethers5 infinite requests #3086
Conversation
🦋 Changeset detectedLatest commit: 4e9fb31 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Coverage Report for Coverage
File CoverageNo changed files found. |
04cc251
to
343d20e
Compare
const caipAddress = `${this.chainNamespace}:${chainId}:${firstAddress}` as CaipAddress | ||
const caipNetwork = this.caipNetworks.find(c => c.id === chainId) ?? this.caipNetworks[0] | ||
const caipAddress = | ||
`${this.chainNamespace}:${caipNetwork?.id}:${firstAddress}` as CaipAddress |
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.
why not use the caipNetwork id directly?
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.
Like adding chainId
directly into caipAddress
? I tried doing that, but when switching to a unsupported network it'd throw an error, instead i checked if the network is supported.
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.
No, I meant ${caipNetwork.namespace}:${caipNetwork?.id}:${firstAddress}
or ${caipNetwork.caipNetworkId}:${firstAddress}
(unsure about proper names but you get what I mean)
@@ -631,9 +631,12 @@ export class EthersAdapter { | |||
if (provider) { | |||
const { addresses, chainId } = await EthersHelpersUtil.getUserInfo(provider) |
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.
why source the infor from 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.
I think it's because during the construct of the adapter we'd need to get the address and chain id directly from the provider so users are still connected even if they refresh the page. The logic happens here.
Description
There's a bug where if you switch to any network other than ethereum you'll get a lot of network requests sometimes up to 50k.
This happens because the ethers/ethers5 adapters switches caip address every second. It goes back and forth between the ethereum caip address and polygon caip address if you're connected to polygon. This results into hitting the rpc endpoint loads of times.
Type of change
Associated Issues
For Linear issues: Closes APKT-1283
For GH issues: closes #...
Checklist