@yodlpay/tokenlists 1.1.3 → 1.1.5
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 +74 -23
- package/dist/{ccip-DHHrdFRp.cjs → ccip-CDL0XQMl.cjs} +1 -1
- package/dist/{ccip-D_Tl0Okc.js → ccip-Dv296j_Q.js} +1 -1
- package/dist/{index-DexvUg55.cjs → index-BqYpjiy9.cjs} +11035 -19164
- package/dist/{index-DDrpnhH2.js → index-CIWcrB8e.js} +11034 -19160
- package/dist/index.cjs +3 -6
- package/dist/index.d.ts +82 -30
- package/dist/index.js +1 -1
- package/dist/tokens/tokenlist-featured.json +512 -280
- package/dist/tokens/tokenlist-generated.json +2436 -18693
- package/dist/tokens/tokenlist-overrides.json +265 -0
- package/dist/tokens/tokenlist.schema.json +329 -0
- package/package.json +20 -11
- package/dist/tokens/stablecoin-registry.json +0 -67
package/README.md
CHANGED
|
@@ -72,33 +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
|
-
|
|
78
|
-
getStablecoinCurrency,
|
|
79
|
-
getStablecoinInfo,
|
|
80
|
-
getStablecoinsByPeg,
|
|
79
|
+
getTokenBySymbol,
|
|
81
80
|
type FiatCurrency,
|
|
82
|
-
type
|
|
81
|
+
type TokenInfo
|
|
83
82
|
} from '@yodlpay/tokenlists';
|
|
84
83
|
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
isStablecoin('ethereum'); // false
|
|
84
|
+
// Get a token and check if it's a stablecoin
|
|
85
|
+
const usdc = getTokenBySymbol('USDC', 1);
|
|
88
86
|
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
//
|
|
94
|
-
|
|
95
|
-
const info = getStablecoinInfo(token);
|
|
96
|
-
// { isStablecoin: true, peggedTo: 'USD' }
|
|
93
|
+
// Filter tokens by peg currency
|
|
94
|
+
import { tokenlist } from '@yodlpay/tokenlists';
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const eurStablecoins = tokenlist.filter(
|
|
97
|
+
(token) => token.extensions?.peggedTo === 'EUR'
|
|
98
|
+
);
|
|
100
99
|
```
|
|
101
100
|
|
|
101
|
+
Supported fiat currencies: `USD`, `EUR`, `CHF`, `BRL`, `IDR`, `GBP`, `JPY`, `KRW`, `SGD`, `AUD`, `MXN`, `CNY`, `TRY`
|
|
102
|
+
|
|
102
103
|
### Router ABIs
|
|
103
104
|
|
|
104
105
|
```typescript
|
|
@@ -161,21 +162,24 @@ The package maintains these data files:
|
|
|
161
162
|
|
|
162
163
|
- **Featured** (`tokenlist-featured.json`) - Manually curated tokens with metadata updated from on-chain data
|
|
163
164
|
- **Generated** (`tokenlist-generated.json`) - Auto-fetched tokens from external sources (cross-checked with other services as they are added)
|
|
164
|
-
|
|
165
|
+
|
|
166
|
+
Stablecoin peg information is stored directly in token extensions via the `peggedTo` field (e.g., `"peggedTo": "USD"`).
|
|
165
167
|
|
|
166
168
|
### How `yarn update:tokens` Works
|
|
167
169
|
|
|
168
170
|
1. **Fetch tokens from Relay Link API** - Discovers tokens across all supported chains
|
|
169
171
|
2. **Enrich with on-chain data** - Verifies name, symbol, and decimals directly from contracts
|
|
170
|
-
3. **
|
|
171
|
-
4. **
|
|
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:
|
|
172
175
|
- Market cap rank (must be ≤ 10,000)
|
|
173
176
|
- 24h volume (must be ≥ $10,000)
|
|
174
177
|
- Volume/market cap ratio (must be ≥ 0.1%)
|
|
175
178
|
- Circulating/max supply ratio (must be ≥ 0.1%)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
+
|
|
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.
|
|
179
183
|
|
|
180
184
|
### Featured Token Overrides
|
|
181
185
|
|
|
@@ -192,6 +196,53 @@ FEATURED_TOKEN_OVERRIDES: Array<{
|
|
|
192
196
|
|
|
193
197
|
When querying by symbol, the `primary` address is returned. Use `getTokenByAddress()` to get a specific variant.
|
|
194
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
|
+
|
|
195
246
|
### Token Logo Management
|
|
196
247
|
|
|
197
248
|
Token logos are stored in Vercel Blob storage. Run:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseError, g as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, a as localBatchGatewayRequest, c as call, b as concat, e as encodeAbiParameters, H as HttpRequestError, f as isHex } from './index-
|
|
1
|
+
import { B as BaseError, g as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, a as localBatchGatewayRequest, c as call, b as concat, e as encodeAbiParameters, H as HttpRequestError, f as isHex } from './index-CIWcrB8e.js';
|
|
2
2
|
|
|
3
3
|
class OffchainLookupError extends BaseError {
|
|
4
4
|
constructor({ callbackSelector, cause, data, extraData, sender, urls }){
|