Skip to content

fix(lifi): remove dead getAllChains() helper that raced config init - #10

Open
ifeanyikizito393 wants to merge 1 commit into
Saber1Y:mainfrom
ifeanyikizito393:fix/getAllChains-race-condition
Open

fix(lifi): remove dead getAllChains() helper that raced config init#10
ifeanyikizito393 wants to merge 1 commit into
Saber1Y:mainfrom
ifeanyikizito393:fix/getAllChains-race-condition

Conversation

@ifeanyikizito393

Copy link
Copy Markdown

Overview

This PR fixes the buggy getAllChains() helper in src/lib/lifi.ts. The function called ensureConfig() without awaiting it, so getChains() could run before the LI.FI config (and chain set) was initialized — a potential race condition. It also dumped the entire chain list to the server console via console.log(chains) and was never referenced anywhere in the codebase (dead code).

Per the issue's suggested fix, the function is removed entirely. The LI.FI config is still initialized properly via await ensureConfig() in fetchSupportedChains() and getBridgeQuote().

Related Issue

Closes #7

Changes

  • [REMOVE] getAllChains() from src/lib/lifi.ts
    • Eliminates the un-awaited ensureConfig() race condition.
    • Stops dumping the full chain array to stdout.
    • Removes the dead export and the confusion it caused about the intended helper API.
    • ChainType / getChains imports remain in use by ensureConfig() and fetchSupportedChains().

Verification Results

bunx tsc --noEmit        → ✅ passes
bun run build            → ✅ Next.js production build succeeds (25 pages)
bunx eslint src/lib/lifi.ts → ✅ clean
Runtime import smoke test → ✅ module loads; all remaining exports intact; getAllChains gone
Check Result
getAllChains() no longer references ensureConfig() ✅ removed
No console.log(chains) noise in server logs ✅ removed
getAllChains referenced anywhere in codebase ✅ no matches
Full-project lint Same pre-existing issues as on main; none introduced
TypeScript + production build ✅ pass

getAllChains() called ensureConfig() without awaiting it, creating a
race condition where getChains() could run before LI.FI config was
initialized. It also dumped the full chain list to the server console
and was never referenced anywhere in the codebase.

Remove the dead export entirely; the LI.FI config is initialized via
ensureConfig() in fetchSupportedChains() and getBridgeQuote().
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@ifeanyikizito393 is attempting to deploy a commit to the saber1y's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ifeanyikizito393

Copy link
Copy Markdown
Author

@Saber1Y Hi! This PR is open and ready for review — happy to address any feedback. Thanks!

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.

Bug: getAllChains() never awaits ensureConfig() and dumps chain list to console

1 participant