solagent_plugin_birdeye/
primitive.rs

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// Wallet portfolio
244#[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}