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: Option<Extensions>,
19 pub logo_uri: Option<String>,
20 pub liquidity: Option<f64>,
21 pub last_trade_unix_time: Option<u64>,
22 pub last_trade_human_time: Option<String>,
23 pub price: Option<f64>,
24 pub history_30m_price: Option<f64>,
25 pub price_change_30m_percent: Option<f64>,
26 pub history_1h_price: Option<f64>,
27 pub price_change_1h_percent: Option<f64>,
28 pub history_2h_price: Option<f64>,
29 pub price_change_2h_percent: Option<f64>,
30 pub history_4h_price: Option<f64>,
31 pub price_change_4h_percent: Option<f64>,
32 pub history_6h_price: Option<f64>,
33 pub price_change_6h_percent: Option<f64>,
34 pub history_8h_price: Option<f64>,
35 pub price_change_8h_percent: Option<f64>,
36 pub history_12h_price: Option<f64>,
37 pub price_change_12h_percent: Option<f64>,
38 pub history_24h_price: Option<f64>,
39 pub price_change_24h_percent: Option<f64>,
40 pub unique_wallet_30m: Option<u64>,
41 pub unique_wallet_history_30m: Option<u64>,
42 pub unique_wallet_30m_change_percent: Option<f64>,
43 pub unique_wallet_1h: Option<u64>,
44 pub unique_wallet_history_1h: Option<u64>,
45 pub unique_wallet_1h_change_percent: Option<f64>,
46 pub unique_wallet_2h: Option<u64>,
47 pub unique_wallet_history_2h: Option<u64>,
48 pub unique_wallet_2h_change_percent: Option<f64>,
49 pub unique_wallet_4h: Option<u64>,
50 pub unique_wallet_history_4h: Option<u64>,
51 pub unique_wallet_4h_change_percent: Option<f64>,
52 pub unique_wallet_8h: Option<u64>,
53 pub unique_wallet_history_8h: Option<u64>,
54 pub unique_wallet_8h_change_percent: Option<f64>,
55 pub unique_wallet_24h: Option<u64>,
56 pub unique_wallet_history_24h: Option<u64>,
57 pub unique_wallet_24h_change_percent: Option<f64>,
58 pub supply: Option<f64>,
59 pub mc: Option<f64>,
60 pub circulating_supply: Option<f64>,
61 pub real_mc: Option<f64>,
62 pub holder: Option<u64>,
63 pub trade_30m: Option<u64>,
64 pub trade_history_30m: Option<u64>,
65 pub trade_30m_change_percent: Option<f64>,
66 pub sell_30m: Option<u64>,
67 pub sell_history_30m: Option<u64>,
68 pub sell_30m_change_percent: Option<f64>,
69 pub buy_30m: Option<u64>,
70 pub buy_history_30m: Option<u64>,
71 pub buy_30m_change_percent: Option<f64>,
72 pub v_30m: Option<f64>,
73 pub v_30m_usd: Option<f64>,
74 pub v_history_30m: Option<f64>,
75 pub v_history_30m_usd: Option<f64>,
76 pub v_30m_change_percent: Option<f64>,
77 pub v_buy_30m: Option<f64>,
78 pub v_buy_30m_usd: Option<f64>,
79 pub v_buy_history_30m: Option<f64>,
80 pub v_buy_history_30m_usd: Option<f64>,
81 pub v_buy_30m_change_percent: Option<f64>,
82 pub v_sell_30m: Option<f64>,
83 pub v_sell_30m_usd: Option<f64>,
84 pub v_sell_history_30m: Option<f64>,
85 pub v_sell_history_30m_usd: Option<f64>,
86 pub v_sell_30m_change_percent: Option<f64>,
87 pub trade_1h: Option<u64>,
88 pub trade_history_1h: Option<u64>,
89 pub trade_1h_change_percent: Option<f64>,
90 pub sell_1h: Option<u64>,
91 pub sell_history_1h: Option<u64>,
92 pub sell_1h_change_percent: Option<f64>,
93 pub buy_1h: Option<u64>,
94 pub buy_history_1h: Option<u64>,
95 pub buy_1h_change_percent: Option<f64>,
96 pub v_1h: Option<f64>,
97 pub v_1h_usd: Option<f64>,
98 pub v_history_1h: Option<f64>,
99 pub v_history_1h_usd: Option<f64>,
100 pub v_1h_change_percent: Option<f64>,
101 pub v_buy_1h: Option<f64>,
102 pub v_buy_1h_usd: Option<f64>,
103 pub v_buy_history_1h: Option<f64>,
104 pub v_buy_history_1h_usd: Option<f64>,
105 pub v_buy_1h_change_percent: Option<f64>,
106 pub v_sell_1h: Option<f64>,
107 pub v_sell_1h_usd: Option<f64>,
108 pub v_sell_history_1h: Option<f64>,
109 pub v_sell_history_1h_usd: Option<f64>,
110 pub v_sell_1h_change_percent: Option<f64>,
111 pub trade_2h: Option<u64>,
112 pub trade_history_2h: Option<u64>,
113 pub trade_2h_change_percent: Option<f64>,
114 pub sell_2h: Option<u64>,
115 pub sell_history_2h: Option<u64>,
116 pub sell_2h_change_percent: Option<f64>,
117 pub buy_2h: Option<u64>,
118 pub buy_history_2h: Option<u64>,
119 pub buy_2h_change_percent: Option<f64>,
120 pub v_2h: Option<f64>,
121 pub v_2h_usd: Option<f64>,
122 pub v_history_2h: Option<f64>,
123 pub v_history_2h_usd: Option<f64>,
124 pub v_2h_change_percent: Option<f64>,
125 pub v_buy_2h: Option<f64>,
126 pub v_buy_2h_usd: Option<f64>,
127 pub v_buy_history_2h: Option<f64>,
128 pub v_buy_history_2h_usd: Option<f64>,
129 pub v_buy_2h_change_percent: Option<f64>,
130 pub v_sell_2h: Option<f64>,
131 pub v_sell_2h_usd: Option<f64>,
132 pub v_sell_history_2h: Option<f64>,
133 pub v_sell_history_2h_usd: Option<f64>,
134 pub v_sell_2h_change_percent: Option<f64>,
135 pub trade_4h: Option<u64>,
136 pub trade_history_4h: Option<u64>,
137 pub trade_4h_change_percent: Option<f64>,
138 pub sell_4h: Option<u64>,
139 pub sell_history_4h: Option<u64>,
140 pub sell_4h_change_percent: Option<f64>,
141 pub buy_4h: Option<u64>,
142 pub buy_history_4h: Option<u64>,
143 pub buy_4h_change_percent: Option<f64>,
144 pub v_4h: Option<f64>,
145 pub v_4h_usd: Option<f64>,
146 pub v_history_4h: Option<f64>,
147 pub v_history_4h_usd: Option<f64>,
148 pub v_4h_change_percent: Option<f64>,
149 pub v_buy_4h: Option<f64>,
150 pub v_buy_4h_usd: Option<f64>,
151 pub v_buy_history_4h: Option<f64>,
152 pub v_buy_history_4h_usd: Option<f64>,
153 pub v_buy_4h_change_percent: Option<f64>,
154 pub v_sell_4h: Option<f64>,
155 pub v_sell_4h_usd: Option<f64>,
156 pub v_sell_history_4h: Option<f64>,
157 pub v_sell_history_4h_usd: Option<f64>,
158 pub v_sell_4h_change_percent: Option<f64>,
159 pub trade_8h: Option<u64>,
160 pub trade_history_8h: Option<u64>,
161 pub trade_8h_change_percent: Option<f64>,
162 pub sell_8h: Option<u64>,
163 pub sell_history_8h: Option<u64>,
164 pub sell_8h_change_percent: Option<f64>,
165 pub buy_8h: Option<u64>,
166 pub buy_history_8h: Option<u64>,
167 pub buy_8h_change_percent: Option<f64>,
168 pub v_8h: Option<f64>,
169 pub v_8h_usd: Option<f64>,
170 pub v_history_8h: Option<f64>,
171 pub v_history_8h_usd: Option<f64>,
172 pub v_8h_change_percent: Option<f64>,
173 pub v_buy_8h: Option<f64>,
174 pub v_buy_8h_usd: Option<f64>,
175 pub v_buy_history_8h: Option<f64>,
176 pub v_buy_history_8h_usd: Option<f64>,
177 pub v_buy_8h_change_percent: Option<f64>,
178 pub v_sell_8h: Option<f64>,
179 pub v_sell_8h_usd: Option<f64>,
180 pub v_sell_history_8h: Option<f64>,
181 pub v_sell_history_8h_usd: Option<f64>,
182 pub v_sell_8h_change_percent: Option<f64>,
183 pub trade_24h: Option<u64>,
184 pub trade_history_24h: Option<u64>,
185 pub trade_24h_change_percent: Option<f64>,
186 pub sell_24h: Option<u64>,
187 pub sell_history_24h: Option<u64>,
188 pub sell_24h_change_percent: Option<f64>,
189 pub buy_24h: Option<u64>,
190 pub buy_history_24h: Option<u64>,
191 pub buy_24h_change_percent: Option<f64>,
192 pub v_24h: Option<f64>,
193 pub v_24h_usd: Option<f64>,
194 pub v_history_24h: Option<f64>,
195 pub v_history_24h_usd: Option<f64>,
196 pub v_24h_change_percent: Option<f64>,
197 pub v_buy_24h: Option<f64>,
198 pub v_buy_24h_usd: Option<f64>,
199 pub v_buy_history_24h: Option<f64>,
200 pub v_buy_history_24h_usd: Option<f64>,
201 pub v_buy_24h_change_percent: Option<f64>,
202 pub v_sell_24h: Option<f64>,
203 pub v_sell_24h_usd: Option<f64>,
204 pub v_sell_history_24h: Option<f64>,
205 pub v_sell_history_24h_usd: Option<f64>,
206 pub v_sell_24h_change_percent: Option<f64>,
207 pub watch: Option<String>,
208 pub number_markets: Option<u64>,
209}
210
211#[derive(Debug, Serialize, Deserialize)]
212#[serde(rename_all = "camelCase")]
213pub struct Extensions {
214 pub coingecko_id: Option<String>,
215 pub serum_v3_usdc: Option<String>,
216 pub serum_v3_usdt: Option<String>,
217 pub website: Option<String>,
218 pub telegram: Option<String>,
219 pub twitter: Option<String>,
220 pub description: Option<String>,
221 pub discord: Option<String>,
222 pub medium: Option<String>,
223}
224
225#[derive(Debug, Serialize, Deserialize)]
231pub struct TokenMarketDataResponse {
232 pub data: TokenMarketData,
233 pub success: bool,
234}
235
236#[derive(Debug, Serialize, Deserialize)]
237pub struct TokenMarketData {
238 pub address: String,
239 pub price: f64,
240 pub liquidity: f64,
241 pub supply: f64,
242 pub total_supply: f64,
243 pub circulating_supply: f64,
244 pub marketcap: f64,
245 pub fdv: f64,
246 pub circulating_marketcap: f64,
247 pub market_cap: f64,
248}
249
250#[derive(Debug, Serialize, Deserialize, Clone)]
252pub struct WalletPortfolioResponse {
253 pub success: bool,
254 pub data: WalletPortfolio,
255}
256
257#[derive(Debug, Serialize, Deserialize, Clone, Default)]
258pub struct WalletPortfolio {
259 pub wallet: String,
260 pub total_usd: Option<f64>,
261 pub items: Vec<TokenMetadata>,
262}
263
264#[derive(Debug, Serialize, Deserialize, Clone, Default)]
265pub struct TokenMetadata {
266 pub address: String,
267 pub decimals: u8,
268 pub balance: u64,
269
270 #[serde(rename = "uiAmount")]
271 pub ui_amount: f64,
272
273 #[serde(rename = "chainId")]
274 pub chain_id: String,
275
276 pub name: Option<String>,
277 pub symbol: Option<String>,
278 pub icon: Option<String>,
279
280 #[serde(rename = "logoURI")]
281 pub logo_uri: Option<String>,
282
283 #[serde(rename = "priceUsd")]
284 pub price_usd: Option<f64>,
285
286 pub value_usd: Option<f64>,
287}
288#[derive(Debug, Serialize, Deserialize, Clone, Default)]
294pub struct TokenHolderQueryParams {
295 pub address: String,
297
298 pub offset: Option<u32>,
300
301 pub limit: Option<u32>,
303}
304
305impl TokenHolderQueryParams {
306 pub fn new(address: String, offset: Option<u32>, limit: Option<u32>) -> Self {
307 Self { address, offset, limit }
308 }
309}
310
311#[derive(Debug, Serialize, Deserialize, Clone)]
312pub struct TokenHolderResponse {
313 pub data: TokenHolderData,
314 pub success: bool,
315}
316
317#[derive(Debug, Serialize, Deserialize, Clone)]
318pub struct TokenHolderData {
319 pub items: Vec<TokenHolderInfo>,
320}
321
322#[derive(Debug, Serialize, Deserialize, Clone)]
323pub struct TokenHolderInfo {
324 pub amount: String,
325 pub decimals: u8,
326 pub mint: String,
327 pub owner: String,
328 pub token_account: String,
329 pub ui_amount: f64,
330}
331
332#[derive(Debug, Serialize, Deserialize)]
338pub struct TokenMetadataResponse {
339 pub data: TokenMetaData,
340 pub success: bool,
341}
342
343#[derive(Debug, Serialize, Deserialize)]
344pub struct TokenMetaData {
345 pub address: String,
346 pub name: String,
347 pub symbol: String,
348 pub decimals: u8,
349 pub extensions: Extensions,
350 pub logo_uri: Option<String>,
351}
352
353#[derive(Debug, Serialize, Deserialize)]
359pub struct TokenPriceResponse {
360 pub data: TokenPriceData,
361 pub success: bool,
362}
363
364#[derive(Debug, Serialize, Deserialize)]
365#[serde(rename_all = "camelCase")]
366pub struct TokenPriceData {
367 pub value: f64,
368 pub update_unix_time: u64,
369 pub update_human_time: String,
370 pub price_change_24h: f64,
371 pub price_in_native: u8,
372}
373
374#[derive(Debug, Serialize, Deserialize)]
380pub struct TokenPriceVolumeQueryParams {
381 pub address: String,
383
384 pub vh: String,
386}
387
388impl TokenPriceVolumeQueryParams {
389 pub fn new(address: String, vh: String) -> Self {
390 Self { address, vh }
391 }
392}
393
394#[derive(Debug, Serialize, Deserialize)]
395pub struct TokenPriceVolumeResponse {
396 pub data: TokenPriceVolumeData,
397 pub success: bool,
398}
399
400#[derive(Debug, Serialize, Deserialize)]
401#[serde(rename_all = "camelCase")]
402pub struct TokenPriceVolumeData {
403 price: f64,
404 update_unix_time: u64,
405 update_human_time: String,
406
407 #[serde(rename = "volumeUSD")]
408 volume_usd: f64,
409
410 volume_change_percent: f64,
411 price_change_percent: f64,
412}
413
414#[derive(Debug, Serialize, Deserialize)]
420pub struct TokenTrendingQueryParams {
421 pub sort_by: String,
423
424 pub sort_type: String,
426
427 pub offset: Option<u32>,
429
430 pub limit: Option<u32>,
432}
433
434impl TokenTrendingQueryParams {
435 pub fn new(sort_by: String, sort_type: String, offset: Option<u32>, limit: Option<u32>) -> Self {
436 Self { sort_by, sort_type, offset, limit }
437 }
438}
439
440#[derive(Debug, Serialize, Deserialize)]
441pub struct TokenTrendingResponse {
442 pub data: TokenTrendingData,
443 pub success: bool,
444}
445
446#[derive(Debug, Serialize, Deserialize)]
447#[serde(rename_all = "camelCase")]
448pub struct TokenTrendingData {
449 pub update_unix_time: u64,
450 pub update_time: String,
451 pub tokens: Vec<TokenInfo>,
452 pub total: u32,
453}
454
455#[derive(Debug, Serialize, Deserialize)]
456pub struct TokenInfo {
457 pub address: String,
458 pub decimals: u8,
459 pub liquidity: Option<f64>,
460
461 #[serde(rename = "logoURI")]
462 pub logo_uri: Option<String>,
463
464 pub name: String,
465 pub symbol: String,
466
467 #[serde(rename = "volume24hUSD")]
468 pub volume_24h_usd: Option<f64>,
469
470 #[serde(rename = "volume24hChangePercent")]
471 pub volume_24h_change_percent: Option<f64>,
472
473 pub fdv: Option<f64>,
474 pub marketcap: Option<f64>,
475 pub rank: Option<u32>,
476 pub price: f64,
477
478 #[serde(rename = "price24hChangePercent")]
479 pub price_24h_change_percent: Option<f64>,
480}
481
482#[derive(Debug, Serialize, Deserialize)]
488pub struct TokenMintOrBurnQueryParams {
489 pub address: String,
491
492 pub tx_type: String,
494
495 pub offset: Option<u32>,
497
498 pub limit: Option<u32>,
500}
501
502#[derive(Debug, Serialize, Deserialize)]
503pub struct TokenMintOrBurnResponse {
504 pub success: bool,
505 pub data: TokenMintOrBurnData,
506}
507
508#[derive(Debug, Serialize, Deserialize)]
509pub struct TokenMintOrBurnData {
510 pub items: Vec<TokenMintOrBurnItem>,
511}
512
513#[derive(Debug, Serialize, Deserialize)]
514pub struct TokenMintOrBurnItem {
515 pub amount: Option<String>,
516 pub block_human_time: Option<String>,
517 pub block_time: u64,
518 pub common_type: Option<String>,
519 pub decimals: u32,
520 pub mint: Option<String>,
521 pub program_id: String,
522 pub slot: u64,
523 pub tx_hash: String,
524 pub ui_amount: u64,
525 pub ui_amount_string: Option<String>,
526}
527
528#[derive(Debug, Serialize, Deserialize)]
534pub struct TokenOrMarketQueryParams {
535 pub keyword: String,
536
537 pub target: String,
539
540 pub offset: Option<u32>,
542
543 pub limit: Option<u32>,
545}
546
547#[derive(Debug, Serialize, Deserialize)]
548pub struct TokenOrMarketResponse {
549 pub success: bool,
550 pub data: TokenOrMarketData,
551}
552
553#[derive(Debug, Serialize, Deserialize)]
554pub struct TokenOrMarketData {
555 #[serde(rename = "type")]
556 pub data_type: String,
557
558 pub result: Vec<TokenOrMarketDataItem>,
559}
560
561#[derive(Debug, Serialize, Deserialize)]
562pub struct TokenOrMarketDataItem {
563 pub name: Option<String>,
564 pub symbol: Option<String>,
565 pub address: Option<String>,
566 pub decimals: u64,
567 pub fdv: Option<f64>,
568 pub market_cap: Option<f64>,
569 pub liquidity: u64,
570 pub volume_24h_change_percent: f64,
571 pub price: Option<f64>,
572 pub price_change_24h_percent: Option<f64>,
573 pub network: Option<String>,
574 pub buy_24h: u64,
575 pub buy_24h_change_percent: Option<f64>,
576 pub sell_24h: u64,
577 pub sell_24h_change_percent: Option<f64>,
578 pub trade_24h: u64,
579 pub trade_24h_change_percent: Option<f64>,
580 pub unique_wallet_24h: u64,
581 pub unique_view_24h_change_percent: Option<f64>,
582 pub last_trade_human_time: Option<String>,
583 pub last_trade_unix_time: u64,
584 pub creation_time: Option<String>,
585 pub volume_24h_usd: f64,
586 pub logo_uri: Option<String>,
587 pub verified: bool,
588}