Skip to content

refactor: gas queries #1174

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

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

refactor: gas queries #1174

wants to merge 6 commits into from

Conversation

0xAlunara
Copy link
Collaborator

@0xAlunara 0xAlunara commented Jul 19, 2025

  1. Replaces Zustand slices for updating gas prices for each app with a single shared Tanstack query. Greatly reduces deduplicated gas fetching code with slight inconsistencies across the board.
  2. All manual fetching (primary in slices) has been replaced by 4 usages of useGasInfoAndUpdateLib({ chainId, networks }) in the layouts of all dapps. In other words, instead of having gas updates sprinkled everywhere, we now have 4 major hook usages on the top level of each app keeping gas info fresh.
  3. The query has side-effects; namely that it calls curve.setCustomFeeData() when it fetches gas info. This is not ideal and we'd want to keep queries side-effect free. But I think that refactor is out of scope. I've extensively documented this in comments above the query's queryFactory call. I've also named the query useGasInfoAndUpdateLib with a specific AndUpdateLib part to specify this behavior. A later PR / ticket can be made to extract this side-effect and put it in a proper useEffect on the layout level of the apps.

Copy link

vercel bot commented Jul 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curve-dapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 5:49pm
curve-dapp-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 5:49pm

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