Skip to content

Commit 4ed474c

Browse files
committed
[ICONS] 🔧 cursor skill with coin radar
1 parent f840b88 commit 4ed474c

4 files changed

Lines changed: 241 additions & 0 deletions

File tree

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
---
2+
name: coin-radar-update-mapping
3+
description: Updates ledger ID mappings using Ledger's Coinradar API to sync the top cryptocurrencies. Use when the user asks to update mappings from Coinradar, sync top tokens, or mentions the Coinradar API.
4+
---
5+
6+
# Coin Radar Update Mapping
7+
8+
Automatically syncs cryptocurrency token ledger IDs from Ledger's Coinradar API into `assets/_record.json`. This approach fetches the top tokens by market cap and their complete ledger ID mappings.
9+
10+
## When to Use
11+
12+
- User asks to update mappings from Coinradar
13+
- User wants to sync the top N tokens (e.g., "top 50", "top 100")
14+
- User mentions using the Coinradar API
15+
- User wants to update multiple tokens at once based on market rank
16+
17+
## Process
18+
19+
### 1. Fetch Top Currencies List
20+
21+
Use the Coinradar currencies endpoint to get the top tokens by market cap:
22+
23+
```
24+
https://api.coinradar.ledger.com/v1/live/currencies?limit=50&offset=0
25+
```
26+
27+
**Parameters:**
28+
- `limit` - Number of tokens to fetch (start with 50, max 1000)
29+
- `offset` - Pagination offset (use 0 to start from the top)
30+
31+
**Response structure:**
32+
```json
33+
[
34+
{
35+
"name": "Bitcoin",
36+
"ticker": "BTC",
37+
"rank": 1,
38+
"image": "https://proxycgassets.api.live.ledger.com/coins/images/1/large/bitcoin.png",
39+
"coinradarId": "672de245673914b8252e64fae57cf88d56cb930e18f172e96498e0041970e127",
40+
"supported": true,
41+
"swap": true,
42+
"buy": true,
43+
"currencies": null
44+
}
45+
]
46+
```
47+
48+
**Key field:** `coinradarId` - Use this to fetch detailed ledger IDs for each token.
49+
50+
### 2. Fetch Ledger IDs for Each Token
51+
52+
For each `coinradarId` from step 1, call the nested currency endpoint:
53+
54+
```
55+
https://api.coinradar.ledger.com/v1/live/currency-nested/{coinradarId}
56+
```
57+
58+
**Response structure:**
59+
```json
60+
{
61+
"name": "Tether USD",
62+
"ticker": "USDT",
63+
"rank": 3,
64+
"image": "https://proxycgassets.api.live.ledger.com/coins/images/325/large/Tether.png",
65+
"coinradarId": "b19f92c398a6f639793b7a21cb678d75c4d8383f9fa4bf2bbc5afb4e212e57c7",
66+
"currencies": [
67+
{
68+
"name": "Tether USD",
69+
"ticker": "USDT",
70+
"network": "ethereum",
71+
"contract": "0xdac17f958d2ee523a2206206994597c13d831ec7",
72+
"ledgerId": "ethereum/erc20/usd_tether__erc20_",
73+
"supported": true
74+
},
75+
{
76+
"name": "Tether USD",
77+
"ticker": "USDT",
78+
"network": "bsc",
79+
"contract": "0x55d398326f99059ff775485246999027b3197955",
80+
"ledgerId": "bsc/bep20/binance-peg_bsc-usd",
81+
"supported": true
82+
}
83+
]
84+
}
85+
```
86+
87+
### 3. Extract All Ledger IDs
88+
89+
From the `currencies` array, extract all `ledgerId` values (ignore entries where `ledgerId` is null).
90+
91+
**Important Rule:** All ledger IDs returned for a single `coinradarId` should use the same icon/image, with the following exceptions:
92+
- **L1 and L2 exceptions:** Base, Optimism, Arbitrum, and other Layer 1/Layer 2 networks may have their own specific icons
93+
- For most tokens, all networks share the same icon
94+
- The `image` field from the parent object provides the standard icon URL
95+
96+
### 4. Read Current State
97+
98+
Load `assets/_record.json` to see existing mappings.
99+
100+
### 5. Match or Create Token Entry
101+
102+
For each token from the API:
103+
104+
1. Look for an existing entry in `_record.json` using the ticker (UPPERCASE)
105+
2. If found, prepare to merge ledger IDs
106+
3. If not found, prepare to create a new entry with the ticker in UPPERCASE
107+
108+
### 6. Merge Ledger IDs
109+
110+
For each token:
111+
- Keep all existing IDs from `_record.json`
112+
- Add new IDs from the Coinradar API
113+
- Remove duplicates
114+
- Sort alphabetically
115+
116+
### 7. Update File
117+
118+
Update `assets/_record.json` with the merged ledger ID lists for all processed tokens.
119+
120+
## File Format
121+
122+
`assets/_record.json` structure:
123+
```json
124+
{
125+
"TOKEN_TICKER": {
126+
"ids": [
127+
"network/standard/token_identifier",
128+
"another_network/standard/token_identifier"
129+
]
130+
}
131+
}
132+
```
133+
134+
## Examples
135+
136+
**User request:** "Update les mappings pour les top 50 tokens avec Coinradar"
137+
138+
**Steps:**
139+
1. Fetch `https://api.coinradar.ledger.com/v1/live/currencies?limit=50&offset=0`
140+
2. For each token in the response:
141+
- Extract `coinradarId` and `ticker`
142+
- Fetch `https://api.coinradar.ledger.com/v1/live/currency-nested/{coinradarId}`
143+
- Extract all `ledgerId` values from the `currencies` array
144+
3. Load `assets/_record.json`
145+
4. For each token:
146+
- Find or create entry for the ticker (UPPERCASE)
147+
- Merge new ledger IDs with existing ones
148+
- Sort and deduplicate
149+
5. Update `assets/_record.json` with all changes
150+
6. Report summary: how many tokens processed, how many updated, how many created
151+
152+
**User request:** "Sync BTC, ETH, and USDT from Coinradar"
153+
154+
**Steps:**
155+
1. Fetch `https://api.coinradar.ledger.com/v1/live/currencies?limit=100&offset=0`
156+
2. Filter the response to only BTC, ETH, and USDT by ticker
157+
3. For each of these 3 tokens:
158+
- Extract `coinradarId`
159+
- Fetch nested currency data
160+
- Extract all ledger IDs
161+
4. Load `assets/_record.json`
162+
5. Merge ledger IDs for "BTC", "ETH", and "USDT" entries
163+
6. Update file
164+
165+
## Edge Cases
166+
167+
**Token not in Coinradar API**: Inform user that the token wasn't found in the top N tokens from Coinradar.
168+
169+
**Token not in _record.json**: Create a new entry with the ticker in UPPERCASE.
170+
171+
**No new IDs**: Inform user that the token already has all ledger IDs from Coinradar.
172+
173+
**Null ledgerId**: Skip entries where `ledgerId` is null in the currencies array.
174+
175+
**API rate limiting**: If processing many tokens, consider adding small delays between requests.
176+
177+
**Large limit values**: Start with limit=50 for testing. Can go up to 1000 for full sync.
178+
179+
## Important Notes
180+
181+
- Token tickers in `_record.json` use UPPERCASE
182+
- Always preserve existing IDs from `_record.json`
183+
- Sort final list alphabetically for consistency
184+
- Maintain JSON formatting with 2-space indentation
185+
- The API endpoint is production: `api.coinradar.ledger.com`
186+
- All ledger IDs for the same `coinradarId` share the same icon (except L1/L2 exceptions)
187+
- The `image` field provides the direct URL to the token's icon
188+
- Skip any currency entries where `ledgerId` is null
189+
- Process tokens in order of their market cap rank
190+
- Consider fetching in batches (e.g., 50 at a time) for large syncs
191+
192+
## Performance Tips
193+
194+
- Start with small limits (50) for testing
195+
- For full sync, can use limit=1000 but will take longer
196+
- Show progress to user (e.g., "Processing token 10/50: USDC")
197+
- Batch write to `_record.json` at the end rather than per-token

