binance_sdk/staking/rest_api/mod.rs
1/*
2 * Binance Staking REST API
3 *
4 * OpenAPI Specification for the Binance Staking REST API
5 *
6 * The version of the OpenAPI document: 1.0.0
7 *
8 *
9 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10 * https://openapi-generator.tech
11 * Do not edit the class manually.
12 */
13
14#![allow(unused_imports)]
15use http::Method;
16use serde::de::DeserializeOwned;
17use serde_json::Value;
18use std::collections::BTreeMap;
19
20use crate::common::{config::ConfigurationRestApi, models::RestApiResponse, utils::send_request};
21
22mod apis;
23mod models;
24
25pub use apis::*;
26pub use models::*;
27
28#[derive(Debug, Clone)]
29pub struct RestApi {
30 configuration: ConfigurationRestApi,
31 eth_staking_api_client: EthStakingApiClient,
32 on_chain_yields_api_client: OnChainYieldsApiClient,
33 soft_staking_api_client: SoftStakingApiClient,
34 sol_staking_api_client: SolStakingApiClient,
35}
36
37impl RestApi {
38 pub fn new(configuration: ConfigurationRestApi) -> Self {
39 let eth_staking_api_client = EthStakingApiClient::new(configuration.clone());
40 let on_chain_yields_api_client = OnChainYieldsApiClient::new(configuration.clone());
41 let soft_staking_api_client = SoftStakingApiClient::new(configuration.clone());
42 let sol_staking_api_client = SolStakingApiClient::new(configuration.clone());
43
44 Self {
45 configuration,
46 eth_staking_api_client,
47 on_chain_yields_api_client,
48 soft_staking_api_client,
49 sol_staking_api_client,
50 }
51 }
52
53 /// Send an unsigned request to the API
54 ///
55 /// # Arguments
56 ///
57 /// * `endpoint` - The API endpoint to send the request to
58 /// * `method` - The HTTP method to use for the request
59 /// * `query_params` - A map of query parameters to send with the request
60 /// * `body_params` - A map of body parameters to send with the request
61 ///
62 /// # Returns
63 ///
64 /// A `RestApiResponse` containing the deserialized response data on success, or an error if the request fails
65 ///
66 /// # Errors
67 ///
68 /// Returns an `anyhow::Error` if the HTTP request fails or if parsing the response fails
69 pub async fn send_request<R: DeserializeOwned + Send + 'static>(
70 &self,
71 endpoint: &str,
72 method: Method,
73 query_params: BTreeMap<String, Value>,
74 body_params: BTreeMap<String, Value>,
75 ) -> anyhow::Result<RestApiResponse<R>> {
76 send_request::<R>(
77 &self.configuration,
78 endpoint,
79 method,
80 query_params,
81 body_params,
82 None,
83 false,
84 )
85 .await
86 }
87
88 /// Send a signed request to the API
89 ///
90 /// # Arguments
91 ///
92 /// * `endpoint` - The API endpoint to send the request to
93 /// * `method` - The HTTP method to use for the request
94 /// * `query_params` - A map of query parameters to send with the request
95 /// * `body_params` - A map of body parameters to send with the request
96 ///
97 /// # Returns
98 ///
99 /// A `RestApiResponse` containing the deserialized response data on success, or an error if the request fails
100 ///
101 /// # Errors
102 ///
103 /// Returns an `anyhow::Error` if the HTTP request fails or if parsing the response fails
104 pub async fn send_signed_request<R: DeserializeOwned + Send + 'static>(
105 &self,
106 endpoint: &str,
107 method: Method,
108 query_params: BTreeMap<String, Value>,
109 body_params: BTreeMap<String, Value>,
110 ) -> anyhow::Result<RestApiResponse<R>> {
111 send_request::<R>(
112 &self.configuration,
113 endpoint,
114 method,
115 query_params,
116 body_params,
117 None,
118 true,
119 )
120 .await
121 }
122
123 /// ETH Staking `account(USER_DATA)`
124 ///
125 /// ETH Staking account
126 ///
127 /// Weight: 150
128 ///
129 /// # Arguments
130 ///
131 /// - `params`: [`EthStakingAccountParams`]
132 /// The parameters for this operation.
133 ///
134 /// # Returns
135 ///
136 /// [`RestApiResponse<models::EthStakingAccountResponse>`] on success.
137 ///
138 /// # Errors
139 ///
140 /// This function will return an [`anyhow::Error`] if:
141 /// - the HTTP request fails
142 /// - any parameter is invalid
143 /// - the response cannot be parsed
144 /// - or one of the following occurs:
145 /// - `RequiredError`
146 /// - `ConnectorClientError`
147 /// - `UnauthorizedError`
148 /// - `ForbiddenError`
149 /// - `TooManyRequestsError`
150 /// - `RateLimitBanError`
151 /// - `ServerError`
152 /// - `NotFoundError`
153 /// - `NetworkError`
154 /// - `BadRequestError`
155 ///
156 ///
157 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/account/ETH-Staking-account).
158 ///
159 pub async fn eth_staking_account(
160 &self,
161 params: EthStakingAccountParams,
162 ) -> anyhow::Result<RestApiResponse<models::EthStakingAccountResponse>> {
163 self.eth_staking_api_client
164 .eth_staking_account(params)
165 .await
166 }
167
168 /// Get current ETH staking `quota(USER_DATA)`
169 ///
170 /// Get current ETH staking quota
171 ///
172 /// Weight: 150
173 ///
174 /// # Arguments
175 ///
176 /// - `params`: [`GetCurrentEthStakingQuotaParams`]
177 /// The parameters for this operation.
178 ///
179 /// # Returns
180 ///
181 /// [`RestApiResponse<models::GetCurrentEthStakingQuotaResponse>`] on success.
182 ///
183 /// # Errors
184 ///
185 /// This function will return an [`anyhow::Error`] if:
186 /// - the HTTP request fails
187 /// - any parameter is invalid
188 /// - the response cannot be parsed
189 /// - or one of the following occurs:
190 /// - `RequiredError`
191 /// - `ConnectorClientError`
192 /// - `UnauthorizedError`
193 /// - `ForbiddenError`
194 /// - `TooManyRequestsError`
195 /// - `RateLimitBanError`
196 /// - `ServerError`
197 /// - `NotFoundError`
198 /// - `NetworkError`
199 /// - `BadRequestError`
200 ///
201 ///
202 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/account/Get-current-ETH-staking-quota).
203 ///
204 pub async fn get_current_eth_staking_quota(
205 &self,
206 params: GetCurrentEthStakingQuotaParams,
207 ) -> anyhow::Result<RestApiResponse<models::GetCurrentEthStakingQuotaResponse>> {
208 self.eth_staking_api_client
209 .get_current_eth_staking_quota(params)
210 .await
211 }
212
213 /// Get ETH redemption `history(USER_DATA)`
214 ///
215 /// Get ETH redemption history
216 ///
217 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
218 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
219 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
220 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
221 ///
222 /// Weight: 150
223 ///
224 /// # Arguments
225 ///
226 /// - `params`: [`GetEthRedemptionHistoryParams`]
227 /// The parameters for this operation.
228 ///
229 /// # Returns
230 ///
231 /// [`RestApiResponse<models::GetEthRedemptionHistoryResponse>`] on success.
232 ///
233 /// # Errors
234 ///
235 /// This function will return an [`anyhow::Error`] if:
236 /// - the HTTP request fails
237 /// - any parameter is invalid
238 /// - the response cannot be parsed
239 /// - or one of the following occurs:
240 /// - `RequiredError`
241 /// - `ConnectorClientError`
242 /// - `UnauthorizedError`
243 /// - `ForbiddenError`
244 /// - `TooManyRequestsError`
245 /// - `RateLimitBanError`
246 /// - `ServerError`
247 /// - `NotFoundError`
248 /// - `NetworkError`
249 /// - `BadRequestError`
250 ///
251 ///
252 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-redemption-history).
253 ///
254 pub async fn get_eth_redemption_history(
255 &self,
256 params: GetEthRedemptionHistoryParams,
257 ) -> anyhow::Result<RestApiResponse<models::GetEthRedemptionHistoryResponse>> {
258 self.eth_staking_api_client
259 .get_eth_redemption_history(params)
260 .await
261 }
262
263 /// Get ETH staking `history(USER_DATA)`
264 ///
265 /// Get ETH staking history
266 ///
267 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
268 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
269 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
270 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
271 ///
272 /// Weight: 150
273 ///
274 /// # Arguments
275 ///
276 /// - `params`: [`GetEthStakingHistoryParams`]
277 /// The parameters for this operation.
278 ///
279 /// # Returns
280 ///
281 /// [`RestApiResponse<models::GetEthStakingHistoryResponse>`] on success.
282 ///
283 /// # Errors
284 ///
285 /// This function will return an [`anyhow::Error`] if:
286 /// - the HTTP request fails
287 /// - any parameter is invalid
288 /// - the response cannot be parsed
289 /// - or one of the following occurs:
290 /// - `RequiredError`
291 /// - `ConnectorClientError`
292 /// - `UnauthorizedError`
293 /// - `ForbiddenError`
294 /// - `TooManyRequestsError`
295 /// - `RateLimitBanError`
296 /// - `ServerError`
297 /// - `NotFoundError`
298 /// - `NetworkError`
299 /// - `BadRequestError`
300 ///
301 ///
302 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-staking-history).
303 ///
304 pub async fn get_eth_staking_history(
305 &self,
306 params: GetEthStakingHistoryParams,
307 ) -> anyhow::Result<RestApiResponse<models::GetEthStakingHistoryResponse>> {
308 self.eth_staking_api_client
309 .get_eth_staking_history(params)
310 .await
311 }
312
313 /// Get WBETH Rate `History(USER_DATA)`
314 ///
315 /// Get WBETH Rate History
316 ///
317 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
318 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
319 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
320 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
321 ///
322 /// Weight: 150
323 ///
324 /// # Arguments
325 ///
326 /// - `params`: [`GetWbethRateHistoryParams`]
327 /// The parameters for this operation.
328 ///
329 /// # Returns
330 ///
331 /// [`RestApiResponse<models::GetWbethRateHistoryResponse>`] on success.
332 ///
333 /// # Errors
334 ///
335 /// This function will return an [`anyhow::Error`] if:
336 /// - the HTTP request fails
337 /// - any parameter is invalid
338 /// - the response cannot be parsed
339 /// - or one of the following occurs:
340 /// - `RequiredError`
341 /// - `ConnectorClientError`
342 /// - `UnauthorizedError`
343 /// - `ForbiddenError`
344 /// - `TooManyRequestsError`
345 /// - `RateLimitBanError`
346 /// - `ServerError`
347 /// - `NotFoundError`
348 /// - `NetworkError`
349 /// - `BadRequestError`
350 ///
351 ///
352 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-BETH-Rate-History).
353 ///
354 pub async fn get_wbeth_rate_history(
355 &self,
356 params: GetWbethRateHistoryParams,
357 ) -> anyhow::Result<RestApiResponse<models::GetWbethRateHistoryResponse>> {
358 self.eth_staking_api_client
359 .get_wbeth_rate_history(params)
360 .await
361 }
362
363 /// Get WBETH rewards `history(USER_DATA)`
364 ///
365 /// Get WBETH rewards history
366 ///
367 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
368 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
369 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
370 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
371 ///
372 /// Weight: 150
373 ///
374 /// # Arguments
375 ///
376 /// - `params`: [`GetWbethRewardsHistoryParams`]
377 /// The parameters for this operation.
378 ///
379 /// # Returns
380 ///
381 /// [`RestApiResponse<models::GetWbethRewardsHistoryResponse>`] on success.
382 ///
383 /// # Errors
384 ///
385 /// This function will return an [`anyhow::Error`] if:
386 /// - the HTTP request fails
387 /// - any parameter is invalid
388 /// - the response cannot be parsed
389 /// - or one of the following occurs:
390 /// - `RequiredError`
391 /// - `ConnectorClientError`
392 /// - `UnauthorizedError`
393 /// - `ForbiddenError`
394 /// - `TooManyRequestsError`
395 /// - `RateLimitBanError`
396 /// - `ServerError`
397 /// - `NotFoundError`
398 /// - `NetworkError`
399 /// - `BadRequestError`
400 ///
401 ///
402 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-rewards-history).
403 ///
404 pub async fn get_wbeth_rewards_history(
405 &self,
406 params: GetWbethRewardsHistoryParams,
407 ) -> anyhow::Result<RestApiResponse<models::GetWbethRewardsHistoryResponse>> {
408 self.eth_staking_api_client
409 .get_wbeth_rewards_history(params)
410 .await
411 }
412
413 /// Get WBETH unwrap `history(USER_DATA)`
414 ///
415 /// Get WBETH unwrap history
416 ///
417 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
418 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
419 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
420 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
421 ///
422 /// Weight: 150
423 ///
424 /// # Arguments
425 ///
426 /// - `params`: [`GetWbethUnwrapHistoryParams`]
427 /// The parameters for this operation.
428 ///
429 /// # Returns
430 ///
431 /// [`RestApiResponse<models::GetWbethUnwrapHistoryResponse>`] on success.
432 ///
433 /// # Errors
434 ///
435 /// This function will return an [`anyhow::Error`] if:
436 /// - the HTTP request fails
437 /// - any parameter is invalid
438 /// - the response cannot be parsed
439 /// - or one of the following occurs:
440 /// - `RequiredError`
441 /// - `ConnectorClientError`
442 /// - `UnauthorizedError`
443 /// - `ForbiddenError`
444 /// - `TooManyRequestsError`
445 /// - `RateLimitBanError`
446 /// - `ServerError`
447 /// - `NotFoundError`
448 /// - `NetworkError`
449 /// - `BadRequestError`
450 ///
451 ///
452 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-unwrap-history).
453 ///
454 pub async fn get_wbeth_unwrap_history(
455 &self,
456 params: GetWbethUnwrapHistoryParams,
457 ) -> anyhow::Result<RestApiResponse<models::GetWbethUnwrapHistoryResponse>> {
458 self.eth_staking_api_client
459 .get_wbeth_unwrap_history(params)
460 .await
461 }
462
463 /// Get WBETH wrap `history(USER_DATA)`
464 ///
465 /// Get WBETH wrap history
466 ///
467 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
468 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
469 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
470 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
471 ///
472 /// Weight: 150
473 ///
474 /// # Arguments
475 ///
476 /// - `params`: [`GetWbethWrapHistoryParams`]
477 /// The parameters for this operation.
478 ///
479 /// # Returns
480 ///
481 /// [`RestApiResponse<models::GetWbethWrapHistoryResponse>`] on success.
482 ///
483 /// # Errors
484 ///
485 /// This function will return an [`anyhow::Error`] if:
486 /// - the HTTP request fails
487 /// - any parameter is invalid
488 /// - the response cannot be parsed
489 /// - or one of the following occurs:
490 /// - `RequiredError`
491 /// - `ConnectorClientError`
492 /// - `UnauthorizedError`
493 /// - `ForbiddenError`
494 /// - `TooManyRequestsError`
495 /// - `RateLimitBanError`
496 /// - `ServerError`
497 /// - `NotFoundError`
498 /// - `NetworkError`
499 /// - `BadRequestError`
500 ///
501 ///
502 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-wrap-history).
503 ///
504 pub async fn get_wbeth_wrap_history(
505 &self,
506 params: GetWbethWrapHistoryParams,
507 ) -> anyhow::Result<RestApiResponse<models::GetWbethWrapHistoryResponse>> {
508 self.eth_staking_api_client
509 .get_wbeth_wrap_history(params)
510 .await
511 }
512
513 /// Redeem ETH(TRADE)
514 ///
515 /// Redeem WBETH or BETH and get ETH
516 ///
517 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
518 ///
519 /// Weight: 150
520 ///
521 /// # Arguments
522 ///
523 /// - `params`: [`RedeemEthParams`]
524 /// The parameters for this operation.
525 ///
526 /// # Returns
527 ///
528 /// [`RestApiResponse<models::RedeemEthResponse>`] on success.
529 ///
530 /// # Errors
531 ///
532 /// This function will return an [`anyhow::Error`] if:
533 /// - the HTTP request fails
534 /// - any parameter is invalid
535 /// - the response cannot be parsed
536 /// - or one of the following occurs:
537 /// - `RequiredError`
538 /// - `ConnectorClientError`
539 /// - `UnauthorizedError`
540 /// - `ForbiddenError`
541 /// - `TooManyRequestsError`
542 /// - `RateLimitBanError`
543 /// - `ServerError`
544 /// - `NotFoundError`
545 /// - `NetworkError`
546 /// - `BadRequestError`
547 ///
548 ///
549 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/staking/Redeem-ETH).
550 ///
551 pub async fn redeem_eth(
552 &self,
553 params: RedeemEthParams,
554 ) -> anyhow::Result<RestApiResponse<models::RedeemEthResponse>> {
555 self.eth_staking_api_client.redeem_eth(params).await
556 }
557
558 /// Subscribe ETH Staking(TRADE)
559 ///
560 /// Subscribe ETH Staking
561 ///
562 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
563 ///
564 /// Weight: 150
565 ///
566 /// # Arguments
567 ///
568 /// - `params`: [`SubscribeEthStakingParams`]
569 /// The parameters for this operation.
570 ///
571 /// # Returns
572 ///
573 /// [`RestApiResponse<models::SubscribeEthStakingResponse>`] on success.
574 ///
575 /// # Errors
576 ///
577 /// This function will return an [`anyhow::Error`] if:
578 /// - the HTTP request fails
579 /// - any parameter is invalid
580 /// - the response cannot be parsed
581 /// - or one of the following occurs:
582 /// - `RequiredError`
583 /// - `ConnectorClientError`
584 /// - `UnauthorizedError`
585 /// - `ForbiddenError`
586 /// - `TooManyRequestsError`
587 /// - `RateLimitBanError`
588 /// - `ServerError`
589 /// - `NotFoundError`
590 /// - `NetworkError`
591 /// - `BadRequestError`
592 ///
593 ///
594 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/staking/Subscribe-ETH-Staking).
595 ///
596 pub async fn subscribe_eth_staking(
597 &self,
598 params: SubscribeEthStakingParams,
599 ) -> anyhow::Result<RestApiResponse<models::SubscribeEthStakingResponse>> {
600 self.eth_staking_api_client
601 .subscribe_eth_staking(params)
602 .await
603 }
604
605 /// Wrap BETH(TRADE)
606 ///
607 /// Wrap BETH
608 ///
609 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
610 ///
611 /// Weight: 150
612 ///
613 /// # Arguments
614 ///
615 /// - `params`: [`WrapBethParams`]
616 /// The parameters for this operation.
617 ///
618 /// # Returns
619 ///
620 /// [`RestApiResponse<models::WrapBethResponse>`] on success.
621 ///
622 /// # Errors
623 ///
624 /// This function will return an [`anyhow::Error`] if:
625 /// - the HTTP request fails
626 /// - any parameter is invalid
627 /// - the response cannot be parsed
628 /// - or one of the following occurs:
629 /// - `RequiredError`
630 /// - `ConnectorClientError`
631 /// - `UnauthorizedError`
632 /// - `ForbiddenError`
633 /// - `TooManyRequestsError`
634 /// - `RateLimitBanError`
635 /// - `ServerError`
636 /// - `NotFoundError`
637 /// - `NetworkError`
638 /// - `BadRequestError`
639 ///
640 ///
641 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/eth-staking/staking/Wrap-BETH).
642 ///
643 pub async fn wrap_beth(
644 &self,
645 params: WrapBethParams,
646 ) -> anyhow::Result<RestApiResponse<models::WrapBethResponse>> {
647 self.eth_staking_api_client.wrap_beth(params).await
648 }
649
650 /// Get On-chain Yields Locked Personal Left Quota (`USER_DATA`)
651 ///
652 /// Get On-chain Yields Locked Personal Left Quota
653 ///
654 /// Weight: 50
655 ///
656 /// # Arguments
657 ///
658 /// - `params`: [`GetOnChainYieldsLockedPersonalLeftQuotaParams`]
659 /// The parameters for this operation.
660 ///
661 /// # Returns
662 ///
663 /// [`RestApiResponse<models::GetOnChainYieldsLockedPersonalLeftQuotaResponse>`] on success.
664 ///
665 /// # Errors
666 ///
667 /// This function will return an [`anyhow::Error`] if:
668 /// - the HTTP request fails
669 /// - any parameter is invalid
670 /// - the response cannot be parsed
671 /// - or one of the following occurs:
672 /// - `RequiredError`
673 /// - `ConnectorClientError`
674 /// - `UnauthorizedError`
675 /// - `ForbiddenError`
676 /// - `TooManyRequestsError`
677 /// - `RateLimitBanError`
678 /// - `ServerError`
679 /// - `NotFoundError`
680 /// - `NetworkError`
681 /// - `BadRequestError`
682 ///
683 ///
684 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/account/Get-Onchain-Locked-Personal-Left-Quota).
685 ///
686 pub async fn get_on_chain_yields_locked_personal_left_quota(
687 &self,
688 params: GetOnChainYieldsLockedPersonalLeftQuotaParams,
689 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedPersonalLeftQuotaResponse>>
690 {
691 self.on_chain_yields_api_client
692 .get_on_chain_yields_locked_personal_left_quota(params)
693 .await
694 }
695
696 /// Get On-chain Yields Locked Product List (`USER_DATA`)
697 ///
698 /// Get available On-chain Yields Locked product list
699 ///
700 /// * Get available On-chain Yields Locked product list
701 ///
702 /// Weight: 50
703 ///
704 /// # Arguments
705 ///
706 /// - `params`: [`GetOnChainYieldsLockedProductListParams`]
707 /// The parameters for this operation.
708 ///
709 /// # Returns
710 ///
711 /// [`RestApiResponse<models::GetOnChainYieldsLockedProductListResponse>`] on success.
712 ///
713 /// # Errors
714 ///
715 /// This function will return an [`anyhow::Error`] if:
716 /// - the HTTP request fails
717 /// - any parameter is invalid
718 /// - the response cannot be parsed
719 /// - or one of the following occurs:
720 /// - `RequiredError`
721 /// - `ConnectorClientError`
722 /// - `UnauthorizedError`
723 /// - `ForbiddenError`
724 /// - `TooManyRequestsError`
725 /// - `RateLimitBanError`
726 /// - `ServerError`
727 /// - `NotFoundError`
728 /// - `NetworkError`
729 /// - `BadRequestError`
730 ///
731 ///
732 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/account/).
733 ///
734 pub async fn get_on_chain_yields_locked_product_list(
735 &self,
736 params: GetOnChainYieldsLockedProductListParams,
737 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedProductListResponse>> {
738 self.on_chain_yields_api_client
739 .get_on_chain_yields_locked_product_list(params)
740 .await
741 }
742
743 /// Get On-chain Yields Locked Product Position (`USER_DATA`)
744 ///
745 /// Get On-chain Yields Locked Product Position
746 ///
747 /// Weight: 50
748 ///
749 /// # Arguments
750 ///
751 /// - `params`: [`GetOnChainYieldsLockedProductPositionParams`]
752 /// The parameters for this operation.
753 ///
754 /// # Returns
755 ///
756 /// [`RestApiResponse<models::GetOnChainYieldsLockedProductPositionResponse>`] on success.
757 ///
758 /// # Errors
759 ///
760 /// This function will return an [`anyhow::Error`] if:
761 /// - the HTTP request fails
762 /// - any parameter is invalid
763 /// - the response cannot be parsed
764 /// - or one of the following occurs:
765 /// - `RequiredError`
766 /// - `ConnectorClientError`
767 /// - `UnauthorizedError`
768 /// - `ForbiddenError`
769 /// - `TooManyRequestsError`
770 /// - `RateLimitBanError`
771 /// - `ServerError`
772 /// - `NotFoundError`
773 /// - `NetworkError`
774 /// - `BadRequestError`
775 ///
776 ///
777 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/account/Get-Onchain-Locked-Product-Position).
778 ///
779 pub async fn get_on_chain_yields_locked_product_position(
780 &self,
781 params: GetOnChainYieldsLockedProductPositionParams,
782 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedProductPositionResponse>>
783 {
784 self.on_chain_yields_api_client
785 .get_on_chain_yields_locked_product_position(params)
786 .await
787 }
788
789 /// Get On-chain Yields Locked Redemption Record (`USER_DATA`)
790 ///
791 /// Get On-chain Yields Locked Redemption Record
792 ///
793 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
794 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
795 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
796 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
797 ///
798 /// Weight: 50
799 ///
800 /// # Arguments
801 ///
802 /// - `params`: [`GetOnChainYieldsLockedRedemptionRecordParams`]
803 /// The parameters for this operation.
804 ///
805 /// # Returns
806 ///
807 /// [`RestApiResponse<models::GetOnChainYieldsLockedRedemptionRecordResponse>`] on success.
808 ///
809 /// # Errors
810 ///
811 /// This function will return an [`anyhow::Error`] if:
812 /// - the HTTP request fails
813 /// - any parameter is invalid
814 /// - the response cannot be parsed
815 /// - or one of the following occurs:
816 /// - `RequiredError`
817 /// - `ConnectorClientError`
818 /// - `UnauthorizedError`
819 /// - `ForbiddenError`
820 /// - `TooManyRequestsError`
821 /// - `RateLimitBanError`
822 /// - `ServerError`
823 /// - `NotFoundError`
824 /// - `NetworkError`
825 /// - `BadRequestError`
826 ///
827 ///
828 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/history/Get-Onchain-Locked-Redemption-Record).
829 ///
830 pub async fn get_on_chain_yields_locked_redemption_record(
831 &self,
832 params: GetOnChainYieldsLockedRedemptionRecordParams,
833 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedRedemptionRecordResponse>>
834 {
835 self.on_chain_yields_api_client
836 .get_on_chain_yields_locked_redemption_record(params)
837 .await
838 }
839
840 /// Get On-chain Yields Locked Rewards History (`USER_DATA`)
841 ///
842 /// Get On-chain Yields Locked Rewards History
843 ///
844 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
845 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
846 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
847 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
848 ///
849 /// Weight: 50
850 ///
851 /// # Arguments
852 ///
853 /// - `params`: [`GetOnChainYieldsLockedRewardsHistoryParams`]
854 /// The parameters for this operation.
855 ///
856 /// # Returns
857 ///
858 /// [`RestApiResponse<models::GetOnChainYieldsLockedRewardsHistoryResponse>`] on success.
859 ///
860 /// # Errors
861 ///
862 /// This function will return an [`anyhow::Error`] if:
863 /// - the HTTP request fails
864 /// - any parameter is invalid
865 /// - the response cannot be parsed
866 /// - or one of the following occurs:
867 /// - `RequiredError`
868 /// - `ConnectorClientError`
869 /// - `UnauthorizedError`
870 /// - `ForbiddenError`
871 /// - `TooManyRequestsError`
872 /// - `RateLimitBanError`
873 /// - `ServerError`
874 /// - `NotFoundError`
875 /// - `NetworkError`
876 /// - `BadRequestError`
877 ///
878 ///
879 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/history/Get-Onchain-Locked-Rewards-History).
880 ///
881 pub async fn get_on_chain_yields_locked_rewards_history(
882 &self,
883 params: GetOnChainYieldsLockedRewardsHistoryParams,
884 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedRewardsHistoryResponse>> {
885 self.on_chain_yields_api_client
886 .get_on_chain_yields_locked_rewards_history(params)
887 .await
888 }
889
890 /// Get On-chain Yields Locked Subscription Preview (`USER_DATA`)
891 ///
892 /// Get On-chain Yields Locked Subscription Preview
893 ///
894 /// Weight: 50
895 ///
896 /// # Arguments
897 ///
898 /// - `params`: [`GetOnChainYieldsLockedSubscriptionPreviewParams`]
899 /// The parameters for this operation.
900 ///
901 /// # Returns
902 ///
903 /// [`RestApiResponse<models::GetOnChainYieldsLockedSubscriptionPreviewResponse>`] on success.
904 ///
905 /// # Errors
906 ///
907 /// This function will return an [`anyhow::Error`] if:
908 /// - the HTTP request fails
909 /// - any parameter is invalid
910 /// - the response cannot be parsed
911 /// - or one of the following occurs:
912 /// - `RequiredError`
913 /// - `ConnectorClientError`
914 /// - `UnauthorizedError`
915 /// - `ForbiddenError`
916 /// - `TooManyRequestsError`
917 /// - `RateLimitBanError`
918 /// - `ServerError`
919 /// - `NotFoundError`
920 /// - `NetworkError`
921 /// - `BadRequestError`
922 ///
923 ///
924 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/earn/).
925 ///
926 pub async fn get_on_chain_yields_locked_subscription_preview(
927 &self,
928 params: GetOnChainYieldsLockedSubscriptionPreviewParams,
929 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedSubscriptionPreviewResponse>>
930 {
931 self.on_chain_yields_api_client
932 .get_on_chain_yields_locked_subscription_preview(params)
933 .await
934 }
935
936 /// Get On-chain Yields Locked Subscription Record (`USER_DATA`)
937 ///
938 /// Get On-chain Yields Locked Subscription Record
939 ///
940 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
941 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
942 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
943 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
944 ///
945 /// Weight: 50
946 ///
947 /// # Arguments
948 ///
949 /// - `params`: [`GetOnChainYieldsLockedSubscriptionRecordParams`]
950 /// The parameters for this operation.
951 ///
952 /// # Returns
953 ///
954 /// [`RestApiResponse<models::GetOnChainYieldsLockedSubscriptionRecordResponse>`] on success.
955 ///
956 /// # Errors
957 ///
958 /// This function will return an [`anyhow::Error`] if:
959 /// - the HTTP request fails
960 /// - any parameter is invalid
961 /// - the response cannot be parsed
962 /// - or one of the following occurs:
963 /// - `RequiredError`
964 /// - `ConnectorClientError`
965 /// - `UnauthorizedError`
966 /// - `ForbiddenError`
967 /// - `TooManyRequestsError`
968 /// - `RateLimitBanError`
969 /// - `ServerError`
970 /// - `NotFoundError`
971 /// - `NetworkError`
972 /// - `BadRequestError`
973 ///
974 ///
975 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/history/).
976 ///
977 pub async fn get_on_chain_yields_locked_subscription_record(
978 &self,
979 params: GetOnChainYieldsLockedSubscriptionRecordParams,
980 ) -> anyhow::Result<RestApiResponse<models::GetOnChainYieldsLockedSubscriptionRecordResponse>>
981 {
982 self.on_chain_yields_api_client
983 .get_on_chain_yields_locked_subscription_record(params)
984 .await
985 }
986
987 /// On-chain Yields Account (`USER_DATA`)
988 ///
989 /// On-chain Yields Account query
990 ///
991 /// Weight: 50
992 ///
993 /// # Arguments
994 ///
995 /// - `params`: [`OnChainYieldsAccountParams`]
996 /// The parameters for this operation.
997 ///
998 /// # Returns
999 ///
1000 /// [`RestApiResponse<models::OnChainYieldsAccountResponse>`] on success.
1001 ///
1002 /// # Errors
1003 ///
1004 /// This function will return an [`anyhow::Error`] if:
1005 /// - the HTTP request fails
1006 /// - any parameter is invalid
1007 /// - the response cannot be parsed
1008 /// - or one of the following occurs:
1009 /// - `RequiredError`
1010 /// - `ConnectorClientError`
1011 /// - `UnauthorizedError`
1012 /// - `ForbiddenError`
1013 /// - `TooManyRequestsError`
1014 /// - `RateLimitBanError`
1015 /// - `ServerError`
1016 /// - `NotFoundError`
1017 /// - `NetworkError`
1018 /// - `BadRequestError`
1019 ///
1020 ///
1021 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/account/Onchain-Account).
1022 ///
1023 pub async fn on_chain_yields_account(
1024 &self,
1025 params: OnChainYieldsAccountParams,
1026 ) -> anyhow::Result<RestApiResponse<models::OnChainYieldsAccountResponse>> {
1027 self.on_chain_yields_api_client
1028 .on_chain_yields_account(params)
1029 .await
1030 }
1031
1032 /// Redeem On-chain Yields Locked Product (TRADE)
1033 ///
1034 /// Redeem On-chain Yields Locked Product
1035 ///
1036 /// * You need to open `Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
1037 ///
1038 /// Weight: 1/3s per account
1039 ///
1040 /// # Arguments
1041 ///
1042 /// - `params`: [`RedeemOnChainYieldsLockedProductParams`]
1043 /// The parameters for this operation.
1044 ///
1045 /// # Returns
1046 ///
1047 /// [`RestApiResponse<models::RedeemOnChainYieldsLockedProductResponse>`] on success.
1048 ///
1049 /// # Errors
1050 ///
1051 /// This function will return an [`anyhow::Error`] if:
1052 /// - the HTTP request fails
1053 /// - any parameter is invalid
1054 /// - the response cannot be parsed
1055 /// - or one of the following occurs:
1056 /// - `RequiredError`
1057 /// - `ConnectorClientError`
1058 /// - `UnauthorizedError`
1059 /// - `ForbiddenError`
1060 /// - `TooManyRequestsError`
1061 /// - `RateLimitBanError`
1062 /// - `ServerError`
1063 /// - `NotFoundError`
1064 /// - `NetworkError`
1065 /// - `BadRequestError`
1066 ///
1067 ///
1068 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/earn/Redeem-Onchain-Locked-Product).
1069 ///
1070 pub async fn redeem_on_chain_yields_locked_product(
1071 &self,
1072 params: RedeemOnChainYieldsLockedProductParams,
1073 ) -> anyhow::Result<RestApiResponse<models::RedeemOnChainYieldsLockedProductResponse>> {
1074 self.on_chain_yields_api_client
1075 .redeem_on_chain_yields_locked_product(params)
1076 .await
1077 }
1078
1079 /// Set On-chain Yields Locked Auto `Subscribe(USER_DATA)`
1080 ///
1081 /// Set On-chain Yield locked auto subscribe
1082 ///
1083 /// Weight: 50
1084 ///
1085 /// # Arguments
1086 ///
1087 /// - `params`: [`SetOnChainYieldsLockedAutoSubscribeParams`]
1088 /// The parameters for this operation.
1089 ///
1090 /// # Returns
1091 ///
1092 /// [`RestApiResponse<models::SetOnChainYieldsLockedAutoSubscribeResponse>`] on success.
1093 ///
1094 /// # Errors
1095 ///
1096 /// This function will return an [`anyhow::Error`] if:
1097 /// - the HTTP request fails
1098 /// - any parameter is invalid
1099 /// - the response cannot be parsed
1100 /// - or one of the following occurs:
1101 /// - `RequiredError`
1102 /// - `ConnectorClientError`
1103 /// - `UnauthorizedError`
1104 /// - `ForbiddenError`
1105 /// - `TooManyRequestsError`
1106 /// - `RateLimitBanError`
1107 /// - `ServerError`
1108 /// - `NotFoundError`
1109 /// - `NetworkError`
1110 /// - `BadRequestError`
1111 ///
1112 ///
1113 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/earn/Set-Onchain-Locked-Auto-Subscribe).
1114 ///
1115 pub async fn set_on_chain_yields_locked_auto_subscribe(
1116 &self,
1117 params: SetOnChainYieldsLockedAutoSubscribeParams,
1118 ) -> anyhow::Result<RestApiResponse<models::SetOnChainYieldsLockedAutoSubscribeResponse>> {
1119 self.on_chain_yields_api_client
1120 .set_on_chain_yields_locked_auto_subscribe(params)
1121 .await
1122 }
1123
1124 /// Set On-chain Yields Locked Product Redeem `Option(USER_DATA)`
1125 ///
1126 /// Set On-chain Yields redeem option for Locked product
1127 ///
1128 /// Weight: 50
1129 ///
1130 /// # Arguments
1131 ///
1132 /// - `params`: [`SetOnChainYieldsLockedProductRedeemOptionParams`]
1133 /// The parameters for this operation.
1134 ///
1135 /// # Returns
1136 ///
1137 /// [`RestApiResponse<models::SetOnChainYieldsLockedProductRedeemOptionResponse>`] on success.
1138 ///
1139 /// # Errors
1140 ///
1141 /// This function will return an [`anyhow::Error`] if:
1142 /// - the HTTP request fails
1143 /// - any parameter is invalid
1144 /// - the response cannot be parsed
1145 /// - or one of the following occurs:
1146 /// - `RequiredError`
1147 /// - `ConnectorClientError`
1148 /// - `UnauthorizedError`
1149 /// - `ForbiddenError`
1150 /// - `TooManyRequestsError`
1151 /// - `RateLimitBanError`
1152 /// - `ServerError`
1153 /// - `NotFoundError`
1154 /// - `NetworkError`
1155 /// - `BadRequestError`
1156 ///
1157 ///
1158 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/earn/Set-Onchain-Locked-Redeem-Option).
1159 ///
1160 pub async fn set_on_chain_yields_locked_product_redeem_option(
1161 &self,
1162 params: SetOnChainYieldsLockedProductRedeemOptionParams,
1163 ) -> anyhow::Result<RestApiResponse<models::SetOnChainYieldsLockedProductRedeemOptionResponse>>
1164 {
1165 self.on_chain_yields_api_client
1166 .set_on_chain_yields_locked_product_redeem_option(params)
1167 .await
1168 }
1169
1170 /// Subscribe On-chain Yields Locked Product(TRADE)
1171 ///
1172 /// Subscribe On-chain Yields Locked Product
1173 ///
1174 /// * You need to open `Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
1175 ///
1176 /// Weight: 200
1177 ///
1178 /// # Arguments
1179 ///
1180 /// - `params`: [`SubscribeOnChainYieldsLockedProductParams`]
1181 /// The parameters for this operation.
1182 ///
1183 /// # Returns
1184 ///
1185 /// [`RestApiResponse<models::SubscribeOnChainYieldsLockedProductResponse>`] on success.
1186 ///
1187 /// # Errors
1188 ///
1189 /// This function will return an [`anyhow::Error`] if:
1190 /// - the HTTP request fails
1191 /// - any parameter is invalid
1192 /// - the response cannot be parsed
1193 /// - or one of the following occurs:
1194 /// - `RequiredError`
1195 /// - `ConnectorClientError`
1196 /// - `UnauthorizedError`
1197 /// - `ForbiddenError`
1198 /// - `TooManyRequestsError`
1199 /// - `RateLimitBanError`
1200 /// - `ServerError`
1201 /// - `NotFoundError`
1202 /// - `NetworkError`
1203 /// - `BadRequestError`
1204 ///
1205 ///
1206 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/on-chain-yields/earn/Subscribe-Onchain-Locked-Product).
1207 ///
1208 pub async fn subscribe_on_chain_yields_locked_product(
1209 &self,
1210 params: SubscribeOnChainYieldsLockedProductParams,
1211 ) -> anyhow::Result<RestApiResponse<models::SubscribeOnChainYieldsLockedProductResponse>> {
1212 self.on_chain_yields_api_client
1213 .subscribe_on_chain_yields_locked_product(params)
1214 .await
1215 }
1216
1217 /// Get Soft Staking Product List (`USER_DATA`)
1218 ///
1219 /// Get the available Soft Staking product list.
1220 ///
1221 /// Weight: 50
1222 ///
1223 /// # Arguments
1224 ///
1225 /// - `params`: [`GetSoftStakingProductListParams`]
1226 /// The parameters for this operation.
1227 ///
1228 /// # Returns
1229 ///
1230 /// [`RestApiResponse<models::GetSoftStakingProductListResponse>`] on success.
1231 ///
1232 /// # Errors
1233 ///
1234 /// This function will return an [`anyhow::Error`] if:
1235 /// - the HTTP request fails
1236 /// - any parameter is invalid
1237 /// - the response cannot be parsed
1238 /// - or one of the following occurs:
1239 /// - `RequiredError`
1240 /// - `ConnectorClientError`
1241 /// - `UnauthorizedError`
1242 /// - `ForbiddenError`
1243 /// - `TooManyRequestsError`
1244 /// - `RateLimitBanError`
1245 /// - `ServerError`
1246 /// - `NotFoundError`
1247 /// - `NetworkError`
1248 /// - `BadRequestError`
1249 ///
1250 ///
1251 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/soft-staking/).
1252 ///
1253 pub async fn get_soft_staking_product_list(
1254 &self,
1255 params: GetSoftStakingProductListParams,
1256 ) -> anyhow::Result<RestApiResponse<models::GetSoftStakingProductListResponse>> {
1257 self.soft_staking_api_client
1258 .get_soft_staking_product_list(params)
1259 .await
1260 }
1261
1262 /// Get Soft Staking Rewards `History(USER_DATA)`
1263 ///
1264 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1265 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1266 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1267 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1268 ///
1269 /// Weight: 50
1270 ///
1271 /// # Arguments
1272 ///
1273 /// - `params`: [`GetSoftStakingRewardsHistoryParams`]
1274 /// The parameters for this operation.
1275 ///
1276 /// # Returns
1277 ///
1278 /// [`RestApiResponse<models::GetSoftStakingRewardsHistoryResponse>`] on success.
1279 ///
1280 /// # Errors
1281 ///
1282 /// This function will return an [`anyhow::Error`] if:
1283 /// - the HTTP request fails
1284 /// - any parameter is invalid
1285 /// - the response cannot be parsed
1286 /// - or one of the following occurs:
1287 /// - `RequiredError`
1288 /// - `ConnectorClientError`
1289 /// - `UnauthorizedError`
1290 /// - `ForbiddenError`
1291 /// - `TooManyRequestsError`
1292 /// - `RateLimitBanError`
1293 /// - `ServerError`
1294 /// - `NotFoundError`
1295 /// - `NetworkError`
1296 /// - `BadRequestError`
1297 ///
1298 ///
1299 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/soft-staking/Get-Soft-Staking-Rewards-History).
1300 ///
1301 pub async fn get_soft_staking_rewards_history(
1302 &self,
1303 params: GetSoftStakingRewardsHistoryParams,
1304 ) -> anyhow::Result<RestApiResponse<models::GetSoftStakingRewardsHistoryResponse>> {
1305 self.soft_staking_api_client
1306 .get_soft_staking_rewards_history(params)
1307 .await
1308 }
1309
1310 /// Set Soft Staking (`USER_DATA`)
1311 ///
1312 /// Enable or disable Soft Staking.
1313 ///
1314 /// Weight: 50
1315 ///
1316 /// # Arguments
1317 ///
1318 /// - `params`: [`SetSoftStakingParams`]
1319 /// The parameters for this operation.
1320 ///
1321 /// # Returns
1322 ///
1323 /// [`RestApiResponse<models::SetSoftStakingResponse>`] on success.
1324 ///
1325 /// # Errors
1326 ///
1327 /// This function will return an [`anyhow::Error`] if:
1328 /// - the HTTP request fails
1329 /// - any parameter is invalid
1330 /// - the response cannot be parsed
1331 /// - or one of the following occurs:
1332 /// - `RequiredError`
1333 /// - `ConnectorClientError`
1334 /// - `UnauthorizedError`
1335 /// - `ForbiddenError`
1336 /// - `TooManyRequestsError`
1337 /// - `RateLimitBanError`
1338 /// - `ServerError`
1339 /// - `NotFoundError`
1340 /// - `NetworkError`
1341 /// - `BadRequestError`
1342 ///
1343 ///
1344 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/soft-staking/Set-Soft-Staking).
1345 ///
1346 pub async fn set_soft_staking(
1347 &self,
1348 params: SetSoftStakingParams,
1349 ) -> anyhow::Result<RestApiResponse<models::SetSoftStakingResponse>> {
1350 self.soft_staking_api_client.set_soft_staking(params).await
1351 }
1352
1353 /// Claim Boost Rewards(TRADE)
1354 ///
1355 /// Claim Boost APR Airdrop Rewards
1356 ///
1357 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
1358 ///
1359 /// Weight: 150
1360 ///
1361 /// # Arguments
1362 ///
1363 /// - `params`: [`ClaimBoostRewardsParams`]
1364 /// The parameters for this operation.
1365 ///
1366 /// # Returns
1367 ///
1368 /// [`RestApiResponse<models::ClaimBoostRewardsResponse>`] on success.
1369 ///
1370 /// # Errors
1371 ///
1372 /// This function will return an [`anyhow::Error`] if:
1373 /// - the HTTP request fails
1374 /// - any parameter is invalid
1375 /// - the response cannot be parsed
1376 /// - or one of the following occurs:
1377 /// - `RequiredError`
1378 /// - `ConnectorClientError`
1379 /// - `UnauthorizedError`
1380 /// - `ForbiddenError`
1381 /// - `TooManyRequestsError`
1382 /// - `RateLimitBanError`
1383 /// - `ServerError`
1384 /// - `NotFoundError`
1385 /// - `NetworkError`
1386 /// - `BadRequestError`
1387 ///
1388 ///
1389 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/staking/Claim-Boost-Rewards).
1390 ///
1391 pub async fn claim_boost_rewards(
1392 &self,
1393 params: ClaimBoostRewardsParams,
1394 ) -> anyhow::Result<RestApiResponse<models::ClaimBoostRewardsResponse>> {
1395 self.sol_staking_api_client
1396 .claim_boost_rewards(params)
1397 .await
1398 }
1399
1400 /// Get BNSOL Rate `History(USER_DATA)`
1401 ///
1402 /// Get BNSOL Rate History
1403 ///
1404 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1405 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1406 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1407 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1408 ///
1409 /// Weight: 150
1410 ///
1411 /// # Arguments
1412 ///
1413 /// - `params`: [`GetBnsolRateHistoryParams`]
1414 /// The parameters for this operation.
1415 ///
1416 /// # Returns
1417 ///
1418 /// [`RestApiResponse<models::GetBnsolRateHistoryResponse>`] on success.
1419 ///
1420 /// # Errors
1421 ///
1422 /// This function will return an [`anyhow::Error`] if:
1423 /// - the HTTP request fails
1424 /// - any parameter is invalid
1425 /// - the response cannot be parsed
1426 /// - or one of the following occurs:
1427 /// - `RequiredError`
1428 /// - `ConnectorClientError`
1429 /// - `UnauthorizedError`
1430 /// - `ForbiddenError`
1431 /// - `TooManyRequestsError`
1432 /// - `RateLimitBanError`
1433 /// - `ServerError`
1434 /// - `NotFoundError`
1435 /// - `NetworkError`
1436 /// - `BadRequestError`
1437 ///
1438 ///
1439 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-Rate-History).
1440 ///
1441 pub async fn get_bnsol_rate_history(
1442 &self,
1443 params: GetBnsolRateHistoryParams,
1444 ) -> anyhow::Result<RestApiResponse<models::GetBnsolRateHistoryResponse>> {
1445 self.sol_staking_api_client
1446 .get_bnsol_rate_history(params)
1447 .await
1448 }
1449
1450 /// Get BNSOL rewards `history(USER_DATA)`
1451 ///
1452 /// Get BNSOL rewards history
1453 ///
1454 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1455 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1456 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1457 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1458 ///
1459 /// Weight: 150
1460 ///
1461 /// # Arguments
1462 ///
1463 /// - `params`: [`GetBnsolRewardsHistoryParams`]
1464 /// The parameters for this operation.
1465 ///
1466 /// # Returns
1467 ///
1468 /// [`RestApiResponse<models::GetBnsolRewardsHistoryResponse>`] on success.
1469 ///
1470 /// # Errors
1471 ///
1472 /// This function will return an [`anyhow::Error`] if:
1473 /// - the HTTP request fails
1474 /// - any parameter is invalid
1475 /// - the response cannot be parsed
1476 /// - or one of the following occurs:
1477 /// - `RequiredError`
1478 /// - `ConnectorClientError`
1479 /// - `UnauthorizedError`
1480 /// - `ForbiddenError`
1481 /// - `TooManyRequestsError`
1482 /// - `RateLimitBanError`
1483 /// - `ServerError`
1484 /// - `NotFoundError`
1485 /// - `NetworkError`
1486 /// - `BadRequestError`
1487 ///
1488 ///
1489 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-BNSOL-rewards-history).
1490 ///
1491 pub async fn get_bnsol_rewards_history(
1492 &self,
1493 params: GetBnsolRewardsHistoryParams,
1494 ) -> anyhow::Result<RestApiResponse<models::GetBnsolRewardsHistoryResponse>> {
1495 self.sol_staking_api_client
1496 .get_bnsol_rewards_history(params)
1497 .await
1498 }
1499
1500 /// Get Boost Rewards `History(USER_DATA)`
1501 ///
1502 /// Get Boost rewards history
1503 ///
1504 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1505 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1506 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1507 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1508 ///
1509 /// Weight: 150
1510 ///
1511 /// # Arguments
1512 ///
1513 /// - `params`: [`GetBoostRewardsHistoryParams`]
1514 /// The parameters for this operation.
1515 ///
1516 /// # Returns
1517 ///
1518 /// [`RestApiResponse<models::GetBoostRewardsHistoryResponse>`] on success.
1519 ///
1520 /// # Errors
1521 ///
1522 /// This function will return an [`anyhow::Error`] if:
1523 /// - the HTTP request fails
1524 /// - any parameter is invalid
1525 /// - the response cannot be parsed
1526 /// - or one of the following occurs:
1527 /// - `RequiredError`
1528 /// - `ConnectorClientError`
1529 /// - `UnauthorizedError`
1530 /// - `ForbiddenError`
1531 /// - `TooManyRequestsError`
1532 /// - `RateLimitBanError`
1533 /// - `ServerError`
1534 /// - `NotFoundError`
1535 /// - `NetworkError`
1536 /// - `BadRequestError`
1537 ///
1538 ///
1539 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-Boost-Rewards-History).
1540 ///
1541 pub async fn get_boost_rewards_history(
1542 &self,
1543 params: GetBoostRewardsHistoryParams,
1544 ) -> anyhow::Result<RestApiResponse<models::GetBoostRewardsHistoryResponse>> {
1545 self.sol_staking_api_client
1546 .get_boost_rewards_history(params)
1547 .await
1548 }
1549
1550 /// Get SOL redemption `history(USER_DATA)`
1551 ///
1552 /// Get SOL redemption history
1553 ///
1554 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1555 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1556 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1557 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1558 ///
1559 /// Weight: 150
1560 ///
1561 /// # Arguments
1562 ///
1563 /// - `params`: [`GetSolRedemptionHistoryParams`]
1564 /// The parameters for this operation.
1565 ///
1566 /// # Returns
1567 ///
1568 /// [`RestApiResponse<models::GetSolRedemptionHistoryResponse>`] on success.
1569 ///
1570 /// # Errors
1571 ///
1572 /// This function will return an [`anyhow::Error`] if:
1573 /// - the HTTP request fails
1574 /// - any parameter is invalid
1575 /// - the response cannot be parsed
1576 /// - or one of the following occurs:
1577 /// - `RequiredError`
1578 /// - `ConnectorClientError`
1579 /// - `UnauthorizedError`
1580 /// - `ForbiddenError`
1581 /// - `TooManyRequestsError`
1582 /// - `RateLimitBanError`
1583 /// - `ServerError`
1584 /// - `NotFoundError`
1585 /// - `NetworkError`
1586 /// - `BadRequestError`
1587 ///
1588 ///
1589 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-redemption-history).
1590 ///
1591 pub async fn get_sol_redemption_history(
1592 &self,
1593 params: GetSolRedemptionHistoryParams,
1594 ) -> anyhow::Result<RestApiResponse<models::GetSolRedemptionHistoryResponse>> {
1595 self.sol_staking_api_client
1596 .get_sol_redemption_history(params)
1597 .await
1598 }
1599
1600 /// Get SOL staking `history(USER_DATA)`
1601 ///
1602 /// Get SOL staking history
1603 ///
1604 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1605 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1606 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1607 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1608 ///
1609 /// Weight: 150
1610 ///
1611 /// # Arguments
1612 ///
1613 /// - `params`: [`GetSolStakingHistoryParams`]
1614 /// The parameters for this operation.
1615 ///
1616 /// # Returns
1617 ///
1618 /// [`RestApiResponse<models::GetSolStakingHistoryResponse>`] on success.
1619 ///
1620 /// # Errors
1621 ///
1622 /// This function will return an [`anyhow::Error`] if:
1623 /// - the HTTP request fails
1624 /// - any parameter is invalid
1625 /// - the response cannot be parsed
1626 /// - or one of the following occurs:
1627 /// - `RequiredError`
1628 /// - `ConnectorClientError`
1629 /// - `UnauthorizedError`
1630 /// - `ForbiddenError`
1631 /// - `TooManyRequestsError`
1632 /// - `RateLimitBanError`
1633 /// - `ServerError`
1634 /// - `NotFoundError`
1635 /// - `NetworkError`
1636 /// - `BadRequestError`
1637 ///
1638 ///
1639 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-SOL-staking-history).
1640 ///
1641 pub async fn get_sol_staking_history(
1642 &self,
1643 params: GetSolStakingHistoryParams,
1644 ) -> anyhow::Result<RestApiResponse<models::GetSolStakingHistoryResponse>> {
1645 self.sol_staking_api_client
1646 .get_sol_staking_history(params)
1647 .await
1648 }
1649
1650 /// Get SOL staking quota `details(USER_DATA)`
1651 ///
1652 /// Get SOL staking quota
1653 ///
1654 /// Weight: 150
1655 ///
1656 /// # Arguments
1657 ///
1658 /// - `params`: [`GetSolStakingQuotaDetailsParams`]
1659 /// The parameters for this operation.
1660 ///
1661 /// # Returns
1662 ///
1663 /// [`RestApiResponse<models::GetSolStakingQuotaDetailsResponse>`] on success.
1664 ///
1665 /// # Errors
1666 ///
1667 /// This function will return an [`anyhow::Error`] if:
1668 /// - the HTTP request fails
1669 /// - any parameter is invalid
1670 /// - the response cannot be parsed
1671 /// - or one of the following occurs:
1672 /// - `RequiredError`
1673 /// - `ConnectorClientError`
1674 /// - `UnauthorizedError`
1675 /// - `ForbiddenError`
1676 /// - `TooManyRequestsError`
1677 /// - `RateLimitBanError`
1678 /// - `ServerError`
1679 /// - `NotFoundError`
1680 /// - `NetworkError`
1681 /// - `BadRequestError`
1682 ///
1683 ///
1684 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/account/Get-SOL-staking-quota-details).
1685 ///
1686 pub async fn get_sol_staking_quota_details(
1687 &self,
1688 params: GetSolStakingQuotaDetailsParams,
1689 ) -> anyhow::Result<RestApiResponse<models::GetSolStakingQuotaDetailsResponse>> {
1690 self.sol_staking_api_client
1691 .get_sol_staking_quota_details(params)
1692 .await
1693 }
1694
1695 /// Get Unclaimed `Rewards(USER_DATA)`
1696 ///
1697 /// Get Unclaimed rewards
1698 ///
1699 /// * The time between `startTime` and `endTime` cannot be longer than 3 months.
1700 /// * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
1701 /// * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
1702 /// * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.
1703 ///
1704 /// Weight: 150
1705 ///
1706 /// # Arguments
1707 ///
1708 /// - `params`: [`GetUnclaimedRewardsParams`]
1709 /// The parameters for this operation.
1710 ///
1711 /// # Returns
1712 ///
1713 /// [`RestApiResponse<Vec<models::GetUnclaimedRewardsResponseInner>>`] on success.
1714 ///
1715 /// # Errors
1716 ///
1717 /// This function will return an [`anyhow::Error`] if:
1718 /// - the HTTP request fails
1719 /// - any parameter is invalid
1720 /// - the response cannot be parsed
1721 /// - or one of the following occurs:
1722 /// - `RequiredError`
1723 /// - `ConnectorClientError`
1724 /// - `UnauthorizedError`
1725 /// - `ForbiddenError`
1726 /// - `TooManyRequestsError`
1727 /// - `RateLimitBanError`
1728 /// - `ServerError`
1729 /// - `NotFoundError`
1730 /// - `NetworkError`
1731 /// - `BadRequestError`
1732 ///
1733 ///
1734 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/history/Get-Unclaimed-Rewards).
1735 ///
1736 pub async fn get_unclaimed_rewards(
1737 &self,
1738 params: GetUnclaimedRewardsParams,
1739 ) -> anyhow::Result<RestApiResponse<Vec<models::GetUnclaimedRewardsResponseInner>>> {
1740 self.sol_staking_api_client
1741 .get_unclaimed_rewards(params)
1742 .await
1743 }
1744
1745 /// Redeem SOL(TRADE)
1746 ///
1747 /// Redeem BNSOL get SOL
1748 ///
1749 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
1750 ///
1751 /// Weight: 150
1752 ///
1753 /// # Arguments
1754 ///
1755 /// - `params`: [`RedeemSolParams`]
1756 /// The parameters for this operation.
1757 ///
1758 /// # Returns
1759 ///
1760 /// [`RestApiResponse<models::RedeemSolResponse>`] on success.
1761 ///
1762 /// # Errors
1763 ///
1764 /// This function will return an [`anyhow::Error`] if:
1765 /// - the HTTP request fails
1766 /// - any parameter is invalid
1767 /// - the response cannot be parsed
1768 /// - or one of the following occurs:
1769 /// - `RequiredError`
1770 /// - `ConnectorClientError`
1771 /// - `UnauthorizedError`
1772 /// - `ForbiddenError`
1773 /// - `TooManyRequestsError`
1774 /// - `RateLimitBanError`
1775 /// - `ServerError`
1776 /// - `NotFoundError`
1777 /// - `NetworkError`
1778 /// - `BadRequestError`
1779 ///
1780 ///
1781 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/staking/Redeem-SOL).
1782 ///
1783 pub async fn redeem_sol(
1784 &self,
1785 params: RedeemSolParams,
1786 ) -> anyhow::Result<RestApiResponse<models::RedeemSolResponse>> {
1787 self.sol_staking_api_client.redeem_sol(params).await
1788 }
1789
1790 /// SOL Staking `account(USER_DATA)`
1791 ///
1792 /// SOL Staking account
1793 ///
1794 /// Weight: 150
1795 ///
1796 /// # Arguments
1797 ///
1798 /// - `params`: [`SolStakingAccountParams`]
1799 /// The parameters for this operation.
1800 ///
1801 /// # Returns
1802 ///
1803 /// [`RestApiResponse<models::SolStakingAccountResponse>`] on success.
1804 ///
1805 /// # Errors
1806 ///
1807 /// This function will return an [`anyhow::Error`] if:
1808 /// - the HTTP request fails
1809 /// - any parameter is invalid
1810 /// - the response cannot be parsed
1811 /// - or one of the following occurs:
1812 /// - `RequiredError`
1813 /// - `ConnectorClientError`
1814 /// - `UnauthorizedError`
1815 /// - `ForbiddenError`
1816 /// - `TooManyRequestsError`
1817 /// - `RateLimitBanError`
1818 /// - `ServerError`
1819 /// - `NotFoundError`
1820 /// - `NetworkError`
1821 /// - `BadRequestError`
1822 ///
1823 ///
1824 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/account/SOL-Staking-account).
1825 ///
1826 pub async fn sol_staking_account(
1827 &self,
1828 params: SolStakingAccountParams,
1829 ) -> anyhow::Result<RestApiResponse<models::SolStakingAccountResponse>> {
1830 self.sol_staking_api_client
1831 .sol_staking_account(params)
1832 .await
1833 }
1834
1835 /// Subscribe SOL Staking(TRADE)
1836 ///
1837 /// Subscribe SOL Staking
1838 ///
1839 /// * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.
1840 ///
1841 /// Weight: 150
1842 ///
1843 /// # Arguments
1844 ///
1845 /// - `params`: [`SubscribeSolStakingParams`]
1846 /// The parameters for this operation.
1847 ///
1848 /// # Returns
1849 ///
1850 /// [`RestApiResponse<models::SubscribeSolStakingResponse>`] on success.
1851 ///
1852 /// # Errors
1853 ///
1854 /// This function will return an [`anyhow::Error`] if:
1855 /// - the HTTP request fails
1856 /// - any parameter is invalid
1857 /// - the response cannot be parsed
1858 /// - or one of the following occurs:
1859 /// - `RequiredError`
1860 /// - `ConnectorClientError`
1861 /// - `UnauthorizedError`
1862 /// - `ForbiddenError`
1863 /// - `TooManyRequestsError`
1864 /// - `RateLimitBanError`
1865 /// - `ServerError`
1866 /// - `NotFoundError`
1867 /// - `NetworkError`
1868 /// - `BadRequestError`
1869 ///
1870 ///
1871 /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/staking/sol-staking/staking/Subscribe-SOL-Staking).
1872 ///
1873 pub async fn subscribe_sol_staking(
1874 &self,
1875 params: SubscribeSolStakingParams,
1876 ) -> anyhow::Result<RestApiResponse<models::SubscribeSolStakingResponse>> {
1877 self.sol_staking_api_client
1878 .subscribe_sol_staking(params)
1879 .await
1880 }
1881}