@coingecko/coingecko-typescript 2.3.0 → 3.0.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.
Files changed (202) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/LICENSE +1 -1
  3. package/README.md +23 -10
  4. package/client.d.mts +4 -3
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +4 -3
  7. package/client.d.ts.map +1 -1
  8. package/client.js +15 -2
  9. package/client.js.map +1 -1
  10. package/client.mjs +15 -2
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/coins/circulating-supply-chart.d.mts +1 -1
  20. package/resources/coins/circulating-supply-chart.d.mts.map +1 -1
  21. package/resources/coins/circulating-supply-chart.d.ts +1 -1
  22. package/resources/coins/circulating-supply-chart.d.ts.map +1 -1
  23. package/resources/coins/coins.d.mts +158 -1
  24. package/resources/coins/coins.d.mts.map +1 -1
  25. package/resources/coins/coins.d.ts +158 -1
  26. package/resources/coins/coins.d.ts.map +1 -1
  27. package/resources/coins/coins.js.map +1 -1
  28. package/resources/coins/coins.mjs.map +1 -1
  29. package/resources/coins/contract/contract.d.mts +9 -1
  30. package/resources/coins/contract/contract.d.mts.map +1 -1
  31. package/resources/coins/contract/contract.d.ts +9 -1
  32. package/resources/coins/contract/contract.d.ts.map +1 -1
  33. package/resources/coins/contract/contract.js.map +1 -1
  34. package/resources/coins/contract/contract.mjs.map +1 -1
  35. package/resources/coins/contract/market-chart.d.mts +5 -1
  36. package/resources/coins/contract/market-chart.d.mts.map +1 -1
  37. package/resources/coins/contract/market-chart.d.ts +5 -1
  38. package/resources/coins/contract/market-chart.d.ts.map +1 -1
  39. package/resources/coins/contract/market-chart.js +5 -1
  40. package/resources/coins/contract/market-chart.js.map +1 -1
  41. package/resources/coins/contract/market-chart.mjs +5 -1
  42. package/resources/coins/contract/market-chart.mjs.map +1 -1
  43. package/resources/coins/history.d.mts +1 -1
  44. package/resources/coins/history.d.ts +1 -1
  45. package/resources/coins/market-chart.d.mts +5 -1
  46. package/resources/coins/market-chart.d.mts.map +1 -1
  47. package/resources/coins/market-chart.d.ts +5 -1
  48. package/resources/coins/market-chart.d.ts.map +1 -1
  49. package/resources/coins/market-chart.js +5 -1
  50. package/resources/coins/market-chart.js.map +1 -1
  51. package/resources/coins/market-chart.mjs +5 -1
  52. package/resources/coins/market-chart.mjs.map +1 -1
  53. package/resources/coins/markets.d.mts +9 -0
  54. package/resources/coins/markets.d.mts.map +1 -1
  55. package/resources/coins/markets.d.ts +9 -0
  56. package/resources/coins/markets.d.ts.map +1 -1
  57. package/resources/coins/tickers.d.mts +1 -1
  58. package/resources/coins/tickers.d.mts.map +1 -1
  59. package/resources/coins/tickers.d.ts +1 -1
  60. package/resources/coins/tickers.d.ts.map +1 -1
  61. package/resources/exchanges/exchanges.d.mts +3 -3
  62. package/resources/exchanges/exchanges.d.mts.map +1 -1
  63. package/resources/exchanges/exchanges.d.ts +3 -3
  64. package/resources/exchanges/exchanges.d.ts.map +1 -1
  65. package/resources/exchanges/tickers.d.mts +1 -1
  66. package/resources/exchanges/tickers.d.mts.map +1 -1
  67. package/resources/exchanges/tickers.d.ts +1 -1
  68. package/resources/exchanges/tickers.d.ts.map +1 -1
  69. package/resources/global/global.d.mts +4 -0
  70. package/resources/global/global.d.mts.map +1 -1
  71. package/resources/global/global.d.ts +4 -0
  72. package/resources/global/global.d.ts.map +1 -1
  73. package/resources/global/global.js.map +1 -1
  74. package/resources/global/global.mjs.map +1 -1
  75. package/resources/index.d.mts +1 -1
  76. package/resources/index.d.mts.map +1 -1
  77. package/resources/index.d.ts +1 -1
  78. package/resources/index.d.ts.map +1 -1
  79. package/resources/index.js.map +1 -1
  80. package/resources/index.mjs.map +1 -1
  81. package/resources/key.d.mts +10 -0
  82. package/resources/key.d.mts.map +1 -1
  83. package/resources/key.d.ts +10 -0
  84. package/resources/key.d.ts.map +1 -1
  85. package/resources/onchain/networks/dexes.d.mts +8 -0
  86. package/resources/onchain/networks/dexes.d.mts.map +1 -1
  87. package/resources/onchain/networks/dexes.d.ts +8 -0
  88. package/resources/onchain/networks/dexes.d.ts.map +1 -1
  89. package/resources/onchain/networks/new-pools.d.mts +16 -0
  90. package/resources/onchain/networks/new-pools.d.mts.map +1 -1
  91. package/resources/onchain/networks/new-pools.d.ts +16 -0
  92. package/resources/onchain/networks/new-pools.d.ts.map +1 -1
  93. package/resources/onchain/networks/pools/info.d.mts +2 -0
  94. package/resources/onchain/networks/pools/info.d.mts.map +1 -1
  95. package/resources/onchain/networks/pools/info.d.ts +2 -0
  96. package/resources/onchain/networks/pools/info.d.ts.map +1 -1
  97. package/resources/onchain/networks/pools/pools.d.mts +8 -0
  98. package/resources/onchain/networks/pools/pools.d.mts.map +1 -1
  99. package/resources/onchain/networks/pools/pools.d.ts +8 -0
  100. package/resources/onchain/networks/pools/pools.d.ts.map +1 -1
  101. package/resources/onchain/networks/pools/pools.js.map +1 -1
  102. package/resources/onchain/networks/pools/pools.mjs.map +1 -1
  103. package/resources/onchain/networks/tokens/index.d.mts +1 -0
  104. package/resources/onchain/networks/tokens/index.d.mts.map +1 -1
  105. package/resources/onchain/networks/tokens/index.d.ts +1 -0
  106. package/resources/onchain/networks/tokens/index.d.ts.map +1 -1
  107. package/resources/onchain/networks/tokens/index.js +3 -1
  108. package/resources/onchain/networks/tokens/index.js.map +1 -1
  109. package/resources/onchain/networks/tokens/index.mjs +1 -0
  110. package/resources/onchain/networks/tokens/index.mjs.map +1 -1
  111. package/resources/onchain/networks/tokens/info.d.mts +2 -0
  112. package/resources/onchain/networks/tokens/info.d.mts.map +1 -1
  113. package/resources/onchain/networks/tokens/info.d.ts +2 -0
  114. package/resources/onchain/networks/tokens/info.d.ts.map +1 -1
  115. package/resources/onchain/networks/tokens/multi.d.mts +6 -0
  116. package/resources/onchain/networks/tokens/multi.d.mts.map +1 -1
  117. package/resources/onchain/networks/tokens/multi.d.ts +6 -0
  118. package/resources/onchain/networks/tokens/multi.d.ts.map +1 -1
  119. package/resources/onchain/networks/tokens/ohlcv.d.mts +5 -0
  120. package/resources/onchain/networks/tokens/ohlcv.d.mts.map +1 -1
  121. package/resources/onchain/networks/tokens/ohlcv.d.ts +5 -0
  122. package/resources/onchain/networks/tokens/ohlcv.d.ts.map +1 -1
  123. package/resources/onchain/networks/tokens/pools.d.mts +14 -0
  124. package/resources/onchain/networks/tokens/pools.d.mts.map +1 -1
  125. package/resources/onchain/networks/tokens/pools.d.ts +14 -0
  126. package/resources/onchain/networks/tokens/pools.d.ts.map +1 -1
  127. package/resources/onchain/networks/tokens/tokens.d.mts +10 -0
  128. package/resources/onchain/networks/tokens/tokens.d.mts.map +1 -1
  129. package/resources/onchain/networks/tokens/tokens.d.ts +10 -0
  130. package/resources/onchain/networks/tokens/tokens.d.ts.map +1 -1
  131. package/resources/onchain/networks/tokens/tokens.js +4 -0
  132. package/resources/onchain/networks/tokens/tokens.js.map +1 -1
  133. package/resources/onchain/networks/tokens/tokens.mjs +4 -0
  134. package/resources/onchain/networks/tokens/tokens.mjs.map +1 -1
  135. package/resources/onchain/networks/tokens/top-holders.d.mts +12 -0
  136. package/resources/onchain/networks/tokens/top-holders.d.mts.map +1 -1
  137. package/resources/onchain/networks/tokens/top-holders.d.ts +12 -0
  138. package/resources/onchain/networks/tokens/top-holders.d.ts.map +1 -1
  139. package/resources/onchain/networks/tokens/top-traders.d.mts +77 -0
  140. package/resources/onchain/networks/tokens/top-traders.d.mts.map +1 -0
  141. package/resources/onchain/networks/tokens/top-traders.d.ts +77 -0
  142. package/resources/onchain/networks/tokens/top-traders.d.ts.map +1 -0
  143. package/resources/onchain/networks/tokens/top-traders.js +30 -0
  144. package/resources/onchain/networks/tokens/top-traders.js.map +1 -0
  145. package/resources/onchain/networks/tokens/top-traders.mjs +26 -0
  146. package/resources/onchain/networks/tokens/top-traders.mjs.map +1 -0
  147. package/resources/onchain/networks/trending-pools.d.mts +16 -0
  148. package/resources/onchain/networks/trending-pools.d.mts.map +1 -1
  149. package/resources/onchain/networks/trending-pools.d.ts +16 -0
  150. package/resources/onchain/networks/trending-pools.d.ts.map +1 -1
  151. package/resources/onchain/pools/megafilter.d.mts +13 -1
  152. package/resources/onchain/pools/megafilter.d.mts.map +1 -1
  153. package/resources/onchain/pools/megafilter.d.ts +13 -1
  154. package/resources/onchain/pools/megafilter.d.ts.map +1 -1
  155. package/resources/onchain/simple/networks/token-price.d.mts +20 -0
  156. package/resources/onchain/simple/networks/token-price.d.mts.map +1 -1
  157. package/resources/onchain/simple/networks/token-price.d.ts +20 -0
  158. package/resources/onchain/simple/networks/token-price.d.ts.map +1 -1
  159. package/resources/public-treasury.d.mts +286 -31
  160. package/resources/public-treasury.d.mts.map +1 -1
  161. package/resources/public-treasury.d.ts +286 -31
  162. package/resources/public-treasury.d.ts.map +1 -1
  163. package/resources/public-treasury.js +39 -4
  164. package/resources/public-treasury.js.map +1 -1
  165. package/resources/public-treasury.mjs +39 -4
  166. package/resources/public-treasury.mjs.map +1 -1
  167. package/src/client.ts +29 -4
  168. package/src/internal/parse.ts +6 -0
  169. package/src/resources/coins/circulating-supply-chart.ts +1 -1
  170. package/src/resources/coins/coins.ts +193 -1
  171. package/src/resources/coins/contract/contract.ts +11 -1
  172. package/src/resources/coins/contract/market-chart.ts +5 -1
  173. package/src/resources/coins/history.ts +1 -1
  174. package/src/resources/coins/market-chart.ts +5 -1
  175. package/src/resources/coins/markets.ts +11 -0
  176. package/src/resources/coins/tickers.ts +1 -1
  177. package/src/resources/exchanges/exchanges.ts +3 -3
  178. package/src/resources/exchanges/tickers.ts +1 -1
  179. package/src/resources/global/global.ts +5 -0
  180. package/src/resources/index.ts +5 -0
  181. package/src/resources/key.ts +12 -0
  182. package/src/resources/onchain/networks/dexes.ts +12 -0
  183. package/src/resources/onchain/networks/new-pools.ts +24 -0
  184. package/src/resources/onchain/networks/pools/info.ts +4 -0
  185. package/src/resources/onchain/networks/pools/pools.ts +12 -0
  186. package/src/resources/onchain/networks/tokens/index.ts +1 -0
  187. package/src/resources/onchain/networks/tokens/info.ts +4 -0
  188. package/src/resources/onchain/networks/tokens/multi.ts +8 -0
  189. package/src/resources/onchain/networks/tokens/ohlcv.ts +6 -0
  190. package/src/resources/onchain/networks/tokens/pools.ts +20 -0
  191. package/src/resources/onchain/networks/tokens/tokens.ts +18 -0
  192. package/src/resources/onchain/networks/tokens/top-holders.ts +21 -0
  193. package/src/resources/onchain/networks/tokens/top-traders.ts +116 -0
  194. package/src/resources/onchain/networks/trending-pools.ts +24 -0
  195. package/src/resources/onchain/pools/megafilter.ts +19 -0
  196. package/src/resources/onchain/simple/networks/token-price.ts +16 -0
  197. package/src/resources/public-treasury.ts +386 -35
  198. package/src/version.ts +1 -1
  199. package/version.d.mts +1 -1
  200. package/version.d.ts +1 -1
  201. package/version.js +1 -1
  202. package/version.mjs +1 -1
