Repository navigation
Conversation
Adds network-icons/<caip2>.svg for all 50 network logos served by token-api (src/assets/networkLogos), validated by scripts/network-icons.js (SVG only, CAIP-2 file names, no scripts, event handlers, foreignObject, DOCTYPE/ENTITY, embedded rasters or external references) and uploaded on merge to master to static.cx.metamask.io/api/v2/networkIcons/<namespace>/<reference>.svg. xdc.svg (eip155:50) is stripped of Adobe Illustrator pgf/foreignObject data (58KB -> 1.5KB); it renders identically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sets every root <svg> to width="256" height="256". Artwork is scaled via the viewBox; non-square viewBoxes are padded to a square so the art stays centered instead of stretching. Adds a viewBox to the two icons that had none (eip155:166, eip155:11297108109). Validation now enforces 256x256 with a square viewBox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each environment has its own static bucket in its own AWS account (dev-static / uat-static / static.cx.metamask.io), so the upload job is now a matrix over the three, assuming the per-env role from S3_ROLE_ARN_DEV / S3_ROLE_ARN_UAT / S3_ROLE_ARN. An env whose variable is unset is skipped with a warning; fail-fast is off so one env failing doesn't block the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 61d9d93. Keep the network icons upload prd-only, matching the existing token list upload; nothing in this repo pushes to the dev/uat static buckets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maxime-oe
previously approved these changes
Nov 12, 2026
MRabenda
previously approved these changes
Nov 20, 2026
Collaborator
|
Can you pls resolve conflicts? |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves CodeQL js/file-system-race by deriving size from the same buffer that is validated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Adds a
network-icons/section: one SVG per network, named by its CAIP-2 chain ID (network-icons/eip155:1.svg,network-icons/bip122:000000000019d6689c085ae165831e93.svg). On merge tomaster, the icons are uploaded to the static cache bucket at:This uses the same CAIP path layout as
api/v2/tokenIcons/assets/....Icons
All 50 network logos that token-api serves from
src/assets/networkLogos/. Each file name was mapped to a chain ID usingmm-config-registrychain configs,@codefi/metafi-commonnetwork configs, and, for Eden, the token-api commit that added it (eip155:714). One ID per logo; testnets that share a mainnet logo are not duplicated.eip155:50(XDC): removed Adobe Illustrator export data (DOCTYPE/ENTITY declarations,<switch>/<foreignObject>,i:pgfblob). The file went from 58KB to 1.5KB and renders identically.All icons are resized to 256×256 (root
width/height). The artwork scales through theviewBox. Non-square viewBoxes (arbitrum, cronos, linea, unichain, pharos, harmony, matchain, sonic) are padded to a square so the art stays centered instead of stretching. The two icons without a viewBox (eip155:166omni,eip155:11297108109palm) get one taken from their original width/height.Validation
scripts/network-icons.js verifyruns as part ofyarn testviatest/network-icons.js. It checks that each file:.svgand named by a valid CAIP-2 chain ID<svg>root with the SVGxmlnswidth="256" height="256"with a squareviewBox<script>,<foreignObject>,<image>, inline event handlers,DOCTYPE/ENTITY,javascript:URLs, or non-#fragmenthref/url()referencesThese files are served from a MetaMask origin, so the checks are deliberately strict.
Upload
The workflow in
update-caip-map.ymlgets a newupload-network-iconsjob that:generate-uniswap-listenvironment andS3_ROLE_ARN<namespace>/<reference>.svg, validating again firstaws s3 syncwithContent-Type: image/svg+xmlandCache-Control: max-age=3600The sync only adds or replaces files. Removing an icon here does not delete it from S3.
network-iconsis also added to the npm packagefiles.The
github-contract-metadataIAM role can currently write onlymetamask-uniswap-tokenlist.json. Theapi/v2/networkIcons/*grant must be applied inva-mmcx-api-platform-infra(prd) before this merges: consensys-vertical-apps/va-mmcx-api-platform-infra#77. Otherwiseupload-network-iconsfails with AccessDenied. The token list job is unaffected either way.Test plan
yarn testpasses, including the newtest/network-icons.jsonloadand an external<image>, a.png, and a non-CAIP file namenode scripts/network-icons.js stage <dir>produces 50 files undereip155/andbip122/curl -I https://static.cx.metamask.io/api/v2/networkIcons/eip155/1.svgreturns 200 withimage/svg+xml🤖 Generated with Claude Code