-
Notifications
You must be signed in to change notification settings - Fork 44
refactor: get rid of multiple useChainId variations, rely mostly on wagmi #1493
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for GitHub.
|
DanielSchiavini
requested changes
Oct 8, 2025
d82af27
to
7e414bc
Compare
packages/curve-ui-kit/src/features/connect-wallet/lib/ConnectionProvider.tsx
Outdated
Show resolved
Hide resolved
DanielSchiavini
previously approved these changes
Oct 9, 2025
DanielSchiavini
approved these changes
Oct 10, 2025
OnlyJousting
approved these changes
Oct 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have three different implementations of
useChainId
for the dex, lend and loan apps. In most cases, the selected chain from the wallet should be leading. Just rely on wagmi to get that chain id for simplicity.Relying on the URL is silly, because the wallet chain is being changed to whatever the URL is. For lend it relied on the chain id of the llamalend API, but that is also silly imo, as changing the chain through the wallet or URL will cause llamalend to reinitialize with the new chain. For loan it was especially stupid as it's limited to Ethereum only.
TL;DR: Single source of truth from wagmi is nice.
Stepping stone to rely less on complicated network objects and network id mappers.
Also removes manual bookkeeping of the
chainId
in our wallet singleton.This change even works if you don't have a wallet extension installed and have no wallet connected, as
switchChainAsync
works even without a wallet. So this PR should reduce complexity a bit wrt chain ids and networks.