Skip to content

feat(api): expose icon URL on /lava/specs - #51

Merged
nimrod-teich merged 1 commit into
mainfrom
feat/lava-specs-icon-url
Apr 29, 2026
Merged

nimrod-teich merged 1 commit into
mainfrom
feat/lava-specs-icon-url

Conversation

@nimrod-teich

Copy link
Copy Markdown
Contributor

Summary

  • GET /lava/specs now returns { index, name, icon } for every chain (was { index, name })
  • icon is an absolute URL built via the shared getChainIconUrl(specId, INFO_ICONS_BASE_URL) helper that /specs already uses — same convention, same alias map, same default origin (https://info.lavanet.xyz)
  • Cross-origin consumers (burn-ui, lava-rewards, etc.) can now pick a chain icon straight from the API response without knowing the FE host

Why this endpoint

The heavier /specs already exposes icon URLs but also fans out per-spec provider counts and 30-day relay sums — too expensive for callers that just want a chain selector. /lava/specs is the lightweight chain-RPC-only list, so adding icon here gives a cheap, public-friendly chain catalog without duplicating routes.

Compatibility

Purely additive. The web useChainNames hook only reads index/name, so nothing on the frontend needs to change.

Test plan

  • pnpm --filter @info/api test — 128/128 pass, including new assertion that icon matches <host>/chains/<slug>.svg
  • pnpm typecheck — clean across all packages
  • Smoke curl http://localhost:8080/lava/specs | jq '.data[0]' after deploy → expect index, name, icon
  • Verify icon URL resolves in a browser (e.g. https://info.lavanet.xyz/chains/ethereum.svg)

Notes

While debugging the test I discovered packages/shared/dist/ was stale (pre-chain-icons.ts) and was silently breaking the existing /specs test too — pnpm --filter @info/shared build fixes it. Worth a follow-up to either wire shared's build into a pre-test step or have the workspace consume the TS source directly so this can't recur.

Each spec now returns { index, name, icon } where icon is an absolute
URL built from INFO_ICONS_BASE_URL — same shared helper /specs already
uses, so cross-origin consumers (burn-ui, lava-rewards) can load chain
icons directly from the API response without knowing the FE host.

Additive: useChainNames hook only reads index/name and is unaffected.
@nimrod-teich
nimrod-teich merged commit bb06f97 into main Apr 29, 2026
2 checks passed
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.

1 participant