coingecko-pro 0.1.0

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.
@@ -0,0 +1,4308 @@
1
+ /**
2
+ * @module client
3
+ * Main HTTP client for the CoinGecko REST API.
4
+ *
5
+ * Features:
6
+ * - Automatic base URL selection (Pro vs Free tier)
7
+ * - In-memory TTL cache
8
+ * - Token-bucket rate limiting
9
+ * - Exponential-backoff retry on 429 / 503
10
+ * - AbortController request timeout
11
+ * - Lifecycle hooks (onRequest, onResponse, onError)
12
+ */
13
+ /**
14
+ * Configuration options accepted by {@link CoinGeckoClient}.
15
+ */
16
+ interface CoinGeckoClientConfig {
17
+ /**
18
+ * CoinGecko Pro API key.
19
+ * When present the client targets `pro-api.coingecko.com` and adds the
20
+ * `x-cg-pro-api-key` header.
21
+ */
22
+ apiKey?: string;
23
+ /**
24
+ * Override the base URL entirely (useful for testing or proxies).
25
+ * When omitted the base URL is derived from `apiKey`.
26
+ */
27
+ baseUrl?: string;
28
+ /**
29
+ * Default response cache TTL in milliseconds.
30
+ * @default 30_000
31
+ */
32
+ cacheTtl?: number;
33
+ /**
34
+ * Maximum number of retry attempts for transient errors (429, 503).
35
+ * @default 3
36
+ */
37
+ maxRetries?: number;
38
+ /**
39
+ * Base delay in milliseconds for the first retry. Subsequent retries use
40
+ * exponential backoff: `retryDelay * 2^attempt`.
41
+ * @default 1000
42
+ */
43
+ retryDelay?: number;
44
+ /**
45
+ * Maximum requests per minute enforced by the built-in rate limiter.
46
+ * Defaults to `500` when an `apiKey` is present (Pro tier), otherwise `30`.
47
+ */
48
+ rateLimit?: number;
49
+ /**
50
+ * Request timeout in milliseconds. Requests that exceed this duration are
51
+ * aborted and throw a {@link CoinGeckoError} with `status: 0`.
52
+ * @default 15_000
53
+ */
54
+ timeout?: number;
55
+ /**
56
+ * Called immediately before every outgoing request with the resolved URL.
57
+ */
58
+ onRequest?: (url: string) => void;
59
+ /**
60
+ * Called after every completed request with the URL, HTTP status, and
61
+ * elapsed time in milliseconds.
62
+ */
63
+ onResponse?: (url: string, status: number, ms: number) => void;
64
+ /**
65
+ * Called whenever a request fails (after all retries are exhausted).
66
+ */
67
+ onError?: (url: string, error: Error) => void;
68
+ }
69
+ /**
70
+ * HTTP client for the CoinGecko REST API.
71
+ *
72
+ * Instantiate once and reuse across your application. The client is
73
+ * safe to call concurrently; each call is independently rate-limited and
74
+ * cached.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * // Pro tier
79
+ * const client = new CoinGeckoClient({ apiKey: process.env.CG_KEY });
80
+ * const data = await client.get('/coins/markets', { vs_currency: 'usd' });
81
+ *
82
+ * // Free tier
83
+ * const client = new CoinGeckoClient();
84
+ * ```
85
+ */
86
+ declare class CoinGeckoClient {
87
+ private readonly baseUrl;
88
+ private readonly apiKey;
89
+ private readonly cacheTtl;
90
+ private readonly maxRetries;
91
+ private readonly retryDelay;
92
+ private readonly timeout;
93
+ private readonly onRequest;
94
+ private readonly onResponse;
95
+ private readonly onError;
96
+ private readonly cache;
97
+ private readonly rateLimiter;
98
+ /**
99
+ * @param config - Optional configuration. See {@link CoinGeckoClientConfig}.
100
+ */
101
+ constructor(config?: CoinGeckoClientConfig);
102
+ /**
103
+ * Performs a GET request to the given API path.
104
+ *
105
+ * Results are cached by default. Pass `options.cacheTtl = 0` to bypass
106
+ * caching for a specific call.
107
+ *
108
+ * @template T - Expected shape of the response body.
109
+ * @param path - API endpoint path, e.g. `/coins/markets`.
110
+ * @param params - Query parameters. `undefined`/`null` values are omitted.
111
+ * @param options - Per-call overrides.
112
+ * @returns Parsed JSON response body cast to `T`.
113
+ * @throws {@link CoinGeckoError} on non-2xx responses or network failures.
114
+ */
115
+ get<T>(path: string, params?: Record<string, unknown>, options?: {
116
+ cacheTtl?: number;
117
+ }): Promise<T>;
118
+ /**
119
+ * Performs a single fetch with an AbortController timeout, then handles
120
+ * caching and lifecycle hooks.
121
+ */
122
+ private fetchWithTimeout;
123
+ }
124
+
125
+ /**
126
+ * Common/shared types used across multiple CoinGecko API endpoints.
127
+ */
128
+ /**
129
+ * Standard pagination query parameters used across list endpoints.
130
+ *
131
+ * @example
132
+ * const params: PaginationParams = { per_page: 50, page: 2 };
133
+ */
134
+ interface PaginationParams {
135
+ /** Total results per page. Valid values: 1–250. Default: 100. */
136
+ per_page?: number;
137
+ /** Page number to retrieve. Default: 1. */
138
+ page?: number;
139
+ }
140
+ /**
141
+ * Standard coin/NFT image URLs provided in three sizes.
142
+ *
143
+ * @example
144
+ * const img: ImageUrls = {
145
+ * thumb: "https://assets.coingecko.com/.../thumb/bitcoin.png",
146
+ * small: "https://assets.coingecko.com/.../small/bitcoin.png",
147
+ * large: "https://assets.coingecko.com/.../large/bitcoin.png",
148
+ * };
149
+ */
150
+ interface ImageUrls {
151
+ /** Thumbnail-size image URL. */
152
+ thumb?: string;
153
+ /** Small-size image URL. */
154
+ small?: string;
155
+ /** Large-size image URL. */
156
+ large?: string;
157
+ }
158
+ /**
159
+ * A single historical market data point returned by chart endpoints.
160
+ * The tuple format is `[unix_timestamp_ms, value]`.
161
+ *
162
+ * @example
163
+ * const point: MarketDataPoint = [1712534400000, 69840];
164
+ */
165
+ type MarketDataPoint = [number, number];
166
+ /**
167
+ * Supported vs-currency codes for CoinGecko price queries.
168
+ * Includes fiat currencies, major crypto assets, and commodity metals.
169
+ *
170
+ * @remarks
171
+ * Full list available via `/simple/supported_vs_currencies`.
172
+ */
173
+ type VsCurrency = 'btc' | 'eth' | 'ltc' | 'bch' | 'bnb' | 'eos' | 'xrp' | 'xlm' | 'link' | 'dot' | 'yfi' | 'sol' | 'usd' | 'aed' | 'ars' | 'aud' | 'bdt' | 'bhd' | 'bmd' | 'brl' | 'cad' | 'chf' | 'clp' | 'cny' | 'czk' | 'dkk' | 'eur' | 'gbp' | 'gel' | 'hkd' | 'huf' | 'idr' | 'ils' | 'inr' | 'jpy' | 'krw' | 'kwd' | 'lkr' | 'mmk' | 'mxn' | 'myr' | 'ngn' | 'nok' | 'nzd' | 'php' | 'pkr' | 'pln' | 'rub' | 'sar' | 'sek' | 'sgd' | 'thb' | 'try' | 'twd' | 'uah' | 'vef' | 'vnd' | 'zar' | 'xdr' | 'xag' | 'xau' | 'bits' | 'sats' | string;
174
+ /**
175
+ * Sort order options for coins markets endpoint.
176
+ */
177
+ type CoinsMarketOrder = 'market_cap_asc' | 'market_cap_desc' | 'volume_asc' | 'volume_desc' | 'id_asc' | 'id_desc';
178
+ /**
179
+ * Sort order options for exchange tickers endpoint.
180
+ */
181
+ type TickerOrder = 'trust_score_desc' | 'trust_score_asc' | 'volume_desc' | 'volume_asc';
182
+ /**
183
+ * Sort order options for exchange tickers by exchange ID.
184
+ */
185
+ type ExchangeTickerOrder = 'market_cap_asc' | 'market_cap_desc' | 'trust_score_desc' | 'trust_score_asc' | 'volume_desc' | 'volume_asc' | 'base_target';
186
+ /**
187
+ * Locale codes supported by the `/coins/markets` endpoint.
188
+ */
189
+ type Locale = 'ar' | 'bg' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'sk' | 'sl' | 'sv' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh-tw';
190
+ /**
191
+ * A generic dictionary mapping currency codes to numeric values.
192
+ * Used for multi-currency price, ATH, ATL, and volume maps.
193
+ *
194
+ * @example
195
+ * const prices: CurrencyMap = { usd: 69840, eur: 64375, btc: 1 };
196
+ */
197
+ type CurrencyMap = Record<string, number | null>;
198
+ /**
199
+ * A generic dictionary mapping currency codes to ISO date-time strings.
200
+ * Used for ATH/ATL date maps.
201
+ */
202
+ type CurrencyDateMap = Record<string, string | null>;
203
+ /**
204
+ * A simple ID + name pair used in list (ID map) endpoints.
205
+ */
206
+ interface IdNamePair {
207
+ /** Unique identifier. */
208
+ id: string;
209
+ /** Human-readable name. */
210
+ name: string;
211
+ }
212
+ /**
213
+ * Return on investment data attached to certain coin responses.
214
+ */
215
+ interface RoiData {
216
+ /** ROI multiplier (e.g. 2 = 2x return). */
217
+ times?: number | null;
218
+ /** Currency in which ROI is measured. */
219
+ currency?: string | null;
220
+ /** ROI as a percentage. */
221
+ percentage?: number | null;
222
+ }
223
+
224
+ /**
225
+ * Type definitions for all CoinGecko coin-related endpoints.
226
+ *
227
+ * Covers: /simple/price, /simple/token_price, /coins/list, /coins/markets,
228
+ * /coins/{id}, /coins/{id}/tickers, /coins/{id}/history,
229
+ * /coins/{id}/market_chart, /coins/{id}/market_chart/range,
230
+ * /coins/{id}/ohlc, /coins/{id}/ohlc/range (Analyst+),
231
+ * /coins/{id}/circulating_supply_chart (Enterprise),
232
+ * /coins/{id}/total_supply_chart (Enterprise),
233
+ * /coins/top_gainers_losers (Analyst+), /coins/list/new (Analyst+),
234
+ * /coins/categories/list, /coins/categories,
235
+ * /coins/{platform}/contract/{address} and related chart endpoints.
236
+ */
237
+
238
+ /**
239
+ * Query parameters for `/simple/price`.
240
+ * Returns spot prices for one or more coins.
241
+ *
242
+ * @example
243
+ * const params: SimplePriceParams = {
244
+ * ids: 'bitcoin,ethereum',
245
+ * vs_currencies: 'usd,eur',
246
+ * include_market_cap: true,
247
+ * };
248
+ */
249
+ interface SimplePriceParams {
250
+ /**
251
+ * Comma-separated coin IDs.
252
+ * Refers to `/coins/list` for valid IDs.
253
+ */
254
+ ids: string;
255
+ /** Comma-separated target currencies. */
256
+ vs_currencies: string;
257
+ /** Include market cap data. Default: false. */
258
+ include_market_cap?: boolean;
259
+ /** Include 24h volume data. Default: false. */
260
+ include_24hr_vol?: boolean;
261
+ /** Include 24h price change data. Default: false. */
262
+ include_24hr_change?: boolean;
263
+ /** Include last-updated timestamp. Default: false. */
264
+ include_last_updated_at?: boolean;
265
+ /** Decimal precision for price values. */
266
+ precision?: string;
267
+ }
268
+ /**
269
+ * Response from `/simple/price`.
270
+ * A map of coin ID → currency → price (and optional extras).
271
+ *
272
+ * @example
273
+ * const result: SimplePriceResponse = {
274
+ * bitcoin: { usd: 69840, usd_market_cap: 1381651251183 },
275
+ * };
276
+ */
277
+ type SimplePriceResponse = Record<string, Record<string, number | null>>;
278
+ /**
279
+ * Query parameters for `/simple/token_price/{id}`.
280
+ *
281
+ * @remarks Requires Analyst+ plan for more than 1 address per request.
282
+ */
283
+ interface SimpleTokenPriceParams {
284
+ /** Comma-separated token contract addresses. */
285
+ contract_addresses: string;
286
+ /** Comma-separated target currencies. */
287
+ vs_currencies: string;
288
+ /** Include market cap data. Default: false. */
289
+ include_market_cap?: boolean;
290
+ /** Include 24h volume data. Default: false. */
291
+ include_24hr_vol?: boolean;
292
+ /** Include 24h price change data. Default: false. */
293
+ include_24hr_change?: boolean;
294
+ /** Include last-updated timestamp. Default: false. */
295
+ include_last_updated_at?: boolean;
296
+ /** Decimal precision for price values. */
297
+ precision?: string;
298
+ }
299
+ /**
300
+ * Query parameters for `/coins/list`.
301
+ */
302
+ interface CoinsListParams {
303
+ /** Include contract address for each coin per platform. Default: false. */
304
+ include_platform?: boolean;
305
+ /** Filter list to only active coins. Default: false. */
306
+ status?: 'active' | 'inactive';
307
+ }
308
+ /**
309
+ * A minimal coin entry from `/coins/list`.
310
+ */
311
+ interface CoinListEntry {
312
+ /** Unique coin API ID. */
313
+ id: string;
314
+ /** Coin ticker symbol (e.g. "btc"). */
315
+ symbol: string;
316
+ /** Human-readable coin name. */
317
+ name: string;
318
+ /** Map of platform → contract address when `include_platform=true`. */
319
+ platforms?: Record<string, string>;
320
+ }
321
+ /**
322
+ * Query parameters for `/coins/top_gainers_losers`.
323
+ *
324
+ * @remarks Requires Analyst+ plan
325
+ */
326
+ interface TopGainersLosersParams {
327
+ /** Target vs-currency for price change. */
328
+ vs_currency: VsCurrency;
329
+ /** Time duration filter. */
330
+ duration?: '1h' | '24h' | '7d' | '14d' | '30d' | '60d' | '1y';
331
+ /** Filter by top N coins by market cap. */
332
+ top_coins?: '300' | '500' | '1000' | 'all';
333
+ }
334
+ /**
335
+ * A single coin entry in the top gainers or losers list.
336
+ *
337
+ * @remarks Requires Analyst+ plan
338
+ */
339
+ interface TopMoverCoin {
340
+ /** Coin API ID. */
341
+ id: string;
342
+ /** Coin symbol. */
343
+ symbol: string;
344
+ /** Coin name. */
345
+ name: string;
346
+ /** Coin image URL. */
347
+ image: string;
348
+ /** Current market cap rank. */
349
+ market_cap_rank?: number | null;
350
+ /** USD price. */
351
+ usd?: number | null;
352
+ /** 24h volume in USD. */
353
+ usd_24h_vol?: number | null;
354
+ /** Price change percentage over the requested duration. */
355
+ usd_1h_change?: number | null;
356
+ }
357
+ /**
358
+ * Response from `/coins/top_gainers_losers`.
359
+ *
360
+ * @remarks Requires Analyst+ plan
361
+ */
362
+ interface TopMoversResponse {
363
+ /** Top 30 coins with the largest price gain. */
364
+ top_gainers: TopMoverCoin[];
365
+ /** Top 30 coins with the largest price loss. */
366
+ top_losers: TopMoverCoin[];
367
+ }
368
+ /**
369
+ * A coin entry from `/coins/list/new`.
370
+ *
371
+ * @remarks Requires Analyst+ plan
372
+ */
373
+ interface NewCoin {
374
+ /** Coin API ID. */
375
+ id: string;
376
+ /** Coin symbol. */
377
+ symbol: string;
378
+ /** Coin name. */
379
+ name: string;
380
+ /** Date the coin was activated on CoinGecko. */
381
+ activated_at?: number | null;
382
+ }
383
+ /**
384
+ * Query parameters for `/coins/markets`.
385
+ */
386
+ interface CoinsMarketsParams extends PaginationParams {
387
+ /** Target vs-currency for all market data. */
388
+ vs_currency: VsCurrency;
389
+ /** Comma-separated coin IDs to filter results. */
390
+ ids?: string;
391
+ /** Comma-separated coin names to filter results. */
392
+ names?: string;
393
+ /** Comma-separated coin symbols to filter results. */
394
+ symbols?: string;
395
+ /**
396
+ * When using `symbols` lookup, `top` returns top-ranked tokens,
397
+ * `all` returns all matching tokens (max 50 symbols per request).
398
+ */
399
+ include_tokens?: 'top' | 'all';
400
+ /** Filter by coin category. Refers to `/coins/categories/list`. */
401
+ category?: string;
402
+ /** Sort order. Default: market_cap_desc. */
403
+ order?: CoinsMarketOrder;
404
+ /** Include sparkline 7-day data. Default: false. */
405
+ sparkline?: boolean;
406
+ /** Comma-separated price change percentage timeframes (1h,24h,7d,…). */
407
+ price_change_percentage?: string;
408
+ /** Response language. Default: en. */
409
+ locale?: Locale;
410
+ /** Decimal precision for currency values. */
411
+ precision?: string;
412
+ /** Include rehypothecated tokens. Default: false. */
413
+ include_rehypothecated?: boolean;
414
+ }
415
+ /**
416
+ * A single coin entry from `/coins/markets`.
417
+ *
418
+ * @example
419
+ * const coin: MarketCoin = {
420
+ * id: 'bitcoin',
421
+ * symbol: 'btc',
422
+ * name: 'Bitcoin',
423
+ * current_price: 69840,
424
+ * market_cap: 1381651251183,
425
+ * market_cap_rank: 1,
426
+ * };
427
+ */
428
+ interface MarketCoin {
429
+ /** Coin API ID. */
430
+ id: string;
431
+ /** Coin ticker symbol. */
432
+ symbol: string;
433
+ /** Coin name. */
434
+ name: string;
435
+ /** Coin image URL. */
436
+ image?: string | null;
437
+ /** Current price in the requested vs-currency. */
438
+ current_price?: number | null;
439
+ /** Market capitalisation in the requested vs-currency. */
440
+ market_cap?: number | null;
441
+ /** Rank by market cap. */
442
+ market_cap_rank?: number | null;
443
+ /** Market cap rank including rehypothecated tokens. */
444
+ market_cap_rank_with_rehypothecated?: number | null;
445
+ /** Fully diluted valuation in the requested vs-currency. */
446
+ fully_diluted_valuation?: number | null;
447
+ /** 24h trading volume in the requested vs-currency. */
448
+ total_volume?: number | null;
449
+ /** 24h high price. */
450
+ high_24h?: number | null;
451
+ /** 24h low price. */
452
+ low_24h?: number | null;
453
+ /** Absolute price change over the last 24h. */
454
+ price_change_24h?: number | null;
455
+ /** Percentage price change over the last 24h. */
456
+ price_change_percentage_24h?: number | null;
457
+ /** Absolute market cap change over the last 24h. */
458
+ market_cap_change_24h?: number | null;
459
+ /** Percentage market cap change over the last 24h. */
460
+ market_cap_change_percentage_24h?: number | null;
461
+ /** Circulating supply. */
462
+ circulating_supply?: number | null;
463
+ /** Total supply. */
464
+ total_supply?: number | null;
465
+ /** Maximum possible supply. */
466
+ max_supply?: number | null;
467
+ /** All-time high price. */
468
+ ath?: number | null;
469
+ /** ATH change percentage from current price. */
470
+ ath_change_percentage?: number | null;
471
+ /** Date of all-time high (ISO 8601). */
472
+ ath_date?: string | null;
473
+ /** All-time low price. */
474
+ atl?: number | null;
475
+ /** ATL change percentage from current price. */
476
+ atl_change_percentage?: number | null;
477
+ /** Date of all-time low (ISO 8601). */
478
+ atl_date?: string | null;
479
+ /** Return on investment data (if available). */
480
+ roi?: RoiData | null;
481
+ /** ISO timestamp of last price update. */
482
+ last_updated?: string | null;
483
+ /** Sparkline price data for the last 7 days (when requested). */
484
+ sparkline_in_7d?: {
485
+ price: number[];
486
+ } | null;
487
+ /** Price change percentage over 1h (when requested). */
488
+ price_change_percentage_1h_in_currency?: number | null;
489
+ /** Price change percentage over 24h (when requested). */
490
+ price_change_percentage_24h_in_currency?: number | null;
491
+ /** Price change percentage over 7d (when requested). */
492
+ price_change_percentage_7d_in_currency?: number | null;
493
+ /** Price change percentage over 14d (when requested). */
494
+ price_change_percentage_14d_in_currency?: number | null;
495
+ /** Price change percentage over 30d (when requested). */
496
+ price_change_percentage_30d_in_currency?: number | null;
497
+ /** Price change percentage over 200d (when requested). */
498
+ price_change_percentage_200d_in_currency?: number | null;
499
+ /** Price change percentage over 1y (when requested). */
500
+ price_change_percentage_1y_in_currency?: number | null;
501
+ }
502
+ /**
503
+ * Links object within a CoinDetail response.
504
+ */
505
+ interface CoinLinks {
506
+ homepage?: string[] | null;
507
+ whitepaper?: string | null;
508
+ blockchain_site?: string[] | null;
509
+ official_forum_url?: string[] | null;
510
+ chat_url?: string[] | null;
511
+ announcement_url?: string[] | null;
512
+ snapshot_url?: string | null;
513
+ twitter_screen_name?: string | null;
514
+ facebook_username?: string | null;
515
+ bitcointalk_thread_identifier?: number | null;
516
+ telegram_channel_identifier?: string | null;
517
+ subreddit_url?: string | null;
518
+ repos_url?: {
519
+ github?: string[] | null;
520
+ bitbucket?: string[] | null;
521
+ } | null;
522
+ }
523
+ /**
524
+ * Platform detail entry (decimal places and contract address).
525
+ */
526
+ interface PlatformDetail {
527
+ decimal_place?: number | null;
528
+ contract_address?: string | null;
529
+ }
530
+ /**
531
+ * Category detail with ID and name.
532
+ */
533
+ interface CategoryDetail {
534
+ id: string;
535
+ name: string;
536
+ }
537
+ /**
538
+ * Comprehensive market data block inside a CoinDetail response.
539
+ */
540
+ interface CoinMarketData {
541
+ current_price?: CurrencyMap | null;
542
+ total_value_locked?: number | null;
543
+ mcap_to_tvl_ratio?: number | null;
544
+ fdv_to_tvl_ratio?: number | null;
545
+ roi?: RoiData | null;
546
+ ath?: CurrencyMap | null;
547
+ ath_change_percentage?: CurrencyMap | null;
548
+ ath_date?: Record<string, string | null> | null;
549
+ atl?: CurrencyMap | null;
550
+ atl_change_percentage?: CurrencyMap | null;
551
+ atl_date?: Record<string, string | null> | null;
552
+ market_cap?: CurrencyMap | null;
553
+ market_cap_rank?: number | null;
554
+ market_cap_fdv_ratio?: number | null;
555
+ fully_diluted_valuation?: CurrencyMap | null;
556
+ market_cap_change_24h?: number | null;
557
+ market_cap_change_percentage_24h?: number | null;
558
+ market_cap_change_percentage_24h_in_currency?: CurrencyMap | null;
559
+ total_supply?: number | null;
560
+ max_supply?: number | null;
561
+ circulating_supply?: number | null;
562
+ total_volume?: CurrencyMap | null;
563
+ high_24h?: CurrencyMap | null;
564
+ low_24h?: CurrencyMap | null;
565
+ price_change_24h?: number | null;
566
+ price_change_percentage_24h?: number | null;
567
+ price_change_percentage_7d?: number | null;
568
+ price_change_percentage_14d?: number | null;
569
+ price_change_percentage_30d?: number | null;
570
+ price_change_percentage_60d?: number | null;
571
+ price_change_percentage_200d?: number | null;
572
+ price_change_percentage_1y?: number | null;
573
+ price_change_24h_in_currency?: CurrencyMap | null;
574
+ price_change_percentage_1h_in_currency?: CurrencyMap | null;
575
+ price_change_percentage_24h_in_currency?: CurrencyMap | null;
576
+ price_change_percentage_7d_in_currency?: CurrencyMap | null;
577
+ price_change_percentage_14d_in_currency?: CurrencyMap | null;
578
+ price_change_percentage_30d_in_currency?: CurrencyMap | null;
579
+ price_change_percentage_60d_in_currency?: CurrencyMap | null;
580
+ price_change_percentage_200d_in_currency?: CurrencyMap | null;
581
+ price_change_percentage_1y_in_currency?: CurrencyMap | null;
582
+ last_updated?: string | null;
583
+ sparkline_7d?: {
584
+ price: number[];
585
+ } | null;
586
+ }
587
+ /**
588
+ * Community data block inside a CoinDetail response.
589
+ */
590
+ interface CoinCommunityData {
591
+ facebook_likes?: number | null;
592
+ twitter_followers?: number | null;
593
+ reddit_average_posts_48h?: number | null;
594
+ reddit_average_comments_48h?: number | null;
595
+ reddit_subscribers?: number | null;
596
+ reddit_accounts_active_48h?: number | null;
597
+ telegram_channel_user_count?: number | null;
598
+ }
599
+ /**
600
+ * Developer data block inside a CoinDetail response.
601
+ */
602
+ interface CoinDeveloperData {
603
+ forks?: number | null;
604
+ stars?: number | null;
605
+ subscribers?: number | null;
606
+ total_issues?: number | null;
607
+ closed_issues?: number | null;
608
+ pull_requests_merged?: number | null;
609
+ pull_request_contributors?: number | null;
610
+ code_additions_deletions_4_weeks?: {
611
+ additions: number | null;
612
+ deletions: number | null;
613
+ } | null;
614
+ commit_count_4_weeks?: number | null;
615
+ last_4_weeks_commit_activity_series?: number[] | null;
616
+ }
617
+ /**
618
+ * Full coin detail response from `/coins/{id}`.
619
+ *
620
+ * @example
621
+ * const coin: CoinDetail = {
622
+ * id: 'bitcoin',
623
+ * symbol: 'btc',
624
+ * name: 'Bitcoin',
625
+ * market_cap_rank: 1,
626
+ * };
627
+ */
628
+ interface CoinDetail {
629
+ /** Coin API ID. */
630
+ id: string;
631
+ /** Coin ticker symbol. */
632
+ symbol: string;
633
+ /** Coin name. */
634
+ name: string;
635
+ /** CoinGecko web slug. */
636
+ web_slug?: string | null;
637
+ /** Asset platform ID (null for native chains). */
638
+ asset_platform_id?: string | null;
639
+ /** Map of platform → contract address. */
640
+ platforms?: Record<string, string> | null;
641
+ /** Detailed platform info including decimal places. */
642
+ detail_platforms?: Record<string, PlatformDetail> | null;
643
+ /** Average block time in minutes. */
644
+ block_time_in_minutes?: number | null;
645
+ /** Hashing algorithm name (e.g. "SHA-256"). */
646
+ hashing_algorithm?: string | null;
647
+ /** Category names. */
648
+ categories?: string[] | null;
649
+ /** Category details (id + name) when `include_categories_details=true`. */
650
+ categories_details?: CategoryDetail[] | null;
651
+ /** Whether the coin is in preview/listing mode. */
652
+ preview_listing?: boolean | null;
653
+ /** Public notice message. */
654
+ public_notice?: string | null;
655
+ /** Additional notices. */
656
+ additional_notices?: string[] | null;
657
+ /** Localised names keyed by locale code. */
658
+ localization?: Record<string, string> | null;
659
+ /** Localised descriptions keyed by locale code. */
660
+ description?: Record<string, string> | null;
661
+ /** External links (homepage, socials, repos). */
662
+ links?: CoinLinks | null;
663
+ /** Coin image URLs. */
664
+ image?: ImageUrls | null;
665
+ /** Country of origin. */
666
+ country_origin?: string | null;
667
+ /** Genesis/launch date (YYYY-MM-DD). */
668
+ genesis_date?: string | null;
669
+ /** Positive sentiment vote percentage. */
670
+ sentiment_votes_up_percentage?: number | null;
671
+ /** Negative sentiment vote percentage. */
672
+ sentiment_votes_down_percentage?: number | null;
673
+ /** Number of users who have this coin in watchlist. */
674
+ watchlist_portfolio_users?: number | null;
675
+ /** Market cap rank. */
676
+ market_cap_rank?: number | null;
677
+ /** Market cap rank including rehypothecated tokens. */
678
+ market_cap_rank_with_rehypothecated?: number | null;
679
+ /** Full market data block. */
680
+ market_data?: CoinMarketData | null;
681
+ /** Community engagement data. */
682
+ community_data?: CoinCommunityData | null;
683
+ /** Developer activity data. */
684
+ developer_data?: CoinDeveloperData | null;
685
+ /** ISO timestamp of last update. */
686
+ last_updated?: string | null;
687
+ /** Sparkline 7-day price data (when `sparkline=true`). */
688
+ tickers?: CoinTicker[] | null;
689
+ }
690
+ /**
691
+ * Exchange info embedded in a ticker.
692
+ */
693
+ interface TickerMarket {
694
+ /** Exchange name. */
695
+ name: string;
696
+ /** Exchange identifier (API ID). */
697
+ identifier: string;
698
+ /** Whether the exchange has trading incentives. */
699
+ has_trading_incentive: boolean;
700
+ /** Exchange logo URL (present when `include_exchange_logo=true`). */
701
+ logo?: string | null;
702
+ }
703
+ /**
704
+ * A single trading pair ticker for a coin.
705
+ *
706
+ * @example
707
+ * const ticker: CoinTicker = {
708
+ * base: 'BTC',
709
+ * target: 'USDT',
710
+ * market: { name: 'Binance', identifier: 'binance', has_trading_incentive: false },
711
+ * last: 69476,
712
+ * volume: 20242.04,
713
+ * };
714
+ */
715
+ interface CoinTicker {
716
+ /** Base currency symbol or contract address. */
717
+ base: string;
718
+ /** Quote/target currency symbol or contract address. */
719
+ target: string;
720
+ /** Exchange reference. */
721
+ market: TickerMarket;
722
+ /** Last traded price. */
723
+ last?: number | null;
724
+ /** Trade volume. */
725
+ volume?: number | null;
726
+ /** 2% orderbook depth: cost to move price up in USD. */
727
+ cost_to_move_up_usd?: number | null;
728
+ /** 2% orderbook depth: cost to move price down in USD. */
729
+ cost_to_move_down_usd?: number | null;
730
+ /** Last price in BTC, ETH, and USD. */
731
+ converted_last?: {
732
+ btc?: number;
733
+ eth?: number;
734
+ usd?: number;
735
+ } | null;
736
+ /** Volume in BTC, ETH, and USD. */
737
+ converted_volume?: {
738
+ btc?: number;
739
+ eth?: number;
740
+ usd?: number;
741
+ } | null;
742
+ /** Trust score assigned by CoinGecko. */
743
+ trust_score?: string | null;
744
+ /** Bid-ask spread percentage. */
745
+ bid_ask_spread_percentage?: number | null;
746
+ /** ISO timestamp of this ticker. */
747
+ timestamp?: string | null;
748
+ /** ISO timestamp of the last trade. */
749
+ last_traded_at?: string | null;
750
+ /** ISO timestamp of the last data fetch. */
751
+ last_fetch_at?: string | null;
752
+ /** Whether this ticker is anomalous. */
753
+ is_anomaly?: boolean | null;
754
+ /** Whether this ticker data is stale. */
755
+ is_stale?: boolean | null;
756
+ /** Direct trading URL on the exchange. */
757
+ trade_url?: string | null;
758
+ /** Token info URL (null for non-token markets). */
759
+ token_info_url?: string | null;
760
+ /** Coin ID for the base currency. */
761
+ coin_id?: string | null;
762
+ /** Coin ID for the target currency. */
763
+ target_coin_id?: string | null;
764
+ /** Market cap of the base coin in USD (may appear on exchange ticker responses). */
765
+ coin_mcap_usd?: number | null;
766
+ }
767
+ /**
768
+ * Response wrapper from `/coins/{id}/tickers`.
769
+ */
770
+ interface CoinTickersResponse {
771
+ /** Coin name. */
772
+ name: string;
773
+ /** Array of tickers. */
774
+ tickers: CoinTicker[];
775
+ }
776
+ /**
777
+ * Response from `/coins/{id}/history`.
778
+ */
779
+ interface CoinHistoricalData {
780
+ /** Coin API ID. */
781
+ id?: string | null;
782
+ /** Coin symbol. */
783
+ symbol?: string | null;
784
+ /** Coin name. */
785
+ name?: string | null;
786
+ /** Localised names. */
787
+ localization?: Record<string, string> | null;
788
+ /** Image URLs. */
789
+ image?: Pick<ImageUrls, 'thumb' | 'small'> | null;
790
+ /** Market data at the snapshot date. */
791
+ market_data?: {
792
+ current_price?: Record<string, number> | null;
793
+ market_cap?: Record<string, number> | null;
794
+ total_volume?: Record<string, number> | null;
795
+ } | null;
796
+ /** Community data at the snapshot date. */
797
+ community_data?: CoinCommunityData | null;
798
+ /** Developer data at the snapshot date. */
799
+ developer_data?: CoinDeveloperData | null;
800
+ }
801
+ /**
802
+ * Response from `/coins/{id}/market_chart` and related range endpoints.
803
+ *
804
+ * @example
805
+ * const chart: MarketChartResponse = {
806
+ * prices: [[1712534400000, 69840]],
807
+ * market_caps: [[1712534400000, 1381651251183]],
808
+ * total_volumes: [[1712534400000, 20154184933]],
809
+ * };
810
+ */
811
+ interface MarketChartResponse {
812
+ /** Array of [timestamp_ms, price] data points. */
813
+ prices: MarketDataPoint[];
814
+ /** Array of [timestamp_ms, market_cap] data points. */
815
+ market_caps: MarketDataPoint[];
816
+ /** Array of [timestamp_ms, volume] data points. */
817
+ total_volumes: MarketDataPoint[];
818
+ }
819
+ /**
820
+ * A single OHLC data point: [timestamp_ms, open, high, low, close].
821
+ *
822
+ * @example
823
+ * const candle: OhlcDataPoint = [1712534400000, 69000, 70215, 68060, 69840];
824
+ */
825
+ type OhlcDataPoint = [number, number, number, number, number];
826
+ /**
827
+ * Response from circulating supply chart endpoints.
828
+ * Each entry is [timestamp_ms, supply_value].
829
+ *
830
+ * @remarks Requires Enterprise plan
831
+ */
832
+ type SupplyChartResponse = MarketDataPoint[];
833
+ /**
834
+ * A minimal category entry from `/coins/categories/list`.
835
+ */
836
+ interface CategoryListEntry {
837
+ /** Category ID. */
838
+ category_id: string;
839
+ /** Category name. */
840
+ name: string;
841
+ }
842
+ /**
843
+ * A category with market data from `/coins/categories`.
844
+ */
845
+ interface Category {
846
+ /** Category ID. */
847
+ id: string;
848
+ /** Category name. */
849
+ name: string;
850
+ /** Market cap in USD. */
851
+ market_cap?: number | null;
852
+ /** 1h market cap change percentage. */
853
+ market_cap_change_1h?: number | null;
854
+ /** 24h market cap change percentage. */
855
+ market_cap_change_24h?: number | null;
856
+ /** 7d market cap change percentage. */
857
+ market_cap_change_7d?: number | null;
858
+ /** 30d market cap change percentage. */
859
+ market_cap_change_30d?: number | null;
860
+ /** 24h trading volume in USD. */
861
+ volume_24h?: number | null;
862
+ /** ISO timestamp of last update. */
863
+ updated_at?: string | null;
864
+ /** Top 3 coins in this category. */
865
+ top_3_coins?: string[] | null;
866
+ /** Top 3 coin image URLs. */
867
+ top_3_coins_id?: string[] | null;
868
+ }
869
+ /**
870
+ * Query parameters for `/asset_platforms`.
871
+ */
872
+ interface AssetPlatformsParams {
873
+ /**
874
+ * Filter by platform type.
875
+ * `nft` returns only NFT-supported platforms.
876
+ */
877
+ filter?: 'nft' | string;
878
+ }
879
+ /**
880
+ * Query parameters for `/coins/{id}`.
881
+ */
882
+ interface CoinDetailParams {
883
+ /** Include all localised names. Default: true. */
884
+ localization?: boolean;
885
+ /** Include ticker data. Default: true. */
886
+ tickers?: boolean;
887
+ /** Include market data. Default: true. */
888
+ market_data?: boolean;
889
+ /** Include community data. Default: true. */
890
+ community_data?: boolean;
891
+ /** Include developer data. Default: true. */
892
+ developer_data?: boolean;
893
+ /** Include 7-day sparkline data. Default: false. */
894
+ sparkline?: boolean;
895
+ /** Include category details (id + name). Default: false. */
896
+ include_categories_details?: boolean;
897
+ }
898
+ /**
899
+ * Query parameters for `/coins/{id}/tickers`.
900
+ */
901
+ interface CoinTickerParams extends PaginationParams {
902
+ /** Filter results by exchange ID. */
903
+ exchange_ids?: string;
904
+ /** Include exchange logo URLs. Default: false. */
905
+ include_exchange_logo?: boolean;
906
+ /** Sort order. Default: trust_score_desc. */
907
+ order?: 'trust_score_desc' | 'trust_score_asc' | 'volume_desc' | 'volume_asc';
908
+ /** Return 2% orderbook depth data. Default: false. */
909
+ depth?: boolean;
910
+ }
911
+ /**
912
+ * Query parameters for `/coins/{id}/history`.
913
+ */
914
+ interface CoinHistoryParams {
915
+ /**
916
+ * Historical snapshot date in `dd-mm-yyyy` format.
917
+ * @example '30-12-2022'
918
+ */
919
+ date: string;
920
+ /** Include all localised names. Default: true. */
921
+ localization?: boolean;
922
+ }
923
+ /**
924
+ * Query parameters for `/coins/{id}/market_chart`.
925
+ */
926
+ interface MarketChartParams {
927
+ /** Target vs-currency for price data. */
928
+ vs_currency: VsCurrency;
929
+ /**
930
+ * Data granularity window.
931
+ * Pass a number of days (1–max) or `'max'` for all available history.
932
+ */
933
+ days: number | 'max';
934
+ /**
935
+ * Data interval granularity. Auto-selected when omitted.
936
+ * - `'daily'` — one point per day
937
+ * - `'hourly'` — one point per hour (max 90 days)
938
+ * - `'minutely'` — one point per minute (max 1 day, free tier only)
939
+ */
940
+ interval?: 'daily' | 'hourly' | 'minutely';
941
+ /** Decimal precision for currency values. */
942
+ precision?: string;
943
+ }
944
+ /**
945
+ * Query parameters for `/coins/{id}/market_chart/range`.
946
+ */
947
+ interface MarketChartRangeParams {
948
+ /** Target vs-currency for price data. */
949
+ vs_currency: VsCurrency;
950
+ /** Start of the time range as a UNIX timestamp (seconds). */
951
+ from: number;
952
+ /** End of the time range as a UNIX timestamp (seconds). */
953
+ to: number;
954
+ /** Data interval granularity. Auto-selected when omitted. */
955
+ interval?: 'daily' | 'hourly' | 'minutely';
956
+ /** Decimal precision for currency values. */
957
+ precision?: string;
958
+ }
959
+ /**
960
+ * Query parameters for `/coins/{id}/ohlc`.
961
+ *
962
+ * @remarks Requires Analyst+ plan
963
+ */
964
+ interface OhlcParams {
965
+ /** Target vs-currency for OHLC data. */
966
+ vs_currency: VsCurrency;
967
+ /**
968
+ * Number of days of data to retrieve.
969
+ * Supported values: 1, 7, 14, 30, 90, 180, 365, or `'max'`.
970
+ */
971
+ days: 1 | 7 | 14 | 30 | 90 | 180 | 365 | 'max';
972
+ /** Decimal precision for currency values. */
973
+ precision?: string;
974
+ }
975
+ /**
976
+ * Query parameters for `/coins/{id}/ohlc/range`.
977
+ *
978
+ * @remarks Requires Analyst+ plan
979
+ */
980
+ interface OhlcRangeParams {
981
+ /** Target vs-currency for OHLC data. */
982
+ vs_currency: VsCurrency;
983
+ /** Start of the time range as a UNIX timestamp (seconds). */
984
+ from: number;
985
+ /** End of the time range as a UNIX timestamp (seconds). */
986
+ to: number;
987
+ /** Time series interval. */
988
+ interval?: 'daily' | 'hourly';
989
+ /** Decimal precision for currency values. */
990
+ precision?: string;
991
+ }
992
+ /**
993
+ * Query parameters for circulating/total supply chart endpoints.
994
+ *
995
+ * @remarks Requires Enterprise plan
996
+ */
997
+ interface SupplyChartParams {
998
+ /**
999
+ * Number of days of data to retrieve.
1000
+ * Supported values: 1, 7, 14, 30, 90, 180, 365, or `'max'`.
1001
+ */
1002
+ days: number | 'max';
1003
+ }
1004
+ /**
1005
+ * Query parameters for circulating/total supply chart range endpoints.
1006
+ *
1007
+ * @remarks Requires Enterprise plan
1008
+ */
1009
+ interface SupplyChartRangeParams {
1010
+ /** Start of the time range as a UNIX timestamp (seconds). */
1011
+ from: number;
1012
+ /** End of the time range as a UNIX timestamp (seconds). */
1013
+ to: number;
1014
+ }
1015
+ /**
1016
+ * Query parameters for `/coins/categories`.
1017
+ */
1018
+ interface CategoriesParams {
1019
+ /**
1020
+ * Sort order for the returned categories.
1021
+ * Default: `market_cap_desc`.
1022
+ */
1023
+ order?: 'market_cap_desc' | 'market_cap_asc' | 'name_desc' | 'name_asc' | 'market_cap_change_24h_desc' | 'market_cap_change_24h_asc';
1024
+ }
1025
+
1026
+ /**
1027
+ * @module endpoints/coins
1028
+ * CoinGecko coin-related endpoints.
1029
+ *
1030
+ * Covers simple price, coins list, market data, coin detail, tickers,
1031
+ * historical charts, OHLC, supply charts, contract-address lookups, and
1032
+ * categories.
1033
+ */
1034
+
1035
+ /**
1036
+ * All coin-related CoinGecko API methods.
1037
+ *
1038
+ * Obtain an instance via the top-level SDK facade, e.g.:
1039
+ * ```ts
1040
+ * const sdk = new CoinGeckoSDK({ apiKey: '...' });
1041
+ * const prices = await sdk.coins.price({ ids: 'bitcoin', vs_currencies: 'usd' });
1042
+ * ```
1043
+ */
1044
+ declare class CoinsEndpoints {
1045
+ private readonly client;
1046
+ constructor(client: CoinGeckoClient);
1047
+ /**
1048
+ * @description Get the current price of one or more coins in the requested
1049
+ * vs-currencies. Optionally include market cap, 24h volume, 24h change, and
1050
+ * last-updated timestamp in the response.
1051
+ *
1052
+ * @param params - Query parameters including required `ids` and
1053
+ * `vs_currencies` plus optional data flags.
1054
+ * @returns A map of coin ID → currency code → numeric value.
1055
+ *
1056
+ * @example
1057
+ * ```ts
1058
+ * const prices = await coins.price({
1059
+ * ids: 'bitcoin,ethereum',
1060
+ * vs_currencies: 'usd,eur',
1061
+ * include_market_cap: true,
1062
+ * });
1063
+ * // { bitcoin: { usd: 69840, usd_market_cap: 1.38e12 }, ethereum: { usd: 3700 } }
1064
+ * ```
1065
+ */
1066
+ price(params: SimplePriceParams): Promise<SimplePriceResponse>;
1067
+ /**
1068
+ * @description Get the current price of one or more ERC-20/token contract
1069
+ * addresses on a given asset platform (e.g. `ethereum`).
1070
+ *
1071
+ * @param platformId - Asset platform ID (e.g. `'ethereum'`, `'polygon-pos'`).
1072
+ * @param params - Query parameters including required `contract_addresses` and
1073
+ * `vs_currencies`.
1074
+ * @returns A map of contract address → currency code → numeric value.
1075
+ *
1076
+ * @remarks Requires Analyst+ plan for more than one address per request.
1077
+ *
1078
+ * @example
1079
+ * ```ts
1080
+ * const tokenPrices = await coins.tokenPrice('ethereum', {
1081
+ * contract_addresses: '0xdac17f958d2ee523a2206206994597c13d831ec7',
1082
+ * vs_currencies: 'usd',
1083
+ * });
1084
+ * ```
1085
+ */
1086
+ tokenPrice(platformId: string, params: SimpleTokenPriceParams): Promise<SimplePriceResponse>;
1087
+ /**
1088
+ * @description Get the full list of vs-currency codes supported by CoinGecko
1089
+ * (e.g. `'usd'`, `'eur'`, `'btc'`).
1090
+ *
1091
+ * @returns An array of currency code strings.
1092
+ *
1093
+ * @example
1094
+ * ```ts
1095
+ * const currencies = await coins.supportedVsCurrencies();
1096
+ * // ['btc', 'eth', 'usd', 'eur', ...]
1097
+ * ```
1098
+ */
1099
+ supportedVsCurrencies(): Promise<string[]>;
1100
+ /**
1101
+ * @description Get the full list of coins available on CoinGecko, including
1102
+ * their IDs, symbols, and names. Optionally include contract addresses per
1103
+ * platform.
1104
+ *
1105
+ * @param params - Optional query parameters.
1106
+ * @returns An array of minimal coin entries.
1107
+ *
1108
+ * @example
1109
+ * ```ts
1110
+ * const coins = await coins.list({ include_platform: true });
1111
+ * // [{ id: 'bitcoin', symbol: 'btc', name: 'Bitcoin', platforms: {} }, ...]
1112
+ * ```
1113
+ */
1114
+ list(params?: CoinsListParams): Promise<CoinListEntry[]>;
1115
+ /**
1116
+ * @description Get coin market data (price, market cap, volume, etc.) for
1117
+ * all or a filtered set of coins ordered by market cap.
1118
+ *
1119
+ * @param params - Query parameters including required `vs_currency`.
1120
+ * @returns An array of `MarketCoin` objects with full market statistics.
1121
+ *
1122
+ * @example
1123
+ * ```ts
1124
+ * const top10 = await coins.markets({ vs_currency: 'usd', per_page: 10 });
1125
+ * ```
1126
+ */
1127
+ markets(params: CoinsMarketsParams): Promise<MarketCoin[]>;
1128
+ /**
1129
+ * @description Get the top 30 gaining and top 30 losing coins over a given
1130
+ * time duration, filtered by the requested vs-currency.
1131
+ *
1132
+ * @param params - Optional query parameters including `vs_currency`,
1133
+ * `duration`, and `top_coins` filter.
1134
+ * @returns An object with `top_gainers` and `top_losers` arrays.
1135
+ *
1136
+ * @remarks Requires Analyst+ plan.
1137
+ *
1138
+ * @example
1139
+ * ```ts
1140
+ * const movers = await coins.topGainersLosers({ vs_currency: 'usd', duration: '24h' });
1141
+ * console.log(movers.top_gainers[0]);
1142
+ * ```
1143
+ */
1144
+ topGainersLosers(params?: TopGainersLosersParams): Promise<TopMoversResponse>;
1145
+ /**
1146
+ * @description Get a list of the 200 most recently listed coins on CoinGecko,
1147
+ * ordered by listing date descending.
1148
+ *
1149
+ * @returns An array of `NewCoin` entries with activation timestamps.
1150
+ *
1151
+ * @remarks Requires Analyst+ plan.
1152
+ *
1153
+ * @example
1154
+ * ```ts
1155
+ * const newCoins = await coins.listNew();
1156
+ * console.log(newCoins[0].activated_at);
1157
+ * ```
1158
+ */
1159
+ listNew(): Promise<NewCoin[]>;
1160
+ /**
1161
+ * @description Get comprehensive data for a specific coin by its CoinGecko
1162
+ * ID, including market data, links, community stats, developer activity, and
1163
+ * more.
1164
+ *
1165
+ * @param id - CoinGecko coin ID (e.g. `'bitcoin'`).
1166
+ * @param params - Optional flags controlling which data blocks to include.
1167
+ * @returns A `CoinDetail` object with all available metadata.
1168
+ *
1169
+ * @example
1170
+ * ```ts
1171
+ * const bitcoin = await coins.getById('bitcoin', { market_data: true, tickers: false });
1172
+ * console.log(bitcoin.market_data?.current_price?.usd);
1173
+ * ```
1174
+ */
1175
+ getById(id: string, params?: CoinDetailParams): Promise<CoinDetail>;
1176
+ /**
1177
+ * @description Get the exchange tickers for a specific coin, optionally
1178
+ * filtered by exchange.
1179
+ *
1180
+ * @param id - CoinGecko coin ID (e.g. `'bitcoin'`).
1181
+ * @param params - Optional pagination, exchange filter, and sort params.
1182
+ * @returns A `CoinTickersResponse` wrapping the coin name and ticker array.
1183
+ *
1184
+ * @example
1185
+ * ```ts
1186
+ * const { tickers } = await coins.tickers('bitcoin', { exchange_ids: 'binance' });
1187
+ * ```
1188
+ */
1189
+ tickers(id: string, params?: CoinTickerParams): Promise<CoinTickersResponse>;
1190
+ /**
1191
+ * @description Get historical snapshot data for a coin on a specific past
1192
+ * date, including price, market cap, and volume.
1193
+ *
1194
+ * @param id - CoinGecko coin ID (e.g. `'bitcoin'`).
1195
+ * @param params - Query parameters including required `date` (`dd-mm-yyyy`).
1196
+ * @returns A `CoinHistoricalData` snapshot object.
1197
+ *
1198
+ * @example
1199
+ * ```ts
1200
+ * const snapshot = await coins.history('bitcoin', { date: '30-12-2022' });
1201
+ * console.log(snapshot.market_data?.current_price?.usd);
1202
+ * ```
1203
+ */
1204
+ history(id: string, params: CoinHistoryParams): Promise<CoinHistoricalData>;
1205
+ /**
1206
+ * @description Get historical market chart data (price, market cap, and
1207
+ * volume) for a coin over a given number of days. Data granularity is
1208
+ * automatically selected unless `interval` is specified.
1209
+ *
1210
+ * @param id - CoinGecko coin ID (e.g. `'ethereum'`).
1211
+ * @param params - Query parameters including required `vs_currency` and
1212
+ * `days`.
1213
+ * @returns A `MarketChartResponse` containing price, market cap, and volume
1214
+ * time series.
1215
+ *
1216
+ * @example
1217
+ * ```ts
1218
+ * const chart = await coins.marketChart('ethereum', { vs_currency: 'usd', days: 30 });
1219
+ * const [ts, price] = chart.prices[0];
1220
+ * ```
1221
+ */
1222
+ marketChart(id: string, params: MarketChartParams): Promise<MarketChartResponse>;
1223
+ /**
1224
+ * @description Get historical market chart data (price, market cap, and
1225
+ * volume) for a coin within a UNIX timestamp range.
1226
+ *
1227
+ * @param id - CoinGecko coin ID.
1228
+ * @param params - Query parameters including `vs_currency`, `from`, and `to`
1229
+ * UNIX timestamps (seconds).
1230
+ * @returns A `MarketChartResponse` containing price, market cap, and volume
1231
+ * time series.
1232
+ *
1233
+ * @example
1234
+ * ```ts
1235
+ * const chart = await coins.marketChartRange('bitcoin', {
1236
+ * vs_currency: 'usd',
1237
+ * from: 1640995200,
1238
+ * to: 1672531200,
1239
+ * });
1240
+ * ```
1241
+ */
1242
+ marketChartRange(id: string, params: MarketChartRangeParams): Promise<MarketChartResponse>;
1243
+ /**
1244
+ * @description Get OHLC (open, high, low, close) candlestick data for a coin
1245
+ * over a given number of days.
1246
+ *
1247
+ * @param id - CoinGecko coin ID.
1248
+ * @param params - Query parameters including required `vs_currency` and
1249
+ * `days`.
1250
+ * @returns An array of OHLC data points, each formatted as
1251
+ * `[timestamp_ms, open, high, low, close]`.
1252
+ *
1253
+ * @remarks Requires Analyst+ plan.
1254
+ *
1255
+ * @example
1256
+ * ```ts
1257
+ * const candles = await coins.ohlc('bitcoin', { vs_currency: 'usd', days: 7 });
1258
+ * const [ts, open, high, low, close] = candles[0];
1259
+ * ```
1260
+ */
1261
+ ohlc(id: string, params: OhlcParams): Promise<OhlcDataPoint[]>;
1262
+ /**
1263
+ * @description Get OHLC (open, high, low, close) candlestick data for a coin
1264
+ * within a UNIX timestamp range.
1265
+ *
1266
+ * @param id - CoinGecko coin ID.
1267
+ * @param params - Query parameters including required `vs_currency`, `from`,
1268
+ * and `to` UNIX timestamps (seconds).
1269
+ * @returns An array of OHLC data points, each formatted as
1270
+ * `[timestamp_ms, open, high, low, close]`.
1271
+ *
1272
+ * @remarks Requires Analyst+ plan.
1273
+ *
1274
+ * @example
1275
+ * ```ts
1276
+ * const candles = await coins.ohlcRange('bitcoin', {
1277
+ * vs_currency: 'usd',
1278
+ * from: 1640995200,
1279
+ * to: 1672531200,
1280
+ * });
1281
+ * ```
1282
+ */
1283
+ ohlcRange(id: string, params: OhlcRangeParams): Promise<OhlcDataPoint[]>;
1284
+ /**
1285
+ * @description Get the historical circulating supply chart for a coin over a
1286
+ * given number of days.
1287
+ *
1288
+ * @param id - CoinGecko coin ID.
1289
+ * @param params - Query parameters including required `days`.
1290
+ * @returns An array of `[timestamp_ms, supply_value]` data points.
1291
+ *
1292
+ * @remarks Requires Enterprise plan.
1293
+ *
1294
+ * @example
1295
+ * ```ts
1296
+ * const supply = await coins.circulatingSupplyChart('bitcoin', { days: 365 });
1297
+ * const [ts, value] = supply[0];
1298
+ * ```
1299
+ */
1300
+ circulatingSupplyChart(id: string, params: SupplyChartParams): Promise<MarketDataPoint[]>;
1301
+ /**
1302
+ * @description Get the historical circulating supply chart for a coin within
1303
+ * a UNIX timestamp range.
1304
+ *
1305
+ * @param id - CoinGecko coin ID.
1306
+ * @param params - Query parameters including required `from` and `to` UNIX
1307
+ * timestamps (seconds).
1308
+ * @returns An array of `[timestamp_ms, supply_value]` data points.
1309
+ *
1310
+ * @remarks Requires Enterprise plan.
1311
+ *
1312
+ * @example
1313
+ * ```ts
1314
+ * const supply = await coins.circulatingSupplyChartRange('bitcoin', {
1315
+ * from: 1640995200,
1316
+ * to: 1672531200,
1317
+ * });
1318
+ * ```
1319
+ */
1320
+ circulatingSupplyChartRange(id: string, params: SupplyChartRangeParams): Promise<MarketDataPoint[]>;
1321
+ /**
1322
+ * @description Get the historical total supply chart for a coin over a given
1323
+ * number of days.
1324
+ *
1325
+ * @param id - CoinGecko coin ID.
1326
+ * @param params - Query parameters including required `days`.
1327
+ * @returns An array of `[timestamp_ms, supply_value]` data points.
1328
+ *
1329
+ * @remarks Requires Enterprise plan.
1330
+ *
1331
+ * @example
1332
+ * ```ts
1333
+ * const supply = await coins.totalSupplyChart('ethereum', { days: 90 });
1334
+ * ```
1335
+ */
1336
+ totalSupplyChart(id: string, params: SupplyChartParams): Promise<MarketDataPoint[]>;
1337
+ /**
1338
+ * @description Get the historical total supply chart for a coin within a
1339
+ * UNIX timestamp range.
1340
+ *
1341
+ * @param id - CoinGecko coin ID.
1342
+ * @param params - Query parameters including required `from` and `to` UNIX
1343
+ * timestamps (seconds).
1344
+ * @returns An array of `[timestamp_ms, supply_value]` data points.
1345
+ *
1346
+ * @remarks Requires Enterprise plan.
1347
+ *
1348
+ * @example
1349
+ * ```ts
1350
+ * const supply = await coins.totalSupplyChartRange('ethereum', {
1351
+ * from: 1640995200,
1352
+ * to: 1672531200,
1353
+ * });
1354
+ * ```
1355
+ */
1356
+ totalSupplyChartRange(id: string, params: SupplyChartRangeParams): Promise<MarketDataPoint[]>;
1357
+ /**
1358
+ * @description Get full coin data for a token by its smart contract address
1359
+ * on a given asset platform.
1360
+ *
1361
+ * @param platformId - Asset platform ID (e.g. `'ethereum'`, `'binance-smart-chain'`).
1362
+ * @param contractAddress - Token contract address (e.g. `'0xdac17f…'`).
1363
+ * @returns A `CoinDetail` object equivalent to `/coins/{id}`.
1364
+ *
1365
+ * @example
1366
+ * ```ts
1367
+ * const usdt = await coins.getByContract(
1368
+ * 'ethereum',
1369
+ * '0xdac17f958d2ee523a2206206994597c13d831ec7',
1370
+ * );
1371
+ * console.log(usdt.name); // 'Tether'
1372
+ * ```
1373
+ */
1374
+ getByContract(platformId: string, contractAddress: string): Promise<CoinDetail>;
1375
+ /**
1376
+ * @description Get historical market chart data (price, market cap, volume)
1377
+ * for a token identified by its contract address on a given asset platform.
1378
+ *
1379
+ * @param platformId - Asset platform ID (e.g. `'ethereum'`).
1380
+ * @param contractAddress - Token contract address.
1381
+ * @param params - Query parameters including required `vs_currency` and
1382
+ * `days`.
1383
+ * @returns A `MarketChartResponse` with price, market cap, and volume time
1384
+ * series.
1385
+ *
1386
+ * @example
1387
+ * ```ts
1388
+ * const chart = await coins.contractMarketChart(
1389
+ * 'ethereum',
1390
+ * '0xdac17f958d2ee523a2206206994597c13d831ec7',
1391
+ * { vs_currency: 'usd', days: 30 },
1392
+ * );
1393
+ * ```
1394
+ */
1395
+ contractMarketChart(platformId: string, contractAddress: string, params: MarketChartParams): Promise<MarketChartResponse>;
1396
+ /**
1397
+ * @description Get historical market chart data for a token identified by
1398
+ * its contract address, within a UNIX timestamp range.
1399
+ *
1400
+ * @param platformId - Asset platform ID (e.g. `'ethereum'`).
1401
+ * @param contractAddress - Token contract address.
1402
+ * @param params - Query parameters including required `vs_currency`, `from`,
1403
+ * and `to` UNIX timestamps (seconds).
1404
+ * @returns A `MarketChartResponse` with price, market cap, and volume time
1405
+ * series.
1406
+ *
1407
+ * @example
1408
+ * ```ts
1409
+ * const chart = await coins.contractMarketChartRange(
1410
+ * 'ethereum',
1411
+ * '0xdac17f958d2ee523a2206206994597c13d831ec7',
1412
+ * { vs_currency: 'usd', from: 1640995200, to: 1672531200 },
1413
+ * );
1414
+ * ```
1415
+ */
1416
+ contractMarketChartRange(platformId: string, contractAddress: string, params: MarketChartRangeParams): Promise<MarketChartResponse>;
1417
+ /**
1418
+ * @description Get a flat list of all coin categories available on
1419
+ * CoinGecko, returning only the category ID and name.
1420
+ *
1421
+ * @returns An array of `CategoryListEntry` items with `category_id` and
1422
+ * `name`.
1423
+ *
1424
+ * @example
1425
+ * ```ts
1426
+ * const list = await coins.categoriesList();
1427
+ * // [{ category_id: 'decentralized-finance-defi', name: 'DeFi' }, ...]
1428
+ * ```
1429
+ */
1430
+ categoriesList(): Promise<CategoryListEntry[]>;
1431
+ /**
1432
+ * @description Get all coin categories with market data (market cap, 24h
1433
+ * change, volume, top coins), optionally sorted.
1434
+ *
1435
+ * @param params - Optional query parameters for sort order.
1436
+ * @returns An array of `Category` objects with market statistics.
1437
+ *
1438
+ * @example
1439
+ * ```ts
1440
+ * const categories = await coins.categories({ order: 'market_cap_desc' });
1441
+ * console.log(categories[0].name, categories[0].market_cap);
1442
+ * ```
1443
+ */
1444
+ categories(params?: CategoriesParams): Promise<Category[]>;
1445
+ }
1446
+
1447
+ /**
1448
+ * Type definitions for CoinGecko exchange-related endpoints.
1449
+ *
1450
+ * Covers: /exchanges, /exchanges/list, /exchanges/{id},
1451
+ * /exchanges/{id}/tickers, /exchanges/{id}/volume_chart,
1452
+ * /exchanges/{id}/volume_chart/range (Analyst+).
1453
+ */
1454
+
1455
+ /**
1456
+ * A minimal exchange entry from `/exchanges/list`.
1457
+ */
1458
+ interface ExchangeListEntry {
1459
+ /** Exchange API ID. */
1460
+ id: string;
1461
+ /** Exchange name. */
1462
+ name: string;
1463
+ }
1464
+ /**
1465
+ * Exchange entry from `/exchanges` with full market data.
1466
+ *
1467
+ * @example
1468
+ * const ex: Exchange = {
1469
+ * id: 'binance',
1470
+ * name: 'Binance',
1471
+ * trust_score: 10,
1472
+ * trust_score_rank: 1,
1473
+ * trade_volume_24h_btc: 207319,
1474
+ * };
1475
+ */
1476
+ interface Exchange {
1477
+ /** Exchange API ID. */
1478
+ id: string;
1479
+ /** Exchange name. */
1480
+ name: string;
1481
+ /** Year the exchange was established. */
1482
+ year_established?: number | null;
1483
+ /** Country of incorporation. */
1484
+ country?: string | null;
1485
+ /** Exchange description. */
1486
+ description?: string | null;
1487
+ /** Exchange website URL. */
1488
+ url?: string | null;
1489
+ /** Exchange logo image URL. */
1490
+ image?: string | null;
1491
+ /** Whether the exchange offers trading incentives. */
1492
+ has_trading_incentive?: boolean | null;
1493
+ /** CoinGecko trust score (1–10). */
1494
+ trust_score?: number | null;
1495
+ /** Rank by trust score. */
1496
+ trust_score_rank?: number | null;
1497
+ /** 24h trading volume denominated in BTC. */
1498
+ trade_volume_24h_btc?: number | null;
1499
+ }
1500
+ /**
1501
+ * Detailed exchange data from `/exchanges/{id}`.
1502
+ * Includes social links, tickers, and volume.
1503
+ *
1504
+ * @example
1505
+ * const detail: ExchangeDetail = {
1506
+ * name: 'Binance',
1507
+ * centralized: true,
1508
+ * trust_score: 9,
1509
+ * trade_volume_24h_btc: 207319.13,
1510
+ * tickers: [...],
1511
+ * };
1512
+ */
1513
+ interface ExchangeDetail {
1514
+ /** Exchange name. */
1515
+ name?: string | null;
1516
+ /** Year the exchange was established. */
1517
+ year_established?: number | null;
1518
+ /** Country of incorporation. */
1519
+ country?: string | null;
1520
+ /** Exchange description. */
1521
+ description?: string | null;
1522
+ /** Exchange website URL. */
1523
+ url?: string | null;
1524
+ /** Exchange logo image URL. */
1525
+ image?: string | null;
1526
+ /** Facebook page URL. */
1527
+ facebook_url?: string | null;
1528
+ /** Reddit community URL. */
1529
+ reddit_url?: string | null;
1530
+ /** Telegram channel URL. */
1531
+ telegram_url?: string | null;
1532
+ /** Slack workspace URL. */
1533
+ slack_url?: string | null;
1534
+ /** Additional social/info URL 1. */
1535
+ other_url_1?: string | null;
1536
+ /** Additional social/info URL 2. */
1537
+ other_url_2?: string | null;
1538
+ /** Twitter handle. */
1539
+ twitter_handle?: string | null;
1540
+ /** Whether the exchange offers trading incentives. */
1541
+ has_trading_incentive?: boolean | null;
1542
+ /** Whether this is a centralized exchange. */
1543
+ centralized?: boolean | null;
1544
+ /** Public notice displayed on the exchange. */
1545
+ public_notice?: string | null;
1546
+ /** Alert notice for the exchange. */
1547
+ alert_notice?: string | null;
1548
+ /** CoinGecko trust score. */
1549
+ trust_score?: number | null;
1550
+ /** Rank by trust score. */
1551
+ trust_score_rank?: number | null;
1552
+ /** 24h trading volume in BTC. */
1553
+ trade_volume_24h_btc?: number | null;
1554
+ /** Number of coins listed on the exchange. */
1555
+ coins?: number | null;
1556
+ /** Number of trading pairs. */
1557
+ pairs?: number | null;
1558
+ /** Top 100 tickers (limited; use `/tickers` endpoint for more). */
1559
+ tickers?: CoinTicker[] | null;
1560
+ }
1561
+ /**
1562
+ * Query parameters for `/exchanges/{id}/tickers`.
1563
+ */
1564
+ interface ExchangeTickersParams extends Omit<PaginationParams, 'per_page'> {
1565
+ /** Filter by coin IDs (comma-separated). */
1566
+ coin_ids?: string;
1567
+ /** Include exchange logo. Default: false. */
1568
+ include_exchange_logo?: boolean;
1569
+ /** Include 2% orderbook depth data. Default: false. */
1570
+ depth?: boolean;
1571
+ /** Sort order. Default: trust_score_desc. */
1572
+ order?: ExchangeTickerOrder;
1573
+ /** Display DEX pair base/target as symbols instead of contract addresses. */
1574
+ dex_pair_format?: 'contract_address' | 'symbol';
1575
+ }
1576
+ /**
1577
+ * Response wrapper from `/exchanges/{id}/tickers`.
1578
+ */
1579
+ interface ExchangeTickersResponse {
1580
+ /** Exchange name. */
1581
+ name: string;
1582
+ /** Array of tickers. */
1583
+ tickers: ExchangeTicker[];
1584
+ }
1585
+ /**
1586
+ * A single exchange ticker (extends CoinTicker with exchange-specific fields).
1587
+ */
1588
+ interface ExchangeTicker extends CoinTicker {
1589
+ /** Market cap of the base coin in USD. */
1590
+ coin_mcap_usd?: number | null;
1591
+ }
1592
+ /**
1593
+ * A single volume chart data point: [timestamp_ms, volume_string].
1594
+ * Volume is returned as a string to preserve precision.
1595
+ *
1596
+ * @example
1597
+ * const point: VolumeChartPoint = [1711792200000, '306800.051794'];
1598
+ */
1599
+ type VolumeChartPoint = [number, string];
1600
+ /**
1601
+ * Response from `/exchanges/{id}/volume_chart`.
1602
+ * Array of [timestamp_ms, volume_btc] pairs.
1603
+ */
1604
+ type VolumeChartResponse = VolumeChartPoint[];
1605
+ /**
1606
+ * Query parameters for `/exchanges/{id}/volume_chart`.
1607
+ */
1608
+ interface VolumeChartParams {
1609
+ /** Number of days of historical data. */
1610
+ days: '1' | '7' | '14' | '30' | '90' | '180' | '365';
1611
+ }
1612
+ /**
1613
+ * Query parameters for `/exchanges/{id}/volume_chart/range`.
1614
+ *
1615
+ * @remarks Requires Analyst+ plan
1616
+ */
1617
+ interface VolumeChartRangeParams {
1618
+ /** Start of date range (Unix timestamp seconds). */
1619
+ from: number;
1620
+ /** End of date range (Unix timestamp seconds). */
1621
+ to: number;
1622
+ }
1623
+
1624
+ /**
1625
+ * Type definitions for CoinGecko derivatives-related endpoints.
1626
+ *
1627
+ * Covers: /derivatives, /derivatives/exchanges,
1628
+ * /derivatives/exchanges/{id}, /derivatives/exchanges/list.
1629
+ */
1630
+
1631
+ /**
1632
+ * A single derivatives ticker from `/derivatives`.
1633
+ *
1634
+ * @example
1635
+ * const ticker: DerivativeTicker = {
1636
+ * market: 'Binance (Futures)',
1637
+ * symbol: 'BTC-PERPUSDT',
1638
+ * index_id: 'BTC',
1639
+ * price: '69434.1',
1640
+ * contract_type: 'perpetual',
1641
+ * open_interest: 7690212057.6,
1642
+ * volume_24h: 132888173.547,
1643
+ * };
1644
+ */
1645
+ interface DerivativeTicker {
1646
+ /** Derivatives exchange name. */
1647
+ market?: string | null;
1648
+ /** Ticker symbol. */
1649
+ symbol?: string | null;
1650
+ /** Underlying asset identifier (e.g. "BTC", "ETH"). */
1651
+ index_id?: string | null;
1652
+ /** Last traded price (as a string for precision). */
1653
+ price?: string | null;
1654
+ /** 24h price change percentage. */
1655
+ price_percentage_change_24h?: number | null;
1656
+ /** Contract type ("perpetual" or "futures"). */
1657
+ contract_type?: string | null;
1658
+ /** Current index (spot) price of the underlying asset. */
1659
+ index?: number | null;
1660
+ /** Basis = derivative price − index price. */
1661
+ basis?: number | null;
1662
+ /** Bid-ask spread. */
1663
+ spread?: number | null;
1664
+ /** Funding rate (perpetuals only). */
1665
+ funding_rate?: number | null;
1666
+ /** Open interest in USD. */
1667
+ open_interest?: number | null;
1668
+ /** 24h trading volume in USD. */
1669
+ volume_24h?: number | null;
1670
+ /** Unix timestamp of the last trade. */
1671
+ last_traded_at?: number | null;
1672
+ /** Expiry timestamp (ISO string), null for perpetuals. */
1673
+ expired_at?: string | null;
1674
+ }
1675
+ /**
1676
+ * Sort order options for `/derivatives/exchanges`.
1677
+ */
1678
+ type DerivativesExchangeOrder = 'name_asc' | 'name_desc' | 'open_interest_btc_asc' | 'open_interest_btc_desc' | 'trade_volume_24h_btc_asc' | 'trade_volume_24h_btc_desc';
1679
+ /**
1680
+ * Query parameters for `/derivatives/exchanges`.
1681
+ */
1682
+ interface DerivativesExchangesParams extends PaginationParams {
1683
+ /** Sort order. Default: open_interest_btc_desc. */
1684
+ order?: DerivativesExchangeOrder;
1685
+ }
1686
+ /**
1687
+ * A derivatives exchange entry from `/derivatives/exchanges`.
1688
+ *
1689
+ * @example
1690
+ * const dex: DerivativeExchange = {
1691
+ * id: 'binance_futures',
1692
+ * name: 'Binance (Futures)',
1693
+ * open_interest_btc: 279958.61,
1694
+ * trade_volume_24h_btc: '574366.94',
1695
+ * number_of_perpetual_pairs: 330,
1696
+ * };
1697
+ */
1698
+ interface DerivativeExchange {
1699
+ /** Exchange API ID. */
1700
+ id?: string | null;
1701
+ /** Exchange name. */
1702
+ name?: string | null;
1703
+ /** Total open interest in BTC. */
1704
+ open_interest_btc?: number | null;
1705
+ /** 24h trading volume in BTC (string for precision). */
1706
+ trade_volume_24h_btc?: string | null;
1707
+ /** Number of perpetual contract pairs. */
1708
+ number_of_perpetual_pairs?: number | null;
1709
+ /** Number of futures contract pairs. */
1710
+ number_of_futures_pairs?: number | null;
1711
+ /** Exchange logo image URL. */
1712
+ image?: string | null;
1713
+ /** Year established. */
1714
+ year_established?: number | null;
1715
+ /** Country of incorporation. */
1716
+ country?: string | null;
1717
+ /** Exchange description. */
1718
+ description?: string | null;
1719
+ /** Exchange website URL. */
1720
+ url?: string | null;
1721
+ }
1722
+ /**
1723
+ * Detailed derivatives exchange from `/derivatives/exchanges/{id}`.
1724
+ * Extends DerivativeExchange with optional tickers.
1725
+ */
1726
+ interface DerivativeExchangeDetail extends DerivativeExchange {
1727
+ /** Tickers included when `include_tickers=all` or `include_tickers=unexpired`. */
1728
+ tickers?: DerivativeTicker[] | null;
1729
+ }
1730
+ /**
1731
+ * Query parameters for `/derivatives/exchanges/{id}`.
1732
+ */
1733
+ interface DerivativesExchangeByIdParams {
1734
+ /**
1735
+ * Whether to include tickers.
1736
+ * `all` includes all tickers; `unexpired` excludes expired ones.
1737
+ * Omit to exclude tickers.
1738
+ */
1739
+ include_tickers?: 'all' | 'unexpired';
1740
+ }
1741
+
1742
+ /**
1743
+ * Type definitions for CoinGecko NFT-related endpoints.
1744
+ *
1745
+ * Covers: /nfts/list, /nfts/{id}, /nfts/{asset_platform_id}/contract/{contract_address},
1746
+ * /nfts/markets (Analyst+), /nfts/{id}/market_chart (Analyst+),
1747
+ * /nfts/{id}/tickers (Analyst+).
1748
+ */
1749
+
1750
+ /**
1751
+ * A minimal NFT collection entry from `/nfts/list`.
1752
+ */
1753
+ interface NftListEntry {
1754
+ /** NFT collection API ID. */
1755
+ id: string;
1756
+ /** Token contract address. */
1757
+ contract_address?: string | null;
1758
+ /** Collection name. */
1759
+ name: string;
1760
+ /** Asset platform ID (e.g. "ethereum"). */
1761
+ asset_platform_id?: string | null;
1762
+ /** Collection ticker symbol (e.g. "BAYC"). */
1763
+ symbol?: string | null;
1764
+ }
1765
+ /**
1766
+ * NFT price/market-cap object with native currency and USD values.
1767
+ */
1768
+ interface NftDualValue {
1769
+ /** Value in the collection's native currency. */
1770
+ native_currency?: number | null;
1771
+ /** Value in USD. */
1772
+ usd?: number | null;
1773
+ }
1774
+ /**
1775
+ * NFT links block.
1776
+ */
1777
+ interface NftLinks {
1778
+ /** Collection website URL. */
1779
+ homepage?: string | null;
1780
+ /** Twitter profile URL. */
1781
+ twitter?: string | null;
1782
+ /** Discord server URL. */
1783
+ discord?: string | null;
1784
+ }
1785
+ /**
1786
+ * Block-explorer link for an NFT collection.
1787
+ */
1788
+ interface NftExplorerLink {
1789
+ /** Explorer name. */
1790
+ name?: string | null;
1791
+ /** Explorer URL for this collection. */
1792
+ link?: string | null;
1793
+ }
1794
+ /**
1795
+ * Full NFT collection data from `/nfts/{id}` or `/nfts/{platform}/contract/{address}`.
1796
+ *
1797
+ * @example
1798
+ * const nft: NftCollection = {
1799
+ * id: 'pudgy-penguins',
1800
+ * name: 'Pudgy Penguins',
1801
+ * symbol: 'PPG',
1802
+ * native_currency: 'ethereum',
1803
+ * floor_price: { native_currency: 12.84, usd: 45920 },
1804
+ * };
1805
+ */
1806
+ interface NftCollection {
1807
+ /** NFT collection API ID. */
1808
+ id?: string | null;
1809
+ /** Contract address. */
1810
+ contract_address?: string | null;
1811
+ /** Asset platform ID. */
1812
+ asset_platform_id?: string | null;
1813
+ /** Collection name. */
1814
+ name?: string | null;
1815
+ /** Collection symbol. */
1816
+ symbol?: string | null;
1817
+ /** Collection image URLs. */
1818
+ image?: {
1819
+ small?: string | null;
1820
+ small_2x?: string | null;
1821
+ } | null;
1822
+ /** Banner image URL. */
1823
+ banner_image?: {
1824
+ small?: string | null;
1825
+ } | null;
1826
+ /** Collection description. */
1827
+ description?: string | null;
1828
+ /** Native currency name (e.g. "ethereum"). */
1829
+ native_currency?: string | null;
1830
+ /** Native currency ticker symbol (e.g. "ETH"). */
1831
+ native_currency_symbol?: string | null;
1832
+ /** Market cap rank among NFTs. */
1833
+ market_cap_rank?: number | null;
1834
+ /** Current floor price. */
1835
+ floor_price?: NftDualValue | null;
1836
+ /** Market capitalisation. */
1837
+ market_cap?: NftDualValue | null;
1838
+ /** 24h trading volume. */
1839
+ volume_24h?: NftDualValue | null;
1840
+ /** Floor price 24h change percentage in USD. */
1841
+ floor_price_in_usd_24h_percentage_change?: number | null;
1842
+ /** Floor price 24h change percentage in native and USD. */
1843
+ floor_price_24h_percentage_change?: NftDualValue | null;
1844
+ /** Market cap 24h change percentage. */
1845
+ market_cap_24h_percentage_change?: NftDualValue | null;
1846
+ /** Volume 24h change percentage. */
1847
+ volume_24h_percentage_change?: NftDualValue | null;
1848
+ /** Number of unique holder addresses. */
1849
+ number_of_unique_addresses?: number | null;
1850
+ /** Unique holder count 24h change percentage. */
1851
+ number_of_unique_addresses_24h_percentage_change?: number | null;
1852
+ /** Volume in USD 24h change percentage. */
1853
+ volume_in_usd_24h_percentage_change?: number | null;
1854
+ /** Total NFT supply. */
1855
+ total_supply?: number | null;
1856
+ /** Number of sales in the last day. */
1857
+ one_day_sales?: number | null;
1858
+ /** 24h change percentage for one-day sales count. */
1859
+ one_day_sales_24h_percentage_change?: number | null;
1860
+ /** Average sale price in the last day. */
1861
+ one_day_average_sale_price?: number | null;
1862
+ /** 24h change percentage for average sale price. */
1863
+ one_day_average_sale_price_24h_percentage_change?: number | null;
1864
+ /** External links. */
1865
+ links?: NftLinks | null;
1866
+ /** Floor price 7d change percentage. */
1867
+ floor_price_7d_percentage_change?: NftDualValue | null;
1868
+ /** Floor price 14d change percentage. */
1869
+ floor_price_14d_percentage_change?: NftDualValue | null;
1870
+ /** Floor price 30d change percentage. */
1871
+ floor_price_30d_percentage_change?: NftDualValue | null;
1872
+ /** Floor price 60d change percentage. */
1873
+ floor_price_60d_percentage_change?: NftDualValue | null;
1874
+ /** Floor price 1y change percentage. */
1875
+ floor_price_1y_percentage_change?: NftDualValue | null;
1876
+ /** Block explorer links. */
1877
+ explorers?: NftExplorerLink[] | null;
1878
+ /** Number of users who have favourited this collection. */
1879
+ user_favorites_count?: number | null;
1880
+ /** All-time high floor price. */
1881
+ ath?: NftDualValue | null;
1882
+ /** ATH change percentage. */
1883
+ ath_change_percentage?: NftDualValue | null;
1884
+ /** ATH date. */
1885
+ ath_date?: {
1886
+ native_currency?: string | null;
1887
+ usd?: string | null;
1888
+ } | null;
1889
+ }
1890
+ /**
1891
+ * Query parameters for `/nfts/markets`.
1892
+ *
1893
+ * @remarks Requires Analyst+ plan
1894
+ */
1895
+ interface NftMarketsParams extends PaginationParams {
1896
+ /** Asset platform to filter by. */
1897
+ asset_platform_id?: string;
1898
+ /** Sort order. */
1899
+ order?: 'h24_volume_usd_asc' | 'h24_volume_usd_desc' | 'h24_volume_native_asc' | 'h24_volume_native_desc' | 'floor_price_native_asc' | 'floor_price_native_desc' | 'market_cap_native_asc' | 'market_cap_native_desc' | 'market_cap_usd_asc' | 'market_cap_usd_desc';
1900
+ }
1901
+ /**
1902
+ * Response from `/nfts/{id}/market_chart`.
1903
+ * Each series is an array of [timestamp_ms, value] pairs.
1904
+ *
1905
+ * @remarks Requires Analyst+ plan
1906
+ */
1907
+ interface NftMarketChart {
1908
+ /** Floor price history in native currency. */
1909
+ floor_price_native?: MarketDataPoint[] | null;
1910
+ /** Floor price history in USD. */
1911
+ floor_price_usd?: MarketDataPoint[] | null;
1912
+ /** Market cap history in native currency. */
1913
+ market_cap_native?: MarketDataPoint[] | null;
1914
+ /** Market cap history in USD. */
1915
+ market_cap_usd?: MarketDataPoint[] | null;
1916
+ /** 24h volume history in native currency. */
1917
+ volume_native?: MarketDataPoint[] | null;
1918
+ /** 24h volume history in USD. */
1919
+ volume_usd?: MarketDataPoint[] | null;
1920
+ }
1921
+ /**
1922
+ * Query parameters for NFT market chart endpoints.
1923
+ *
1924
+ * @remarks Requires Analyst+ plan
1925
+ */
1926
+ interface NftMarketChartParams {
1927
+ /** Number of days to look back. */
1928
+ days: number | 'max';
1929
+ }
1930
+ /**
1931
+ * A single NFT marketplace ticker entry.
1932
+ *
1933
+ * @remarks Requires Analyst+ plan
1934
+ */
1935
+ interface NftTicker {
1936
+ /** Floor price in the marketplace's native currency. */
1937
+ floor_price_in_native_currency?: number | null;
1938
+ /** 24h trading volume in native currency. */
1939
+ h24_volume_in_native_currency?: number | null;
1940
+ /** Native currency name (e.g. "ethereum"). */
1941
+ native_currency?: string | null;
1942
+ /** Native currency symbol (e.g. "ETH"). */
1943
+ native_currency_symbol?: string | null;
1944
+ /** ISO timestamp of last update. */
1945
+ updated_at?: string | null;
1946
+ /** NFT marketplace API ID. */
1947
+ nft_marketplace_id?: string | null;
1948
+ /** Marketplace name. */
1949
+ name?: string | null;
1950
+ /** Marketplace logo image URL. */
1951
+ image?: string | null;
1952
+ /** Collection URL on the marketplace. */
1953
+ nft_collection_url?: string | null;
1954
+ }
1955
+ /**
1956
+ * Response from `/nfts/{id}/tickers`.
1957
+ *
1958
+ * @remarks Requires Analyst+ plan
1959
+ */
1960
+ interface NftTickersResponse {
1961
+ /** Array of marketplace tickers. */
1962
+ tickers: NftTicker[];
1963
+ }
1964
+
1965
+ /**
1966
+ * Type definitions for GeckoTerminal onchain DEX endpoints.
1967
+ *
1968
+ * Covers: /onchain/networks, /onchain/networks/{network}/dexes,
1969
+ * /onchain/networks/{network}/pools/{address},
1970
+ * /onchain/networks/{network}/pools/multi/{addresses},
1971
+ * /onchain/networks/trending_pools, /onchain/networks/{network}/trending_pools,
1972
+ * /onchain/networks/{network}/pools,
1973
+ * /onchain/networks/{network}/dexes/{dex}/pools,
1974
+ * /onchain/networks/new_pools, /onchain/networks/{network}/new_pools,
1975
+ * /onchain/pools/megafilter (Analyst+),
1976
+ * /onchain/search/pools, /onchain/pools/trending_search (Analyst+),
1977
+ * /onchain/networks/{network}/tokens/{address}/pools,
1978
+ * /onchain/networks/{network}/tokens/{address},
1979
+ * /onchain/networks/{network}/tokens/multi/{addresses},
1980
+ * /onchain/networks/{network}/tokens/{address}/info,
1981
+ * /onchain/networks/{network}/pools/{pool_address}/info,
1982
+ * /onchain/tokens/info_recently_updated,
1983
+ * /onchain/networks/{network}/tokens/{address}/top_traders (Analyst+),
1984
+ * /onchain/networks/{network}/tokens/{address}/top_holders (Analyst+),
1985
+ * /onchain/networks/{network}/tokens/{address}/holders_chart (Analyst+),
1986
+ * /onchain/networks/{network}/pools/{pool_address}/ohlcv/{timeframe},
1987
+ * /onchain/networks/{network}/tokens/{address}/ohlcv/{timeframe} (Analyst+),
1988
+ * /onchain/networks/{network}/pools/{pool_address}/trades,
1989
+ * /onchain/networks/{network}/tokens/{address}/trades (Analyst+),
1990
+ * /onchain/categories (Analyst+), /onchain/categories/{category_id}/pools (Analyst+).
1991
+ */
1992
+
1993
+ /**
1994
+ * Generic JSON:API resource object wrapper used by GeckoTerminal responses.
1995
+ */
1996
+ interface JsonApiResource<T> {
1997
+ /** Resource identifier (e.g. "eth_0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640"). */
1998
+ id: string;
1999
+ /** Resource type string (e.g. "pool", "token", "dex"). */
2000
+ type: string;
2001
+ /** Resource attributes. */
2002
+ attributes: T;
2003
+ /** Relationships to other resources. */
2004
+ relationships?: Record<string, {
2005
+ data: {
2006
+ id: string;
2007
+ type: string;
2008
+ };
2009
+ }> | null;
2010
+ }
2011
+ /**
2012
+ * Generic JSON:API list response.
2013
+ */
2014
+ interface JsonApiListResponse<T> {
2015
+ data: JsonApiResource<T>[];
2016
+ /** Sideloaded related resources (when `include` param is used). */
2017
+ included?: JsonApiResource<Record<string, unknown>>[] | null;
2018
+ }
2019
+ /**
2020
+ * Generic JSON:API single-item response.
2021
+ */
2022
+ interface JsonApiSingleResponse<T> {
2023
+ data: JsonApiResource<T>;
2024
+ /** Sideloaded related resources (when `include` param is used). */
2025
+ included?: JsonApiResource<Record<string, unknown>>[] | null;
2026
+ }
2027
+ /**
2028
+ * Attributes for a supported network from `/onchain/networks`.
2029
+ */
2030
+ interface NetworkAttributes {
2031
+ /** Network name (e.g. "Ethereum"). */
2032
+ name: string;
2033
+ /** Short network identifier (e.g. "eth"). */
2034
+ coingecko_asset_platform_id?: string | null;
2035
+ }
2036
+ /**
2037
+ * A network entry from `/onchain/networks`.
2038
+ */
2039
+ type Network = JsonApiResource<NetworkAttributes>;
2040
+ /**
2041
+ * Response from `/onchain/networks`.
2042
+ */
2043
+ type NetworksListResponse = JsonApiListResponse<NetworkAttributes>;
2044
+ /**
2045
+ * Attributes for a DEX from `/onchain/networks/{network}/dexes`.
2046
+ */
2047
+ interface DexAttributes {
2048
+ /** DEX name (e.g. "Uniswap v3"). */
2049
+ name: string;
2050
+ }
2051
+ /**
2052
+ * A DEX entry from the DEX list endpoint.
2053
+ */
2054
+ type DEX = JsonApiResource<DexAttributes>;
2055
+ /**
2056
+ * Response from `/onchain/networks/{network}/dexes`.
2057
+ */
2058
+ type DexListResponse = JsonApiListResponse<DexAttributes>;
2059
+ /**
2060
+ * Transaction counts for a time window.
2061
+ */
2062
+ interface PoolTransactionWindow {
2063
+ /** Number of buy transactions. */
2064
+ buys?: number | null;
2065
+ /** Number of sell transactions. */
2066
+ sells?: number | null;
2067
+ /** Number of unique buyers. */
2068
+ buyers?: number | null;
2069
+ /** Number of unique sellers. */
2070
+ sellers?: number | null;
2071
+ }
2072
+ /**
2073
+ * Multi-timeframe transactions map (m5, m15, m30, h1, h6, h24).
2074
+ */
2075
+ interface PoolTransactions {
2076
+ m5?: PoolTransactionWindow | null;
2077
+ m15?: PoolTransactionWindow | null;
2078
+ m30?: PoolTransactionWindow | null;
2079
+ h1?: PoolTransactionWindow | null;
2080
+ h6?: PoolTransactionWindow | null;
2081
+ h24?: PoolTransactionWindow | null;
2082
+ }
2083
+ /**
2084
+ * Multi-timeframe string value map used for volume and price changes.
2085
+ */
2086
+ interface PoolTimeframeStringMap {
2087
+ m5?: string | null;
2088
+ m15?: string | null;
2089
+ m30?: string | null;
2090
+ h1?: string | null;
2091
+ h6?: string | null;
2092
+ h24?: string | null;
2093
+ }
2094
+ /**
2095
+ * Attributes for a pool resource from the onchain endpoints.
2096
+ *
2097
+ * @example
2098
+ * const attrs: PoolAttributes = {
2099
+ * address: '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640',
2100
+ * name: 'WETH / USDC 0.05%',
2101
+ * reserve_in_usd: '90053526.89',
2102
+ * };
2103
+ */
2104
+ interface PoolAttributes {
2105
+ /** Base token price in USD. */
2106
+ base_token_price_usd?: string | null;
2107
+ /** Base token price in the pool's native currency. */
2108
+ base_token_price_native_currency?: string | null;
2109
+ /** Base token balance in the pool. */
2110
+ base_token_balance?: string | null;
2111
+ /** Base token liquidity in USD. */
2112
+ base_token_liquidity_usd?: string | null;
2113
+ /** Quote token price in USD. */
2114
+ quote_token_price_usd?: string | null;
2115
+ /** Quote token price in native currency. */
2116
+ quote_token_price_native_currency?: string | null;
2117
+ /** Quote token balance in the pool. */
2118
+ quote_token_balance?: string | null;
2119
+ /** Quote token liquidity in USD. */
2120
+ quote_token_liquidity_usd?: string | null;
2121
+ /** Base token price expressed in quote token units. */
2122
+ base_token_price_quote_token?: string | null;
2123
+ /** Quote token price expressed in base token units. */
2124
+ quote_token_price_base_token?: string | null;
2125
+ /** Pool contract address. */
2126
+ address?: string | null;
2127
+ /** Descriptive pool name (e.g. "WETH / USDC 0.05%"). */
2128
+ name?: string | null;
2129
+ /** Short pool name without fee. */
2130
+ pool_name?: string | null;
2131
+ /** Pool fee percentage. */
2132
+ pool_fee_percentage?: string | null;
2133
+ /** ISO timestamp when the pool was created. */
2134
+ pool_created_at?: string | null;
2135
+ /** Fully diluted valuation in USD. */
2136
+ fdv_usd?: string | null;
2137
+ /** Market cap in USD (null if unverified). */
2138
+ market_cap_usd?: string | null;
2139
+ /** Price change percentages over various timeframes. */
2140
+ price_change_percentage?: PoolTimeframeStringMap | null;
2141
+ /** Transaction counts over various timeframes. */
2142
+ transactions?: PoolTransactions | null;
2143
+ /** Total volume in USD over various timeframes. */
2144
+ volume_usd?: PoolTimeframeStringMap | null;
2145
+ /** Net buy volume in USD over various timeframes. */
2146
+ net_buy_volume_usd?: PoolTimeframeStringMap | null;
2147
+ /** Buy volume in USD over various timeframes. */
2148
+ buy_volume_usd?: PoolTimeframeStringMap | null;
2149
+ /** Sell volume in USD over various timeframes. */
2150
+ sell_volume_usd?: PoolTimeframeStringMap | null;
2151
+ /** Total reserve in USD. */
2152
+ reserve_in_usd?: string | null;
2153
+ /** Percentage of liquidity that is locked. */
2154
+ locked_liquidity_percentage?: string | null;
2155
+ }
2156
+ /**
2157
+ * A pool resource from the onchain endpoints.
2158
+ */
2159
+ type Pool = JsonApiResource<PoolAttributes>;
2160
+ /**
2161
+ * A single pool response (JSON:API envelope).
2162
+ */
2163
+ type PoolDetail = JsonApiSingleResponse<PoolAttributes>;
2164
+ /**
2165
+ * Multiple pools response (JSON:API envelope).
2166
+ */
2167
+ type PoolInfo = JsonApiListResponse<PoolAttributes>;
2168
+ /**
2169
+ * Attributes for a token resource from the onchain endpoints.
2170
+ */
2171
+ interface TokenAttributes {
2172
+ /** Contract address. */
2173
+ address?: string | null;
2174
+ /** Token name. */
2175
+ name?: string | null;
2176
+ /** Token symbol. */
2177
+ symbol?: string | null;
2178
+ /** Number of decimal places. */
2179
+ decimals?: number | null;
2180
+ /** Image URL. */
2181
+ image_url?: string | null;
2182
+ /** CoinGecko coin ID (if matched). */
2183
+ coingecko_coin_id?: string | null;
2184
+ /** Price in USD. */
2185
+ price_usd?: string | null;
2186
+ /** Fully diluted valuation in USD. */
2187
+ fdv_usd?: string | null;
2188
+ /** Market cap in USD (null if unverified). */
2189
+ market_cap_usd?: string | null;
2190
+ /** 24h price change percentage. */
2191
+ price_change_percentage_24h?: Record<string, string> | null;
2192
+ /** 24h volume in USD. */
2193
+ volume_usd?: Record<string, string> | null;
2194
+ /** Total supply. */
2195
+ total_supply?: string | null;
2196
+ }
2197
+ /**
2198
+ * A token resource from the onchain endpoints.
2199
+ */
2200
+ type TokenDetail = JsonApiResource<TokenAttributes>;
2201
+ /**
2202
+ * Response for a single token.
2203
+ */
2204
+ interface TokenDetailResponse {
2205
+ data: TokenDetail;
2206
+ }
2207
+ /**
2208
+ * GeckoTerminal score breakdown.
2209
+ */
2210
+ interface GtScoreDetails {
2211
+ pool?: number | null;
2212
+ transaction?: number | null;
2213
+ creation?: number | null;
2214
+ info?: number | null;
2215
+ holders?: number | null;
2216
+ }
2217
+ /**
2218
+ * Token holder distribution percentages.
2219
+ */
2220
+ interface HolderDistribution {
2221
+ top_10?: string | null;
2222
+ /** Holders ranked 11–30. */
2223
+ '11_30'?: string | null;
2224
+ /** Holders ranked 31–50. */
2225
+ '31_50'?: string | null;
2226
+ /** Remaining holders. */
2227
+ rest?: string | null;
2228
+ }
2229
+ /**
2230
+ * Token holder summary.
2231
+ */
2232
+ interface TokenHolders {
2233
+ /** Total holder count. */
2234
+ count?: number | null;
2235
+ /** Distribution percentages by holder rank. */
2236
+ distribution_percentage?: HolderDistribution | null;
2237
+ /** ISO timestamp of last holder data update. */
2238
+ last_updated?: string | null;
2239
+ }
2240
+ /**
2241
+ * Rich metadata attributes for a token (from `/tokens/{address}/info`).
2242
+ */
2243
+ interface TokenInfoAttributes {
2244
+ address?: string | null;
2245
+ name?: string | null;
2246
+ symbol?: string | null;
2247
+ image_url?: string | null;
2248
+ image?: {
2249
+ thumb?: string | null;
2250
+ small?: string | null;
2251
+ large?: string | null;
2252
+ } | null;
2253
+ coingecko_coin_id?: string | null;
2254
+ websites?: string[] | null;
2255
+ description?: string | null;
2256
+ gt_score?: number | null;
2257
+ gt_score_details?: GtScoreDetails | null;
2258
+ discord_url?: string | null;
2259
+ farcaster_url?: string | null;
2260
+ zora_url?: string | null;
2261
+ telegram_handle?: string | null;
2262
+ twitter_handle?: string | null;
2263
+ categories?: string[] | null;
2264
+ gt_categories_id?: string[] | null;
2265
+ holders?: TokenHolders | null;
2266
+ mint_authority?: string | null;
2267
+ freeze_authority?: string | null;
2268
+ is_honeypot?: boolean | string | null;
2269
+ }
2270
+ /**
2271
+ * Token info resource.
2272
+ */
2273
+ type TokenInfo = JsonApiResource<TokenInfoAttributes>;
2274
+ /**
2275
+ * Response from `/tokens/{address}/info`.
2276
+ */
2277
+ interface TokenInfoResponse {
2278
+ data: TokenInfo;
2279
+ }
2280
+ /**
2281
+ * A single top trader entry.
2282
+ *
2283
+ * @remarks Requires Analyst+ plan
2284
+ */
2285
+ interface TopTrader {
2286
+ /** Trader wallet address. */
2287
+ address?: string | null;
2288
+ /** Trader type (e.g. "bot", "whale"). */
2289
+ type?: string | null;
2290
+ /** 24h profit and loss in USD. */
2291
+ pnl_usd?: string | null;
2292
+ /** 24h realized profit in USD. */
2293
+ realized_profit_usd?: string | null;
2294
+ /** 24h buy volume in USD. */
2295
+ buy_volume_usd?: string | null;
2296
+ /** 24h sell volume in USD. */
2297
+ sell_volume_usd?: string | null;
2298
+ /** Number of buy trades. */
2299
+ buy_count?: number | null;
2300
+ /** Number of sell trades. */
2301
+ sell_count?: number | null;
2302
+ }
2303
+ /**
2304
+ * A single top holder entry.
2305
+ *
2306
+ * @remarks Requires Analyst+ plan
2307
+ */
2308
+ interface TopHolder {
2309
+ /** Holder wallet address. */
2310
+ address?: string | null;
2311
+ /** Holder type (e.g. "institution", "smart_money"). */
2312
+ type?: string | null;
2313
+ /** Amount of tokens held. */
2314
+ amount?: string | null;
2315
+ /** Value of holdings in USD. */
2316
+ value_usd?: string | null;
2317
+ /** Percentage of total supply held. */
2318
+ percentage?: string | null;
2319
+ }
2320
+ /**
2321
+ * A single data point in the holder count chart.
2322
+ * Format: [unix_timestamp_seconds, holder_count].
2323
+ *
2324
+ * @remarks Requires Analyst+ plan
2325
+ */
2326
+ type HolderChartPoint = [number, number];
2327
+ /**
2328
+ * Response from `/tokens/{address}/holders_chart`.
2329
+ *
2330
+ * @remarks Requires Analyst+ plan
2331
+ */
2332
+ interface HolderChartResponse {
2333
+ data?: {
2334
+ id?: string | null;
2335
+ type?: string | null;
2336
+ attributes?: {
2337
+ /** Array of [timestamp, holder_count] data points. */
2338
+ holders_chart?: HolderChartPoint[] | null;
2339
+ } | null;
2340
+ } | null;
2341
+ }
2342
+ /**
2343
+ * A single OHLCV data point.
2344
+ * Format: [timestamp_seconds, open, high, low, close, volume].
2345
+ *
2346
+ * @example
2347
+ * const candle: OHLCV = [1712534400, 3454.6, 3660.9, 3417.9, 3660.9, 306823];
2348
+ */
2349
+ type OHLCV = [number, number, number, number, number, number];
2350
+ /**
2351
+ * Token metadata included in OHLCV meta block.
2352
+ */
2353
+ interface OhlcvTokenMeta {
2354
+ /** Contract address. */
2355
+ address?: string | null;
2356
+ /** Token name. */
2357
+ name?: string | null;
2358
+ /** Token symbol. */
2359
+ symbol?: string | null;
2360
+ /** CoinGecko coin ID. */
2361
+ coingecko_coin_id?: string | null;
2362
+ }
2363
+ /**
2364
+ * Response from pool and token OHLCV endpoints.
2365
+ */
2366
+ interface OhlcvResponse {
2367
+ data?: {
2368
+ id?: string | null;
2369
+ type?: string | null;
2370
+ attributes?: {
2371
+ /** Array of OHLCV data points. */
2372
+ ohlcv_list?: OHLCV[] | null;
2373
+ } | null;
2374
+ } | null;
2375
+ meta?: {
2376
+ /** Base token metadata. */
2377
+ base?: OhlcvTokenMeta | null;
2378
+ /** Quote token metadata. */
2379
+ quote?: OhlcvTokenMeta | null;
2380
+ } | null;
2381
+ }
2382
+ /**
2383
+ * Query parameters for OHLCV endpoints.
2384
+ */
2385
+ interface OhlcvParams {
2386
+ /** Aggregation period (e.g. "1", "5", "15" for minutes). */
2387
+ aggregate?: string;
2388
+ /** Return data before this Unix timestamp. */
2389
+ before_timestamp?: number;
2390
+ /** Number of candles to return (max 1000). Default: 100. */
2391
+ limit?: number;
2392
+ /** Currency for OHLCV values. Default: "usd". */
2393
+ currency?: 'usd' | 'token';
2394
+ /** Return OHLCV for "base", "quote", or a specific token address. Default: "base". */
2395
+ token?: string;
2396
+ /** Include empty (no-trade) intervals. Default: false. */
2397
+ include_empty_intervals?: boolean;
2398
+ }
2399
+ /**
2400
+ * A single trade entry from pool/token trades endpoints.
2401
+ */
2402
+ interface Trade {
2403
+ /** Transaction hash. */
2404
+ tx_hash?: string | null;
2405
+ /** Unix timestamp of the trade. */
2406
+ block_timestamp?: string | null;
2407
+ /** Trade side ("buy" or "sell"). */
2408
+ kind?: 'buy' | 'sell' | string | null;
2409
+ /** Price in USD at trade time. */
2410
+ price_usd?: string | null;
2411
+ /** USD volume of this trade. */
2412
+ volume_usd?: string | null;
2413
+ /** Amount of base token traded. */
2414
+ from_token_amount?: string | null;
2415
+ /** Amount of quote token traded. */
2416
+ to_token_amount?: string | null;
2417
+ }
2418
+ /**
2419
+ * Response from pool/token trades endpoints.
2420
+ */
2421
+ interface TradesResponse {
2422
+ data?: JsonApiResource<{
2423
+ trades?: Trade[] | null;
2424
+ }>[] | null;
2425
+ }
2426
+ /**
2427
+ * Query parameters for `/onchain/pools/megafilter`.
2428
+ *
2429
+ * @remarks Requires Analyst+ plan
2430
+ */
2431
+ interface MegafilterParams extends PaginationParams {
2432
+ /** Comma-separated network IDs to filter by. */
2433
+ network?: string;
2434
+ /** Comma-separated DEX IDs to filter by. */
2435
+ dex?: string;
2436
+ /** Minimum pool age in hours. */
2437
+ pool_created_hour_gte?: number;
2438
+ /** Maximum pool age in hours. */
2439
+ pool_created_hour_lte?: number;
2440
+ /** Minimum reserve in USD. */
2441
+ reserve_in_usd_gte?: number;
2442
+ /** Maximum reserve in USD. */
2443
+ reserve_in_usd_lte?: number;
2444
+ /** Minimum fully diluted valuation in USD. */
2445
+ fdv_usd_gte?: number;
2446
+ /** Maximum fully diluted valuation in USD. */
2447
+ fdv_usd_lte?: number;
2448
+ /** Minimum market cap in USD. */
2449
+ market_cap_usd_gte?: number;
2450
+ /** Maximum market cap in USD. */
2451
+ market_cap_usd_lte?: number;
2452
+ /** Sort field (e.g. "h24_volume_usd"). */
2453
+ sort?: string;
2454
+ /** Filter by GeckoTerminal category ID. */
2455
+ categories?: string;
2456
+ /** Filter by verified or unverified tokens. */
2457
+ token_type?: 'verified' | 'unverified';
2458
+ }
2459
+ /**
2460
+ * A GeckoTerminal onchain category from `/onchain/categories`.
2461
+ *
2462
+ * @remarks Requires Analyst+ plan
2463
+ */
2464
+ interface OnchainCategory {
2465
+ /** Category attributes. */
2466
+ id?: string | null;
2467
+ type?: string | null;
2468
+ attributes?: {
2469
+ /** Category name. */
2470
+ name?: string | null;
2471
+ /** Category description. */
2472
+ description?: string | null;
2473
+ } | null;
2474
+ }
2475
+ /**
2476
+ * Response from `/onchain/categories`.
2477
+ *
2478
+ * @remarks Requires Analyst+ plan
2479
+ */
2480
+ interface OnchainCategoriesResponse {
2481
+ data: OnchainCategory[];
2482
+ }
2483
+
2484
+ /**
2485
+ * Type definitions for CoinGecko global market, search, trending,
2486
+ * exchange rates, and asset platform endpoints.
2487
+ *
2488
+ * Covers: /global, /global/decentralized_finance_defi,
2489
+ * /global/market_cap_chart (Analyst+),
2490
+ * /search, /search/trending,
2491
+ * /exchange_rates, /asset_platforms.
2492
+ */
2493
+
2494
+ /**
2495
+ * Inner data payload of the `/global` endpoint.
2496
+ */
2497
+ interface GlobalDataPayload {
2498
+ /** Number of active cryptocurrencies. */
2499
+ active_cryptocurrencies?: number | null;
2500
+ /** Number of upcoming ICOs. */
2501
+ upcoming_icos?: number | null;
2502
+ /** Number of ongoing ICOs. */
2503
+ ongoing_icos?: number | null;
2504
+ /** Number of ended ICOs. */
2505
+ ended_icos?: number | null;
2506
+ /** Number of active exchanges. */
2507
+ markets?: number | null;
2508
+ /** Total market cap in various currencies. */
2509
+ total_market_cap?: CurrencyMap | null;
2510
+ /** Total 24h trading volume in various currencies. */
2511
+ total_volume?: CurrencyMap | null;
2512
+ /** Market cap dominance percentage by coin (e.g. { btc: 50.4, eth: 14.9 }). */
2513
+ market_cap_percentage?: Record<string, number> | null;
2514
+ /** Total market cap 24h change percentage in USD. */
2515
+ market_cap_change_percentage_24h_usd?: number | null;
2516
+ /** Total volume 24h change percentage in USD. */
2517
+ volume_change_percentage_24h_usd?: number | null;
2518
+ /** Unix timestamp of last update. */
2519
+ updated_at?: number | null;
2520
+ }
2521
+ /**
2522
+ * Response from `/global`.
2523
+ */
2524
+ interface GlobalData {
2525
+ /** Global market data payload. */
2526
+ data: GlobalDataPayload;
2527
+ }
2528
+ /**
2529
+ * Inner data payload of the `/global/decentralized_finance_defi` endpoint.
2530
+ */
2531
+ interface GlobalDefiPayload {
2532
+ /** Total DeFi market cap (as a high-precision string). */
2533
+ defi_market_cap?: string | null;
2534
+ /** Ethereum market cap (as a high-precision string). */
2535
+ eth_market_cap?: string | null;
2536
+ /** DeFi-to-ETH market cap ratio (as a high-precision string). */
2537
+ defi_to_eth_ratio?: string | null;
2538
+ /** 24h DeFi trading volume (as a high-precision string). */
2539
+ trading_volume_24h?: string | null;
2540
+ /** DeFi dominance percentage (as a high-precision string). */
2541
+ defi_dominance?: string | null;
2542
+ /** Name of the top DeFi coin. */
2543
+ top_coin_name?: string | null;
2544
+ /** Top coin's DeFi dominance percentage. */
2545
+ top_coin_defi_dominance?: number | null;
2546
+ }
2547
+ /**
2548
+ * Response from `/global/decentralized_finance_defi`.
2549
+ */
2550
+ interface GlobalDefiData {
2551
+ /** DeFi global data payload. */
2552
+ data: GlobalDefiPayload;
2553
+ }
2554
+ /**
2555
+ * Query parameters for `/global/market_cap_chart`.
2556
+ *
2557
+ * @remarks Requires Analyst+ plan
2558
+ */
2559
+ interface GlobalMarketCapChartParams {
2560
+ /** Number of days of historical data. */
2561
+ days: number | 'max';
2562
+ /** Target vs-currency for market cap values. Default: usd. */
2563
+ vs_currency?: string;
2564
+ }
2565
+ /**
2566
+ * Response from `/global/market_cap_chart`.
2567
+ *
2568
+ * @remarks Requires Analyst+ plan
2569
+ */
2570
+ interface GlobalMarketCapChartResponse {
2571
+ market_cap_chart: {
2572
+ /** Array of [timestamp_ms, market_cap] data points. */
2573
+ market_cap: MarketDataPoint[];
2574
+ /** Array of [timestamp_ms, volume] data points. */
2575
+ volume: MarketDataPoint[];
2576
+ };
2577
+ }
2578
+ /**
2579
+ * Response from `/ping`.
2580
+ */
2581
+ interface PingResponse {
2582
+ /** CoinGecko server status string (e.g. `"(V3) To the Moon!"`). */
2583
+ gecko_says: string;
2584
+ }
2585
+ /**
2586
+ * Current API plan usage from `/key`.
2587
+ *
2588
+ * @remarks Requires a valid Pro API key (Analyst+ plan).
2589
+ */
2590
+ interface ApiUsageResponse {
2591
+ /** Name of the active plan (e.g. `"Analyst"`, `"Lite"`). */
2592
+ plan?: string | null;
2593
+ /** Rate limit in requests per minute for the active plan. */
2594
+ rate_limit_request_per_minute?: number | null;
2595
+ /** Number of monthly credits used so far. */
2596
+ monthly_call_credit?: number | null;
2597
+ /** Remaining credits this month. */
2598
+ current_remaining_monthly_calls?: number | null;
2599
+ /** Total credits allocated for the current month. */
2600
+ current_total_monthly_calls?: number | null;
2601
+ }
2602
+ /**
2603
+ * A trending coin entry from `/search/trending`.
2604
+ */
2605
+ interface TrendingCoin {
2606
+ /** Coin API ID. */
2607
+ id?: string | null;
2608
+ /** Market cap rank. */
2609
+ coin_id?: number | null;
2610
+ /** Coin name. */
2611
+ name?: string | null;
2612
+ /** Coin symbol. */
2613
+ symbol?: string | null;
2614
+ /** Market cap rank. */
2615
+ market_cap_rank?: number | null;
2616
+ /** Thumbnail image URL. */
2617
+ thumb?: string | null;
2618
+ /** Small image URL. */
2619
+ small?: string | null;
2620
+ /** Large image URL. */
2621
+ large?: string | null;
2622
+ /** CoinGecko slug. */
2623
+ slug?: string | null;
2624
+ /** Price in BTC. */
2625
+ price_btc?: number | null;
2626
+ /** Score in the trending list (lower = more trending). */
2627
+ score?: number | null;
2628
+ /** Additional coin data. */
2629
+ data?: {
2630
+ price?: string | number | null;
2631
+ price_btc?: string | null;
2632
+ price_change_percentage_24h?: Record<string, number> | null;
2633
+ market_cap?: string | null;
2634
+ market_cap_btc?: string | null;
2635
+ total_volume?: string | null;
2636
+ total_volume_btc?: string | null;
2637
+ sparkline?: string | null;
2638
+ } | null;
2639
+ }
2640
+ /**
2641
+ * A trending NFT entry from `/search/trending`.
2642
+ */
2643
+ interface TrendingNft {
2644
+ /** NFT collection ID. */
2645
+ id?: string | null;
2646
+ /** Collection name. */
2647
+ name?: string | null;
2648
+ /** Asset platform ID. */
2649
+ asset_platform_id?: string | null;
2650
+ /** NFT symbol. */
2651
+ symbol?: string | null;
2652
+ /** Thumbnail image URL. */
2653
+ thumb?: string | null;
2654
+ /** NFT floor price data. */
2655
+ data?: {
2656
+ floor_price?: string | null;
2657
+ floor_price_in_usd_24h_percentage_change?: string | null;
2658
+ h24_volume?: string | null;
2659
+ h24_average_sale_price?: string | null;
2660
+ } | null;
2661
+ }
2662
+ /**
2663
+ * A trending category entry from `/search/trending`.
2664
+ */
2665
+ interface TrendingCategory {
2666
+ /** Category ID. */
2667
+ id?: number | null;
2668
+ /** Category name. */
2669
+ name?: string | null;
2670
+ /** Market cap in 1h change percentage. */
2671
+ market_cap_1h_change?: number | null;
2672
+ /** Slug. */
2673
+ slug?: string | null;
2674
+ /** Coins data for this category. */
2675
+ coins_count?: number | null;
2676
+ /** Data snapshot. */
2677
+ data?: {
2678
+ market_cap?: number | null;
2679
+ market_cap_btc?: number | null;
2680
+ total_volume?: number | null;
2681
+ total_volume_btc?: number | null;
2682
+ market_cap_change_percentage_24h?: Record<string, number> | null;
2683
+ sparkline?: string | null;
2684
+ } | null;
2685
+ }
2686
+ /**
2687
+ * Response from `/search/trending`.
2688
+ */
2689
+ interface TrendingResponse {
2690
+ coins: Array<{
2691
+ item: TrendingCoin;
2692
+ }>;
2693
+ nfts: TrendingNft[];
2694
+ categories: TrendingCategory[];
2695
+ }
2696
+ /**
2697
+ * A coin result from `/search`.
2698
+ */
2699
+ interface SearchCoin {
2700
+ id?: string | null;
2701
+ name?: string | null;
2702
+ symbol?: string | null;
2703
+ market_cap_rank?: number | null;
2704
+ thumb?: string | null;
2705
+ large?: string | null;
2706
+ }
2707
+ /**
2708
+ * An exchange result from `/search`.
2709
+ */
2710
+ interface SearchExchange {
2711
+ id?: string | null;
2712
+ name?: string | null;
2713
+ market_type?: string | null;
2714
+ thumb?: string | null;
2715
+ large?: string | null;
2716
+ }
2717
+ /**
2718
+ * A category result from `/search`.
2719
+ */
2720
+ interface SearchCategory {
2721
+ id?: number | null;
2722
+ name?: string | null;
2723
+ }
2724
+ /**
2725
+ * An NFT result from `/search`.
2726
+ */
2727
+ interface SearchNft {
2728
+ id?: string | null;
2729
+ name?: string | null;
2730
+ asset_platform_id?: string | null;
2731
+ thumb?: string | null;
2732
+ }
2733
+ /**
2734
+ * Response from `/search`.
2735
+ */
2736
+ interface SearchResponse {
2737
+ coins: SearchCoin[];
2738
+ exchanges: SearchExchange[];
2739
+ icos: unknown[];
2740
+ categories: SearchCategory[];
2741
+ nfts: SearchNft[];
2742
+ }
2743
+ /**
2744
+ * A single BTC exchange rate entry.
2745
+ */
2746
+ interface ExchangeRateEntry {
2747
+ /** Currency name. */
2748
+ name?: string | null;
2749
+ /** Currency unit symbol. */
2750
+ unit?: string | null;
2751
+ /** Current exchange rate value relative to BTC. */
2752
+ value?: number | null;
2753
+ /** Currency type ("fiat", "crypto", or "commodity"). */
2754
+ type?: string | null;
2755
+ }
2756
+ /**
2757
+ * Response from `/exchange_rates`.
2758
+ */
2759
+ interface ExchangeRatesResponse {
2760
+ /** Map of currency code → exchange rate info. */
2761
+ rates: Record<string, ExchangeRateEntry>;
2762
+ }
2763
+ /** Convenience alias for a single exchange rate. */
2764
+ type ExchangeRate = ExchangeRateEntry;
2765
+ /**
2766
+ * An asset platform (blockchain network) from `/asset_platforms`.
2767
+ *
2768
+ * @example
2769
+ * const platform: AssetPlatform = {
2770
+ * id: 'ethereum',
2771
+ * name: 'Ethereum',
2772
+ * chain_identifier: 1,
2773
+ * shortname: 'ETH',
2774
+ * };
2775
+ */
2776
+ interface AssetPlatform {
2777
+ /** Platform API ID (e.g. "ethereum"). */
2778
+ id?: string | null;
2779
+ /** Chain identifier (EVM chain ID). */
2780
+ chain_identifier?: number | null;
2781
+ /** Platform display name. */
2782
+ name?: string | null;
2783
+ /** Short display name or ticker. */
2784
+ shortname?: string | null;
2785
+ /** Native coin ID on CoinGecko. */
2786
+ native_coin_id?: string | null;
2787
+ /** Image URLs for the platform. */
2788
+ image?: {
2789
+ thumb?: string | null;
2790
+ small?: string | null;
2791
+ large?: string | null;
2792
+ } | null;
2793
+ }
2794
+
2795
+ /**
2796
+ * Type definitions for CoinGecko Public Treasury endpoints.
2797
+ *
2798
+ * Covers: /entities/list, /{entity}/public_treasury/{coin_id},
2799
+ * /public_treasury/{entity_id}, /public_treasury/{entity_id}/{coin_id}/holding_chart,
2800
+ * /public_treasury/{entity_id}/transaction_history.
2801
+ */
2802
+
2803
+ /**
2804
+ * A minimal entity entry from `/entities/list`.
2805
+ */
2806
+ interface Entity {
2807
+ /** Entity API ID. */
2808
+ id: string;
2809
+ /** Stock ticker symbol (for public companies). */
2810
+ symbol?: string | null;
2811
+ /** Entity name. */
2812
+ name: string;
2813
+ /** ISO 3166-1 alpha-2 country code. */
2814
+ country?: string | null;
2815
+ }
2816
+ /**
2817
+ * A single company or government holding entry.
2818
+ */
2819
+ interface TreasuryHolding {
2820
+ /** Entity name. */
2821
+ name?: string | null;
2822
+ /** Stock ticker symbol. */
2823
+ symbol?: string | null;
2824
+ /** Country code. */
2825
+ country?: string | null;
2826
+ /** Total cryptocurrency holdings. */
2827
+ total_holdings?: number | null;
2828
+ /** Total entry/cost value in USD. */
2829
+ total_entry_value_usd?: number | null;
2830
+ /** Current value of holdings in USD. */
2831
+ total_current_value_usd?: number | null;
2832
+ /** Percentage of total crypto supply. */
2833
+ percentage_of_total_supply?: number | null;
2834
+ }
2835
+ /**
2836
+ * Response from `/{entity}/public_treasury/{coin_id}` for companies.
2837
+ */
2838
+ interface CompanyTreasuryResponse {
2839
+ /** Total holdings across all companies. */
2840
+ total_holdings?: number | null;
2841
+ /** Total value of all holdings in USD. */
2842
+ total_value_usd?: number | null;
2843
+ /** Market cap dominance percentage. */
2844
+ market_cap_dominance?: number | null;
2845
+ /** List of company holdings. */
2846
+ companies: TreasuryHolding[];
2847
+ }
2848
+ /**
2849
+ * Response from `/{entity}/public_treasury/{coin_id}` for governments.
2850
+ */
2851
+ interface GovernmentTreasuryResponse {
2852
+ /** Total holdings across all governments. */
2853
+ total_holdings?: number | null;
2854
+ /** Total value of all holdings in USD. */
2855
+ total_value_usd?: number | null;
2856
+ /** Market cap dominance percentage. */
2857
+ market_cap_dominance?: number | null;
2858
+ /** List of government holdings. */
2859
+ governments: TreasuryHolding[];
2860
+ }
2861
+ /**
2862
+ * Time-series change data for a holding over various periods.
2863
+ */
2864
+ interface HoldingTimeframeChange {
2865
+ '7d'?: number | null;
2866
+ '14d'?: number | null;
2867
+ '30d'?: number | null;
2868
+ '90d'?: number | null;
2869
+ '1y'?: number | null;
2870
+ ytd?: number | null;
2871
+ }
2872
+ /**
2873
+ * A single cryptocurrency holding within an entity's treasury.
2874
+ */
2875
+ interface EntityHolding {
2876
+ /** Coin API ID (e.g. "bitcoin"). */
2877
+ coin_id?: string | null;
2878
+ /** Amount held. */
2879
+ amount?: number | null;
2880
+ /** Percentage of the coin's total supply. */
2881
+ percentage_of_total_supply?: number | null;
2882
+ /** Amount per equity share. */
2883
+ amount_per_share?: number | null;
2884
+ /** This holding as a percentage of entity's total treasury value. */
2885
+ entity_value_usd_percentage?: number | null;
2886
+ /** Current value in USD. */
2887
+ current_value_usd?: number | null;
2888
+ /** Total cost/entry value in USD. */
2889
+ total_entry_value_usd?: number | null;
2890
+ /** Average cost per unit in USD. */
2891
+ average_entry_value_usd?: number | null;
2892
+ /** Unrealized profit and loss in USD. */
2893
+ unrealized_pnl?: number | null;
2894
+ /**
2895
+ * Holding amount changes over timeframes.
2896
+ * Only present when `holding_amount_change` param is specified.
2897
+ */
2898
+ holding_amount_change?: HoldingTimeframeChange | null;
2899
+ /**
2900
+ * Holding change percentages over timeframes.
2901
+ * Only present when `holding_change_percentage` param is specified.
2902
+ */
2903
+ holding_change_percentage?: HoldingTimeframeChange | null;
2904
+ }
2905
+ /**
2906
+ * Full entity treasury response from `/public_treasury/{entity_id}`.
2907
+ *
2908
+ * @example
2909
+ * const treasury: PublicTreasuryEntity = {
2910
+ * id: 'strategy',
2911
+ * name: 'Strategy',
2912
+ * type: 'company',
2913
+ * symbol: 'MSTR.US',
2914
+ * total_treasury_value_usd: 48119580010,
2915
+ * holdings: [{ coin_id: 'bitcoin', amount: 714644 }],
2916
+ * };
2917
+ */
2918
+ interface PublicTreasuryEntity {
2919
+ /** Entity name. */
2920
+ name?: string | null;
2921
+ /** Entity API ID. */
2922
+ id?: string | null;
2923
+ /** Entity type: "company" or "government". */
2924
+ type?: string | null;
2925
+ /** Stock market symbol (for companies). */
2926
+ symbol?: string | null;
2927
+ /** ISO country code. */
2928
+ country?: string | null;
2929
+ /** Official website URL. */
2930
+ website_url?: string | null;
2931
+ /** Twitter handle. */
2932
+ twitter_screen_name?: string | null;
2933
+ /** Total treasury value across all holdings in USD. */
2934
+ total_treasury_value_usd?: number | null;
2935
+ /** Unrealized PnL (current value − total entry value). */
2936
+ unrealized_pnl?: number | null;
2937
+ /** Market NAV ratio. */
2938
+ m_nav?: number | null;
2939
+ /** Total asset value per equity share in USD. */
2940
+ total_asset_value_per_share_usd?: number | null;
2941
+ /** List of individual cryptocurrency holdings. */
2942
+ holdings?: EntityHolding[] | null;
2943
+ }
2944
+ /**
2945
+ * A single data point in the treasury holding chart.
2946
+ * Format: [unix_timestamp_ms, value].
2947
+ */
2948
+ type HoldingChartPoint = [number, number];
2949
+ /**
2950
+ * Response from `/public_treasury/{entity_id}/{coin_id}/holding_chart`.
2951
+ */
2952
+ interface TreasuryHoldingChartResponse {
2953
+ /** Array of [timestamp_ms, holding_amount] data points. */
2954
+ holdings?: HoldingChartPoint[] | null;
2955
+ /** Array of [timestamp_ms, value_usd] data points. */
2956
+ holding_value_in_usd?: HoldingChartPoint[] | null;
2957
+ }
2958
+ /**
2959
+ * Query parameters for `/public_treasury/{entity_id}/{coin_id}/holding_chart`.
2960
+ */
2961
+ interface TreasuryHoldingChartParams {
2962
+ /** Number of days of historical data. Also accepts "max". */
2963
+ days: '7' | '14' | '30' | '90' | '180' | '365' | '730' | 'max';
2964
+ /** Include intervals with no transaction data. Default: false. */
2965
+ include_empty_intervals?: boolean;
2966
+ }
2967
+ /**
2968
+ * A single treasury transaction entry.
2969
+ */
2970
+ interface TreasuryTransaction {
2971
+ /** Coin API ID. */
2972
+ coin_id?: string | null;
2973
+ /** ISO date of the transaction. */
2974
+ date?: string | null;
2975
+ /** Transaction amount (positive = buy, negative = sell). */
2976
+ amount?: number | null;
2977
+ /** Transaction type ("buy" or "sell"). */
2978
+ transaction_type?: string | null;
2979
+ /** Entry price per unit in USD. */
2980
+ price_per_token_usd?: number | null;
2981
+ /** Total transaction value in USD. */
2982
+ total_value_usd?: number | null;
2983
+ }
2984
+ /**
2985
+ * Response from `/public_treasury/{entity_id}/transaction_history`.
2986
+ */
2987
+ interface TreasuryTransactionHistoryResponse {
2988
+ /** Array of transaction records. */
2989
+ data?: TreasuryTransaction[] | null;
2990
+ }
2991
+ /**
2992
+ * Query parameters for `/public_treasury/{entity_id}/transaction_history`.
2993
+ */
2994
+ interface TreasuryTransactionHistoryParams extends PaginationParams {
2995
+ /** Filter by specific coin IDs (comma-separated). */
2996
+ coin_ids?: string;
2997
+ }
2998
+
2999
+ /**
3000
+ * @module endpoints/exchanges
3001
+ * Endpoint methods for CoinGecko exchange-related API paths.
3002
+ *
3003
+ * Covers: /exchanges, /exchanges/list, /exchanges/{id},
3004
+ * /exchanges/{id}/tickers, /exchanges/{id}/volume_chart,
3005
+ * /exchanges/{id}/volume_chart/range (Analyst+).
3006
+ */
3007
+
3008
+ /**
3009
+ * Endpoint group for CoinGecko exchange APIs.
3010
+ *
3011
+ * Obtain an instance via the SDK's top-level entry point; do not
3012
+ * instantiate directly.
3013
+ *
3014
+ * @example
3015
+ * ```ts
3016
+ * const exchanges = new ExchangesEndpoints(client);
3017
+ * const all = await exchanges.list();
3018
+ * ```
3019
+ */
3020
+ declare class ExchangesEndpoints {
3021
+ private readonly client;
3022
+ constructor(client: CoinGeckoClient);
3023
+ /**
3024
+ * Returns a paginated list of all active exchanges with market data.
3025
+ *
3026
+ * @param params - Optional pagination parameters (`per_page`, `page`).
3027
+ * @returns Array of {@link Exchange} objects ordered by trust score rank.
3028
+ *
3029
+ * @example
3030
+ * ```ts
3031
+ * const page1 = await exchanges.list({ per_page: 50, page: 1 });
3032
+ * ```
3033
+ */
3034
+ list(params?: {
3035
+ per_page?: number;
3036
+ page?: number;
3037
+ }): Promise<Exchange[]>;
3038
+ /**
3039
+ * Returns a lightweight list of all exchange IDs and names.
3040
+ *
3041
+ * Use this endpoint to resolve exchange API IDs for subsequent calls
3042
+ * rather than fetching full exchange data.
3043
+ *
3044
+ * @returns Array of {@link ExchangeListEntry} objects (`id` + `name` only).
3045
+ *
3046
+ * @example
3047
+ * ```ts
3048
+ * const ids = await exchanges.listAll();
3049
+ * // [{ id: 'binance', name: 'Binance' }, ...]
3050
+ * ```
3051
+ */
3052
+ listAll(): Promise<ExchangeListEntry[]>;
3053
+ /**
3054
+ * Returns full details for a single exchange by its API ID.
3055
+ *
3056
+ * @param id - Exchange API ID (e.g. `"binance"`). Use {@link listAll} to
3057
+ * discover valid IDs.
3058
+ * @returns {@link ExchangeDetail} including social links, trust score, and
3059
+ * top 100 tickers.
3060
+ *
3061
+ * @example
3062
+ * ```ts
3063
+ * const binance = await exchanges.getById('binance');
3064
+ * console.log(binance.trust_score); // 10
3065
+ * ```
3066
+ */
3067
+ getById(id: string): Promise<ExchangeDetail>;
3068
+ /**
3069
+ * Returns paginated tickers for a specific exchange.
3070
+ *
3071
+ * @param id - Exchange API ID (e.g. `"binance"`).
3072
+ * @param params - Optional filter/sort/pagination parameters.
3073
+ * @returns {@link ExchangeTickersResponse} containing the exchange name and
3074
+ * an array of tickers.
3075
+ *
3076
+ * @example
3077
+ * ```ts
3078
+ * const result = await exchanges.tickers('binance', {
3079
+ * coin_ids: 'bitcoin,ethereum',
3080
+ * order: 'trust_score_desc',
3081
+ * });
3082
+ * console.log(result.tickers.length);
3083
+ * ```
3084
+ */
3085
+ tickers(id: string, params?: ExchangeTickersParams): Promise<ExchangeTickersResponse>;
3086
+ /**
3087
+ * Returns BTC-denominated volume chart data for a specific exchange.
3088
+ *
3089
+ * @param id - Exchange API ID (e.g. `"binance"`).
3090
+ * @param params - Required query parameters, including `days`.
3091
+ * @returns {@link VolumeChartResponse} — array of `[timestamp_ms, volume_btc]`
3092
+ * tuples. Volume is returned as a string to preserve precision.
3093
+ *
3094
+ * @example
3095
+ * ```ts
3096
+ * const chart = await exchanges.volumeChart('binance', { days: '30' });
3097
+ * // [[1711792200000, '306800.051794'], ...]
3098
+ * ```
3099
+ */
3100
+ volumeChart(id: string, params: VolumeChartParams): Promise<VolumeChartResponse>;
3101
+ /**
3102
+ * Returns BTC-denominated volume chart data for an exchange over a custom
3103
+ * Unix timestamp range.
3104
+ *
3105
+ * @param id - Exchange API ID (e.g. `"binance"`).
3106
+ * @param params - Required `from` and `to` Unix timestamps (seconds).
3107
+ * @returns {@link VolumeChartResponse} — array of `[timestamp_ms, volume_btc]`
3108
+ * tuples.
3109
+ *
3110
+ * @remarks Requires **Analyst+** plan.
3111
+ *
3112
+ * @example
3113
+ * ```ts
3114
+ * const chart = await exchanges.volumeChartRange('binance', {
3115
+ * from: 1711670400,
3116
+ * to: 1712275200,
3117
+ * });
3118
+ * ```
3119
+ */
3120
+ volumeChartRange(id: string, params: VolumeChartRangeParams): Promise<VolumeChartResponse>;
3121
+ }
3122
+
3123
+ /**
3124
+ * @module endpoints/derivatives
3125
+ * Endpoint methods for CoinGecko derivatives-related API paths.
3126
+ *
3127
+ * Covers: /derivatives, /derivatives/exchanges,
3128
+ * /derivatives/exchanges/{id}, /derivatives/exchanges/list.
3129
+ */
3130
+
3131
+ /**
3132
+ * Endpoint group for CoinGecko derivatives APIs.
3133
+ *
3134
+ * Obtain an instance via the SDK's top-level entry point; do not
3135
+ * instantiate directly.
3136
+ *
3137
+ * @example
3138
+ * ```ts
3139
+ * const deriv = new DerivativesEndpoints(client);
3140
+ * const tickers = await deriv.tickers();
3141
+ * ```
3142
+ */
3143
+ declare class DerivativesEndpoints {
3144
+ private readonly client;
3145
+ constructor(client: CoinGeckoClient);
3146
+ /**
3147
+ * Returns a list of all derivative tickers across all derivatives exchanges.
3148
+ *
3149
+ * @param params - Optional filter parameters.
3150
+ * @param params.include_tickers - Whether to include tickers.
3151
+ * `"all"` returns all tickers; `"unexpired"` excludes expired contracts.
3152
+ * @returns Array of {@link DerivativeTicker} objects.
3153
+ *
3154
+ * @example
3155
+ * ```ts
3156
+ * const allTickers = await deriv.tickers({ include_tickers: 'unexpired' });
3157
+ * ```
3158
+ */
3159
+ tickers(params?: {
3160
+ include_tickers?: 'all' | 'unexpired';
3161
+ }): Promise<DerivativeTicker[]>;
3162
+ /**
3163
+ * Returns a paginated list of all derivatives exchanges.
3164
+ *
3165
+ * @param params - Optional sort and pagination parameters.
3166
+ * @returns Array of {@link DerivativeExchange} objects.
3167
+ *
3168
+ * @example
3169
+ * ```ts
3170
+ * const top = await deriv.exchanges({
3171
+ * order: 'open_interest_btc_desc',
3172
+ * per_page: 10,
3173
+ * });
3174
+ * ```
3175
+ */
3176
+ exchanges(params?: DerivativesExchangesParams): Promise<DerivativeExchange[]>;
3177
+ /**
3178
+ * Returns detailed data for a single derivatives exchange by its API ID.
3179
+ *
3180
+ * @param id - Derivatives exchange API ID (e.g. `"binance_futures"`).
3181
+ * @param params - Optional parameters to include ticker data.
3182
+ * @returns {@link DerivativeExchangeDetail} with optional tickers array.
3183
+ *
3184
+ * @example
3185
+ * ```ts
3186
+ * const detail = await deriv.exchangeById('binance_futures', {
3187
+ * include_tickers: 'unexpired',
3188
+ * });
3189
+ * console.log(detail.open_interest_btc);
3190
+ * ```
3191
+ */
3192
+ exchangeById(id: string, params?: DerivativesExchangeByIdParams): Promise<DerivativeExchangeDetail>;
3193
+ /**
3194
+ * Returns a lightweight list of all derivatives exchange IDs and names.
3195
+ *
3196
+ * Use this to resolve exchange API IDs for subsequent calls.
3197
+ *
3198
+ * @returns Array of {@link ExchangeListEntry} objects (`id` + `name` only).
3199
+ *
3200
+ * @example
3201
+ * ```ts
3202
+ * const ids = await deriv.exchangesList();
3203
+ * // [{ id: 'binance_futures', name: 'Binance (Futures)' }, ...]
3204
+ * ```
3205
+ */
3206
+ exchangesList(): Promise<ExchangeListEntry[]>;
3207
+ }
3208
+
3209
+ /**
3210
+ * @module endpoints/nfts
3211
+ * Endpoint methods for CoinGecko NFT-related API paths.
3212
+ *
3213
+ * Covers: /nfts/list, /nfts/{id}, /nfts/{platformId}/contract/{address},
3214
+ * /nfts/markets (Analyst+), /nfts/{id}/market_chart (Analyst+),
3215
+ * /nfts/{platformId}/contract/{address}/market_chart (Analyst+),
3216
+ * /nfts/{id}/tickers (Analyst+).
3217
+ */
3218
+
3219
+ /**
3220
+ * Endpoint group for CoinGecko NFT APIs.
3221
+ *
3222
+ * Obtain an instance via the SDK's top-level entry point; do not
3223
+ * instantiate directly.
3224
+ *
3225
+ * @example
3226
+ * ```ts
3227
+ * const nfts = new NftsEndpoints(client);
3228
+ * const listing = await nfts.list();
3229
+ * ```
3230
+ */
3231
+ declare class NftsEndpoints {
3232
+ private readonly client;
3233
+ constructor(client: CoinGeckoClient);
3234
+ /**
3235
+ * Returns a paginated list of all NFT collections supported by CoinGecko.
3236
+ *
3237
+ * @param params - Optional pagination parameters (`per_page`, `page`).
3238
+ * @returns Array of {@link NftListEntry} objects with minimal metadata.
3239
+ *
3240
+ * @example
3241
+ * ```ts
3242
+ * const collections = await nfts.list({ per_page: 100, page: 1 });
3243
+ * ```
3244
+ */
3245
+ list(params?: {
3246
+ per_page?: number;
3247
+ page?: number;
3248
+ }): Promise<NftListEntry[]>;
3249
+ /**
3250
+ * Returns full data for a single NFT collection by its CoinGecko API ID.
3251
+ *
3252
+ * @param id - NFT collection API ID (e.g. `"pudgy-penguins"`). Use
3253
+ * {@link list} to discover valid IDs.
3254
+ * @returns {@link NftCollection} with floor price, market cap, volume, and
3255
+ * other collection metadata.
3256
+ *
3257
+ * @example
3258
+ * ```ts
3259
+ * const penguins = await nfts.getById('pudgy-penguins');
3260
+ * console.log(penguins.floor_price?.usd);
3261
+ * ```
3262
+ */
3263
+ getById(id: string): Promise<NftCollection>;
3264
+ /**
3265
+ * Returns full data for a single NFT collection identified by its contract
3266
+ * address on a specific asset platform.
3267
+ *
3268
+ * @param platformId - Asset platform ID (e.g. `"ethereum"`).
3269
+ * @param address - Token contract address (e.g. `"0xBd3531..."`).
3270
+ * @returns {@link NftCollection} with the same fields as {@link getById}.
3271
+ *
3272
+ * @example
3273
+ * ```ts
3274
+ * const collection = await nfts.getByContract(
3275
+ * 'ethereum',
3276
+ * '0xBd3531dA5CF5857e7CfAA92426877b022e612cf8',
3277
+ * );
3278
+ * ```
3279
+ */
3280
+ getByContract(platformId: string, address: string): Promise<NftCollection>;
3281
+ /**
3282
+ * Returns a paginated list of NFT collections with market data.
3283
+ *
3284
+ * @param params - Optional filter and sort parameters.
3285
+ * @returns Array of {@link NftCollection} objects with market data.
3286
+ *
3287
+ * @remarks Requires **Analyst+** plan.
3288
+ *
3289
+ * @example
3290
+ * ```ts
3291
+ * const markets = await nfts.markets({
3292
+ * asset_platform_id: 'ethereum',
3293
+ * order: 'market_cap_usd_desc',
3294
+ * per_page: 50,
3295
+ * });
3296
+ * ```
3297
+ */
3298
+ markets(params?: NftMarketsParams): Promise<NftCollection[]>;
3299
+ /**
3300
+ * Returns historical market chart data for a single NFT collection.
3301
+ *
3302
+ * @param id - NFT collection API ID (e.g. `"pudgy-penguins"`).
3303
+ * @param params - Optional query parameters, including `days`.
3304
+ * @returns {@link NftMarketChart} with floor price, market cap, and volume
3305
+ * time series.
3306
+ *
3307
+ * @remarks Requires **Analyst+** plan.
3308
+ *
3309
+ * @example
3310
+ * ```ts
3311
+ * const chart = await nfts.marketChart('pudgy-penguins', { days: 30 });
3312
+ * console.log(chart.floor_price_usd);
3313
+ * ```
3314
+ */
3315
+ marketChart(id: string, params?: NftMarketChartParams): Promise<NftMarketChart>;
3316
+ /**
3317
+ * Returns historical market chart data for an NFT collection identified by
3318
+ * its contract address on a specific asset platform.
3319
+ *
3320
+ * @param platformId - Asset platform ID (e.g. `"ethereum"`).
3321
+ * @param address - Token contract address.
3322
+ * @param params - Optional query parameters, including `days`.
3323
+ * @returns {@link NftMarketChart} with floor price, market cap, and volume
3324
+ * time series.
3325
+ *
3326
+ * @remarks Requires **Analyst+** plan.
3327
+ *
3328
+ * @example
3329
+ * ```ts
3330
+ * const chart = await nfts.contractMarketChart(
3331
+ * 'ethereum',
3332
+ * '0xBd3531dA5CF5857e7CfAA92426877b022e612cf8',
3333
+ * { days: 14 },
3334
+ * );
3335
+ * ```
3336
+ */
3337
+ contractMarketChart(platformId: string, address: string, params?: NftMarketChartParams): Promise<NftMarketChart>;
3338
+ /**
3339
+ * Returns marketplace tickers (floor price, volume) for a single NFT
3340
+ * collection across all supported NFT marketplaces.
3341
+ *
3342
+ * @param id - NFT collection API ID (e.g. `"pudgy-penguins"`).
3343
+ * @returns {@link NftTickersResponse} with an array of marketplace tickers.
3344
+ *
3345
+ * @remarks Requires **Analyst+** plan.
3346
+ *
3347
+ * @example
3348
+ * ```ts
3349
+ * const result = await nfts.tickers('pudgy-penguins');
3350
+ * result.tickers.forEach(t => console.log(t.name, t.floor_price_in_native_currency));
3351
+ * ```
3352
+ */
3353
+ tickers(id: string): Promise<NftTickersResponse>;
3354
+ }
3355
+
3356
+ /**
3357
+ * @module endpoints/onchain
3358
+ * OnchainEndpoints class covering all GeckoTerminal / on-chain DEX endpoints
3359
+ * exposed under the `/onchain` path prefix.
3360
+ *
3361
+ * All methods delegate to {@link CoinGeckoClient.get} and return typed
3362
+ * JSON:API response objects defined in `src/types/onchain.ts`.
3363
+ */
3364
+
3365
+ /**
3366
+ * Response from the simple token price endpoint.
3367
+ * Maps each token address to a map of currency → price value (string).
3368
+ */
3369
+ type SimpleTokenPriceResponse = Record<string, Record<string, string>>;
3370
+ /**
3371
+ * Query parameters for `/onchain/search/pools`.
3372
+ */
3373
+ interface SearchPoolsParams extends PaginationParams {
3374
+ /** Optional network ID to narrow the search (e.g. `"eth"`). */
3375
+ network?: string;
3376
+ }
3377
+ /**
3378
+ * Response type for the pool info endpoint.
3379
+ */
3380
+ type PoolInfoResponse = JsonApiSingleResponse<PoolAttributes>;
3381
+ /**
3382
+ * Provides typed access to all GeckoTerminal / on-chain DEX endpoints
3383
+ * under the `/onchain` prefix.
3384
+ *
3385
+ * Instantiate indirectly through a higher-level SDK facade, or directly:
3386
+ *
3387
+ * @example
3388
+ * ```ts
3389
+ * import { CoinGeckoClient } from '../client.js';
3390
+ * import { OnchainEndpoints } from './onchain.js';
3391
+ *
3392
+ * const client = new CoinGeckoClient({ apiKey: process.env.CG_KEY });
3393
+ * const onchain = new OnchainEndpoints(client);
3394
+ *
3395
+ * const { data } = await onchain.networks();
3396
+ * console.log(data.map(n => n.attributes.name));
3397
+ * ```
3398
+ */
3399
+ declare class OnchainEndpoints {
3400
+ private readonly client;
3401
+ constructor(client: CoinGeckoClient);
3402
+ /**
3403
+ * Returns the current USD (or other currency) price of one or more tokens
3404
+ * on a given network.
3405
+ *
3406
+ * @param network - Network ID (e.g. `"eth"`, `"bsc"`).
3407
+ * @param addresses - Token contract address or array of addresses.
3408
+ * @returns A map of address → { usd: "price" } (or whichever currencies were requested).
3409
+ *
3410
+ * @example
3411
+ * ```ts
3412
+ * const prices = await onchain.tokenPrice('eth', [
3413
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3414
+ * '0xdac17f958d2ee523a2206206994597c13d831ec7',
3415
+ * ]);
3416
+ * // { '0xa0b8...': { usd: '1.001' }, '0xdac1...': { usd: '0.9998' } }
3417
+ * ```
3418
+ */
3419
+ tokenPrice(network: string, addresses: string | string[]): Promise<SimpleTokenPriceResponse>;
3420
+ /**
3421
+ * Returns the list of all supported networks (blockchains) on GeckoTerminal.
3422
+ *
3423
+ * @param params - Optional pagination parameters.
3424
+ * @returns Paginated list of network resources.
3425
+ *
3426
+ * @example
3427
+ * ```ts
3428
+ * const { data } = await onchain.networks();
3429
+ * data.forEach(n => console.log(n.id, n.attributes.name));
3430
+ * ```
3431
+ */
3432
+ networks(params?: PaginationParams): Promise<NetworksListResponse>;
3433
+ /**
3434
+ * Returns the list of DEXes available on a given network.
3435
+ *
3436
+ * @param network - Network ID (e.g. `"eth"`).
3437
+ * @param params - Optional pagination parameters.
3438
+ * @returns Paginated list of DEX resources.
3439
+ *
3440
+ * @example
3441
+ * ```ts
3442
+ * const { data } = await onchain.dexes('eth');
3443
+ * data.forEach(d => console.log(d.id, d.attributes.name));
3444
+ * ```
3445
+ */
3446
+ dexes(network: string, params?: PaginationParams): Promise<DexListResponse>;
3447
+ /**
3448
+ * Returns detailed data for a single pool by contract address.
3449
+ *
3450
+ * @param network - Network ID (e.g. `"eth"`).
3451
+ * @param address - Pool contract address.
3452
+ * @returns Single pool resource (JSON:API envelope).
3453
+ *
3454
+ * @example
3455
+ * ```ts
3456
+ * const { data } = await onchain.pool('eth', '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640');
3457
+ * console.log(data.attributes.name, data.attributes.reserve_in_usd);
3458
+ * ```
3459
+ */
3460
+ pool(network: string, address: string): Promise<PoolDetail>;
3461
+ /**
3462
+ * Returns data for multiple pools by contract addresses in one request.
3463
+ *
3464
+ * @param network - Network ID (e.g. `"eth"`).
3465
+ * @param addresses - Array of pool contract addresses (joined as comma-separated path segment).
3466
+ * @returns List of pool resources (JSON:API envelope).
3467
+ *
3468
+ * @example
3469
+ * ```ts
3470
+ * const { data } = await onchain.pools('eth', [
3471
+ * '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640',
3472
+ * '0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8',
3473
+ * ]);
3474
+ * ```
3475
+ */
3476
+ pools(network: string, addresses: string[]): Promise<PoolInfo>;
3477
+ /**
3478
+ * Returns the top pools on a given network ranked by volume or liquidity.
3479
+ *
3480
+ * @param network - Network ID (e.g. `"eth"`).
3481
+ * @param params - Optional pagination parameters.
3482
+ * @returns Paginated list of pool resources.
3483
+ *
3484
+ * @example
3485
+ * ```ts
3486
+ * const { data } = await onchain.topPools('eth', { page: 1 });
3487
+ * ```
3488
+ */
3489
+ topPools(network: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3490
+ /**
3491
+ * Returns the top pools for a specific DEX on a given network.
3492
+ *
3493
+ * @param network - Network ID (e.g. `"eth"`).
3494
+ * @param dex - DEX ID (e.g. `"uniswap_v3"`).
3495
+ * @param params - Optional pagination parameters.
3496
+ * @returns Paginated list of pool resources.
3497
+ *
3498
+ * @example
3499
+ * ```ts
3500
+ * const { data } = await onchain.topPoolsByDex('eth', 'uniswap_v3');
3501
+ * ```
3502
+ */
3503
+ topPoolsByDex(network: string, dex: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3504
+ /**
3505
+ * Returns trending pools, either globally or filtered to a specific network.
3506
+ *
3507
+ * When `network` is omitted, the global trending pools endpoint is used:
3508
+ * `GET /onchain/networks/trending_pools`.
3509
+ * When `network` is provided: `GET /onchain/networks/{network}/trending_pools`.
3510
+ *
3511
+ * @param network - Optional network ID to scope results.
3512
+ * @param params - Optional pagination parameters.
3513
+ * @returns Paginated list of trending pool resources.
3514
+ *
3515
+ * @example
3516
+ * ```ts
3517
+ * // Global trending
3518
+ * const { data } = await onchain.trendingPools();
3519
+ *
3520
+ * // Network-scoped trending
3521
+ * const { data: ethTrending } = await onchain.trendingPools('eth');
3522
+ * ```
3523
+ */
3524
+ trendingPools(network?: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3525
+ /**
3526
+ * Returns newly created pools, either globally or filtered to a specific network.
3527
+ *
3528
+ * When `network` is omitted, the global new pools endpoint is used:
3529
+ * `GET /onchain/networks/new_pools`.
3530
+ * When `network` is provided: `GET /onchain/networks/{network}/new_pools`.
3531
+ *
3532
+ * @param network - Optional network ID to scope results.
3533
+ * @param params - Optional pagination parameters.
3534
+ * @returns Paginated list of new pool resources.
3535
+ *
3536
+ * @example
3537
+ * ```ts
3538
+ * // All new pools across all networks
3539
+ * const { data } = await onchain.newPools();
3540
+ *
3541
+ * // New pools on Solana only
3542
+ * const { data: solNew } = await onchain.newPools('solana');
3543
+ * ```
3544
+ */
3545
+ newPools(network?: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3546
+ /**
3547
+ * Returns pools matching advanced filter criteria (megafilter).
3548
+ *
3549
+ * @remarks
3550
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3551
+ * lower-tier keys.
3552
+ *
3553
+ * @param params - Filter, sort, and pagination parameters.
3554
+ * @returns Paginated list of pool resources matching the criteria.
3555
+ *
3556
+ * @example
3557
+ * ```ts
3558
+ * const { data } = await onchain.megafilter({
3559
+ * network: 'eth',
3560
+ * reserve_in_usd_gte: 100_000,
3561
+ * sort: 'h24_volume_usd',
3562
+ * page: 1,
3563
+ * });
3564
+ * ```
3565
+ */
3566
+ megafilter(params: MegafilterParams): Promise<JsonApiListResponse<PoolAttributes>>;
3567
+ /**
3568
+ * Searches for pools matching a text query across all networks or a
3569
+ * specific network.
3570
+ *
3571
+ * @param query - Search query string (token name, symbol, or pool address).
3572
+ * @param params - Optional network filter and pagination parameters.
3573
+ * @returns Paginated list of matching pool resources.
3574
+ *
3575
+ * @example
3576
+ * ```ts
3577
+ * const { data } = await onchain.searchPools('PEPE');
3578
+ * const { data: ethPepe } = await onchain.searchPools('PEPE', { network: 'eth' });
3579
+ * ```
3580
+ */
3581
+ searchPools(query: string, params?: SearchPoolsParams): Promise<JsonApiListResponse<PoolAttributes>>;
3582
+ /**
3583
+ * Returns pools that are currently trending in search on GeckoTerminal.
3584
+ *
3585
+ * @remarks
3586
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3587
+ * lower-tier keys.
3588
+ *
3589
+ * @returns List of trending-search pool resources.
3590
+ *
3591
+ * @example
3592
+ * ```ts
3593
+ * const { data } = await onchain.trendingSearchPools();
3594
+ * ```
3595
+ */
3596
+ trendingSearchPools(): Promise<JsonApiListResponse<PoolAttributes>>;
3597
+ /**
3598
+ * Returns rich metadata / info for a single pool.
3599
+ *
3600
+ * @param network - Network ID (e.g. `"eth"`).
3601
+ * @param poolAddress - Pool contract address.
3602
+ * @returns Single pool info resource (JSON:API envelope).
3603
+ *
3604
+ * @example
3605
+ * ```ts
3606
+ * const { data } = await onchain.poolInfo('eth', '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640');
3607
+ * ```
3608
+ */
3609
+ poolInfo(network: string, poolAddress: string): Promise<PoolInfoResponse>;
3610
+ /**
3611
+ * Returns OHLCV (candlestick) data for a pool.
3612
+ *
3613
+ * @param network - Network ID (e.g. `"eth"`).
3614
+ * @param poolAddress - Pool contract address.
3615
+ * @param timeframe - Candle timeframe: `"minute"`, `"hour"`, or `"day"`.
3616
+ * @param params - Optional OHLCV query parameters (aggregate, limit, etc.).
3617
+ * @returns OHLCV response containing an array of candles and token metadata.
3618
+ *
3619
+ * @example
3620
+ * ```ts
3621
+ * const ohlcv = await onchain.poolOhlcv(
3622
+ * 'eth',
3623
+ * '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640',
3624
+ * 'hour',
3625
+ * { aggregate: '4', limit: 200 },
3626
+ * );
3627
+ * ohlcv.data?.attributes?.ohlcv_list?.forEach(([ts, o, h, l, c, v]) => {
3628
+ * console.log(new Date(ts * 1000).toISOString(), c);
3629
+ * });
3630
+ * ```
3631
+ */
3632
+ poolOhlcv(network: string, poolAddress: string, timeframe: string, params?: OhlcvParams): Promise<OhlcvResponse>;
3633
+ /**
3634
+ * Returns recent trades for a pool.
3635
+ *
3636
+ * @param network - Network ID (e.g. `"eth"`).
3637
+ * @param poolAddress - Pool contract address.
3638
+ * @param params - Optional query parameters (e.g. `trade_volume_in_usd_greater_than`).
3639
+ * @returns Trades response containing an array of trade objects.
3640
+ *
3641
+ * @example
3642
+ * ```ts
3643
+ * const trades = await onchain.poolTrades(
3644
+ * 'eth',
3645
+ * '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640',
3646
+ * );
3647
+ * ```
3648
+ */
3649
+ poolTrades(network: string, poolAddress: string, params?: Record<string, unknown>): Promise<TradesResponse>;
3650
+ /**
3651
+ * Returns price and market data for a single token by contract address.
3652
+ *
3653
+ * @param network - Network ID (e.g. `"eth"`).
3654
+ * @param address - Token contract address.
3655
+ * @returns Single token resource (JSON:API envelope).
3656
+ *
3657
+ * @example
3658
+ * ```ts
3659
+ * const { data } = await onchain.token(
3660
+ * 'eth',
3661
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3662
+ * );
3663
+ * console.log(data.attributes.symbol, data.attributes.price_usd);
3664
+ * ```
3665
+ */
3666
+ token(network: string, address: string): Promise<TokenDetailResponse>;
3667
+ /**
3668
+ * Returns price and market data for multiple tokens in one request.
3669
+ *
3670
+ * @param network - Network ID (e.g. `"eth"`).
3671
+ * @param addresses - Array of token contract addresses (joined as comma-separated path segment).
3672
+ * @returns List of token resources (JSON:API envelope).
3673
+ *
3674
+ * @example
3675
+ * ```ts
3676
+ * const { data } = await onchain.tokens('eth', [
3677
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3678
+ * '0xdac17f958d2ee523a2206206994597c13d831ec7',
3679
+ * ]);
3680
+ * ```
3681
+ */
3682
+ tokens(network: string, addresses: string[]): Promise<JsonApiListResponse<TokenAttributes>>;
3683
+ /**
3684
+ * Returns rich metadata (socials, description, security flags) for a token.
3685
+ *
3686
+ * @param network - Network ID (e.g. `"eth"`).
3687
+ * @param address - Token contract address.
3688
+ * @returns Token info resource (JSON:API envelope).
3689
+ *
3690
+ * @example
3691
+ * ```ts
3692
+ * const { data } = await onchain.tokenInfo(
3693
+ * 'eth',
3694
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3695
+ * );
3696
+ * console.log(data.attributes.description, data.attributes.gt_score);
3697
+ * ```
3698
+ */
3699
+ tokenInfo(network: string, address: string): Promise<TokenInfoResponse>;
3700
+ /**
3701
+ * Returns the list of pools that include a given token.
3702
+ *
3703
+ * @param network - Network ID (e.g. `"eth"`).
3704
+ * @param address - Token contract address.
3705
+ * @param params - Optional pagination parameters.
3706
+ * @returns Paginated list of pool resources containing the token.
3707
+ *
3708
+ * @example
3709
+ * ```ts
3710
+ * const { data } = await onchain.tokenPools(
3711
+ * 'eth',
3712
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3713
+ * );
3714
+ * ```
3715
+ */
3716
+ tokenPools(network: string, address: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3717
+ /**
3718
+ * Returns OHLCV (candlestick) data for a token.
3719
+ *
3720
+ * @remarks
3721
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3722
+ * lower-tier keys.
3723
+ *
3724
+ * @param network - Network ID (e.g. `"eth"`).
3725
+ * @param address - Token contract address.
3726
+ * @param timeframe - Candle timeframe: `"minute"`, `"hour"`, or `"day"`.
3727
+ * @param params - Optional OHLCV query parameters (aggregate, limit, etc.).
3728
+ * @returns OHLCV response containing an array of candles and token metadata.
3729
+ *
3730
+ * @example
3731
+ * ```ts
3732
+ * const ohlcv = await onchain.tokenOhlcv(
3733
+ * 'eth',
3734
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3735
+ * 'day',
3736
+ * { limit: 30 },
3737
+ * );
3738
+ * ```
3739
+ */
3740
+ tokenOhlcv(network: string, address: string, timeframe: string, params?: OhlcvParams): Promise<OhlcvResponse>;
3741
+ /**
3742
+ * Returns recent trades involving a specific token.
3743
+ *
3744
+ * @remarks
3745
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3746
+ * lower-tier keys.
3747
+ *
3748
+ * @param network - Network ID (e.g. `"eth"`).
3749
+ * @param address - Token contract address.
3750
+ * @param params - Optional query parameters.
3751
+ * @returns Trades response containing recent trade objects for the token.
3752
+ *
3753
+ * @example
3754
+ * ```ts
3755
+ * const trades = await onchain.tokenTrades(
3756
+ * 'eth',
3757
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3758
+ * );
3759
+ * ```
3760
+ */
3761
+ tokenTrades(network: string, address: string, params?: Record<string, unknown>): Promise<TradesResponse>;
3762
+ /**
3763
+ * Returns the top traders for a specific token over the last 24 hours.
3764
+ *
3765
+ * @remarks
3766
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3767
+ * lower-tier keys.
3768
+ *
3769
+ * @param network - Network ID (e.g. `"eth"`).
3770
+ * @param address - Token contract address.
3771
+ * @returns List response containing top trader entries.
3772
+ *
3773
+ * @example
3774
+ * ```ts
3775
+ * const result = await onchain.topTraders(
3776
+ * 'eth',
3777
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3778
+ * );
3779
+ * ```
3780
+ */
3781
+ topTraders(network: string, address: string): Promise<JsonApiListResponse<TopTrader>>;
3782
+ /**
3783
+ * Returns the top holders (largest wallets) for a specific token.
3784
+ *
3785
+ * @remarks
3786
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3787
+ * lower-tier keys.
3788
+ *
3789
+ * @param network - Network ID (e.g. `"eth"`).
3790
+ * @param address - Token contract address.
3791
+ * @returns List response containing top holder entries.
3792
+ *
3793
+ * @example
3794
+ * ```ts
3795
+ * const result = await onchain.topHolders(
3796
+ * 'eth',
3797
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3798
+ * );
3799
+ * ```
3800
+ */
3801
+ topHolders(network: string, address: string): Promise<JsonApiListResponse<TopHolder>>;
3802
+ /**
3803
+ * Returns a time-series chart of holder count for a specific token.
3804
+ *
3805
+ * @remarks
3806
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3807
+ * lower-tier keys.
3808
+ *
3809
+ * @param network - Network ID (e.g. `"eth"`).
3810
+ * @param address - Token contract address.
3811
+ * @returns Holder chart response with an array of `[timestamp, count]` data points.
3812
+ *
3813
+ * @example
3814
+ * ```ts
3815
+ * const chart = await onchain.holdersChart(
3816
+ * 'eth',
3817
+ * '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
3818
+ * );
3819
+ * chart.data?.attributes?.holders_chart?.forEach(([ts, count]) => {
3820
+ * console.log(new Date(ts * 1000).toISOString(), count);
3821
+ * });
3822
+ * ```
3823
+ */
3824
+ holdersChart(network: string, address: string): Promise<HolderChartResponse>;
3825
+ /**
3826
+ * Returns a list of tokens whose info was recently updated on GeckoTerminal.
3827
+ *
3828
+ * Useful for syncing token metadata caches.
3829
+ *
3830
+ * @returns List of recently-updated token info resources (JSON:API).
3831
+ *
3832
+ * @example
3833
+ * ```ts
3834
+ * const { data } = await onchain.recentlyUpdatedTokens();
3835
+ * data.forEach(t => console.log(t.attributes.symbol, t.attributes.coingecko_coin_id));
3836
+ * ```
3837
+ */
3838
+ recentlyUpdatedTokens(): Promise<JsonApiListResponse<TokenAttributes>>;
3839
+ /**
3840
+ * Returns the list of GeckoTerminal onchain categories.
3841
+ *
3842
+ * @remarks
3843
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3844
+ * lower-tier keys.
3845
+ *
3846
+ * @returns Response containing an array of category objects.
3847
+ *
3848
+ * @example
3849
+ * ```ts
3850
+ * const { data } = await onchain.categories();
3851
+ * data.forEach(c => console.log(c.id, c.attributes?.name));
3852
+ * ```
3853
+ */
3854
+ categories(): Promise<OnchainCategoriesResponse>;
3855
+ /**
3856
+ * Returns pools belonging to a specific GeckoTerminal onchain category.
3857
+ *
3858
+ * @remarks
3859
+ * **Requires Analyst+ (💼) plan.** Calls are rejected with HTTP 403 on
3860
+ * lower-tier keys.
3861
+ *
3862
+ * @param categoryId - Category ID (e.g. `"defi"`, `"meme"`).
3863
+ * @param params - Optional pagination parameters.
3864
+ * @returns Paginated list of pool resources in the category.
3865
+ *
3866
+ * @example
3867
+ * ```ts
3868
+ * const { data } = await onchain.categoryPools('meme', { page: 1, per_page: 50 });
3869
+ * data.forEach(p => console.log(p.attributes.name, p.attributes.volume_usd?.h24));
3870
+ * ```
3871
+ */
3872
+ categoryPools(categoryId: string, params?: PaginationParams): Promise<JsonApiListResponse<PoolAttributes>>;
3873
+ }
3874
+
3875
+ /**
3876
+ * @module endpoints/global
3877
+ * Endpoint methods for CoinGecko global market, search, trending,
3878
+ * exchange rates, asset platforms, and token list API paths.
3879
+ *
3880
+ * Covers: /global, /global/decentralized_finance_defi,
3881
+ * /global/market_cap_chart (Analyst+), /search, /search/trending,
3882
+ * /exchange_rates, /asset_platforms, /token_lists/{platformId}/all.json.
3883
+ */
3884
+
3885
+ /**
3886
+ * Endpoint group for CoinGecko global market, search, and utility APIs.
3887
+ *
3888
+ * Obtain an instance via the SDK's top-level entry point; do not
3889
+ * instantiate directly.
3890
+ *
3891
+ * @example
3892
+ * ```ts
3893
+ * const global = new GlobalEndpoints(client);
3894
+ * const data = await global.global();
3895
+ * console.log(data.data.total_market_cap?.usd);
3896
+ * ```
3897
+ */
3898
+ declare class GlobalEndpoints {
3899
+ private readonly client;
3900
+ constructor(client: CoinGeckoClient);
3901
+ /**
3902
+ * Returns global cryptocurrency market data, including total market cap,
3903
+ * volume, dominance, and number of active coins and exchanges.
3904
+ *
3905
+ * @returns {@link GlobalData} wrapping a {@link GlobalDataPayload}.
3906
+ *
3907
+ * @example
3908
+ * ```ts
3909
+ * const { data } = await global.global();
3910
+ * console.log(data.market_cap_percentage?.btc); // BTC dominance %
3911
+ * ```
3912
+ */
3913
+ global(): Promise<GlobalData>;
3914
+ /**
3915
+ * Returns global DeFi market data, including total DeFi market cap, ETH
3916
+ * market cap, DeFi dominance, and trading volume.
3917
+ *
3918
+ * @returns {@link GlobalDefiData} wrapping a {@link GlobalDefiPayload}.
3919
+ *
3920
+ * @example
3921
+ * ```ts
3922
+ * const { data } = await global.globalDefi();
3923
+ * console.log(data.defi_market_cap);
3924
+ * ```
3925
+ */
3926
+ globalDefi(): Promise<GlobalDefiData>;
3927
+ /**
3928
+ * Returns historical global market cap and volume chart data.
3929
+ *
3930
+ * @param params - Required query parameters, including `days`.
3931
+ * @returns {@link GlobalMarketCapChartResponse} with `market_cap` and
3932
+ * `volume` time series arrays.
3933
+ *
3934
+ * @remarks Requires **Analyst+** plan.
3935
+ *
3936
+ * @example
3937
+ * ```ts
3938
+ * const chart = await global.globalMarketCapChart({ days: 30 });
3939
+ * console.log(chart.market_cap_chart.market_cap[0]); // [timestamp_ms, value]
3940
+ * ```
3941
+ */
3942
+ globalMarketCapChart(params: GlobalMarketCapChartParams): Promise<GlobalMarketCapChartResponse>;
3943
+ /**
3944
+ * Searches for coins, exchanges, categories, and NFT collections by a
3945
+ * free-text query string.
3946
+ *
3947
+ * @param query - Search term (e.g. `"bitcoin"`, `"uni"`).
3948
+ * @returns {@link SearchResponse} with matched coins, exchanges, categories,
3949
+ * and NFTs.
3950
+ *
3951
+ * @example
3952
+ * ```ts
3953
+ * const results = await global.search('uniswap');
3954
+ * results.coins.forEach(c => console.log(c.id, c.name));
3955
+ * ```
3956
+ */
3957
+ search(query: string): Promise<SearchResponse>;
3958
+ /**
3959
+ * Returns the top trending coins, NFTs, and categories on CoinGecko in the
3960
+ * last 24 hours, determined by search volume.
3961
+ *
3962
+ * @returns {@link TrendingResponse} with arrays of trending coins, NFTs, and
3963
+ * categories.
3964
+ *
3965
+ * @example
3966
+ * ```ts
3967
+ * const { coins } = await global.trending();
3968
+ * coins.forEach(({ item }) => console.log(item.name));
3969
+ * ```
3970
+ */
3971
+ trending(): Promise<TrendingResponse>;
3972
+ /**
3973
+ * Returns BTC exchange rates against fiat currencies, crypto assets, and
3974
+ * commodities.
3975
+ *
3976
+ * @returns {@link ExchangeRatesResponse} mapping currency codes to rate data.
3977
+ *
3978
+ * @example
3979
+ * ```ts
3980
+ * const { rates } = await global.exchangeRates();
3981
+ * console.log(rates['usd']?.value); // BTC price in USD
3982
+ * ```
3983
+ */
3984
+ exchangeRates(): Promise<ExchangeRatesResponse>;
3985
+ /**
3986
+ * Returns a list of all asset platforms (blockchain networks) supported by
3987
+ * CoinGecko.
3988
+ *
3989
+ * @param params - Optional filter parameters (e.g. `filter: 'nft'`).
3990
+ * @returns Array of {@link AssetPlatform} objects.
3991
+ *
3992
+ * @example
3993
+ * ```ts
3994
+ * const platforms = await global.assetPlatforms({ filter: 'nft' });
3995
+ * ```
3996
+ */
3997
+ assetPlatforms(params?: AssetPlatformsParams): Promise<AssetPlatform[]>;
3998
+ /**
3999
+ * Returns a Uniswap-compatible token list for all tokens on a given asset
4000
+ * platform.
4001
+ *
4002
+ * @param platformId - Asset platform ID (e.g. `"ethereum"`).
4003
+ * @returns Token list object in the standard Uniswap token list format.
4004
+ * The exact shape depends on the platform; typed as `unknown` for
4005
+ * flexibility.
4006
+ *
4007
+ * @example
4008
+ * ```ts
4009
+ * const list = await global.tokenLists('ethereum');
4010
+ * ```
4011
+ */
4012
+ tokenLists(platformId: string): Promise<unknown>;
4013
+ }
4014
+
4015
+ /**
4016
+ * @module endpoints/treasury
4017
+ * Endpoint methods for CoinGecko Public Treasury API paths.
4018
+ *
4019
+ * Covers: /entities/list, /companies/public_treasury/{coinId},
4020
+ * /public_treasury/{entityId}, /public_treasury/{entityId}/{coinId}/holding_chart,
4021
+ * /public_treasury/{entityId}/transaction_history.
4022
+ */
4023
+
4024
+ /**
4025
+ * Endpoint group for CoinGecko Public Treasury APIs.
4026
+ *
4027
+ * Obtain an instance via the SDK's top-level entry point; do not
4028
+ * instantiate directly.
4029
+ *
4030
+ * @example
4031
+ * ```ts
4032
+ * const treasury = new TreasuryEndpoints(client);
4033
+ * const entities = await treasury.entitiesList();
4034
+ * ```
4035
+ */
4036
+ declare class TreasuryEndpoints {
4037
+ private readonly client;
4038
+ constructor(client: CoinGeckoClient);
4039
+ /**
4040
+ * Returns a list of all public entities (companies and governments) tracked
4041
+ * in CoinGecko's public treasury database.
4042
+ *
4043
+ * @returns Array of {@link Entity} objects with `id`, `name`, `symbol`, and
4044
+ * `country`.
4045
+ *
4046
+ * @example
4047
+ * ```ts
4048
+ * const entities = await treasury.entitiesList();
4049
+ * entities.forEach(e => console.log(e.id, e.name));
4050
+ * ```
4051
+ */
4052
+ entitiesList(): Promise<Entity[]>;
4053
+ /**
4054
+ * Returns public company Bitcoin or Ethereum treasury holdings, including
4055
+ * aggregate totals and per-company breakdowns.
4056
+ *
4057
+ * @param coinId - Coin API ID to query holdings for.
4058
+ * Currently supported values: `"bitcoin"`, `"ethereum"`.
4059
+ * @returns {@link CompanyTreasuryResponse} with aggregate totals and a
4060
+ * `companies` array.
4061
+ *
4062
+ * @example
4063
+ * ```ts
4064
+ * const holdings = await treasury.companyHoldings('bitcoin');
4065
+ * console.log(holdings.total_holdings);
4066
+ * holdings.companies.forEach(c => console.log(c.name, c.total_holdings));
4067
+ * ```
4068
+ */
4069
+ companyHoldings(coinId: string): Promise<CompanyTreasuryResponse>;
4070
+ /**
4071
+ * Returns the full treasury profile for a single public entity, including
4072
+ * all cryptocurrency holdings and financial metrics.
4073
+ *
4074
+ * @param entityId - Entity API ID (e.g. `"strategy"`, `"tesla"`). Use
4075
+ * {@link entitiesList} to discover valid IDs.
4076
+ * @returns {@link PublicTreasuryEntity} with holdings, valuation, and PnL.
4077
+ *
4078
+ * @example
4079
+ * ```ts
4080
+ * const profile = await treasury.entityHoldings('strategy');
4081
+ * console.log(profile.total_treasury_value_usd);
4082
+ * profile.holdings?.forEach(h => console.log(h.coin_id, h.amount));
4083
+ * ```
4084
+ */
4085
+ entityHoldings(entityId: string): Promise<PublicTreasuryEntity>;
4086
+ /**
4087
+ * Returns historical holding amount and USD value chart data for a specific
4088
+ * coin in an entity's treasury.
4089
+ *
4090
+ * @param entityId - Entity API ID (e.g. `"strategy"`).
4091
+ * @param coinId - Coin API ID (e.g. `"bitcoin"`).
4092
+ * @param params - Required query parameters, including `days`.
4093
+ * @returns {@link TreasuryHoldingChartResponse} with `holdings` and
4094
+ * `holding_value_in_usd` time series.
4095
+ *
4096
+ * @example
4097
+ * ```ts
4098
+ * const chart = await treasury.entityHoldingChart('strategy', 'bitcoin', {
4099
+ * days: '365',
4100
+ * });
4101
+ * chart.holdings?.forEach(([ts, amount]) => console.log(ts, amount));
4102
+ * ```
4103
+ */
4104
+ entityHoldingChart(entityId: string, coinId: string, params: TreasuryHoldingChartParams): Promise<TreasuryHoldingChartResponse>;
4105
+ /**
4106
+ * Returns the paginated transaction history for a public treasury entity,
4107
+ * including buy/sell events with price and value data.
4108
+ *
4109
+ * @param entityId - Entity API ID (e.g. `"strategy"`).
4110
+ * @param params - Optional pagination and coin filter parameters.
4111
+ * @returns {@link TreasuryTransactionHistoryResponse} with a `data` array of
4112
+ * {@link TreasuryTransaction} records.
4113
+ *
4114
+ * @example
4115
+ * ```ts
4116
+ * const history = await treasury.entityTransactions('strategy', {
4117
+ * coin_ids: 'bitcoin',
4118
+ * per_page: 50,
4119
+ * });
4120
+ * history.data?.forEach(tx => console.log(tx.date, tx.transaction_type, tx.amount));
4121
+ * ```
4122
+ */
4123
+ entityTransactions(entityId: string, params?: TreasuryTransactionHistoryParams): Promise<TreasuryTransactionHistoryResponse>;
4124
+ }
4125
+
4126
+ /**
4127
+ * @module errors
4128
+ * Custom error types for the CoinGecko SDK.
4129
+ */
4130
+ /**
4131
+ * Thrown whenever the CoinGecko API returns a non-2xx HTTP status code, or
4132
+ * when a network-level failure occurs during a request.
4133
+ *
4134
+ * @example
4135
+ * ```ts
4136
+ * try {
4137
+ * await client.get('/coins/does-not-exist');
4138
+ * } catch (err) {
4139
+ * if (err instanceof CoinGeckoError) {
4140
+ * console.error(err.status, err.url, err.data);
4141
+ * }
4142
+ * }
4143
+ * ```
4144
+ */
4145
+ declare class CoinGeckoError extends Error {
4146
+ /**
4147
+ * The HTTP status code returned by the API, or `0` for network-level
4148
+ * failures (e.g. timeout, DNS error).
4149
+ */
4150
+ readonly status: number;
4151
+ /**
4152
+ * The full URL that was requested when the error occurred.
4153
+ */
4154
+ readonly url: string;
4155
+ /**
4156
+ * The response body parsed as JSON if possible, otherwise the raw text.
4157
+ * `undefined` when the error is network-level and no response was received.
4158
+ */
4159
+ readonly data: unknown;
4160
+ /**
4161
+ * @param message - Human-readable error description.
4162
+ * @param status - HTTP status code (use `0` for network errors).
4163
+ * @param url - URL that triggered the error.
4164
+ * @param data - Parsed response body, if available.
4165
+ */
4166
+ constructor(message: string, status: number, url: string, data?: unknown);
4167
+ }
4168
+
4169
+ /**
4170
+ * @module endpoints/meta
4171
+ * Endpoint methods for CoinGecko API meta and connectivity checks.
4172
+ *
4173
+ * Covers: /ping, /key (Analyst+).
4174
+ */
4175
+
4176
+ /**
4177
+ * Endpoint group for CoinGecko meta/utility APIs.
4178
+ *
4179
+ * Obtain an instance via the SDK's top-level entry point; do not
4180
+ * instantiate directly.
4181
+ *
4182
+ * @example
4183
+ * ```ts
4184
+ * const meta = new MetaEndpoints(client);
4185
+ * const status = await meta.ping();
4186
+ * console.log(status.gecko_says);
4187
+ * ```
4188
+ */
4189
+ declare class MetaEndpoints {
4190
+ private readonly client;
4191
+ constructor(client: CoinGeckoClient);
4192
+ /**
4193
+ * Checks the API server status. Use this as a lightweight connectivity test
4194
+ * before making heavier requests.
4195
+ *
4196
+ * @returns {@link PingResponse} containing a `gecko_says` status string
4197
+ * (e.g. `"(V3) To the Moon!"`).
4198
+ *
4199
+ * @example
4200
+ * ```ts
4201
+ * const { gecko_says } = await meta.ping();
4202
+ * console.log(gecko_says); // "(V3) To the Moon!"
4203
+ * ```
4204
+ */
4205
+ ping(): Promise<PingResponse>;
4206
+ /**
4207
+ * Returns usage statistics and plan information for the current Pro API key.
4208
+ *
4209
+ * @returns {@link ApiUsageResponse} with plan name, rate limit, monthly
4210
+ * credit usage, and remaining credits.
4211
+ *
4212
+ * @remarks Requires a valid **Pro API key** (Analyst+ plan). Returns 401 for
4213
+ * free-tier or unauthenticated requests.
4214
+ *
4215
+ * @example
4216
+ * ```ts
4217
+ * const usage = await meta.apiUsage();
4218
+ * console.log(usage.plan); // "Analyst"
4219
+ * console.log(usage.current_remaining_monthly_calls); // remaining credits
4220
+ * ```
4221
+ */
4222
+ apiUsage(): Promise<ApiUsageResponse>;
4223
+ }
4224
+
4225
+ /**
4226
+ * Main entry point for the CoinGecko Pro SDK.
4227
+ *
4228
+ * Instantiate once and access every API group through its dedicated namespace.
4229
+ * The underlying HTTP client handles caching, rate limiting, retries, and
4230
+ * timeout management automatically.
4231
+ *
4232
+ * @example
4233
+ * ```typescript
4234
+ * import { CoinGecko } from 'coingecko-pro';
4235
+ *
4236
+ * // Pro tier (higher rate limits, Pro-only endpoints)
4237
+ * const cg = new CoinGecko({ apiKey: 'CG-xxx' });
4238
+ *
4239
+ * // Free tier
4240
+ * const cg = new CoinGecko();
4241
+ *
4242
+ * // With full configuration
4243
+ * const cg = new CoinGecko({
4244
+ * apiKey: process.env.CG_API_KEY,
4245
+ * cacheTtl: 60_000,
4246
+ * maxRetries: 5,
4247
+ * rateLimit: 500,
4248
+ * timeout: 30_000,
4249
+ * onError: (url, err) => console.error(`[CoinGecko] ${url}`, err.message),
4250
+ * });
4251
+ * ```
4252
+ */
4253
+ declare class CoinGecko {
4254
+ /** Coin prices, market data, charts, OHLC, supply, categories, and contract lookups. */
4255
+ readonly coins: CoinsEndpoints;
4256
+ /** Exchange listings, details, tickers, and volume charts. */
4257
+ readonly exchanges: ExchangesEndpoints;
4258
+ /** Derivatives tickers and exchange data. */
4259
+ readonly derivatives: DerivativesEndpoints;
4260
+ /** NFT collections, market data, charts, and tickers. */
4261
+ readonly nfts: NftsEndpoints;
4262
+ /** On-chain DEX data (GeckoTerminal): pools, tokens, trades, OHLCV, top traders/holders. */
4263
+ readonly onchain: OnchainEndpoints;
4264
+ /** Global market data, search, trending, exchange rates, and asset platforms. */
4265
+ readonly global: GlobalEndpoints;
4266
+ /** Public treasury holdings, charts, and transaction history. */
4267
+ readonly treasury: TreasuryEndpoints;
4268
+ private readonly meta;
4269
+ /**
4270
+ * Creates a new CoinGecko SDK instance.
4271
+ *
4272
+ * @param config - Optional configuration for the underlying HTTP client.
4273
+ * See {@link CoinGeckoClientConfig} for all available options.
4274
+ */
4275
+ constructor(config?: CoinGeckoClientConfig);
4276
+ /**
4277
+ * Checks the CoinGecko API server status.
4278
+ *
4279
+ * Use this as a lightweight connectivity and authentication test.
4280
+ *
4281
+ * @returns Object containing the server status message
4282
+ * (`{ gecko_says: "(V3) To the Moon!" }`).
4283
+ *
4284
+ * @example
4285
+ * ```typescript
4286
+ * const { gecko_says } = await cg.ping();
4287
+ * console.log(gecko_says); // "(V3) To the Moon!"
4288
+ * ```
4289
+ */
4290
+ ping(): Promise<PingResponse>;
4291
+ /**
4292
+ * Returns API key usage statistics and plan information.
4293
+ *
4294
+ * @remarks Requires a valid **Pro API key** (Analyst+ plan). Returns 401 on
4295
+ * free-tier or unauthenticated requests.
4296
+ *
4297
+ * @returns Usage data including plan name, rate limits, and remaining credits.
4298
+ *
4299
+ * @example
4300
+ * ```typescript
4301
+ * const usage = await cg.apiUsage();
4302
+ * console.log(usage.plan, usage.current_remaining_monthly_calls);
4303
+ * ```
4304
+ */
4305
+ apiUsage(): Promise<ApiUsageResponse>;
4306
+ }
4307
+
4308
+ export { type ApiUsageResponse, type AssetPlatform, type AssetPlatformsParams, type CategoriesParams, type Category, type CategoryDetail, type CategoryListEntry, type CoinCommunityData, type CoinDetail, type CoinDetailParams, type CoinDeveloperData, CoinGecko, CoinGeckoClient, type CoinGeckoClientConfig, CoinGeckoError, type CoinHistoricalData, type CoinHistoryParams, type CoinLinks, type CoinListEntry, type CoinMarketData, type CoinTicker, type CoinTickerParams, type CoinTickersResponse, CoinsEndpoints, type CoinsListParams, type CoinsMarketOrder, type CoinsMarketsParams, type CompanyTreasuryResponse, type CurrencyDateMap, type CurrencyMap, type DEX, type DerivativeExchange, type DerivativeExchangeDetail, type DerivativeTicker, DerivativesEndpoints, type DerivativesExchangeByIdParams, type DerivativesExchangeOrder, type DerivativesExchangesParams, type DexAttributes, type DexListResponse, type Entity, type EntityHolding, type Exchange, type ExchangeDetail, type ExchangeListEntry, type ExchangeRate, type ExchangeRateEntry, type ExchangeRatesResponse, type ExchangeTicker, type ExchangeTickerOrder, type ExchangeTickersParams, type ExchangeTickersResponse, ExchangesEndpoints, type GlobalData, type GlobalDataPayload, type GlobalDefiData, type GlobalDefiPayload, GlobalEndpoints, type GlobalMarketCapChartParams, type GlobalMarketCapChartResponse, type GovernmentTreasuryResponse, type GtScoreDetails, type HolderChartPoint, type HolderChartResponse, type HolderDistribution, type HoldingChartPoint, type HoldingTimeframeChange, type IdNamePair, type ImageUrls, type JsonApiListResponse, type JsonApiResource, type JsonApiSingleResponse, type Locale, type MarketChartParams, type MarketChartRangeParams, type MarketChartResponse, type MarketCoin, type MarketDataPoint, type MegafilterParams, MetaEndpoints, type Network, type NetworkAttributes, type NetworksListResponse, type NewCoin, type NftCollection, type NftDualValue, type NftExplorerLink, type NftLinks, type NftListEntry, type NftMarketChart, type NftMarketChartParams, type NftMarketsParams, type NftTicker, type NftTickersResponse, NftsEndpoints, type OHLCV, type OhlcDataPoint, type OhlcParams, type OhlcRangeParams, type OhlcvParams, type OhlcvResponse, type OhlcvTokenMeta, type OnchainCategoriesResponse, type OnchainCategory, OnchainEndpoints, type PaginationParams, type PingResponse, type PlatformDetail, type Pool, type PoolAttributes, type PoolDetail, type PoolInfo, type PoolTimeframeStringMap, type PoolTransactionWindow, type PoolTransactions, type PublicTreasuryEntity, type RoiData, type SearchCategory, type SearchCoin, type SearchExchange, type SearchNft, type SearchResponse, type SimplePriceParams, type SimplePriceResponse, type SimpleTokenPriceParams, type SupplyChartParams, type SupplyChartRangeParams, type SupplyChartResponse, type TickerMarket, type TickerOrder, type TokenAttributes, type TokenDetail, type TokenDetailResponse, type TokenHolders, type TokenInfo, type TokenInfoAttributes, type TokenInfoResponse, type TopGainersLosersParams, type TopHolder, type TopMoverCoin, type TopMoversResponse, type TopTrader, type Trade, type TradesResponse, TreasuryEndpoints, type TreasuryHolding, type TreasuryHoldingChartParams, type TreasuryHoldingChartResponse, type TreasuryTransaction, type TreasuryTransactionHistoryParams, type TreasuryTransactionHistoryResponse, type TrendingCategory, type TrendingCoin, type TrendingNft, type TrendingResponse, type VolumeChartParams, type VolumeChartPoint, type VolumeChartRangeParams, type VolumeChartResponse, type VsCurrency };