@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.
- package/CHANGELOG.md +100 -0
- package/LICENSE +1 -1
- package/README.md +23 -10
- package/client.d.mts +4 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -3
- package/client.d.ts.map +1 -1
- package/client.js +15 -2
- package/client.js.map +1 -1
- package/client.mjs +15 -2
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/coins/circulating-supply-chart.d.mts +1 -1
- package/resources/coins/circulating-supply-chart.d.mts.map +1 -1
- package/resources/coins/circulating-supply-chart.d.ts +1 -1
- package/resources/coins/circulating-supply-chart.d.ts.map +1 -1
- package/resources/coins/coins.d.mts +158 -1
- package/resources/coins/coins.d.mts.map +1 -1
- package/resources/coins/coins.d.ts +158 -1
- package/resources/coins/coins.d.ts.map +1 -1
- package/resources/coins/coins.js.map +1 -1
- package/resources/coins/coins.mjs.map +1 -1
- package/resources/coins/contract/contract.d.mts +9 -1
- package/resources/coins/contract/contract.d.mts.map +1 -1
- package/resources/coins/contract/contract.d.ts +9 -1
- package/resources/coins/contract/contract.d.ts.map +1 -1
- package/resources/coins/contract/contract.js.map +1 -1
- package/resources/coins/contract/contract.mjs.map +1 -1
- package/resources/coins/contract/market-chart.d.mts +5 -1
- package/resources/coins/contract/market-chart.d.mts.map +1 -1
- package/resources/coins/contract/market-chart.d.ts +5 -1
- package/resources/coins/contract/market-chart.d.ts.map +1 -1
- package/resources/coins/contract/market-chart.js +5 -1
- package/resources/coins/contract/market-chart.js.map +1 -1
- package/resources/coins/contract/market-chart.mjs +5 -1
- package/resources/coins/contract/market-chart.mjs.map +1 -1
- package/resources/coins/history.d.mts +1 -1
- package/resources/coins/history.d.ts +1 -1
- package/resources/coins/market-chart.d.mts +5 -1
- package/resources/coins/market-chart.d.mts.map +1 -1
- package/resources/coins/market-chart.d.ts +5 -1
- package/resources/coins/market-chart.d.ts.map +1 -1
- package/resources/coins/market-chart.js +5 -1
- package/resources/coins/market-chart.js.map +1 -1
- package/resources/coins/market-chart.mjs +5 -1
- package/resources/coins/market-chart.mjs.map +1 -1
- package/resources/coins/markets.d.mts +9 -0
- package/resources/coins/markets.d.mts.map +1 -1
- package/resources/coins/markets.d.ts +9 -0
- package/resources/coins/markets.d.ts.map +1 -1
- package/resources/coins/tickers.d.mts +1 -1
- package/resources/coins/tickers.d.mts.map +1 -1
- package/resources/coins/tickers.d.ts +1 -1
- package/resources/coins/tickers.d.ts.map +1 -1
- package/resources/exchanges/exchanges.d.mts +3 -3
- package/resources/exchanges/exchanges.d.mts.map +1 -1
- package/resources/exchanges/exchanges.d.ts +3 -3
- package/resources/exchanges/exchanges.d.ts.map +1 -1
- package/resources/exchanges/tickers.d.mts +1 -1
- package/resources/exchanges/tickers.d.mts.map +1 -1
- package/resources/exchanges/tickers.d.ts +1 -1
- package/resources/exchanges/tickers.d.ts.map +1 -1
- package/resources/global/global.d.mts +4 -0
- package/resources/global/global.d.mts.map +1 -1
- package/resources/global/global.d.ts +4 -0
- package/resources/global/global.d.ts.map +1 -1
- package/resources/global/global.js.map +1 -1
- package/resources/global/global.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/key.d.mts +10 -0
- package/resources/key.d.mts.map +1 -1
- package/resources/key.d.ts +10 -0
- package/resources/key.d.ts.map +1 -1
- package/resources/onchain/networks/dexes.d.mts +8 -0
- package/resources/onchain/networks/dexes.d.mts.map +1 -1
- package/resources/onchain/networks/dexes.d.ts +8 -0
- package/resources/onchain/networks/dexes.d.ts.map +1 -1
- package/resources/onchain/networks/new-pools.d.mts +16 -0
- package/resources/onchain/networks/new-pools.d.mts.map +1 -1
- package/resources/onchain/networks/new-pools.d.ts +16 -0
- package/resources/onchain/networks/new-pools.d.ts.map +1 -1
- package/resources/onchain/networks/pools/info.d.mts +2 -0
- package/resources/onchain/networks/pools/info.d.mts.map +1 -1
- package/resources/onchain/networks/pools/info.d.ts +2 -0
- package/resources/onchain/networks/pools/info.d.ts.map +1 -1
- package/resources/onchain/networks/pools/pools.d.mts +8 -0
- package/resources/onchain/networks/pools/pools.d.mts.map +1 -1
- package/resources/onchain/networks/pools/pools.d.ts +8 -0
- package/resources/onchain/networks/pools/pools.d.ts.map +1 -1
- package/resources/onchain/networks/pools/pools.js.map +1 -1
- package/resources/onchain/networks/pools/pools.mjs.map +1 -1
- package/resources/onchain/networks/tokens/index.d.mts +1 -0
- package/resources/onchain/networks/tokens/index.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/index.d.ts +1 -0
- package/resources/onchain/networks/tokens/index.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/index.js +3 -1
- package/resources/onchain/networks/tokens/index.js.map +1 -1
- package/resources/onchain/networks/tokens/index.mjs +1 -0
- package/resources/onchain/networks/tokens/index.mjs.map +1 -1
- package/resources/onchain/networks/tokens/info.d.mts +2 -0
- package/resources/onchain/networks/tokens/info.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/info.d.ts +2 -0
- package/resources/onchain/networks/tokens/info.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/multi.d.mts +6 -0
- package/resources/onchain/networks/tokens/multi.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/multi.d.ts +6 -0
- package/resources/onchain/networks/tokens/multi.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/ohlcv.d.mts +5 -0
- package/resources/onchain/networks/tokens/ohlcv.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/ohlcv.d.ts +5 -0
- package/resources/onchain/networks/tokens/ohlcv.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/pools.d.mts +14 -0
- package/resources/onchain/networks/tokens/pools.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/pools.d.ts +14 -0
- package/resources/onchain/networks/tokens/pools.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/tokens.d.mts +10 -0
- package/resources/onchain/networks/tokens/tokens.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/tokens.d.ts +10 -0
- package/resources/onchain/networks/tokens/tokens.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/tokens.js +4 -0
- package/resources/onchain/networks/tokens/tokens.js.map +1 -1
- package/resources/onchain/networks/tokens/tokens.mjs +4 -0
- package/resources/onchain/networks/tokens/tokens.mjs.map +1 -1
- package/resources/onchain/networks/tokens/top-holders.d.mts +12 -0
- package/resources/onchain/networks/tokens/top-holders.d.mts.map +1 -1
- package/resources/onchain/networks/tokens/top-holders.d.ts +12 -0
- package/resources/onchain/networks/tokens/top-holders.d.ts.map +1 -1
- package/resources/onchain/networks/tokens/top-traders.d.mts +77 -0
- package/resources/onchain/networks/tokens/top-traders.d.mts.map +1 -0
- package/resources/onchain/networks/tokens/top-traders.d.ts +77 -0
- package/resources/onchain/networks/tokens/top-traders.d.ts.map +1 -0
- package/resources/onchain/networks/tokens/top-traders.js +30 -0
- package/resources/onchain/networks/tokens/top-traders.js.map +1 -0
- package/resources/onchain/networks/tokens/top-traders.mjs +26 -0
- package/resources/onchain/networks/tokens/top-traders.mjs.map +1 -0
- package/resources/onchain/networks/trending-pools.d.mts +16 -0
- package/resources/onchain/networks/trending-pools.d.mts.map +1 -1
- package/resources/onchain/networks/trending-pools.d.ts +16 -0
- package/resources/onchain/networks/trending-pools.d.ts.map +1 -1
- package/resources/onchain/pools/megafilter.d.mts +13 -1
- package/resources/onchain/pools/megafilter.d.mts.map +1 -1
- package/resources/onchain/pools/megafilter.d.ts +13 -1
- package/resources/onchain/pools/megafilter.d.ts.map +1 -1
- package/resources/onchain/simple/networks/token-price.d.mts +20 -0
- package/resources/onchain/simple/networks/token-price.d.mts.map +1 -1
- package/resources/onchain/simple/networks/token-price.d.ts +20 -0
- package/resources/onchain/simple/networks/token-price.d.ts.map +1 -1
- package/resources/public-treasury.d.mts +286 -31
- package/resources/public-treasury.d.mts.map +1 -1
- package/resources/public-treasury.d.ts +286 -31
- package/resources/public-treasury.d.ts.map +1 -1
- package/resources/public-treasury.js +39 -4
- package/resources/public-treasury.js.map +1 -1
- package/resources/public-treasury.mjs +39 -4
- package/resources/public-treasury.mjs.map +1 -1
- package/src/client.ts +29 -4
- package/src/internal/parse.ts +6 -0
- package/src/resources/coins/circulating-supply-chart.ts +1 -1
- package/src/resources/coins/coins.ts +193 -1
- package/src/resources/coins/contract/contract.ts +11 -1
- package/src/resources/coins/contract/market-chart.ts +5 -1
- package/src/resources/coins/history.ts +1 -1
- package/src/resources/coins/market-chart.ts +5 -1
- package/src/resources/coins/markets.ts +11 -0
- package/src/resources/coins/tickers.ts +1 -1
- package/src/resources/exchanges/exchanges.ts +3 -3
- package/src/resources/exchanges/tickers.ts +1 -1
- package/src/resources/global/global.ts +5 -0
- package/src/resources/index.ts +5 -0
- package/src/resources/key.ts +12 -0
- package/src/resources/onchain/networks/dexes.ts +12 -0
- package/src/resources/onchain/networks/new-pools.ts +24 -0
- package/src/resources/onchain/networks/pools/info.ts +4 -0
- package/src/resources/onchain/networks/pools/pools.ts +12 -0
- package/src/resources/onchain/networks/tokens/index.ts +1 -0
- package/src/resources/onchain/networks/tokens/info.ts +4 -0
- package/src/resources/onchain/networks/tokens/multi.ts +8 -0
- package/src/resources/onchain/networks/tokens/ohlcv.ts +6 -0
- package/src/resources/onchain/networks/tokens/pools.ts +20 -0
- package/src/resources/onchain/networks/tokens/tokens.ts +18 -0
- package/src/resources/onchain/networks/tokens/top-holders.ts +21 -0
- package/src/resources/onchain/networks/tokens/top-traders.ts +116 -0
- package/src/resources/onchain/networks/trending-pools.ts +24 -0
- package/src/resources/onchain/pools/megafilter.ts +19 -0
- package/src/resources/onchain/simple/networks/token-price.ts +16 -0
- package/src/resources/public-treasury.ts +386 -35
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- 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
|
-
*
|
|
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
|
-
|
|
43
|
+
getHoldingChart(coinID: string, params: PublicTreasuryGetHoldingChartParams, options?: RequestOptions): APIPromise<PublicTreasuryGetHoldingChartResponse>;
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
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
|
-
|
|
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
|
|
60
|
+
interface CompaniesTreasury {
|
|
61
|
+
companies: Array<CompaniesTreasury.Company>;
|
|
48
62
|
/**
|
|
49
|
-
*
|
|
63
|
+
* market cap dominance
|
|
50
64
|
*/
|
|
51
|
-
|
|
65
|
+
market_cap_dominance: number;
|
|
52
66
|
/**
|
|
53
|
-
*
|
|
67
|
+
* total crypto holdings of companies
|
|
54
68
|
*/
|
|
55
|
-
|
|
69
|
+
total_holdings: number;
|
|
56
70
|
/**
|
|
57
|
-
*
|
|
71
|
+
* total crypto holdings value in usd
|
|
58
72
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
*
|
|
110
|
+
* market cap dominance
|
|
66
111
|
*/
|
|
67
|
-
|
|
112
|
+
market_cap_dominance: number;
|
|
68
113
|
/**
|
|
69
|
-
* total
|
|
114
|
+
* total crypto holdings of governments
|
|
70
115
|
*/
|
|
71
|
-
|
|
116
|
+
total_holdings: number;
|
|
72
117
|
/**
|
|
73
|
-
* total crypto holdings
|
|
118
|
+
* total crypto holdings value in usd
|
|
74
119
|
*/
|
|
75
|
-
|
|
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,
|
|
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,CACT,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,+BAA+B,GAAG,IAAI,GAAG,SAAc,EAC9D,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,iCAAiC,CAAC;IAIhD;;;;;;;;;;;;OAYG;IACH,eAAe,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mCAAmC,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qCAAqC,CAAC;IAQpD;;;;;;;;;;;OAWG;IACH,qBAAqB,CACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,yCAAyC,GAAG,IAAI,GAAG,SAAc,EACxE,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2CAA2C,CAAC;CAG3D;AAED,MAAM,MAAM,+BAA+B,GACvC,+B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,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,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;
|
|
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,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,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,IAAA,WAAI,EAAA,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,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;
|
|
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
|
|
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
|
-
|
|
594
|
+
const abort = this._makeAbort(controller);
|
|
595
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
590
596
|
|
|
591
|
-
const timeout = setTimeout(
|
|
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 {
|
package/src/internal/parse.ts
CHANGED
|
@@ -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
|
}
|