chore: bump CowSwap.json version with new Ink tokens and updated WETH logos#1353
chore: bump CowSwap.json version with new Ink tokens and updated WETH logos#1353alfetopito merged 2 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughUpdated CoinGecko URL handling and token validation in Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/scripts/cowFi-tokens.js`:
- Around line 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).
🧹 Nitpick comments (1)
src/scripts/cowFi-tokens.js (1)
187-203: Add normalization for platform chain keys to match codebase patterns.
While CoinGecko's API currently returns lowercase platform keys (ethereum,xdai), normalizing thechainparameter with.toLowerCase()improves consistency with how addresses and symbols are handled elsewhere in the file and adds defensive resilience against potential future API changes.🔧 Suggested change
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 } + const normalizedChain = chain.toLowerCase() return ( combined_ids[address.toLowerCase()] && - ['ethereum', 'xdai'].includes(chain) + ['ethereum', 'xdai'].includes(normalizedChain) ) })
| 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}`) |
There was a problem hiding this comment.
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).
New Ink tokens:
WETHtoINK#1331USDGtoINK#1328USDCtoINK#1324USD₮0toINK#1320Updated WETH logos:
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2toMAINNET#13350x6a023ccd1ff6f2045c3309768ead9e68f978f6e1toGNOSIS_CHAIN#13370x82af49447d8a07e3bd95bd0d56f35241523fbab1toARBITRUM_ONE#13390x4200000000000000000000000000000000000006toBASE#13400x7ceb23fd6bc0add59e62ac25578270cff1b9f619toPOLYGON#13420x49d5c2bdffac6ce2bfdb6640f4f80f226bc10babtoAVALANCHE#13440x2170ed0880ac9a755fd29b2688956bd959f933f8toBNB#13460xe5ecd226b3032910ceaa43ba92ee8232f8237553toLENS#13490xe5d7c2a44ffddf6b295a15c148167daaaf5cf34ftoLINEA#13510x9895d81bb462a195b4922ed7de0e3acd007c32cbtoPLASMA#1352See https://tokenlists.org/token-list?url=https://raw.githubusercontent.com/cowprotocol/token-lists/09d9130a61cb5587c5b667a017d8d2915c873478/src/public/CowSwap.json
Summary by CodeRabbit
Chores
Bug Fixes