1use serde::{Deserialize, Serialize};
2
3pub const BIRDEYE_URL: &str = "https://public-api.birdeye.so";
4
5#[derive(Debug, Serialize, Deserialize)]
6pub struct TokenOverviewResponse {
7 pub data: TokenData,
8 pub success: bool,
9}
10
11#[derive(Debug, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct TokenData {
14 pub address: String,
15 pub decimals: u8,
16 pub symbol: String,
17 pub name: String,
18 pub extensions: Extensions,
19 pub logo_uri: String,
20 pub liquidity: f64,
21 pub last_trade_unix_time: u64,
22 pub last_trade_human_time: String,
23 pub price: f64,
24 pub history_30m_price: f64,
25 pub price_change_30m_percent: f64,
26 pub history_1h_price: f64,
27 pub price_change_1h_percent: f64,
28 pub history_2h_price: f64,
29 pub price_change_2h_percent: f64,
30 pub history_4h_price: f64,
31 pub price_change_4h_percent: f64,
32 pub history_6h_price: f64,
33 pub price_change_6h_percent: f64,
34 pub history_8h_price: f64,
35 pub price_change_8h_percent: f64,
36 pub history_12h_price: f64,
37 pub price_change_12h_percent: f64,
38 pub history_24h_price: f64,
39 pub price_change_24h_percent: f64,
40 pub unique_wallet_30m: u64,
41 pub unique_wallet_history_30m: u64,
42 pub unique_wallet_30m_change_percent: f64,
43 pub unique_wallet_1h: u64,
44 pub unique_wallet_history_1h: u64,
45 pub unique_wallet_1h_change_percent: f64,
46 pub unique_wallet_2h: u64,
47 pub unique_wallet_history_2h: u64,
48 pub unique_wallet_2h_change_percent: f64,
49 pub unique_wallet_4h: u64,
50 pub unique_wallet_history_4h: u64,
51 pub unique_wallet_4h_change_percent: f64,
52 pub unique_wallet_8h: u64,
53 pub unique_wallet_history_8h: u64,
54 pub unique_wallet_8h_change_percent: f64,
55 pub unique_wallet_24h: u64,
56 pub unique_wallet_history_24h: u64,
57 pub unique_wallet_24h_change_percent: f64,
58 pub supply: f64,
59 pub mc: f64,
60 pub circulating_supply: f64,
61 pub real_mc: f64,
62 pub holder: u64,
63 pub trade_30m: u64,
64 pub trade_history_30m: u64,
65 pub trade_30m_change_percent: f64,
66 pub sell_30m: u64,
67 pub sell_history_30m: u64,
68 pub sell_30m_change_percent: f64,
69 pub buy_30m: u64,
70 pub buy_history_30m: u64,
71 pub buy_30m_change_percent: f64,
72 pub v_30m: f64,
73 pub v_30m_usd: f64,
74 pub v_history_30m: f64,
75 pub v_history_30m_usd: f64,
76 pub v_30m_change_percent: f64,
77 pub v_buy_30m: f64,
78 pub v_buy_30m_usd: f64,
79 pub v_buy_history_30m: f64,
80 pub v_buy_history_30m_usd: f64,
81 pub v_buy_30m_change_percent: f64,
82 pub v_sell_30m: f64,
83 pub v_sell_30m_usd: f64,
84 pub v_sell_history_30m: f64,
85 pub v_sell_history_30m_usd: f64,
86 pub v_sell_30m_change_percent: f64,
87 pub trade_1h: u64,
88 pub trade_history_1h: u64,
89 pub trade_1h_change_percent: f64,
90 pub sell_1h: u64,
91 pub sell_history_1h: u64,
92 pub sell_1h_change_percent: f64,
93 pub buy_1h: u64,
94 pub buy_history_1h: u64,
95 pub buy_1h_change_percent: f64,
96 pub v_1h: f64,
97 pub v_1h_usd: f64,
98 pub v_history_1h: f64,
99 pub v_history_1h_usd: f64,
100 pub v_1h_change_percent: f64,
101 pub v_buy_1h: f64,
102 pub v_buy_1h_usd: f64,
103 pub v_buy_history_1h: f64,
104 pub v_buy_history_1h_usd: f64,
105 pub v_buy_1h_change_percent: f64,
106 pub v_sell_1h: f64,
107 pub v_sell_1h_usd: f64,
108 pub v_sell_history_1h: f64,
109 pub v_sell_history_1h_usd: f64,
110 pub v_sell_1h_change_percent: f64,
111 pub trade_2h: u64,
112 pub trade_history_2h: u64,
113 pub trade_2h_change_percent: f64,
114 pub sell_2h: u64,
115 pub sell_history_2h: u64,
116 pub sell_2h_change_percent: f64,
117 pub buy_2h: u64,
118 pub buy_history_2h: u64,
119 pub buy_2h_change_percent: f64,
120 pub v_2h: f64,
121 pub v_2h_usd: f64,
122 pub v_history_2h: f64,
123 pub v_history_2h_usd: f64,
124 pub v_2h_change_percent: f64,
125 pub v_buy_2h: f64,
126 pub v_buy_2h_usd: f64,
127 pub v_buy_history_2h: f64,
128 pub v_buy_history_2h_usd: f64,
129 pub v_buy_2h_change_percent: f64,
130 pub v_sell_2h: f64,
131 pub v_sell_2h_usd: f64,
132 pub v_sell_history_2h: f64,
133 pub v_sell_history_2h_usd: f64,
134 pub v_sell_2h_change_percent: f64,
135 pub trade_4h: u64,
136 pub trade_history_4h: u64,
137 pub trade_4h_change_percent: f64,
138 pub sell_4h: u64,
139 pub sell_history_4h: u64,
140 pub sell_4h_change_percent: f64,
141 pub buy_4h: u64,
142 pub buy_history_4h: u64,
143 pub buy_4h_change_percent: f64,
144 pub v_4h: f64,
145 pub v_4h_usd: f64,
146 pub v_history_4h: f64,
147 pub v_history_4h_usd: f64,
148 pub v_4h_change_percent: f64,
149 pub v_buy_4h: f64,
150 pub v_buy_4h_usd: f64,
151 pub v_buy_history_4h: f64,
152 pub v_buy_history_4h_usd: f64,
153 pub v_buy_4h_change_percent: f64,
154 pub v_sell_4h: f64,
155 pub v_sell_4h_usd: f64,
156 pub v_sell_history_4h: f64,
157 pub v_sell_history_4h_usd: f64,
158 pub v_sell_4h_change_percent: f64,
159 pub trade_8h: u64,
160 pub trade_history_8h: u64,
161 pub trade_8h_change_percent: f64,
162 pub sell_8h: u64,
163 pub sell_history_8h: u64,
164 pub sell_8h_change_percent: f64,
165 pub buy_8h: u64,
166 pub buy_history_8h: u64,
167 pub buy_8h_change_percent: f64,
168 pub v_8h: f64,
169 pub v_8h_usd: f64,
170 pub v_history_8h: f64,
171 pub v_history_8h_usd: f64,
172 pub v_8h_change_percent: f64,
173 pub v_buy_8h: f64,
174 pub v_buy_8h_usd: f64,
175 pub v_buy_history_8h: f64,
176 pub v_buy_history_8h_usd: f64,
177 pub v_buy_8h_change_percent: f64,
178 pub v_sell_8h: f64,
179 pub v_sell_8h_usd: f64,
180 pub v_sell_history_8h: f64,
181 pub v_sell_history_8h_usd: f64,
182 pub v_sell_8h_change_percent: f64,
183 pub trade_24h: u64,
184 pub trade_history_24h: u64,
185 pub trade_24h_change_percent: f64,
186 pub sell_24h: u64,
187 pub sell_history_24h: u64,
188 pub sell_24h_change_percent: f64,
189 pub buy_24h: u64,
190 pub buy_history_24h: u64,
191 pub buy_24h_change_percent: f64,
192 pub v_24h: f64,
193 pub v_24h_usd: f64,
194 pub v_history_24h: f64,
195 pub v_history_24h_usd: f64,
196 pub v_24h_change_percent: f64,
197 pub v_buy_24h: f64,
198 pub v_buy_24h_usd: f64,
199 pub v_buy_history_24h: f64,
200 pub v_buy_history_24h_usd: f64,
201 pub v_buy_24h_change_percent: f64,
202 pub v_sell_24h: f64,
203 pub v_sell_24h_usd: f64,
204 pub v_sell_history_24h: f64,
205 pub v_sell_history_24h_usd: f64,
206 pub v_sell_24h_change_percent: f64,
207 pub watch: Option<String>,
208 pub number_markets: u64,
209}
210
211#[derive(Debug, Serialize, Deserialize)]
212#[serde(rename_all = "camelCase")]
213pub struct Extensions {
214 pub coingecko_id: String,
215 pub serum_v3_usdc: String,
216 pub serum_v3_usdt: String,
217 pub website: String,
218 pub telegram: Option<String>,
219 pub twitter: String,
220 pub description: String,
221 pub discord: String,
222 pub medium: String,
223}
224
225#[derive(Debug, Serialize, Deserialize)]
226#[serde(rename_all = "camelCase")]
227pub struct MarketData {
228 pub address: String,
229 pub price: f64,
230 pub liquidity: f64,
231 pub supply: f64,
232 pub marketcap: f64,
233 pub circulating_supply: f64,
234 pub circulating_marketcap: f64,
235}
236
237#[derive(Debug, Serialize, Deserialize)]
238pub struct MarketDataResponse {
239 pub data: MarketData,
240 pub success: bool,
241}
242
243#[derive(Debug, Serialize, Deserialize, Clone)]
245pub struct WalletPortfolioResponse {
246 pub success: bool,
247 pub data: WalletPortfolio,
248}
249
250#[derive(Debug, Serialize, Deserialize, Clone, Default)]
251pub struct WalletPortfolio {
252 pub wallet: String,
253 pub total_usd: Option<f64>,
254 pub items: Vec<TokenMetadata>,
255}
256
257#[derive(Debug, Serialize, Deserialize, Clone, Default)]
258pub struct TokenMetadata {
259 pub address: String,
260 pub decimals: u8,
261 pub balance: u64,
262
263 #[serde(rename = "uiAmount")]
264 pub ui_amount: f64,
265
266 #[serde(rename = "chainId")]
267 pub chain_id: String,
268
269 pub name: Option<String>,
270 pub symbol: Option<String>,
271 pub icon: Option<String>,
272
273 #[serde(rename = "logoURI")]
274 pub logo_uri: Option<String>,
275
276 #[serde(rename = "priceUsd")]
277 pub price_usd: Option<f64>,
278
279 pub value_usd: Option<f64>,
280}
281
282#[derive(Debug, Serialize, Deserialize, Clone, Default)]
288pub struct TokenHolderQueryParams {
289 pub address: String,
291
292 pub offset: Option<u32>,
294
295 pub limit: Option<u32>,
297}
298
299#[derive(Debug, Serialize, Deserialize, Clone)]
300pub struct TokenHolderResponse {
301 pub data: TokenHolderData,
302 pub success: bool,
303}
304
305#[derive(Debug, Serialize, Deserialize, Clone)]
306pub struct TokenHolderData {
307 pub items: Vec<TokenHolderInfo>,
308}
309
310#[derive(Debug, Serialize, Deserialize, Clone)]
311pub struct TokenHolderInfo {
312 pub amount: String,
313 pub decimals: u8,
314 pub mint: String,
315 pub owner: String,
316 pub token_account: String,
317 pub ui_amount: f64,
318}
319
320#[derive(Debug, Serialize, Deserialize)]
326pub struct TokenMetadataResponse {
327 pub data: TokenMetaData,
328 pub success: bool,
329}
330
331#[derive(Debug, Serialize, Deserialize)]
332pub struct TokenMetaData {
333 pub address: String,
334 pub name: String,
335 pub symbol: String,
336 pub decimals: u8,
337 pub extensions: Extensions,
338}
339
340#[derive(Debug, Serialize, Deserialize)]
346pub struct TokenPriceResponse {
347 pub data: TokenPriceData,
348 pub success: bool,
349}
350
351#[derive(Debug, Serialize, Deserialize)]
352#[serde(rename_all = "camelCase")]
353pub struct TokenPriceData {
354 pub value: f64,
355 pub update_unix_time: u64,
356 pub update_human_time: String,
357 pub price_change_24h: f64,
358 pub price_in_native: u8,
359}
360
361#[derive(Debug, Serialize, Deserialize)]
367pub struct TokenPriceVolumeQueryParams {
368 pub address: String,
370
371 pub vh: String,
373}
374
375impl TokenPriceVolumeQueryParams {
376 pub fn new(address: String, vh: String) -> Self {
377 Self { address, vh }
378 }
379}
380
381#[derive(Debug, Serialize, Deserialize)]
382pub struct TokenPriceVolumeResponse {
383 pub data: TokenPriceVolumeData,
384 pub success: bool,
385}
386
387#[derive(Debug, Serialize, Deserialize)]
388#[serde(rename_all = "camelCase")]
389pub struct TokenPriceVolumeData {
390 price: f64,
391 update_unix_time: u64,
392 update_human_time: String,
393 volume_usd: f64,
394 volume_change_percent: f64,
395 price_change_percent: f64,
396}
397
398#[derive(Debug, Serialize, Deserialize)]
404pub struct TokenTrendingQueryParams {
405 pub sort_by: String,
407
408 pub sort_type: String,
410
411 pub offset: Option<u32>,
413
414 pub limit: Option<u32>,
416}
417
418impl TokenTrendingQueryParams {
419 pub fn new(sort_by: String, sort_type: String, offset: Option<u32>, limit: Option<u32>) -> Self {
420 Self { sort_by, sort_type, offset, limit }
421 }
422}
423
424#[derive(Debug, Serialize, Deserialize)]
425pub struct TokenTrendingResponse {
426 pub data: TokenTrendingData,
427 pub success: bool,
428}
429
430#[derive(Debug, Serialize, Deserialize)]
431pub struct TokenTrendingData {
432 pub update_unix_time: u64,
433 pub update_time: String,
434 pub tokens: Vec<Token>,
435 pub total: u32,
436}
437
438#[derive(Debug, Serialize, Deserialize)]
439pub struct Token {
440 pub address: String,
441 pub decimals: u8,
442 pub liquidity: f64,
443
444 #[serde(rename = "logoURI")]
445 pub logo_uri: Option<String>,
446
447 pub name: String,
448 pub symbol: String,
449
450 #[serde(rename = "volume24hUSD")]
451 pub volume_24h_usd: f64,
452
453 #[serde(rename = "volume24hChangePercent")]
454 pub volume_24h_change_percent: f64,
455
456 pub fdv: f64,
457 pub marketcap: f64,
458 pub rank: u32,
459 pub price: f64,
460
461 #[serde(rename = "price24hChangePercent")]
462 pub price_24h_change_percent: f64,
463}