@metamask/contract-metadata
A mapping of ethereum contract addresses to broadly accepted icons for those addresses, plus a CAIP-19 based multi-chain metadata store used in this repository.
- The npm package exports a legacy Ethereum mainnet map keyed by EIP-55 checksummed addresses (
contract-map.json + images/).
- The repository source of truth for new assets is CAIP-19 file layout under
metadata/ and icons/ (CAIP-19).
This repository is effectively frozen for casual token additions. We recommend that developers of new tokens use EIP-747 to ask the user's permission to display your tokens in their wallet. This reduces the dangers of airdrop-based phishing, and reduces administrative overhead from managing this list.
Usage
Install from npm with npm install @metamask/contract-metadata and use it like this:
import contractMap from '@metamask/contract-metadata'
import ethJSUtil from 'ethereumjs-util'
const { toChecksumAddress } = ethJSUtil
function imageElFor (address) {
const metadata = contractMap[toChecksumAddress(address)]
if (metadata?.logo) {
const img = document.createElement('img')
// Published package keeps logos under images/
img.src = `${__dirname}/images/${metadata.logo}`
img.style.width = '100%'
return img
}
}
imageElFor('0x6B175474E89094C44Da98b954EedeAC495271d0F')
Each map entry looks like:
{
"name": "Dai Stablecoin",
"logo": "dai.svg",
"erc20": true,
"symbol": "DAI",
"decimals": 18
}
For local CAIP-19 data in this repo, require ./buildindex.js instead. That builds an in-memory map keyed by CAIP-19 asset IDs (for example eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F) from the metadata/ folder. It does not rewrite contract-map.json.
CLI Tool for Managing Assets
This repository includes a CLI tool (cli-update-asset.js) to help manage contract metadata and icons following the CAIP-19 standard.
Available Commands
Add or Update an Asset
# Add a new asset
npm run asset:set -- \
--caip "eip155:1/erc20:0xTOKEN_ADDRESS" \
--name "Token Name" \
--symbol "SYMBOL" \
--decimals 18 \
--image ./path/to/logo.svg
# Update an existing asset
npm run asset:set -- \
--caip "eip155:1/erc20:0xTOKEN_ADDRESS" \
--name "Updated Token Name"
# Update labels
npm run asset:set -- \
--caip "eip155:1/erc20:0xTOKEN_ADDRESS" \
--labels "stable_coin,blue_chip"
# Use an image URL
npm run asset:set -- \
--caip "eip155:1/erc20:0xTOKEN_ADDRESS" \
--name "Token Name" \
--symbol "SYMBOL" \
--decimals 18 \
--image "https://example.com/logo.png"
Verify an Asset
npm run asset:verify -- \
--caip "eip155:1/erc20:0xTOKEN_ADDRESS"
List Assets
# List all assets in a namespace
npm run asset:list -- --namespace "eip155:1"
CLI Parameters
--caip: CAIP-19 identifier (required) - Format: namespace:chainId/assetNamespace:assetReference
--name: Token name (required for new assets)
--symbol: Token symbol (required for new assets)
--decimals: Number of decimals (required for new assets)
--image: Path to image file or URL (required for new assets)
- Supports:
.svg, .png, .jpg, .jpeg
- Can be a local file path or HTTP/HTTPS URL
--labels: Labels for the asset (optional)
- Comma-separated values:
stable_coin,blue_chip
- Or JSON array:
["stable_coin","blue_chip"]
--erc20: Set to true or false (optional, auto-detected for erc20: prefix)
--spl: Set to true or false (optional, auto-detected for spl: prefix)
File Structure
The tool manages:
- Metadata:
metadata/{namespace}/{assetId}.json
Example: metadata/eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F.json
- Icons:
icons/{namespace}/{assetId}.{ext}
Example: icons/eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F.svg
- Labels (optional):
labels/{namespace}/{assetId}.json
Workflow
- Add or update an asset using
npm run asset:set
- Verify the changes using
npm run asset:verify
- Run tests:
npm test
- Review the changes in git
- Commit and push your changes
The tool automatically:
- Validates all inputs using Zod schemas
- Renames icon files to match the asset ID
- Removes old icons when updating with a new image
- Auto-detects
erc20 and spl fields based on the asset namespace
- Downloads and saves images from URLs with the correct extension
Uniswap-standard token list (metamask-uniswap-tokenlist.json)
In addition to the npm package and the CAIP-19 metadata/ store, this repository produces a flat
Token Lists (Uniswap standard) JSON file covering every eip155:* asset in metadata/.
It lets consumers ingest this repo's data with any standard token-list reader instead of walking the repo.
Where it is published
- Published copy (source of truth for consumers): https://static.cx.metamask.io/metamask-uniswap-tokenlist.json
(S3 bucket
static.cx.metamask.io, key metamask-uniswap-tokenlist.json, served with max-age=3600).
- Repository copy: the
metamask-uniswap-tokenlist.json committed at the repo root is only a historical
snapshot. It is not updated by CI and should not be relied on. Use the published URL.
How it is generated
.github/workflows/update-caip-map.yml runs on every push to
master (and on manual workflow_dispatch). It runs
generate-multichain-uniswap-standard-list.js and uploads the
result to S3. Changes to metadata/ therefore reach the published list on merge, with no release or npm publish needed.
To generate it locally (writes metamask-uniswap-tokenlist.json in the repo root):
node generate-multichain-uniswap-standard-list.js
The generator reads the map built by buildindex.js (every file under metadata/),
keeps keys starting with eip155:, and maps each to a token entry:
| Token list field |
Source |
chainId |
Numeric part of the CAIP-2 chain (eip155:1 -> 1) |
address |
The reference part of the asset id (erc20:0xabc... -> 0xabc...), case preserved |
name/symbol |
name / symbol from the metadata file (empty string if missing) |
decimals |
decimals from the metadata file, verbatim. 0 is kept; only a missing value becomes 18 |
logoURI |
https://raw.githubusercontent.com/MetaMask/contract-metadata/master/icons/<chain>/<asset>.<ext>, or '' if the asset has no logo |
The file also carries the standard top-level fields: name (MetaMask Token List), logoURI, keywords,
timestamp (generation time) and version (currently fixed at 1.0.0).
Known characteristics:
- EVM only. Non-EVM namespaces (
solana:, bip122:, stellar:) are not included.
- Not only ERC-20s. All
eip155:* asset types are emitted, including slip44 (native coins) and hip3
entries. For those the token-list address is the asset reference (for example 60 for ETH), not a
0x... contract address. Consumers that need contract addresses should filter for 0x-prefixed 40-hex values.
- No on-chain validation. Values are copied from
metadata/; nothing is checked against the chain at generation time.
Who uses it
The MetaMask token API pipeline (va-mmcx-platform-workflow-service) ingests this list as its metamask
source for many EVM chains (see tokenStandardURLMap in evm_tokens/sources/standard_urls.go in that repo).
That source has the highest priority when sources are merged, so whatever is in this list, including
decimals, symbol and name, wins over CoinGecko, TrustWallet and aggregator data and ends up in
tokens.api.cx.metamask.io/v3/chains/<chain>/assets. A wrong value here is therefore a wrong value in the API
(this is how decimals: 0 tokens such as Dentacoin were once served as 18).
Testing
npm run test:uniswap-list (also part of npm test) asserts that every eip155:* asset's decimals in
metadata/ is carried unchanged into the generated list.
Submission Process
Maintaining this list is a considerable chore, and it is not our highest priority. We do not guarantee inclusion in this list on any urgent timeline. We are actively looking for fair and safe ways to maintain a list like this in a decentralized way, because maintaining it is a large and security-delicate task.
Preferred path: use the CLI (npm run asset:set) so paths and fields are generated correctly.
Manual submissions:
- Fork this repository.
- Add your logo image in
.svg or .png format under icons/{namespace}/ using the CAIP-19 asset id as the filename (for example icons/eip155:1/erc20:0x….svg).
- Add asset metadata as a JSON object (not wrapped in an outer key) at
metadata/{namespace}/{assetId}.json.
Criteria:
- The icon should be small, square, but high resolution, and a vector/svg or a png. Please refer to the style guide for best practices.
- The address should be in checksum format or it will not be accepted. This is true of non-evm assets as well - since some network's addressing formats are case-sensitive.
- PR should include link to official project website referencing the suggested address.
- Project website should include explanation of project.
- Project should have clear signs of activity, either traffic on the network, activity on GitHub, or community buzz.
- Nice to have a verified source code on a block explorer like Etherscan.
- Must have a 'NEUTRAL' reputation or 'OK' reputation on Etherscan if it is an Ethereum-network asset. Other EVM Networks will be verified as possible.
- Assets must not be ERC-721s or ERC-1155s.
A sample submission file at metadata/eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F.json:
{
"name": "Dai Stablecoin",
"decimals": 18,
"symbol": "DAI",
"erc20": true,
"logo": "./icons/eip155:1/erc20:0x6B175474E89094C44Da98b954EedeAC495271d0F.svg"
}
Tokens should include a field "erc20": true when applicable, and can include additional fields:
symbol (ticker symbol; keep to 11 characters or fewer to pass tests)
decimals (precision of the tokens stored)
A full list of permitted fields for the legacy contract map can be found in the permitted-fields.json file.
Release & Publishing
The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions action-create-release-pr and action-publish-release are used to automate the release process; see those repositories for more information about how they work.
Choose a release version.
- The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See the SemVer specification for more information.
If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. 1.x for a v1 backport release).
- The major version branch should be set to the most recent release with that major version. For example, when backporting a
v1.0.2 release, you'd want to ensure there was a 1.x branch that was set to the v1.0.1 tag.