From fdaa0140cf1086b55038632bc312e78544118b35 Mon Sep 17 00:00:00 2001 From: aelmanaa <4503543+aelmanaa@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:56:34 +0000 Subject: [PATCH 1/2] CCT: Update changelog with new tokens --- public/changelog.json | 104 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 7 deletions(-) diff --git a/public/changelog.json b/public/changelog.json index 2d26663b189..9a8b0527b0a 100644 --- a/public/changelog.json +++ b/public/changelog.json @@ -302,6 +302,45 @@ } }, "data": [ + { + "category": "integration", + "date": "2025-07-21", + "description": "Newly supported tokens: BTR, ILMT, USELESS, YBTC.B, stBTC", + "relatedTokens": [ + { + "assetName": "BTR Token", + "baseAsset": "BTR", + "url": "https://docs.chain.link/ccip/directory/mainnet/token/BTR", + "iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/btr.webp?auto=compress%2Cformat" + }, + { + "assetName": "Iluminary Token", + "baseAsset": "ILMT", + "url": "https://docs.chain.link/ccip/directory/mainnet/token/ILMT", + "iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/ilmt.webp?auto=compress%2Cformat" + }, + { + "assetName": "USELESS COIN", + "baseAsset": "USELESS", + "url": "https://docs.chain.link/ccip/directory/mainnet/token/USELESS", + "iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/useless.webp?auto=compress%2Cformat" + }, + { + "assetName": "Yield BTC.B", + "baseAsset": "YBTC.B", + "url": "https://docs.chain.link/ccip/directory/mainnet/token/YBTC.B", + "iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/ybtcb.webp?auto=compress%2Cformat" + }, + { + "assetName": "Lorenzo stBTC", + "baseAsset": "stBTC", + "url": "https://docs.chain.link/ccip/directory/mainnet/token/stBTC", + "iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/stbtc.webp?auto=compress%2Cformat" + } + ], + "title": "Cross-chain token (CCT) standard: Added support for new tokens", + "topic": "CCIP" + }, { "category": "integration", "date": "2025-07-20", @@ -2497,7 +2536,14 @@ "category": "integration", "date": "2025-05-11", "description": "New Data Feeds available:", - "relatedNetworks": ["arbitrum", "ethereum", "celo", "sonic", "polygon", "bnb-chain"], + "relatedNetworks": [ + "arbitrum", + "ethereum", + "celo", + "sonic", + "polygon", + "bnb-chain" + ], "relatedTokens": [ { "assetName": "Berachain", @@ -3229,7 +3275,15 @@ "url": "https://docs.chain.link/ccip/directory/testnet/chain/zora-testnet" } ], - "relatedNetworks": ["abstract", "hemi", "lisk", "metal", "mint", "superseed", "zora"], + "relatedNetworks": [ + "abstract", + "hemi", + "lisk", + "metal", + "mint", + "superseed", + "zora" + ], "title": "CCIP on new blockchains", "topic": "CCIP" }, @@ -4388,7 +4442,17 @@ "url": "https://docs.chain.link/ccip/directory/testnet/chain/ethereum-testnet-sepolia-xlayer-1" } ], - "relatedNetworks": ["botanix", "corn", "hashkey", "ink", "polygonzkevm", "sei", "soneium", "xlayer", "monad"], + "relatedNetworks": [ + "botanix", + "corn", + "hashkey", + "ink", + "polygonzkevm", + "sei", + "soneium", + "xlayer", + "monad" + ], "title": "CCIP Expands to New Blockchains", "topic": "CCIP" }, @@ -5246,7 +5310,13 @@ "category": "release", "date": "2023-07-20", "description": "Chainlink CCIP is publicly available on the following testnet chains:\n\n- Ethereum Sepolia\n- Optimism Goerli\n- Avalanche Fuji\n- Arbitrum Goerli\n- Polygon Mumbai\n\nSee the [CCIP Directory](https://docs.chain.link/ccip/directory/testnet) page for more information.", - "relatedNetworks": ["ethereum", "optimism", "avalanche", "arbitrum", "polygon"], + "relatedNetworks": [ + "ethereum", + "optimism", + "avalanche", + "arbitrum", + "polygon" + ], "title": "CCIP Testnet GA release", "topic": "CCIP" }, @@ -5395,7 +5465,13 @@ "category": "release", "date": "2024-04-29", "description": "VRF V2.5 is available on Ethereum, BNB Chain, Polygon, Avalanche and Arbitrum mainnets and testnets.The new version of Chainlink VRF implements the following changes:\n\n- Support for native gas token billing\n- Easy 1-click migration to future new versions\n- New [billing model](https://docs.chain.link/vrf/v2-5/billing), where the premium is a percentage of the gas costs of the VRF callback instead of a flat fee\n- Gas optimizations\n\nLearn how to [migrate to VRF V2.5](https://docs.chain.link/vrf/v2-5/migration-from-v2).", - "relatedNetworks": ["ethereum", "bnb-chain", "polygon", "avalanche", "arbitrum"], + "relatedNetworks": [ + "ethereum", + "bnb-chain", + "polygon", + "avalanche", + "arbitrum" + ], "title": "VRF v2.5", "topic": "VRF" }, @@ -5560,7 +5636,14 @@ "category": "deprecation", "date": "2024-06-03", "description": "Older Automation [registrars](https://docs.chain.link/chainlink-automation/reference/automation-contracts#automationregistrarsol) for v1.0, v1.1, v1.2, v1.3, and v2.0 are deprecated on all [supported networks](https://docs.chain.link/chainlink-automation/overview/supported-networks) (Ethereum, Avalanche, BSC, Polygon, Arbitrum and Optimism). You can no longer register new upkeeps using these older versions. Please [migrate your older upkeeps to Automation 2.1](https://docs.chain.link/chainlink-automation/guides/migrate-to-v2) to ensure they remain operational as we start deprecating older versions.", - "relatedNetworks": ["ethereum", "avalanche", "bnb-chain", "polygon", "arbitrum", "optimism"], + "relatedNetworks": [ + "ethereum", + "avalanche", + "bnb-chain", + "polygon", + "arbitrum", + "optimism" + ], "title": "Registrar deprecation through v2.0", "topic": "Automation" }, @@ -5614,7 +5697,14 @@ "category": "release", "date": "2023-10-02", "description": "Automation 2.0 is now live on Ethereum, Binance Smart Chain, Polygon, Avalanche, Arbitrum, and Optimism. Automation 2.0 features include:\n\n- **Verifiable compute**: The Automation DON now leverages a consensus mechanism, via Chainlink OCR3, to give you cryptographically verified compute. Save up to 90% of onchain gas costs by off-loading compute intensive tasks to the Automation DON.\n- **Log triggers**: Natively use log data in your smart contracts with [log triggers](https://docs.chain.link/chainlink-automation/guides/log-trigger). Unlock new connection possibilities.\n- **StreamsLookup**: Seamlessly access and use Chainlink's Low Latency Data in upkeeps via [StreamsLookup](https://docs.chain.link/chainlink-automation/reference/automation-interfaces#streamslookupcompatibleinterface). Build like the best Derivative protocols.\n- **Forwarder**: A unique `msg.Sender` for your `performUpkeep` function so you can lock down sensitive upkeeps. Read more about the [forwarder](https://docs.chain.link/chainlink-automation/guides/forwarder).", - "relatedNetworks": ["ethereum", "bnb-chain", "polygon", "avalanche", "arbitrum", "optimism"], + "relatedNetworks": [ + "ethereum", + "bnb-chain", + "polygon", + "avalanche", + "arbitrum", + "optimism" + ], "title": "Automation v2.0 release", "topic": "Automation" }, From af3846881c46077f77a345bf78ca5b64b44a1dc5 Mon Sep 17 00:00:00 2001 From: aelmanaa Date: Mon, 21 Jul 2025 15:31:00 +0200 Subject: [PATCH 2/2] update --- public/changelog.json | 65 +++---------------- src/scripts/ccip/detect-new-tokens.ts | 89 ++++++++++++++++++++++++--- 2 files changed, 87 insertions(+), 67 deletions(-) diff --git a/public/changelog.json b/public/changelog.json index 9a8b0527b0a..2b5f2da4e10 100644 --- a/public/changelog.json +++ b/public/changelog.json @@ -2536,14 +2536,7 @@ "category": "integration", "date": "2025-05-11", "description": "New Data Feeds available:", - "relatedNetworks": [ - "arbitrum", - "ethereum", - "celo", - "sonic", - "polygon", - "bnb-chain" - ], + "relatedNetworks": ["arbitrum", "ethereum", "celo", "sonic", "polygon", "bnb-chain"], "relatedTokens": [ { "assetName": "Berachain", @@ -3275,15 +3268,7 @@ "url": "https://docs.chain.link/ccip/directory/testnet/chain/zora-testnet" } ], - "relatedNetworks": [ - "abstract", - "hemi", - "lisk", - "metal", - "mint", - "superseed", - "zora" - ], + "relatedNetworks": ["abstract", "hemi", "lisk", "metal", "mint", "superseed", "zora"], "title": "CCIP on new blockchains", "topic": "CCIP" }, @@ -4442,17 +4427,7 @@ "url": "https://docs.chain.link/ccip/directory/testnet/chain/ethereum-testnet-sepolia-xlayer-1" } ], - "relatedNetworks": [ - "botanix", - "corn", - "hashkey", - "ink", - "polygonzkevm", - "sei", - "soneium", - "xlayer", - "monad" - ], + "relatedNetworks": ["botanix", "corn", "hashkey", "ink", "polygonzkevm", "sei", "soneium", "xlayer", "monad"], "title": "CCIP Expands to New Blockchains", "topic": "CCIP" }, @@ -5310,13 +5285,7 @@ "category": "release", "date": "2023-07-20", "description": "Chainlink CCIP is publicly available on the following testnet chains:\n\n- Ethereum Sepolia\n- Optimism Goerli\n- Avalanche Fuji\n- Arbitrum Goerli\n- Polygon Mumbai\n\nSee the [CCIP Directory](https://docs.chain.link/ccip/directory/testnet) page for more information.", - "relatedNetworks": [ - "ethereum", - "optimism", - "avalanche", - "arbitrum", - "polygon" - ], + "relatedNetworks": ["ethereum", "optimism", "avalanche", "arbitrum", "polygon"], "title": "CCIP Testnet GA release", "topic": "CCIP" }, @@ -5465,13 +5434,7 @@ "category": "release", "date": "2024-04-29", "description": "VRF V2.5 is available on Ethereum, BNB Chain, Polygon, Avalanche and Arbitrum mainnets and testnets.The new version of Chainlink VRF implements the following changes:\n\n- Support for native gas token billing\n- Easy 1-click migration to future new versions\n- New [billing model](https://docs.chain.link/vrf/v2-5/billing), where the premium is a percentage of the gas costs of the VRF callback instead of a flat fee\n- Gas optimizations\n\nLearn how to [migrate to VRF V2.5](https://docs.chain.link/vrf/v2-5/migration-from-v2).", - "relatedNetworks": [ - "ethereum", - "bnb-chain", - "polygon", - "avalanche", - "arbitrum" - ], + "relatedNetworks": ["ethereum", "bnb-chain", "polygon", "avalanche", "arbitrum"], "title": "VRF v2.5", "topic": "VRF" }, @@ -5636,14 +5599,7 @@ "category": "deprecation", "date": "2024-06-03", "description": "Older Automation [registrars](https://docs.chain.link/chainlink-automation/reference/automation-contracts#automationregistrarsol) for v1.0, v1.1, v1.2, v1.3, and v2.0 are deprecated on all [supported networks](https://docs.chain.link/chainlink-automation/overview/supported-networks) (Ethereum, Avalanche, BSC, Polygon, Arbitrum and Optimism). You can no longer register new upkeeps using these older versions. Please [migrate your older upkeeps to Automation 2.1](https://docs.chain.link/chainlink-automation/guides/migrate-to-v2) to ensure they remain operational as we start deprecating older versions.", - "relatedNetworks": [ - "ethereum", - "avalanche", - "bnb-chain", - "polygon", - "arbitrum", - "optimism" - ], + "relatedNetworks": ["ethereum", "avalanche", "bnb-chain", "polygon", "arbitrum", "optimism"], "title": "Registrar deprecation through v2.0", "topic": "Automation" }, @@ -5697,14 +5653,7 @@ "category": "release", "date": "2023-10-02", "description": "Automation 2.0 is now live on Ethereum, Binance Smart Chain, Polygon, Avalanche, Arbitrum, and Optimism. Automation 2.0 features include:\n\n- **Verifiable compute**: The Automation DON now leverages a consensus mechanism, via Chainlink OCR3, to give you cryptographically verified compute. Save up to 90% of onchain gas costs by off-loading compute intensive tasks to the Automation DON.\n- **Log triggers**: Natively use log data in your smart contracts with [log triggers](https://docs.chain.link/chainlink-automation/guides/log-trigger). Unlock new connection possibilities.\n- **StreamsLookup**: Seamlessly access and use Chainlink's Low Latency Data in upkeeps via [StreamsLookup](https://docs.chain.link/chainlink-automation/reference/automation-interfaces#streamslookupcompatibleinterface). Build like the best Derivative protocols.\n- **Forwarder**: A unique `msg.Sender` for your `performUpkeep` function so you can lock down sensitive upkeeps. Read more about the [forwarder](https://docs.chain.link/chainlink-automation/guides/forwarder).", - "relatedNetworks": [ - "ethereum", - "bnb-chain", - "polygon", - "avalanche", - "arbitrum", - "optimism" - ], + "relatedNetworks": ["ethereum", "bnb-chain", "polygon", "avalanche", "arbitrum", "optimism"], "title": "Automation v2.0 release", "topic": "Automation" }, diff --git a/src/scripts/ccip/detect-new-tokens.ts b/src/scripts/ccip/detect-new-tokens.ts index fea0c3147fd..56ed9ee981d 100644 --- a/src/scripts/ccip/detect-new-tokens.ts +++ b/src/scripts/ccip/detect-new-tokens.ts @@ -408,8 +408,27 @@ function countTotalLanes(lanesReferenceData: LanesConfig): number { function getTokenName(tokenSymbol: string, tokensData: TokensConfig): string { // Get token details from the tokens data const tokenDetails = tokensData[tokenSymbol] - const sampleChain = tokenDetails ? Object.keys(tokenDetails)[0] : null - return sampleChain && tokenDetails[sampleChain] ? tokenDetails[sampleChain].name || tokenSymbol : tokenSymbol + + if (!tokenDetails) { + logger.warn({ tokenSymbol }, "Token details not found in reference data") + return tokenSymbol + } + + const availableChains = Object.keys(tokenDetails) + if (availableChains.length === 0) { + logger.warn({ tokenSymbol }, "No chains found for token") + return tokenSymbol + } + + const sampleChain = availableChains[0] + const chainTokenData = tokenDetails[sampleChain] + + if (!chainTokenData) { + logger.warn({ tokenSymbol, sampleChain }, "Chain token data not found") + return tokenSymbol + } + + return chainTokenData.name || tokenSymbol } /** @@ -1519,6 +1538,56 @@ function getFileFromGitHistory(filePath: string, date: string): string | null { } } +/** + * Get a robust prettier configuration with fallbacks + * + * @param {string} filePath - File path to resolve config for + * @returns {Promise} Prettier configuration object + */ +async function getPrettierConfig(filePath: string): Promise { + try { + // Try resolving config for the specific file path first + let config = await prettier.resolveConfig(filePath) + + if (!config) { + // Fallback: try resolving with the config file directly + config = await prettier.resolveConfig(".prettierrc") + } + + if (!config) { + // Final fallback: use project defaults from .prettierrc + logger.warn("Could not resolve prettier config, using fallback defaults") + config = { + semi: false, + singleQuote: false, + tabWidth: 2, + trailingComma: "es5" as const, + printWidth: 120, + } + } + + logger.debug({ config }, "Resolved prettier configuration") + return config + } catch (error) { + logger.error( + { + error: error instanceof Error ? error.message : String(error), + filePath, + }, + "Error resolving prettier config, using fallback" + ) + + // Return safe fallback configuration + return { + semi: false, + singleQuote: false, + tabWidth: 2, + trailingComma: "es5" as const, + printWidth: 120, + } + } +} + /** * Generate a changelog entry for newly supported tokens * @@ -1613,16 +1682,17 @@ async function generateChangelogEntry( logger.debug(`Created directory: ${changelogDir}`) } - // Format the JSON with prettier using project config - const prettierConfig = await prettier.resolveConfig(process.cwd()) + // Get robust prettier configuration + const prettierConfig = await getPrettierConfig(FILE_PATHS.CHANGELOG) - // Format the JSON content directly before writing (like detect-new-data.ts) - const formattedJson = await prettier.format(JSON.stringify(changelog), { + // Format the JSON content with proper initial formatting + const jsonString = JSON.stringify(changelog, null, 2) + const formattedJson = await prettier.format(jsonString, { ...prettierConfig, - parser: "json", // Explicitly specify JSON parser + parser: "json", }) - // Write the formatted content directly + // Write the formatted content fs.writeFileSync(FILE_PATHS.CHANGELOG, formattedJson, "utf8") const changelogSize = fs.statSync(FILE_PATHS.CHANGELOG).size @@ -1632,7 +1702,7 @@ async function generateChangelogEntry( entriesCount: changelog.data.length, sizeBytes: changelogSize, }, - "Changelog file updated and formatted" + "Changelog file updated and formatted successfully" ) } catch (error) { logger.error( @@ -1642,6 +1712,7 @@ async function generateChangelogEntry( }, "Error writing changelog file" ) + throw error // Re-throw to handle upstream } return {