Skip to content

Commit 75b999c

Browse files
Update CCT Changelog: New CCIP Tokens Detected (smartcontractkit#2835)
* CCT: Update changelog with new tokens * update --------- Co-authored-by: aelmanaa <[email protected]> Co-authored-by: aelmanaa <[email protected]>
1 parent 46a21c1 commit 75b999c

File tree

2 files changed

+119
-9
lines changed

2 files changed

+119
-9
lines changed

public/changelog.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,45 @@
302302
}
303303
},
304304
"data": [
305+
{
306+
"category": "integration",
307+
"date": "2025-07-21",
308+
"description": "Newly supported tokens: BTR, ILMT, USELESS, YBTC.B, stBTC",
309+
"relatedTokens": [
310+
{
311+
"assetName": "BTR Token",
312+
"baseAsset": "BTR",
313+
"url": "https://docs.chain.link/ccip/directory/mainnet/token/BTR",
314+
"iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/btr.webp?auto=compress%2Cformat"
315+
},
316+
{
317+
"assetName": "Iluminary Token",
318+
"baseAsset": "ILMT",
319+
"url": "https://docs.chain.link/ccip/directory/mainnet/token/ILMT",
320+
"iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/ilmt.webp?auto=compress%2Cformat"
321+
},
322+
{
323+
"assetName": "USELESS COIN",
324+
"baseAsset": "USELESS",
325+
"url": "https://docs.chain.link/ccip/directory/mainnet/token/USELESS",
326+
"iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/useless.webp?auto=compress%2Cformat"
327+
},
328+
{
329+
"assetName": "Yield BTC.B",
330+
"baseAsset": "YBTC.B",
331+
"url": "https://docs.chain.link/ccip/directory/mainnet/token/YBTC.B",
332+
"iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/ybtcb.webp?auto=compress%2Cformat"
333+
},
334+
{
335+
"assetName": "Lorenzo stBTC",
336+
"baseAsset": "stBTC",
337+
"url": "https://docs.chain.link/ccip/directory/mainnet/token/stBTC",
338+
"iconUrl": "https://d2f70xi62kby8n.cloudfront.net/tokens/stbtc.webp?auto=compress%2Cformat"
339+
}
340+
],
341+
"title": "Cross-chain token (CCT) standard: Added support for new tokens",
342+
"topic": "CCIP"
343+
},
305344
{
306345
"category": "integration",
307346
"date": "2025-07-20",

src/scripts/ccip/detect-new-tokens.ts

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,27 @@ function countTotalLanes(lanesReferenceData: LanesConfig): number {
408408
function getTokenName(tokenSymbol: string, tokensData: TokensConfig): string {
409409
// Get token details from the tokens data
410410
const tokenDetails = tokensData[tokenSymbol]
411-
const sampleChain = tokenDetails ? Object.keys(tokenDetails)[0] : null
412-
return sampleChain && tokenDetails[sampleChain] ? tokenDetails[sampleChain].name || tokenSymbol : tokenSymbol
411+
412+
if (!tokenDetails) {
413+
logger.warn({ tokenSymbol }, "Token details not found in reference data")
414+
return tokenSymbol
415+
}
416+
417+
const availableChains = Object.keys(tokenDetails)
418+
if (availableChains.length === 0) {
419+
logger.warn({ tokenSymbol }, "No chains found for token")
420+
return tokenSymbol
421+
}
422+
423+
const sampleChain = availableChains[0]
424+
const chainTokenData = tokenDetails[sampleChain]
425+
426+
if (!chainTokenData) {
427+
logger.warn({ tokenSymbol, sampleChain }, "Chain token data not found")
428+
return tokenSymbol
429+
}
430+
431+
return chainTokenData.name || tokenSymbol
413432
}
414433

415434
/**
@@ -1519,6 +1538,56 @@ function getFileFromGitHistory(filePath: string, date: string): string | null {
15191538
}
15201539
}
15211540

1541+
/**
1542+
* Get a robust prettier configuration with fallbacks
1543+
*
1544+
* @param {string} filePath - File path to resolve config for
1545+
* @returns {Promise<prettier.Config>} Prettier configuration object
1546+
*/
1547+
async function getPrettierConfig(filePath: string): Promise<prettier.Config> {
1548+
try {
1549+
// Try resolving config for the specific file path first
1550+
let config = await prettier.resolveConfig(filePath)
1551+
1552+
if (!config) {
1553+
// Fallback: try resolving with the config file directly
1554+
config = await prettier.resolveConfig(".prettierrc")
1555+
}
1556+
1557+
if (!config) {
1558+
// Final fallback: use project defaults from .prettierrc
1559+
logger.warn("Could not resolve prettier config, using fallback defaults")
1560+
config = {
1561+
semi: false,
1562+
singleQuote: false,
1563+
tabWidth: 2,
1564+
trailingComma: "es5" as const,
1565+
printWidth: 120,
1566+
}
1567+
}
1568+
1569+
logger.debug({ config }, "Resolved prettier configuration")
1570+
return config
1571+
} catch (error) {
1572+
logger.error(
1573+
{
1574+
error: error instanceof Error ? error.message : String(error),
1575+
filePath,
1576+
},
1577+
"Error resolving prettier config, using fallback"
1578+
)
1579+
1580+
// Return safe fallback configuration
1581+
return {
1582+
semi: false,
1583+
singleQuote: false,
1584+
tabWidth: 2,
1585+
trailingComma: "es5" as const,
1586+
printWidth: 120,
1587+
}
1588+
}
1589+
}
1590+
15221591
/**
15231592
* Generate a changelog entry for newly supported tokens
15241593
*
@@ -1613,16 +1682,17 @@ async function generateChangelogEntry(
16131682
logger.debug(`Created directory: ${changelogDir}`)
16141683
}
16151684

1616-
// Format the JSON with prettier using project config
1617-
const prettierConfig = await prettier.resolveConfig(process.cwd())
1685+
// Get robust prettier configuration
1686+
const prettierConfig = await getPrettierConfig(FILE_PATHS.CHANGELOG)
16181687

1619-
// Format the JSON content directly before writing (like detect-new-data.ts)
1620-
const formattedJson = await prettier.format(JSON.stringify(changelog), {
1688+
// Format the JSON content with proper initial formatting
1689+
const jsonString = JSON.stringify(changelog, null, 2)
1690+
const formattedJson = await prettier.format(jsonString, {
16211691
...prettierConfig,
1622-
parser: "json", // Explicitly specify JSON parser
1692+
parser: "json",
16231693
})
16241694

1625-
// Write the formatted content directly
1695+
// Write the formatted content
16261696
fs.writeFileSync(FILE_PATHS.CHANGELOG, formattedJson, "utf8")
16271697

16281698
const changelogSize = fs.statSync(FILE_PATHS.CHANGELOG).size
@@ -1632,7 +1702,7 @@ async function generateChangelogEntry(
16321702
entriesCount: changelog.data.length,
16331703
sizeBytes: changelogSize,
16341704
},
1635-
"Changelog file updated and formatted"
1705+
"Changelog file updated and formatted successfully"
16361706
)
16371707
} catch (error) {
16381708
logger.error(
@@ -1642,6 +1712,7 @@ async function generateChangelogEntry(
16421712
},
16431713
"Error writing changelog file"
16441714
)
1715+
throw error // Re-throw to handle upstream
16451716
}
16461717

16471718
return {

0 commit comments

Comments
 (0)