@yodlpay/tokenlists 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -72,35 +72,34 @@ const weth = getNativeWrappedToken(1);
72
72
 
73
73
  ### Stablecoins
74
74
 
75
+ Stablecoin peg information is stored directly in token extensions via the `peggedTo` field:
76
+
75
77
  ```typescript
76
78
  import {
77
- isStablecoin,
78
- getStablecoinCurrency,
79
- getStablecoinInfo,
80
- getStablecoinsByPeg,
79
+ getTokenBySymbol,
81
80
  type FiatCurrency,
82
- type StablecoinCheckResult
81
+ type TokenInfo
83
82
  } from '@yodlpay/tokenlists';
84
83
 
85
- // Check if a token is a stablecoin (by coinGeckoId)
86
- isStablecoin('tether'); // true
87
- isStablecoin('ethereum'); // false
84
+ // Get a token and check if it's a stablecoin
85
+ const usdc = getTokenBySymbol('USDC', 1);
88
86
 
89
- // Get the currency a stablecoin is pegged to
90
- getStablecoinCurrency('usd-coin'); // 'USD'
91
- getStablecoinCurrency('euro-coin'); // 'EUR'
87
+ // Check the peggedTo field in extensions
88
+ if (usdc.extensions?.peggedTo) {
89
+ console.log(`${usdc.symbol} is pegged to ${usdc.extensions.peggedTo}`);
90
+ // "USDC is pegged to USD"
91
+ }
92
92
 
93
- // Get detailed stablecoin info for a token
94
- // Checks coinGeckoId first, falls back to symbol if not in registry
95
- // (handles bridged stablecoins like l2-standard-bridged-usdt-base)
96
- const token = getTokenBySymbol('USDC', 1);
97
- const info = getStablecoinInfo(token);
98
- // { isStablecoin: true, peggedTo: 'USD' }
93
+ // Filter tokens by peg currency
94
+ import { tokenlist } from '@yodlpay/tokenlists';
99
95
 
100
- // Get all stablecoin coinGeckoIds for a currency
101
- getStablecoinsByPeg('EUR'); // ['euro-coin', 'monerium-eur-money', ...]
96
+ const eurStablecoins = tokenlist.filter(
97
+ (token) => token.extensions?.peggedTo === 'EUR'
98
+ );
102
99
  ```
103
100
 
101
+ Supported fiat currencies: `USD`, `EUR`, `CHF`, `BRL`, `IDR`, `GBP`, `JPY`, `KRW`, `SGD`, `AUD`, `MXN`, `CNY`, `TRY`
102
+
104
103
  ### Router ABIs
105
104
 
106
105
  ```typescript
@@ -163,23 +162,24 @@ The package maintains these data files:
163
162
 
164
163
  - **Featured** (`tokenlist-featured.json`) - Manually curated tokens with metadata updated from on-chain data
165
164
  - **Generated** (`tokenlist-generated.json`) - Auto-fetched tokens from external sources (cross-checked with other services as they are added)
166
- - **Stablecoin Registry** (`stablecoin-registry.json`) - Mapping of CoinGecko IDs to fiat currencies (USD, EUR, etc.) for stablecoin detection
165
+
166
+ Stablecoin peg information is stored directly in token extensions via the `peggedTo` field (e.g., `"peggedTo": "USD"`).
167
167
 
168
168
  ### How `yarn update:tokens` Works
169
169
 
170
170
  1. **Fetch tokens from Relay Link API** - Discovers tokens across all supported chains
171
171
  2. **Enrich with on-chain data** - Verifies name, symbol, and decimals directly from contracts
172
- 3. **Match CoinGecko IDs** - Links tokens to CoinGecko for market data (tokens without a match are excluded)
173
- 4. **Filter by market data** - Removes low-quality tokens based on:
172
+ 3. **Fetch stablecoin data** - Gets stablecoin categories from CoinGecko to determine `peggedTo` values
173
+ 4. **Match CoinGecko IDs** - Links tokens to CoinGecko for market data and adds `peggedTo` for stablecoins (tokens without a match are excluded)
174
+ 5. **Filter by market data** - Removes low-quality tokens based on:
174
175
  - Market cap rank (must be ≤ 10,000)
175
176
  - 24h volume (must be ≥ $10,000)
176
177
  - Volume/market cap ratio (must be ≥ 0.1%)
177
178
  - Circulating/max supply ratio (must be ≥ 0.1%)
178
- 5. **Remove duplicates** - Tokens with duplicate symbols on the same chain are removed
179
- 6. **Write to generated list** - Updates `tokenlist-generated.json`
180
- 7. **Update stablecoin registry** - Fetches stablecoin data from CoinGecko Pro API and updates `stablecoin-registry.json`
179
+ 6. **Remove duplicates** - Tokens with duplicate symbols on the same chain are removed
180
+ 7. **Write to generated list** - Updates `tokenlist-generated.json`
181
181
 
182
- > **Note:** Steps 3, 4, and 7 use the CoinGecko Pro API and require a `COINGECKO_API_KEY` environment variable with a valid Pro API key.
182
+ > **Note:** Steps 3, 4, and 5 use the CoinGecko Pro API and require a `COINGECKO_API_KEY` environment variable with a valid Pro API key.
183
183
 
184
184
  ### Featured Token Overrides
185
185
 
@@ -196,6 +196,53 @@ FEATURED_TOKEN_OVERRIDES: Array<{
196
196
 
197
197
  When querying by symbol, the `primary` address is returned. Use `getTokenByAddress()` to get a specific variant.
198
198
 
199
+ ### Symbol-Based Overrides
200
+
201
+ The `tokenlist-overrides.json` file allows you to customize generated tokens without modifying the auto-generated list. Overrides are applied by symbol (uppercase) and affect **all tokens with that symbol** across all chains.
202
+
203
+ ```json
204
+ {
205
+ "name": "Yodl Token Overrides",
206
+ "timestamp": "2024-01-01T00:00:00.000Z",
207
+ "version": { "major": 2, "minor": 0, "patch": 0 },
208
+ "overrides": {
209
+ "USDC": {
210
+ "logoURI": "https://example.com/usdc.png",
211
+ "extensions": {
212
+ "peggedTo": "USD"
213
+ }
214
+ },
215
+ "SPAM": {
216
+ "_deleted": true
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ Override fields:
223
+ - `name` - Override the token name
224
+ - `logoURI` - Override the logo URL
225
+ - `tags` - Override tags array
226
+ - `extensions` - Merge additional extension fields
227
+ - `_deleted` - Set to `true` to hide all tokens with this symbol
228
+
229
+ Overrides are automatically re-applied after running `yarn update:tokens`.
230
+
231
+ ### Token Manager UI
232
+
233
+ A web-based UI for managing tokens is available:
234
+
235
+ ```bash
236
+ yarn tool:tokens
237
+ ```
238
+
239
+ This starts a local server at `http://localhost:3456` where you can:
240
+ - Browse featured and generated tokens
241
+ - Filter by chain, source, and search
242
+ - Add/edit overrides for generated tokens
243
+ - Mark tokens as deleted
244
+ - Validate token lists against the Uniswap schema
245
+
199
246
  ### Token Logo Management
200
247
 
201
248
  Token logos are stored in Vercel Blob storage. Run: