Skip to content

Conversation

0xAlunara
Copy link
Collaborator

@0xAlunara 0xAlunara commented Oct 8, 2025

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.

Copy link

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
curve-dapp Ready Ready Preview Comment Oct 9, 2025 1:13pm
curve-dapp-storybook Ready Ready Preview Comment Oct 9, 2025 1:13pm

DanielSchiavini
DanielSchiavini previously approved these changes Oct 9, 2025
@0xAlunara 0xAlunara enabled auto-merge October 10, 2025 13:05
@0xAlunara 0xAlunara merged commit 054b750 into main Oct 10, 2025
16 checks passed
@0xAlunara 0xAlunara deleted the refactor/useChainId branch October 10, 2025 13:10
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.

3 participants