Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/public/CowSwap.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "CoW Swap",
"timestamp": "2026-01-29T16:30:00+00:00",
"timestamp": "2026-02-05T10:45:00+00:00",
"version": {
"major": 6,
"minor": 9,
"minor": 10,
"patch": 0
},
"logoURI": "https://files.cow.fi/token-lists/images/list-logo.png",
Expand Down Expand Up @@ -2133,4 +2133,4 @@
"logoURI": "https://files.cow.fi/token-lists/images/59144/0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f/logo.png"
}
]
}
}
29 changes: 20 additions & 9 deletions src/scripts/cowFi-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const USE_CACHE = (process.env.USE_CACHE ?? 'true') === 'true'

const cowListUrl = 'https://files.cow.fi/tokens/CowSwap.json'
// const coinGeckoListUrl = "https://files.cow.fi/tokens/CoinGecko.json";
const coinGeckoIdListUrl = 'https://api.coingecko.com/api/v3/coins/list'
const coinGeckoCoinsUrl = 'https://api.coingecko.com/api/v3/coins'
const coinGeckoCoinsQuoteParams = `localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false`
const coinGeckoIdListUrl = `${coinGeckoCoinsUrl}/list`

const LIST_DIR = path.join('src', 'cowFi')

Expand Down Expand Up @@ -123,10 +125,10 @@ async function getStaticData(idsData) {

let index = 0
const totalTokens = idsData.length + 1

while (index < idsData.length) {
const idItem = idsData[index]
const quoteParams = `localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false`
const url = `https://api.coingecko.com/api/v3/coins/${idItem.id}?${quoteParams}`
const url = `${coinGeckoCoinsUrl}/${idItem.id}?${coinGeckoCoinsQuoteParams}`

console.log(`[${index + 1}/${totalTokens}] Fetching data for ID: ${idItem.id}`)
Comment on lines 127 to 133
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Progress counter is off by one.
totalTokens is idsData.length + 1, so logs show n/(n+1) on the last item. If there’s no extra item, use idsData.length.

🧮 Suggested fix
-  const totalTokens = idsData.length + 1
+  const totalTokens = idsData.length
🤖 Prompt for AI Agents
In `@src/scripts/cowFi-tokens.js` around lines 127 - 133, The progress counter is
off because totalTokens is set to idsData.length + 1; change totalTokens to
compute from idsData.length (e.g., totalTokens = idsData.length) so the console
log inside the while loop that prints `[${index + 1}/${totalTokens}]` shows
correct n/n on the final item; update the variable assignment near where
totalTokens, idsData, index and the while loop are defined (ensure no other
logic depends on the +1).


Expand Down Expand Up @@ -182,13 +184,22 @@ async function getStaticDataFinal(data) {

// Filter current static list with only tokens from our 2 exists list
const filtered = parsed.filter(({ platforms, description, id }) => {
return (
description?.en?.trim().length &&
!TOKENS_TO_REMOVE.includes(id) &&
Object.entries(platforms).some(
([chain, address]) => combined_ids[address.toLowerCase()] && ['ethereum', 'xdai'].includes(chain),
if (!description?.en?.trim().length || TOKENS_TO_REMOVE.includes(id) || !platforms) {
return false
}

return Object.entries(platforms).some(([chain, address]) => {
if (typeof address !== 'string' || !address) {
console.warn(
`Platform entry for chain="${chain}" has no address. Skipping... Debug URL: ${coinGeckoCoinsUrl}/${id}?${coinGeckoCoinsQuoteParams}`,
)
return false
}

return (
combined_ids[address.toLowerCase()] && ['ethereum', 'xdai'].includes(chain)
)
)
})
})

// Sort the data by market cap and take limit the list
Expand Down