@@ -26,53 +26,130 @@ export declare class PublicTreasury extends APIResource {
26
26
  * );
27
27
  * ```
28
28
  */
29
- getEntityID(entityID: string, options?: RequestOptions): APIPromise<PublicTreasuryGetEntityIDResponse>;
30
- }
31
- export interface PublicTreasuryGetCoinIDResponse {
32
- companies?: Array<PublicTreasuryGetCoinIDResponse.Company>;
33
- /**
34
- * market cap dominance
35
- */
36
- market_cap_dominance?: number;
29
+ getEntityID(entityID: string, query?: PublicTreasuryGetEntityIDParams | null | undefined, options?: RequestOptions): APIPromise<PublicTreasuryGetEntityIDResponse>;
37
30
  /**
38
- * total crypto holdings of companies or government
31
+ * This endpoint allows you to **query historical cryptocurrency holdings chart of
32
+ * public companies & governments** by Entity ID and Coin ID
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const response =
37
+ * await client.publicTreasury.getHoldingChart('bitcoin', {
38
+ * entity_id: 'strategy',
39
+ * days: 'days',
40
+ * });
41
+ * ```
39
42
  */
40
- total_holdings?: number;
43
+ getHoldingChart(coinID: string, params: PublicTreasuryGetHoldingChartParams, options?: RequestOptions): APIPromise<PublicTreasuryGetHoldingChartResponse>;
41
44
  /**
42
- * total crypto holdings value in usd
45
+ * This endpoint allows you **query public companies & governments' cryptocurrency
46
+ * transaction history** by Entity ID
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const response =
51
+ * await client.publicTreasury.getTransactionHistory(
52
+ * 'strategy',
53
+ * );
54
+ * ```
43
55
  */
