fix: added image fetching from das#1068
Conversation
|
@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds a DAS-based image fallback for token pages. When a token has an image in DAS metadata but no
Confidence Score: 5/5Safe to merge. The new token-image route is well-guarded, the SSRF vector from previous review threads is fully addressed, and all error paths return sensible responses. The route correctly rejects custom clusters, applies NO_STORE headers when DAS is unreachable, and validates input. The schema relaxation is intentional and backward-compatible. The one remaining note (hook firing for custom-cluster users) is a minor efficiency issue, not a correctness one. app/entities/digital-asset/model/use-das-image.ts — the hook can skip the SWR key for custom cluster users since the server will always reject those requests. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Browser
participant AccountHeader
participant useDasImage
participant TokenImageAPI as /api/token-image/[mint]
participant DAS as DAS RPC (getAssets)
Browser->>AccountHeader: render token page
AccountHeader->>useDasImage: useDasImage(address) (if no logoURI / nftData image)
useDasImage->>TokenImageAPI: "GET /api/token-image/{mint}?cluster=..."
Note over TokenImageAPI: validate mint (400 if invalid)<br/>validate cluster (400 if unknown)<br/>reject Custom cluster (400)
TokenImageAPI->>DAS: POST getAssets([mint])
DAS-->>TokenImageAPI: result[] (nullable items)
Note over TokenImageAPI: NO_STORE if assets null<br/>IMAGE_CACHE (1h) if assets present
TokenImageAPI-->>useDasImage: "{ image } or {}"
useDasImage-->>AccountHeader: "dasImage string | undefined"
AccountHeader->>Browser: render TokenMintHeaderCard with dasImage as logoURI fallback
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Browser
participant AccountHeader
participant useDasImage
participant TokenImageAPI as /api/token-image/[mint]
participant DAS as DAS RPC (getAssets)
Browser->>AccountHeader: render token page
AccountHeader->>useDasImage: useDasImage(address) (if no logoURI / nftData image)
useDasImage->>TokenImageAPI: "GET /api/token-image/{mint}?cluster=..."
Note over TokenImageAPI: validate mint (400 if invalid)<br/>validate cluster (400 if unknown)<br/>reject Custom cluster (400)
TokenImageAPI->>DAS: POST getAssets([mint])
DAS-->>TokenImageAPI: result[] (nullable items)
Note over TokenImageAPI: NO_STORE if assets null<br/>IMAGE_CACHE (1h) if assets present
TokenImageAPI-->>useDasImage: "{ image } or {}"
useDasImage-->>AccountHeader: "dasImage string | undefined"
AccountHeader->>Browser: render TokenMintHeaderCard with dasImage as logoURI fallback
Reviews (11): Last reviewed commit: "null support" | Re-trigger Greptile |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There is a misprint in PR title |
6b8acb5 to
ddcdad8
Compare
Description
some addresses have image in metadata. image is showing in search, but not on page. so this fix adding das request to get image.
Type of change
Screenshots
Testing
Related Issues
HOO-571
Checklist
pnpm test,pnpm lint,pnpm typecheck)build:infoscript to update build information