assets/RSETH.png

863 Bytes
Loading

assets/_record.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,20 @@
989989
"ROSE": {
990990
"ids": ["bsc/bep20/wrapped_rose", "ethereum/erc20/oasis_labs"]
991991
},
992+
"RSETH": {
993+
"ids": [
994+
"arbitrum/erc20/kelpdao_restaked_eth",
995+
"avalanche_c_chain/erc20/kelpdao_restaked_eth_0xc430c78da6e4af49bd115f0329d154bb135f1363",
996+
"base/erc20/kelpdao_restaked_eth",
997+
"berachain/erc20/rseth",
998+
"blast/erc20/kelpdao_bridged_rseth_blast",
999+
"ethereum/erc20/rseth",
1000+
"linea/erc20/kelpdao_restaked_eth",
1001+
"optimism/erc20/kelpdao_restaked_eth",
1002+
"scroll/erc20/kelpdao_restaked_eth",
1003+
"sonic/erc20/kelpdao_restaked_eth_0xd75787ba9aba324420d522bda84c08c87e5099b1"
1004+
]
1005+
},
9921006
"RUNE": {
9931007
"ids": ["thorchain"]
9941008
},

assets/index.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
"arbitrum/erc20/graph_token": {
7878
"icon": "GRT.png"
7979
},
80+
"arbitrum/erc20/kelpdao_restaked_eth": {
81+
"icon": "RSETH.png"
82+
},
8083
"arbitrum/erc20/kujira_native_asset": {
8184
"icon": "KUJI.png"
8285
},
@@ -212,6 +215,9 @@
212215
"avalanche_c_chain/erc20/graph_token_(bridged)": {
213216
"icon": "GRT.png"
214217
},
218+
"avalanche_c_chain/erc20/kelpdao_restaked_eth_0xc430c78da6e4af49bd115f0329d154bb135f1363": {
219+
"icon": "RSETH.png"
220+
},
215221
"avalanche_c_chain/erc20/kyber_network_crystal_v2": {
216222
"icon": "KNC.png"
217223
},
@@ -290,6 +296,9 @@
290296
"base/erc20/iotex_network": {
291297
"icon": "IOTX.png"
292298
},
299+
"base/erc20/kelpdao_restaked_eth": {
300+
"icon": "RSETH.png"
301+
},
293302
"base/erc20/mog_coin": {
294303
"icon": "MOG.png"
295304
},
@@ -371,6 +380,9 @@
371380
"berachain/erc20/pendle": {
372381
"icon": "PENDLE.png"
373382
},
383+
"berachain/erc20/rseth": {
384+
"icon": "RSETH.png"
385+
},
374386
"berachain/erc20/stargatetoken_0x9895d81bb462a195b4922ed7de0e3acd007c32cb": {
375387
"icon": "STG.png"
376388
},
@@ -416,6 +428,9 @@
416428
"blast/erc20/ena_0x58538e6a46e07434d7e7375bc268d3cb839c0133": {
417429
"icon": "ENA.png"
418430
},
431+
"blast/erc20/kelpdao_bridged_rseth_blast": {
432+
"icon": "RSETH.png"
433+
},
419434
"blast/erc20/usde_0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34": {
420435
"icon": "USDE.png"
421436
},
@@ -1133,6 +1148,9 @@
11331148
"ethereum/erc20/rollbit_coin": {
11341149
"icon": "RLB.png"
11351150
},
1151+
"ethereum/erc20/rseth": {
1152+
"icon": "RSETH.png"
1153+
},
11361154
"ethereum/erc20/runesbridge": {
11371155
"icon": "RB.png"
11381156
},
@@ -1430,6 +1448,9 @@
14301448
"linea/erc20/gnosis_token": {
14311449
"icon": "GNO.png"
14321450
},
1451+
"linea/erc20/kelpdao_restaked_eth": {
1452+
"icon": "RSETH.png"
1453+
},
14331454
"linea/erc20/kyber_network_crystal_v2": {
14341455
"icon": "KNC.png"
14351456
},
@@ -1598,6 +1619,9 @@
15981619
"optimism/erc20/frax_ether": {
15991620
"icon": "FRXETH.png"
16001621
},
1622+
"optimism/erc20/kelpdao_restaked_eth": {
1623+
"icon": "RSETH.png"
1624+
},
16011625
"optimism/erc20/kujira_native_asset": {
16021626
"icon": "KUJI.png"
16031627
},
@@ -1865,6 +1889,9 @@
18651889
"scroll/erc20/ena_0x58538e6a46e07434d7e7375bc268d3cb839c0133": {
18661890
"icon": "ENA.png"
18671891
},
1892+
"scroll/erc20/kelpdao_restaked_eth": {
1893+
"icon": "RSETH.png"
1894+
},
18681895
"scroll/erc20/stargatetoken_0x8731d54e9d02c286767d56ac03e8037c07e01e98": {
18691896
"icon": "STG.png"
18701897
},
@@ -2000,6 +2027,9 @@
20002027
"sonic/erc20/chainlink_token_0x71052bae71c25c78e37fd12e5ff1101a71d9018f": {
20012028
"icon": "LINK.png"
20022029
},
2030+
"sonic/erc20/kelpdao_restaked_eth_0xd75787ba9aba324420d522bda84c08c87e5099b1": {
2031+
"icon": "RSETH.png"
2032+
},
20032033
"sonic/erc20/pendle_0xf1ef7d2d4c0c881cd634481e0586ed5d2871a74b": {
20042034
"icon": "PENDLE.png"
20052035
},

0 commit comments

Comments
 (0)