44
- total_value_usd?: number;
56
+ getTransactionHistory(entityID: string, query?: PublicTreasuryGetTransactionHistoryParams | null | undefined, options?: RequestOptions): APIPromise<PublicTreasuryGetTransactionHistoryResponse>;
45
57
  }
58
+ export type PublicTreasuryGetCoinIDResponse = PublicTreasuryGetCoinIDResponse.CompaniesTreasury | PublicTreasuryGetCoinIDResponse.GovernmentsTreasury;
46
59
  export declare namespace PublicTreasuryGetCoinIDResponse {
47
- interface Company {
60
+ interface CompaniesTreasury {
61
+ companies: Array<CompaniesTreasury.Company>;
48
62
  /**
49
- * company incorporated or government country
63
+ * market cap dominance
50
64
  */
51
- country?: string;
65
+ market_cap_dominance: number;
52
66
  /**
53
- * company or government name
67
+ * total crypto holdings of companies
54
68
  */
55
- name?: string;
69
+ total_holdings: number;
56
70
  /**
57
- * percentage of total crypto supply
71
+ * total crypto holdings value in usd
58
72
  */
59
- percentage_of_total_supply?: number;
60
- /**
61
- * company symbol
62
- */
63
- symbol?: string;
73
+ total_value_usd: number;
74
+ }
75
+ namespace CompaniesTreasury {
76
+ interface Company {
77
+ /**
78
+ * company incorporated or government country
79
+ */
80
+ country?: string;
81
+ /**
82
+ * company or government name
83
+ */
84
+ name?: string;
85
+ /**
86
+ * percentage of total crypto supply
87
+ */
88
+ percentage_of_total_supply?: number;
89
+ /**
90
+ * company symbol
91
+ */
92
+ symbol?: string;
93
+ /**
94
+ * total current value of crypto holdings in usd
95
+ */
96
+ total_current_value_usd?: number;
97
+ /**
98
+ * total entry value in usd
99
+ */
100
+ total_entry_value_usd?: number;
101
+ /**
102
+ * total crypto holdings
103
+ */
104
+ total_holdings?: number;
105
+ }
106
+ }
107
+ interface GovernmentsTreasury {
108
+ governments: Array<GovernmentsTreasury.Government>;
64
109
  /**
65
- * total current value of crypto holdings in usd
110
+ * market cap dominance
66
111
  */
67
- total_current_value_usd?: number;
112
+ market_cap_dominance: number;
68
113
  /**
69
- * total entry value in usd
114
+ * total crypto holdings of governments
70
115
  */
71
- total_entry_value_usd?: number;
116
+ total_holdings: number;
72
117
  /**
73
- * total crypto holdings of company
118
+ * total crypto holdings value in usd
74
119
  */
75
- total_holdings?: number;
120
+ total_value_usd: number;
121
+ }
122
+ namespace GovernmentsTreasury {
123
+ interface Government {
124
+ /**
125
+ * company incorporated or government country
126
+ */
127
+ country?: string;
128
+ /**
129
+ * company or government name
130
+ */
131
+ name?: string;
132
+ /**
133
+ * percentage of total crypto supply
134
+ */
135
+ percentage_of_total_supply?: number;
136
+ /**
137
+ * company symbol
138
+ */
139
+ symbol?: string;
140
+ /**
141
+ * total current value of crypto holdings in usd
142
+ */
143
+ total_current_value_usd?: number;
144
+ /**
145
+ * total entry value in usd
146
+ */
147
+ total_entry_value_usd?: number;
148
+ /**
149
+ * total crypto holdings
150
+ */
151
+ total_holdings?: number;
152
+ }
76
153
  }
77
154
  }
78
155
  export interface PublicTreasuryGetEntityIDResponse {
@@ -88,6 +165,10 @@ export interface PublicTreasuryGetEntityIDResponse {
88
165
  * list of cryptocurrency assets held by the entity
89
166
  */
90
167
  holdings?: Array<PublicTreasuryGetEntityIDResponse.Holding>;
168
+ /**
169
+ * market to net asset value ratio
170
+ */
171
+ m_nav?: number;
91
172
  /**
92
173
  * entity name
93
174
  */
@@ -96,6 +177,14 @@ export interface PublicTreasuryGetEntityIDResponse {
96
177
  * stock market symbol for public company
97
178
  */
98
179
  symbol?: string;
180
+ /**
181
+ * total asset value per share in USD
182
+ */
183
+ total_asset_value_per_share_usd?: number;
184
+ /**
185
+ * total current value of all holdings in USD
186
+ */
187
+ total_treasury_value_usd?: number;
99
188
  /**
100
189
  * official Twitter handle of the entity
101
190
  */
@@ -104,6 +193,10 @@ export interface PublicTreasuryGetEntityIDResponse {
104
193
  * entity type: company or government
105
194
  */
106
195
  type?: string;
196
+ /**
197
+ * unrealized profit and loss (current value - total entry value)
198
+ */
199
+ unrealized_pnl?: number;
107
200
  /**
108
201
  * official website URL of the entity
109
202
  */
@@ -115,23 +208,185 @@ export declare namespace PublicTreasuryGetEntityIDResponse {
115
208
  * amount of the cryptocurrency held
116
209
  */
117
210
  amount?: number;
211
+ /**
212
+ * amount of cryptocurrency per share
213
+ */
214
+ amount_per_share?: number;
215
+ /**
216
+ * average entry cost per unit in USD
217
+ */
218
+ average_entry_value_usd?: number;
118
219
  /**
119
220
  * coin ID
120
221
  */
121
222
  coin_id?: string;
223
+ /**
224
+ * current value of holdings in USD
225
+ */
226
+ current_value_usd?: number;
227
+ /**
228
+ * percentage of entity's total treasury value
229
+ */
230
+ entity_value_usd_percentage?: number;
231
+ /**
232
+ * holding amount changes over different timeframes (only present if
233
+ * holding_amount_change param is used)
234
+ */
235
+ holding_amount_change?: Holding.HoldingAmountChange;
236
+ /**
237
+ * holding change percentages over different timeframes (only present if
238
+ * holding_change_percentage param is used)
239
+ */
240
+ holding_change_percentage?: Holding.HoldingChangePercentage;
122
241
  /**
123
242
  * percentage of total crypto supply
124
243
  */
125
244
  percentage_of_total_supply?: number;
245
+ /**
246
+ * total entry cost/purchase value in USD
247
+ */
248
+ total_entry_value_usd?: number;
249
+ /**
250
+ * unrealized profit and loss for this holding
251
+ */
252
+ unrealized_pnl?: number;
253
+ }
254
+ namespace Holding {
255
+ /**
256
+ * holding amount changes over different timeframes (only present if
257
+ * holding_amount_change param is used)
258
+ */
259
+ interface HoldingAmountChange {
260
+ '14d'?: number;
261
+ '1y'?: number;
262
+ '30d'?: number;
263
+ '7d'?: number;
264
+ '90d'?: number;
265
+ ytd?: number;
266
+ }
267
+ /**
268
+ * holding change percentages over different timeframes (only present if
269
+ * holding_change_percentage param is used)
270
+ */
271
+ interface HoldingChangePercentage {
272
+ '14d'?: number;
273
+ '1y'?: number;
274
+ '30d'?: number;
275
+ '7d'?: number;
276
+ '90d'?: number;
277
+ ytd?: number;
278
+ }
279
+ }
280
+ }
281
+ export interface PublicTreasuryGetHoldingChartResponse {
282
+ holding_value_in_usd?: Array<Array<number>>;
283
+ holdings?: Array<Array<number>>;
284
+ }
285
+ export interface PublicTreasuryGetTransactionHistoryResponse {
286
+ transactions?: Array<PublicTreasuryGetTransactionHistoryResponse.Transaction>;
287
+ }
288
+ export declare namespace PublicTreasuryGetTransactionHistoryResponse {
289
+ interface Transaction {
290
+ /**
291
+ * average entry value in usd after the transaction
292
+ */
293
+ average_entry_value_usd?: number;
294
+ /**
295
+ * coin ID
296
+ */
297
+ coin_id?: string;
298
+ /**
299
+ * transaction date in UNIX timestamp
300
+ */
301
+ date?: number;
302
+ /**
303
+ * total holding balance after the transaction
304
+ */
305
+ holding_balance?: number;
306
+ /**
307
+ * net change in holdings after the transaction
308
+ */
309
+ holding_net_change?: number;
310
+ /**
311
+ * source document URL
312
+ */
313
+ source_url?: string;
314
+ /**
315
+ * transaction value in usd
316
+ */
317
+ transaction_value_usd?: number;
318
+ /**
319
+ * transaction type: buy or sell
320
+ */
321
+ type?: 'buy' | 'sell';
126
322
  }
127
323
  }
128
324
  export interface PublicTreasuryGetCoinIDParams {
129
325
  /**
130
- * public company or government entity
326
+ * Path param: public company or government entity
131
327
  */
132
328
  entity: 'companies' | 'governments';
329
+ /**
330
+ * Query param: Sort order for results
331
+ */
332
+ order?: 'total_holdings_usd_desc' | 'total_holdings_usd_asc';
333
+ /**
334
+ * Query param: Page number to return
335
+ */
336
+ page?: number;
337
+ /**
338
+ * Query param: Number of results to return per page
339
+ */
340
+ per_page?: number;
341
+ }
342
+ export interface PublicTreasuryGetEntityIDParams {
343
+ /**
344
+ * include holding amount change for specified timeframes, comma-separated if
345
+ * querying more than 1 timeframe Valid values: 7d, 14d, 30d, 90d, 1y, ytd
346
+ */
347
+ holding_amount_change?: string;
348
+ /**
349
+ * include holding change percentage for specified timeframes, comma-separated if
350
+ * querying more than 1 timeframe Valid values: 7d, 14d, 30d, 90d, 1y, ytd
351
+ */
352
+ holding_change_percentage?: string;
353
+ }
354
+ export interface PublicTreasuryGetHoldingChartParams {
355
+ /**
356
+ * Path param: public company or government entity ID \*refers to
357
+ * [`/entities/list`](/reference/entities-list).
358
+ */
359
+ entity_id: string;
360
+ /**
361
+ * Query param: data up to number of days ago Valid values:
362
+ * `7, 14, 30, 90, 180, 365, 730, max`
363
+ */
364
+ days: string;
365
+ /**
366
+ * Query param: include empty intervals with no transaction data, default: false
367
+ */
368
+ include_empty_intervals?: boolean;
369
+ }
370
+ export interface PublicTreasuryGetTransactionHistoryParams {
371
+ /**
372
+ * filter transactions by coin IDs, comma-separated if querying more than 1 coin
373
+ * \*refers to [`/coins/list`](/reference/coins-list).
374
+ */
375
+ coin_ids?: string;
376
+ /**
377
+ * use this to sort the order of transactions, default: `date_desc`
378
+ */
379
+ order?: 'date_desc' | 'date_asc' | 'holding_net_change_desc' | 'holding_net_change_asc' | 'transaction_value_usd_desc' | 'transaction_value_usd_asc' | 'average_cost_desc' | 'average_cost_asc';
380
+ /**
381
+ * page through results, default: `1`
382
+ */
383
+ page?: number;
384
+ /**
385
+ * total results per page, default: `100` Valid values: 1...250
386
+ */
387
+ per_page?: number;
133
388
  }
134
389
  export declare namespace PublicTreasury {
135
- export { type PublicTreasuryGetCoinIDResponse as PublicTreasuryGetCoinIDResponse, type PublicTreasuryGetEntityIDResponse as PublicTreasuryGetEntityIDResponse, type PublicTreasuryGetCoinIDParams as PublicTreasuryGetCoinIDParams, };
390
+ export { type PublicTreasuryGetCoinIDResponse as PublicTreasuryGetCoinIDResponse, type PublicTreasuryGetEntityIDResponse as PublicTreasuryGetEntityIDResponse, type PublicTreasuryGetHoldingChartResponse as PublicTreasuryGetHoldingChartResponse, type PublicTreasuryGetTransactionHistoryResponse as PublicTreasuryGetTransactionHistoryResponse, type PublicTreasuryGetCoinIDParams as PublicTreasuryGetCoinIDParams, type PublicTreasuryGetEntityIDParams as PublicTreasuryGetEntityIDParams, type PublicTreasuryGetHoldingChartParams as PublicTreasuryGetHoldingChartParams, type PublicTreasuryGetTransactionHistoryParams as PublicTreasuryGetTransactionHistoryParams, };
136
391
  }
137
392
  //# sourceMappingURL=public-treasury.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-treasury.d.ts","sourceRoot":"","sources":["../src/resources/public-treasury.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;OAWG;IACH,SAAS,CACP,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,6BAA6B,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,+BAA+B,CAAC;IAK9C;;;;;;;;;;OAUG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,iCAAiC,CAAC;CAGvG;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAE3D;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,yBAAiB,+BAA+B,CAAC;IAC/C,UAAiB,OAAO;QACtB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;QAEjC;;WAEG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAE/B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;CACF;AAED,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC;IAE5D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yBAAiB,iCAAiC,CAAC;IACjD,UAAiB,OAAO;QACtB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;KACrC;CACF;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,OAAO,EACL,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,6BAA6B,IAAI,6BAA6B,GACpE,CAAC;CACH"}
1
+ {"version":3,"file":"public-treasury.d.ts","sourceRoot":"","sources":["../src/resources/public-treasury.ts"],"names":[],"mappings":"OAEO,EAAE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;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,yCAAyC;IACxD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EACF,WAAW,GACX,UAAU,GACV,yBAAyB,GACzB,wBAAwB,GACxB,4BAA4B,GAC5B,2BAA2B,GAC3B,mBAAmB,GACnB,kBAAkB,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,OAAO,EACL,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,2CAA2C,IAAI,2CAA2C,EAC/F,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,yCAAyC,IAAI,yCAAyC,GAC5F,CAAC;CACH"}
@@ -18,8 +18,8 @@ class PublicTreasury extends resource_1.APIResource {
18
18
  * ```
19
19
  */
20
20
  getCoinID(coinID, params, options) {
21
- const { entity } = params;
22
- return this._client.get((0, path_1.path) `/${entity}/public_treasury/${coinID}`, options);
21
+ const { entity, ...query } = params;
22
+ return this._client.get((0, path_1.path) `/${entity}/public_treasury/${coinID}`, { query, ...options });
23
23
  }
24
24
  /**
25
25
  * This endpoint allows you **query public companies & governments' cryptocurrency
@@ -32,8 +32,43 @@ class PublicTreasury extends resource_1.APIResource {
32
32
  * );
33
33
  * ```
34
34
  */
35
- getEntityID(entityID, options) {
36
- return this._client.get((0, path_1.path) `/public_treasury/${entityID}`, options);
35
+ getEntityID(entityID, query = {}, options) {
36
+ return this._client.get((0, path_1.path) `/public_treasury/${entityID}`, { query, ...options });
37
+ }
38
+ /**
39
+ * This endpoint allows you to **query historical cryptocurrency holdings chart of
40
+ * public companies & governments** by Entity ID and Coin ID
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const response =
45
+ * await client.publicTreasury.getHoldingChart('bitcoin', {
46
+ * entity_id: 'strategy',
47
+ * days: 'days',
48
+ * });
49
+ * ```
50
+ */
51
+ getHoldingChart(coinID, params, options) {
52
+ const { entity_id, ...query } = params;
53
+ return this._client.get((0, path_1.path) `/public_treasury/${entity_id}/${coinID}/holding_chart`, {
54
+ query,
55
+ ...options,
56
+ });
57
+ }
58
+ /**
59
+ * This endpoint allows you **query public companies & governments' cryptocurrency
60
+ * transaction history** by Entity ID
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const response =
65
+ * await client.publicTreasury.getTransactionHistory(
66
+ * 'strategy',
67
+ * );
68
+ * ```
69
+ */
70
+ getTransactionHistory(entityID, query = {}, options) {
71
+ return this._client.get((0, path_1.path) `/public_treasury/${entityID}/transaction_history`, { query, ...options });
37
72
  }
38
73
  }
39
74
  exports.PublicTreasury = PublicTreasury;
@@ -1 +1 @@
1
- {"version":3,"file":"public-treasury.js","sourceRoot":"","sources":["../src/resources/public-treasury.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,cAAe,SAAQ,sBAAW;IAC7C;;;;;;;;;;;OAWG;IACH,SAAS,CACP,MAAc,EACd,MAAqC,EACrC,OAAwB;QAExB,MAAM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C,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,oBAAoB,SAAS,IAAI,MAAM,gBAAgB,EAAE;YACnF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,qBAAqB,CACnB,QAAgB,EAChB,QAAsE,EAAE,EACxE,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,oBAAoB,QAAQ,sBAAsB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;CACF;AArFD,wCAqFC"}
@@ -15,8 +15,8 @@ export class PublicTreasury extends APIResource {
15
15
  * ```
16
16
  */
17
17
  getCoinID(coinID, params, options) {
18
- const { entity } = params;
19
- return this._client.get(path `/${entity}/public_treasury/${coinID}`, options);
18
+ const { entity, ...query } = params;
19
+ return this._client.get(path `/${entity}/public_treasury/${coinID}`, { query, ...options });
20
20
  }
21
21
  /**
22
22
  * This endpoint allows you **query public companies & governments' cryptocurrency
@@ -29,8 +29,43 @@ export class PublicTreasury extends APIResource {
29
29
  * );
30
30
  * ```
31
31
  */
32
- getEntityID(entityID, options) {
33
- return this._client.get(path `/public_treasury/${entityID}`, options);
32
+ getEntityID(entityID, query = {}, options) {
33
+ return this._client.get(path `/public_treasury/${entityID}`, { query, ...options });
34
+ }
35
+ /**
36
+ * This endpoint allows you to **query historical cryptocurrency holdings chart of
37
+ * public companies & governments** by Entity ID and Coin ID
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response =
42
+ * await client.publicTreasury.getHoldingChart('bitcoin', {
43
+ * entity_id: 'strategy',
44
+ * days: 'days',
45
+ * });
46
+ * ```
47
+ */
48
+ getHoldingChart(coinID, params, options) {
49
+ const { entity_id, ...query } = params;
50
+ return this._client.get(path `/public_treasury/${entity_id}/${coinID}/holding_chart`, {
51
+ query,
52
+ ...options,
53
+ });
54
+ }
55
+ /**
56
+ * This endpoint allows you **query public companies & governments' cryptocurrency
57
+ * transaction history** by Entity ID
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const response =
62
+ * await client.publicTreasury.getTransactionHistory(
63
+ * 'strategy',
64
+ * );
65
+ * ```
66
+ */
67
+ getTransactionHistory(entityID, query = {}, options) {
68
+ return this._client.get(path `/public_treasury/${entityID}/transaction_history`, { query, ...options });
34
69
  }
35
70
  }
36
71
  //# sourceMappingURL=public-treasury.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-treasury.mjs","sourceRoot":"","sources":["../src/resources/public-treasury.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;OAWG;IACH,SAAS,CACP,MAAc,EACd,MAAqC,EACrC,OAAwB;QAExB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,IAAI,MAAM,oBAAoB,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,WAAW,CAAC,QAAgB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACF"}
1
+ {"version":3,"file":"public-treasury.mjs","sourceRoot":"","sources":["../src/resources/public-treasury.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C;;;;;;;;;;;OAWG;IACH,SAAS,CACP,MAAc,EACd,MAAqC,EACrC,OAAwB;QAExB,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,IAAI,MAAM,oBAAoB,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;;;;;;;;OAUG;IACH,WAAW,CACT,QAAgB,EAChB,QAA4D,EAAE,EAC9D,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,eAAe,CACb,MAAc,EACd,MAA2C,EAC3C,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,SAAS,IAAI,MAAM,gBAAgB,EAAE;YACnF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,qBAAqB,CACnB,QAAgB,EAChB,QAAsE,EAAE,EACxE,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,QAAQ,sBAAsB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -29,7 +29,12 @@ import {
29
29
  PublicTreasury,
30
30
  PublicTreasuryGetCoinIDParams,
31
31
  PublicTreasuryGetCoinIDResponse,
32
+ PublicTreasuryGetEntityIDParams,
32
33
  PublicTreasuryGetEntityIDResponse,
34
+ PublicTreasuryGetHoldingChartParams,
35
+ PublicTreasuryGetHoldingChartResponse,
36
+ PublicTreasuryGetTransactionHistoryParams,
37
+ PublicTreasuryGetTransactionHistoryResponse,
33
38
  } from './resources/public-treasury';
34
39
  import { TokenListGetAllJsonResponse, TokenLists } from './resources/token-lists';
35
40
  import { CoinGetIDParams, CoinGetIDResponse, Coins } from './resources/coins/coins';
@@ -173,7 +178,7 @@ export class Coingecko {
173
178
  baseURL: string;
174
179
  maxRetries: number;
175
180
  timeout: number;
176
- logger: Logger | undefined;
181
+ logger: Logger;
177
182
  logLevel: LogLevel | undefined;
178
183
  fetchOptions: MergedRequestInit | undefined;
179
184
 
@@ -545,7 +550,7 @@ export class Coingecko {
545
550
  loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
546
551
 
547
552
  const errText = await response.text().catch((err: any) => castToError(err).message);
548
- const errJSON = safeJSON(errText);
553
+ const errJSON = safeJSON(errText) as any;
549
554
  const errMessage = errJSON ? undefined : errText;
550
555
 
551
556
  loggerFor(this).debug(
@@ -586,9 +591,10 @@ export class Coingecko {
586
591
  controller: AbortController,
587
592
  ): Promise<Response> {
588
593
  const { signal, method, ...options } = init || {};
589
- if (signal) signal.addEventListener('abort', () => controller.abort());
594
+ const abort = this._makeAbort(controller);
595
+ if (signal) signal.addEventListener('abort', abort, { once: true });
590
596
 
591
- const timeout = setTimeout(() => controller.abort(), ms);
597
+ const timeout = setTimeout(abort, ms);
592
598
 
593
599
  const isReadableBody =
594
600
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -755,6 +761,12 @@ export class Coingecko {
755
761
  return headers.values;
756
762
  }
757
763
 
764
+ private _makeAbort(controller: AbortController) {
765
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
766
+ // would capture all request options, and cause a memory leak.
767
+ return () => controller.abort();
768
+ }
769
+
758
770
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
759
771
  bodyHeaders: HeadersLike;
760
772
  body: BodyInit | undefined;
@@ -787,6 +799,14 @@ export class Coingecko {
787
799
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
788
800
  ) {
789
801
  return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
802
+ } else if (
803
+ typeof body === 'object' &&
804
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
805
+ ) {
806
+ return {
807
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
808
+ body: this.stringifyQuery(body as Record<string, unknown>),
809
+ };
790
810
  } else {
791
811
  return this.#encoder({ body, headers });
792
812
  }
@@ -900,7 +920,12 @@ export declare namespace Coingecko {
900
920
  PublicTreasury as PublicTreasury,
901
921
  type PublicTreasuryGetCoinIDResponse as PublicTreasuryGetCoinIDResponse,
902
922
  type PublicTreasuryGetEntityIDResponse as PublicTreasuryGetEntityIDResponse,
923
+ type PublicTreasuryGetHoldingChartResponse as PublicTreasuryGetHoldingChartResponse,
924
+ type PublicTreasuryGetTransactionHistoryResponse as PublicTreasuryGetTransactionHistoryResponse,
903
925
  type PublicTreasuryGetCoinIDParams as PublicTreasuryGetCoinIDParams,
926
+ type PublicTreasuryGetEntityIDParams as PublicTreasuryGetEntityIDParams,
927
+ type PublicTreasuryGetHoldingChartParams as PublicTreasuryGetHoldingChartParams,
928
+ type PublicTreasuryGetTransactionHistoryParams as PublicTreasuryGetTransactionHistoryParams,
904
929
  };
905
930
 
906
931
  export {
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Coingecko, props: APIRespo
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }
@@ -65,7 +65,7 @@ export interface CirculatingSupplyChartGetParams {
65
65
  /**
66
66
  * data interval
67
67
  */
68
- interval?: 'daily';
68
+ interval?: '5m' | 'hourly' | 'daily';
69
69
  }
70
70
 
71
71
  export interface CirculatingSupplyChartGetRangeParams {