#!/usr/bin/env node // Apply enrichment data to tokenList.js: add name + url fields to each token. import { readFileSync, writeFileSync } from "fs"; const enrichment = JSON.parse( readFileSync("scripts/token-enrichment.json", "utf8"), ); // Well-known URLs for major tokens not in ethereum-lists. // These are official project websites verified from public sources. const EXTRA_URLS = { "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": "https://weth.io", "0xdAC17F958D2ee523a2206206994597C13D831ec7": "https://tether.to", "0xB8c77482e45F1F44dE1745F52C74426C631bDD52": "https://www.bnbchain.org", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": "https://www.circle.com/usdc", "0xdC035D45d973E3EC169d2276DDab16f1e407384F": "https://sky.money", "0x2AF5D2aD76741191D15Dfe7bF6aC92d4Bd912Ca3": "https://www.bitfinex.com", "0x514910771AF9Ca656af840dff83E8264EcF986CA": "https://chain.link", "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3": "https://ethena.fi", "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d": "https://www.worldlibertyfinancial.com", "0x6B175474E89094C44Da98b954EedeAC495271d0F": "https://makerdao.com", "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8": "https://www.paypal.com/us/digital-wallet/manage-money/crypto/pyusd", "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE": "https://shibatoken.com", "0xdA5e1988097297dCdc1f90D4dFE7909e847CBeF6": "https://www.worldlibertyfinancial.com", "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b": "https://crypto.com", "0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1": "https://ton.org", "0x68749665FF8D2d112Fa859AA293F07A622782F38": "https://gold.tether.to", "0x196C20DA81Fbc324EcdF55501e95Ce9f0bD84d14": "https://polkadot.network", "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984": "https://uniswap.org", "0x45804880De22913dAFE09f4980848ECE6EcbAf78": "https://www.paxos.com/paxgold", "0x3c3a81e81dc49A522A592e7622A7E711c06bf354": "https://www.mantle.xyz", "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9": "https://aave.com", "0x75231F58b43240C9718Dd58B4967c5114342a86c": "https://www.okx.com", "0x6982508145454Ce325dDbE47a25d4ec3d2311933": "https://www.pepe.vip", "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": "https://wbtc.network", "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84": "https://lido.fi", "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32": "https://lido.fi", "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72": "https://ens.domains", "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0": "https://polygon.technology", "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2": "https://makerdao.com", "0xD533a949740bb3306d119CC777fa900bA034cd52": "https://curve.fi", "0x111111111117dC0aa78b770fA6A738034120C302": "https://1inch.io", "0x163f8C2467924be0ae7B5347228CABF260318753": "https://worldcoin.org", "0xba100000625a3754423978a60c9317c58a424e3D": "https://balancer.fi", "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F": "https://synthetix.io", "0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8": "https://www.euler.finance", "0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD": "https://loopring.org", "0xC669928185DbCE49d2230CC9B0979BE6DC797957": "https://bitstable.finance", "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0": "https://lido.fi", "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704": "https://www.coinbase.com/cbeth", "0xfAbA6f8e4a5E8Ab82F62fe7C39859FA577269BE3": "https://ondo.finance", "0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6": "https://decentraland.org", "0x6De037ef9aD2725EB40118Bb1702EBb27e4Aeb24": "https://www.render.com", "0x4a220E6096B25EADb88358cb44068A3248254675": "https://www.quant.network", "0xba5BDe662c17e2aDFF1075610382B9B691296350": "https://superrare.com", "0x15D4c048F83bd7e37d49eA4C83a07267Ec4203dA": "https://galxe.com", "0xc00e94Cb662C3520282E6f5717214004A7f26888": "https://compound.finance", "0xE41d2489571d322189246DaFA5ebDe1F4699F498": "https://0x.org", "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e": "https://yearn.fi", "0x6fB3e0A217407EFFf7Ca062D46c26E5d60a14d69": "https://iotex.io", "0xD31a59c85aE9D8edEFec411D448f90841571b89c": "https://solana.com", "0xa1faa113cbE53436Df28FF0aEe54275c13B40975": "https://alphafinance.io", "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF": "https://immutable.com", "0x0f5D2fB29fb7d3CFeE444a200298f468908cC942": "https://decentraland.org", "0x3845badAde8e6dFF049820680d1F14bD3903a5d0": "https://www.sandbox.game", "0x4d224452801ACEd8B2F0aebE155379bb5D594381": "https://apecoin.com", "0x6810e776880C02933D47DB1b9fc05908e5386b96": "https://gnosis.io", "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0": "https://www.liquity.org", "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07": "https://omg.network", "0x0D8775F648430679A709E98d2b0Cb6250d2887EF": "https://basicattentiontoken.org", "0xc944E90C64B2c07662A292be6244BDf05Cda44a7": "https://thegraph.com", "0x1985365e9f78359a9B6AD760e32412f4a445E862": "https://augur.net", "0x4E15361FD6b4BB609Fa63C81A2be19d873717870": "https://fantom.foundation", "0x853d955aCEf822Db058eb8505911ED77F175b99e": "https://frax.finance", "0x0000000000085d4780B73119b644AE5ecd22b376": "https://www.trueusd.com", "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e": "https://polymesh.network", "0x956F47F50A910163D8BF957Cf5846D573E7f87CA": "https://fei.money", "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0": "https://frax.finance", "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E": "https://curve.fi", "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6": "https://alchemix.fi", "0x808507121B80c02388fAd14726482e061B8da827": "https://pendle.finance", "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766": "https://starknet.io", "0x8457CA5040ad67fdebbCC8EdCE889A335Bc0fbFB": "https://alt.layer", "0x4C19596f5aAfF459fA38B0f7eD92F11AE6543784": "https://www.truflation.com", "0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1": "https://arbitrum.io", "0x912CE59144191C1204E64559FE8253a0e49E6548": "https://arbitrum.io", "0x6985884C4392D348587B19cb9eAAf157F13271cd": "https://layerzero.network", "0xFe0c30065B384F05761f15d0CC899D4F9F9Cc0eB": "https://ethfi.org", "0x18084fbA666a33d37592fA2633fD49a74DD93a88": "https://tbtc.network", "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497": "https://suilend.fi", "0x5283D291DBCF85356A21bA090E6db59121208b44": "https://blur.io", "0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd": "https://dydx.exchange", "0xCf0C122c6b73ff809C693DB761e7BaeBe62b6a2E": "https://floki.com", "0xe53EC727dbDEB9E2d5456c3be40cFF031AB40A55": "https://superfarm.com", "0x32353A6C91143bfd6C7d363B546e62a9A2489A20": "https://www.agora.finance", "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c": "https://www.euro-coin.com", "0x1a03eF3d1a80b5f214e468ACD97F55714E049393": "https://gemspad.io", "0x7122985656e38BDC0302Db86685bb972b145bD3C": "https://stone.fi", "0xa35923162C49cF95e6BF26623385eb431ad920D3": "https://www.turbo-eth.com", "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF": "https://alchemix.fi", "0x08c32b0726C5684024ea6e141C50aDe9690bBdcc": "https://stratis.io", "0x65Ef703f5594D2573eb71Aaf55BC0CB548492df4": "https://multichain.org", "0x1151CB3d861920e07a38e03eEAd12C32178567F6": "https://bonk.com", "0x090185f2135308BaD17527004364eBcC2D37e5F6": "https://spell.club", "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6": "https://stargate.finance", }; // Apply extra URLs where enrichment has none for (const [addr, url] of Object.entries(EXTRA_URLS)) { const e = enrichment[addr]; if (e && !e.url) { e.url = url; } } // Read original tokenList.js const original = readFileSync("src/shared/tokenList.js", "utf8"); // Replace each token block: add name and url after decimals let result = original; let replacements = 0; for (const [addr, data] of Object.entries(enrichment)) { // Escape special regex characters in the address const escaped = addr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // Match the token block: { address: "...", symbol: "...", decimals: N, } // The closing }, may have trailing whitespace const blockRe = new RegExp( `(\\{\\s*address:\\s*"${escaped}",\\s*symbol:\\s*"[^"]+",\\s*decimals:\\s*\\d+),?(\\s*\\})`, ); const match = result.match(blockRe); if (!match) { console.error(`WARNING: Could not find block for ${addr}`); continue; } // Build replacement: original fields + name + url const nameEscaped = data.name.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); const urlEscaped = data.url.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); const replacement = match[1] + `,\n name: "${nameEscaped}",` + `\n url: "${urlEscaped}",` + match[2]; result = result.replace(blockRe, replacement); replacements++; } console.error(`Applied ${replacements} enrichments to tokenList.js`); writeFileSync("src/shared/tokenList.js", result); console.error("Done!");