Repository navigation
feat(api): expose icon URL on /lava/specs - #51
Merged
Merged
Conversation
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.
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
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.
Summary
GET /lava/specsnow returns{ index, name, icon }for every chain (was{ index, name })iconis an absolute URL built via the sharedgetChainIconUrl(specId, INFO_ICONS_BASE_URL)helper that/specsalready uses — same convention, same alias map, same default origin (https://info.lavanet.xyz)Why this endpoint
The heavier
/specsalready 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/specsis the lightweight chain-RPC-only list, so addingiconhere gives a cheap, public-friendly chain catalog without duplicating routes.Compatibility
Purely additive. The web
useChainNameshook only readsindex/name, so nothing on the frontend needs to change.Test plan
pnpm --filter @info/api test— 128/128 pass, including new assertion thaticonmatches<host>/chains/<slug>.svgpnpm typecheck— clean across all packagescurl http://localhost:8080/lava/specs | jq '.data[0]'after deploy → expectindex,name,iconhttps://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/specstest too —pnpm --filter @info/shared buildfixes 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.