Skip to main content

fireblocks_sdk/apis/
blockchains_assets_api.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    super::{Error, configuration},
11    crate::{
12        apis::{ContentType, ResponseContent},
13        models,
14    },
15    async_trait::async_trait,
16    reqwest,
17    serde::{Deserialize, Serialize, de::Error as _},
18    std::sync::Arc,
19};
20
21#[async_trait]
22pub trait BlockchainsAssetsApi: Send + Sync {
23    /// GET /estimate_network_fee
24    ///
25    /// Gets the estimated required fee for an asset. Fireblocks fetches, calculates and caches the result every 30 seconds. Customers should query this API while taking the caching interval into consideration. Notes: - The `networkFee` parameter is the `gasPrice` with a given delta added, multiplied by the gasLimit plus the delta. - The estimation provided depends on the asset type.     - For UTXO-based assets, the response contains the `feePerByte` parameter     - For ETH-based and all EVM based assets, the response will contain `gasPrice` parameter. This is calculated by adding the `baseFee` to the `actualPriority` based on the latest 12 blocks. The response for ETH-based  contains the `baseFee`, `gasPrice`, and `priorityFee` parameters.     - For ADA-based assets, the response will contain the parameter `networkFee` and `feePerByte` parameters.     - For XRP and XLM, the response will contain the transaction fee.     - For other assets, the response will contain the `networkFee` parameter.  Learn more about Fireblocks Fee Management in the following [guide](https://developers.fireblocks.com/reference/estimate-transaction-fee). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
26    async fn estimate_network_fee(
27        &self,
28        params: EstimateNetworkFeeParams,
29    ) -> Result<models::EstimatedNetworkFeeResponse, Error<EstimateNetworkFeeError>>;
30
31    /// GET /assets/{id}
32    ///
33    /// Returns an asset by ID or legacyID.</br>   **Note**: - We will continue
34    /// displaying and supporting the legacy ID (API ID).  Since not all
35    /// Fireblocks services fully support the new Assets UUID, please use only
36    /// the legacy ID until further notice.
37    async fn get_asset(
38        &self,
39        params: GetAssetParams,
40    ) -> Result<models::Asset, Error<GetAssetError>>;
41
42    /// GET /blockchains/{id}
43    ///
44    /// Returns a blockchain by ID or legacyID.
45    async fn get_blockchain(
46        &self,
47        params: GetBlockchainParams,
48    ) -> Result<models::BlockchainResponse, Error<GetBlockchainError>>;
49
50    /// GET /supported_assets
51    ///
52    /// **This legacy endpoint has not been deprecated but it should not be used in your operations. Instead, use the new [List assets](https://developers.fireblocks.com/reference/listassets) endpoint for better performance and to retrieve more detailed asset information.**  Retrieves all assets supported by Fireblocks in your workspace.  **Endpoint Permissions:** Admin, Non-Signing Admin, Signer, Approver, Editor.
53    async fn get_supported_assets(
54        &self,
55    ) -> Result<Vec<models::AssetTypeResponse>, Error<GetSupportedAssetsError>>;
56
57    /// GET /assets
58    ///
59    /// Retrieves a paginated list of all assets supported by Fireblocks in your
60    /// workspace.  **Note:** We will continue to support and display the legacy
61    /// ID (API ID). Since not all Fireblocks services fully support the new
62    /// Assets UUID, please use only the legacy ID until further notice.
63    async fn list_assets(
64        &self,
65        params: ListAssetsParams,
66    ) -> Result<models::ListAssetsResponse, Error<ListAssetsError>>;
67
68    /// GET /blockchains
69    ///
70    /// Returns all blockchains supported by Fireblocks.</br>
71    async fn list_blockchains(
72        &self,
73        params: ListBlockchainsParams,
74    ) -> Result<models::ListBlockchainsResponse, Error<ListBlockchainsError>>;
75
76    /// POST /assets
77    ///
78    /// Registers a new asset to a workspace and retrieves the newly created
79    /// asset's details. Currently supported chains are:    - EVM-based chains
80    /// - Algorand   - NEAR   - Solana   - Stellar   - Sui   - TRON  **Endpoint
81    /// Permissions:** Owner, Admin, Non-Signing Admin, NCW Admin, Editor,
82    /// Signer.
83    async fn register_new_asset(
84        &self,
85        params: RegisterNewAssetParams,
86    ) -> Result<models::AssetResponse, Error<RegisterNewAssetError>>;
87
88    /// POST /assets/prices/{id}
89    ///
90    /// Set asset price for the given asset id. Returns the asset price
91    /// response.
92    async fn set_asset_price(
93        &self,
94        params: SetAssetPriceParams,
95    ) -> Result<models::AssetPriceResponse, Error<SetAssetPriceError>>;
96
97    /// PATCH /assets/{id}
98    ///
99    /// Update the user’s metadata for an asset.  **Endpoint Permissions:**
100    /// Owner, Admin, Non-Signing Admin, NCW Admin, Signer, Editor.
101    async fn update_asset_user_metadata(
102        &self,
103        params: UpdateAssetUserMetadataParams,
104    ) -> Result<models::Asset, Error<UpdateAssetUserMetadataError>>;
105
106    /// GET /transactions/validate_address/{assetId}/{address}
107    ///
108    /// Checks if an address is valid and active (for XRP, DOT, XLM, and EOS).
109    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
110    /// Editor.
111    async fn validate_address(
112        &self,
113        params: ValidateAddressParams,
114    ) -> Result<models::ValidateAddressResponse, Error<ValidateAddressError>>;
115}
116
117pub struct BlockchainsAssetsApiClient {
118    configuration: Arc<configuration::Configuration>,
119}
120
121impl BlockchainsAssetsApiClient {
122    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
123        Self { configuration }
124    }
125}
126
127/// struct for passing parameters to the method
128/// [`BlockchainsAssetsApi::estimate_network_fee`]
129#[derive(Clone, Debug)]
130#[cfg_attr(feature = "bon", derive(::bon::Builder))]
131pub struct EstimateNetworkFeeParams {
132    /// The asset for which to estimate the fee
133    pub asset_id: String,
134}
135
136/// struct for passing parameters to the method
137/// [`BlockchainsAssetsApi::get_asset`]
138#[derive(Clone, Debug)]
139#[cfg_attr(feature = "bon", derive(::bon::Builder))]
140pub struct GetAssetParams {
141    /// The ID or legacyId of the asset
142    pub id: String,
143    /// A unique identifier for the request. If the request is sent multiple
144    /// times with the same idempotency key, the server will return the same
145    /// response as the first request. The idempotency key is valid for 24
146    /// hours.
147    pub idempotency_key: Option<String>,
148}
149
150/// struct for passing parameters to the method
151/// [`BlockchainsAssetsApi::get_blockchain`]
152#[derive(Clone, Debug)]
153#[cfg_attr(feature = "bon", derive(::bon::Builder))]
154pub struct GetBlockchainParams {
155    /// The ID or legacyId of the blockchain
156    pub id: String,
157}
158
159/// struct for passing parameters to the method
160/// [`BlockchainsAssetsApi::list_assets`]
161#[derive(Clone, Debug)]
162#[cfg_attr(feature = "bon", derive(::bon::Builder))]
163pub struct ListAssetsParams {
164    /// Blockchain id of the assets
165    pub blockchain_id: Option<String>,
166    /// Assets class
167    pub asset_class: Option<models::AssetClass>,
168    /// Assets onchain symbol
169    pub symbol: Option<String>,
170    /// Scope of the assets
171    pub scope: Option<models::AssetScope>,
172    /// Are assets deprecated
173    pub deprecated: Option<bool>,
174    /// A list of asset IDs (max 100)
175    pub ids: Option<Vec<String>>,
176    /// Next page cursor to fetch
177    pub page_cursor: Option<String>,
178    /// Items per page
179    pub page_size: Option<f64>,
180    /// A unique identifier for the request. If the request is sent multiple
181    /// times with the same idempotency key, the server will return the same
182    /// response as the first request. The idempotency key is valid for 24
183    /// hours.
184    pub idempotency_key: Option<String>,
185}
186
187/// struct for passing parameters to the method
188/// [`BlockchainsAssetsApi::list_blockchains`]
189#[derive(Clone, Debug)]
190#[cfg_attr(feature = "bon", derive(::bon::Builder))]
191pub struct ListBlockchainsParams {
192    /// Blockchain protocol
193    pub protocol: Option<String>,
194    /// Is blockchain deprecated
195    pub deprecated: Option<bool>,
196    /// Is test blockchain
197    pub test: Option<bool>,
198    /// A list of blockchain IDs (max 100)
199    pub ids: Option<Vec<String>>,
200    /// Page cursor to fetch
201    pub page_cursor: Option<String>,
202    /// Items per page (max 500)
203    pub page_size: Option<f64>,
204}
205
206/// struct for passing parameters to the method
207/// [`BlockchainsAssetsApi::register_new_asset`]
208#[derive(Clone, Debug)]
209#[cfg_attr(feature = "bon", derive(::bon::Builder))]
210pub struct RegisterNewAssetParams {
211    /// A unique identifier for the request. If the request is sent multiple
212    /// times with the same idempotency key, the server will return the same
213    /// response as the first request. The idempotency key is valid for 24
214    /// hours.
215    pub idempotency_key: Option<String>,
216    pub register_new_asset_request: Option<models::RegisterNewAssetRequest>,
217}
218
219/// struct for passing parameters to the method
220/// [`BlockchainsAssetsApi::set_asset_price`]
221#[derive(Clone, Debug)]
222#[cfg_attr(feature = "bon", derive(::bon::Builder))]
223pub struct SetAssetPriceParams {
224    /// The ID of the asset
225    pub id: String,
226    /// A unique identifier for the request. If the request is sent multiple
227    /// times with the same idempotency key, the server will return the same
228    /// response as the first request. The idempotency key is valid for 24
229    /// hours.
230    pub idempotency_key: Option<String>,
231    pub set_asset_price_request: Option<models::SetAssetPriceRequest>,
232}
233
234/// struct for passing parameters to the method
235/// [`BlockchainsAssetsApi::update_asset_user_metadata`]
236#[derive(Clone, Debug)]
237#[cfg_attr(feature = "bon", derive(::bon::Builder))]
238pub struct UpdateAssetUserMetadataParams {
239    /// The ID or legacyId of the asset
240    pub id: String,
241    /// A unique identifier for the request. If the request is sent multiple
242    /// times with the same idempotency key, the server will return the same
243    /// response as the first request. The idempotency key is valid for 24
244    /// hours.
245    pub idempotency_key: Option<String>,
246    pub update_asset_user_metadata_request: Option<models::UpdateAssetUserMetadataRequest>,
247}
248
249/// struct for passing parameters to the method
250/// [`BlockchainsAssetsApi::validate_address`]
251#[derive(Clone, Debug)]
252#[cfg_attr(feature = "bon", derive(::bon::Builder))]
253pub struct ValidateAddressParams {
254    /// The asset of the address
255    pub asset_id: String,
256    /// The address to validate
257    pub address: String,
258}
259
260#[async_trait]
261impl BlockchainsAssetsApi for BlockchainsAssetsApiClient {
262    /// Gets the estimated required fee for an asset. Fireblocks fetches, calculates and caches the result every 30 seconds. Customers should query this API while taking the caching interval into consideration. Notes: - The `networkFee` parameter is the `gasPrice` with a given delta added, multiplied by the gasLimit plus the delta. - The estimation provided depends on the asset type.     - For UTXO-based assets, the response contains the `feePerByte` parameter     - For ETH-based and all EVM based assets, the response will contain `gasPrice` parameter. This is calculated by adding the `baseFee` to the `actualPriority` based on the latest 12 blocks. The response for ETH-based  contains the `baseFee`, `gasPrice`, and `priorityFee` parameters.     - For ADA-based assets, the response will contain the parameter `networkFee` and `feePerByte` parameters.     - For XRP and XLM, the response will contain the transaction fee.     - For other assets, the response will contain the `networkFee` parameter.  Learn more about Fireblocks Fee Management in the following [guide](https://developers.fireblocks.com/reference/estimate-transaction-fee). </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.
263    async fn estimate_network_fee(
264        &self,
265        params: EstimateNetworkFeeParams,
266    ) -> Result<models::EstimatedNetworkFeeResponse, Error<EstimateNetworkFeeError>> {
267        let EstimateNetworkFeeParams { asset_id } = params;
268
269        let local_var_configuration = &self.configuration;
270
271        let local_var_client = &local_var_configuration.client;
272
273        let local_var_uri_str =
274            format!("{}/estimate_network_fee", local_var_configuration.base_path);
275        let mut local_var_req_builder =
276            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
277
278        local_var_req_builder = local_var_req_builder.query(&[("assetId", &asset_id.to_string())]);
279        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
280            local_var_req_builder = local_var_req_builder
281                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
282        }
283
284        let local_var_req = local_var_req_builder.build()?;
285        let local_var_resp = local_var_client.execute(local_var_req).await?;
286
287        let local_var_status = local_var_resp.status();
288        let local_var_content_type = local_var_resp
289            .headers()
290            .get("content-type")
291            .and_then(|v| v.to_str().ok())
292            .unwrap_or("application/octet-stream");
293        let local_var_content_type = super::ContentType::from(local_var_content_type);
294        let local_var_content = local_var_resp.text().await?;
295
296        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
297            match local_var_content_type {
298                ContentType::Json => {
299                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
300                }
301                ContentType::Text => {
302                    return Err(Error::from(serde_json::Error::custom(
303                        "Received `text/plain` content type response that cannot be converted to \
304                         `models::EstimatedNetworkFeeResponse`",
305                    )));
306                }
307                ContentType::Unsupported(local_var_unknown_type) => {
308                    return Err(Error::from(serde_json::Error::custom(format!(
309                        "Received `{local_var_unknown_type}` content type response that cannot be \
310                         converted to `models::EstimatedNetworkFeeResponse`"
311                    ))));
312                }
313            }
314        } else {
315            let local_var_entity: Option<EstimateNetworkFeeError> =
316                serde_json::from_str(&local_var_content).ok();
317            let local_var_error = ResponseContent {
318                status: local_var_status,
319                content: local_var_content,
320                entity: local_var_entity,
321            };
322            Err(Error::ResponseError(local_var_error))
323        }
324    }
325
326    /// Returns an asset by ID or legacyID.</br>   **Note**: - We will continue
327    /// displaying and supporting the legacy ID (API ID).  Since not all
328    /// Fireblocks services fully support the new Assets UUID, please use only
329    /// the legacy ID until further notice.
330    async fn get_asset(
331        &self,
332        params: GetAssetParams,
333    ) -> Result<models::Asset, Error<GetAssetError>> {
334        let GetAssetParams {
335            id,
336            idempotency_key,
337        } = params;
338
339        let local_var_configuration = &self.configuration;
340
341        let local_var_client = &local_var_configuration.client;
342
343        let local_var_uri_str = format!(
344            "{}/assets/{id}",
345            local_var_configuration.base_path,
346            id = crate::apis::urlencode(id)
347        );
348        let mut local_var_req_builder =
349            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
350
351        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
352            local_var_req_builder = local_var_req_builder
353                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
354        }
355        if let Some(local_var_param_value) = idempotency_key {
356            local_var_req_builder =
357                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
358        }
359
360        let local_var_req = local_var_req_builder.build()?;
361        let local_var_resp = local_var_client.execute(local_var_req).await?;
362
363        let local_var_status = local_var_resp.status();
364        let local_var_content_type = local_var_resp
365            .headers()
366            .get("content-type")
367            .and_then(|v| v.to_str().ok())
368            .unwrap_or("application/octet-stream");
369        let local_var_content_type = super::ContentType::from(local_var_content_type);
370        let local_var_content = local_var_resp.text().await?;
371
372        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
373            match local_var_content_type {
374                ContentType::Json => {
375                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
376                }
377                ContentType::Text => {
378                    return Err(Error::from(serde_json::Error::custom(
379                        "Received `text/plain` content type response that cannot be converted to \
380                         `models::Asset`",
381                    )));
382                }
383                ContentType::Unsupported(local_var_unknown_type) => {
384                    return Err(Error::from(serde_json::Error::custom(format!(
385                        "Received `{local_var_unknown_type}` content type response that cannot be \
386                         converted to `models::Asset`"
387                    ))));
388                }
389            }
390        } else {
391            let local_var_entity: Option<GetAssetError> =
392                serde_json::from_str(&local_var_content).ok();
393            let local_var_error = ResponseContent {
394                status: local_var_status,
395                content: local_var_content,
396                entity: local_var_entity,
397            };
398            Err(Error::ResponseError(local_var_error))
399        }
400    }
401
402    /// Returns a blockchain by ID or legacyID.
403    async fn get_blockchain(
404        &self,
405        params: GetBlockchainParams,
406    ) -> Result<models::BlockchainResponse, Error<GetBlockchainError>> {
407        let GetBlockchainParams { id } = params;
408
409        let local_var_configuration = &self.configuration;
410
411        let local_var_client = &local_var_configuration.client;
412
413        let local_var_uri_str = format!(
414            "{}/blockchains/{id}",
415            local_var_configuration.base_path,
416            id = crate::apis::urlencode(id)
417        );
418        let mut local_var_req_builder =
419            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
420
421        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
422            local_var_req_builder = local_var_req_builder
423                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
424        }
425
426        let local_var_req = local_var_req_builder.build()?;
427        let local_var_resp = local_var_client.execute(local_var_req).await?;
428
429        let local_var_status = local_var_resp.status();
430        let local_var_content_type = local_var_resp
431            .headers()
432            .get("content-type")
433            .and_then(|v| v.to_str().ok())
434            .unwrap_or("application/octet-stream");
435        let local_var_content_type = super::ContentType::from(local_var_content_type);
436        let local_var_content = local_var_resp.text().await?;
437
438        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
439            match local_var_content_type {
440                ContentType::Json => {
441                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
442                }
443                ContentType::Text => {
444                    return Err(Error::from(serde_json::Error::custom(
445                        "Received `text/plain` content type response that cannot be converted to \
446                         `models::BlockchainResponse`",
447                    )));
448                }
449                ContentType::Unsupported(local_var_unknown_type) => {
450                    return Err(Error::from(serde_json::Error::custom(format!(
451                        "Received `{local_var_unknown_type}` content type response that cannot be \
452                         converted to `models::BlockchainResponse`"
453                    ))));
454                }
455            }
456        } else {
457            let local_var_entity: Option<GetBlockchainError> =
458                serde_json::from_str(&local_var_content).ok();
459            let local_var_error = ResponseContent {
460                status: local_var_status,
461                content: local_var_content,
462                entity: local_var_entity,
463            };
464            Err(Error::ResponseError(local_var_error))
465        }
466    }
467
468    /// **This legacy endpoint has not been deprecated but it should not be used in your operations. Instead, use the new [List assets](https://developers.fireblocks.com/reference/listassets) endpoint for better performance and to retrieve more detailed asset information.**  Retrieves all assets supported by Fireblocks in your workspace.  **Endpoint Permissions:** Admin, Non-Signing Admin, Signer, Approver, Editor.
469    async fn get_supported_assets(
470        &self,
471    ) -> Result<Vec<models::AssetTypeResponse>, Error<GetSupportedAssetsError>> {
472        let local_var_configuration = &self.configuration;
473
474        let local_var_client = &local_var_configuration.client;
475
476        let local_var_uri_str = format!("{}/supported_assets", local_var_configuration.base_path);
477        let mut local_var_req_builder =
478            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
479
480        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
481            local_var_req_builder = local_var_req_builder
482                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
483        }
484
485        let local_var_req = local_var_req_builder.build()?;
486        let local_var_resp = local_var_client.execute(local_var_req).await?;
487
488        let local_var_status = local_var_resp.status();
489        let local_var_content_type = local_var_resp
490            .headers()
491            .get("content-type")
492            .and_then(|v| v.to_str().ok())
493            .unwrap_or("application/octet-stream");
494        let local_var_content_type = super::ContentType::from(local_var_content_type);
495        let local_var_content = local_var_resp.text().await?;
496
497        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
498            match local_var_content_type {
499                ContentType::Json => {
500                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
501                }
502                ContentType::Text => {
503                    return Err(Error::from(serde_json::Error::custom(
504                        "Received `text/plain` content type response that cannot be converted to \
505                         `Vec&lt;models::AssetTypeResponse&gt;`",
506                    )));
507                }
508                ContentType::Unsupported(local_var_unknown_type) => {
509                    return Err(Error::from(serde_json::Error::custom(format!(
510                        "Received `{local_var_unknown_type}` content type response that cannot be \
511                         converted to `Vec&lt;models::AssetTypeResponse&gt;`"
512                    ))));
513                }
514            }
515        } else {
516            let local_var_entity: Option<GetSupportedAssetsError> =
517                serde_json::from_str(&local_var_content).ok();
518            let local_var_error = ResponseContent {
519                status: local_var_status,
520                content: local_var_content,
521                entity: local_var_entity,
522            };
523            Err(Error::ResponseError(local_var_error))
524        }
525    }
526
527    /// Retrieves a paginated list of all assets supported by Fireblocks in your
528    /// workspace.  **Note:** We will continue to support and display the legacy
529    /// ID (API ID). Since not all Fireblocks services fully support the new
530    /// Assets UUID, please use only the legacy ID until further notice.
531    async fn list_assets(
532        &self,
533        params: ListAssetsParams,
534    ) -> Result<models::ListAssetsResponse, Error<ListAssetsError>> {
535        let ListAssetsParams {
536            blockchain_id,
537            asset_class,
538            symbol,
539            scope,
540            deprecated,
541            ids,
542            page_cursor,
543            page_size,
544            idempotency_key,
545        } = params;
546
547        let local_var_configuration = &self.configuration;
548
549        let local_var_client = &local_var_configuration.client;
550
551        let local_var_uri_str = format!("{}/assets", local_var_configuration.base_path);
552        let mut local_var_req_builder =
553            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
554
555        if let Some(ref param_value) = blockchain_id {
556            local_var_req_builder =
557                local_var_req_builder.query(&[("blockchainId", &param_value.to_string())]);
558        }
559        if let Some(ref param_value) = asset_class {
560            local_var_req_builder =
561                local_var_req_builder.query(&[("assetClass", &param_value.to_string())]);
562        }
563        if let Some(ref param_value) = symbol {
564            local_var_req_builder =
565                local_var_req_builder.query(&[("symbol", &param_value.to_string())]);
566        }
567        if let Some(ref param_value) = scope {
568            local_var_req_builder =
569                local_var_req_builder.query(&[("scope", &param_value.to_string())]);
570        }
571        if let Some(ref param_value) = deprecated {
572            local_var_req_builder =
573                local_var_req_builder.query(&[("deprecated", &param_value.to_string())]);
574        }
575        if let Some(ref param_value) = ids {
576            local_var_req_builder = match "multi" {
577                "multi" => local_var_req_builder.query(
578                    &param_value
579                        .into_iter()
580                        .map(|p| ("ids".to_owned(), p.to_string()))
581                        .collect::<Vec<(std::string::String, std::string::String)>>(),
582                ),
583                _ => local_var_req_builder.query(&[(
584                    "ids",
585                    &param_value
586                        .into_iter()
587                        .map(|p| p.to_string())
588                        .collect::<Vec<String>>()
589                        .join(",")
590                        .to_string(),
591                )]),
592            };
593        }
594        if let Some(ref param_value) = page_cursor {
595            local_var_req_builder =
596                local_var_req_builder.query(&[("pageCursor", &param_value.to_string())]);
597        }
598        if let Some(ref param_value) = page_size {
599            local_var_req_builder =
600                local_var_req_builder.query(&[("pageSize", &param_value.to_string())]);
601        }
602        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
603            local_var_req_builder = local_var_req_builder
604                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
605        }
606        if let Some(local_var_param_value) = idempotency_key {
607            local_var_req_builder =
608                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
609        }
610
611        let local_var_req = local_var_req_builder.build()?;
612        let local_var_resp = local_var_client.execute(local_var_req).await?;
613
614        let local_var_status = local_var_resp.status();
615        let local_var_content_type = local_var_resp
616            .headers()
617            .get("content-type")
618            .and_then(|v| v.to_str().ok())
619            .unwrap_or("application/octet-stream");
620        let local_var_content_type = super::ContentType::from(local_var_content_type);
621        let local_var_content = local_var_resp.text().await?;
622
623        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
624            match local_var_content_type {
625                ContentType::Json => {
626                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
627                }
628                ContentType::Text => {
629                    return Err(Error::from(serde_json::Error::custom(
630                        "Received `text/plain` content type response that cannot be converted to \
631                         `models::ListAssetsResponse`",
632                    )));
633                }
634                ContentType::Unsupported(local_var_unknown_type) => {
635                    return Err(Error::from(serde_json::Error::custom(format!(
636                        "Received `{local_var_unknown_type}` content type response that cannot be \
637                         converted to `models::ListAssetsResponse`"
638                    ))));
639                }
640            }
641        } else {
642            let local_var_entity: Option<ListAssetsError> =
643                serde_json::from_str(&local_var_content).ok();
644            let local_var_error = ResponseContent {
645                status: local_var_status,
646                content: local_var_content,
647                entity: local_var_entity,
648            };
649            Err(Error::ResponseError(local_var_error))
650        }
651    }
652
653    /// Returns all blockchains supported by Fireblocks.</br>
654    async fn list_blockchains(
655        &self,
656        params: ListBlockchainsParams,
657    ) -> Result<models::ListBlockchainsResponse, Error<ListBlockchainsError>> {
658        let ListBlockchainsParams {
659            protocol,
660            deprecated,
661            test,
662            ids,
663            page_cursor,
664            page_size,
665        } = params;
666
667        let local_var_configuration = &self.configuration;
668
669        let local_var_client = &local_var_configuration.client;
670
671        let local_var_uri_str = format!("{}/blockchains", local_var_configuration.base_path);
672        let mut local_var_req_builder =
673            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
674
675        if let Some(ref param_value) = protocol {
676            local_var_req_builder =
677                local_var_req_builder.query(&[("protocol", &param_value.to_string())]);
678        }
679        if let Some(ref param_value) = deprecated {
680            local_var_req_builder =
681                local_var_req_builder.query(&[("deprecated", &param_value.to_string())]);
682        }
683        if let Some(ref param_value) = test {
684            local_var_req_builder =
685                local_var_req_builder.query(&[("test", &param_value.to_string())]);
686        }
687        if let Some(ref param_value) = ids {
688            local_var_req_builder = match "multi" {
689                "multi" => local_var_req_builder.query(
690                    &param_value
691                        .into_iter()
692                        .map(|p| ("ids".to_owned(), p.to_string()))
693                        .collect::<Vec<(std::string::String, std::string::String)>>(),
694                ),
695                _ => local_var_req_builder.query(&[(
696                    "ids",
697                    &param_value
698                        .into_iter()
699                        .map(|p| p.to_string())
700                        .collect::<Vec<String>>()
701                        .join(",")
702                        .to_string(),
703                )]),
704            };
705        }
706        if let Some(ref param_value) = page_cursor {
707            local_var_req_builder =
708                local_var_req_builder.query(&[("pageCursor", &param_value.to_string())]);
709        }
710        if let Some(ref param_value) = page_size {
711            local_var_req_builder =
712                local_var_req_builder.query(&[("pageSize", &param_value.to_string())]);
713        }
714        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
715            local_var_req_builder = local_var_req_builder
716                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
717        }
718
719        let local_var_req = local_var_req_builder.build()?;
720        let local_var_resp = local_var_client.execute(local_var_req).await?;
721
722        let local_var_status = local_var_resp.status();
723        let local_var_content_type = local_var_resp
724            .headers()
725            .get("content-type")
726            .and_then(|v| v.to_str().ok())
727            .unwrap_or("application/octet-stream");
728        let local_var_content_type = super::ContentType::from(local_var_content_type);
729        let local_var_content = local_var_resp.text().await?;
730
731        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
732            match local_var_content_type {
733                ContentType::Json => {
734                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
735                }
736                ContentType::Text => {
737                    return Err(Error::from(serde_json::Error::custom(
738                        "Received `text/plain` content type response that cannot be converted to \
739                         `models::ListBlockchainsResponse`",
740                    )));
741                }
742                ContentType::Unsupported(local_var_unknown_type) => {
743                    return Err(Error::from(serde_json::Error::custom(format!(
744                        "Received `{local_var_unknown_type}` content type response that cannot be \
745                         converted to `models::ListBlockchainsResponse`"
746                    ))));
747                }
748            }
749        } else {
750            let local_var_entity: Option<ListBlockchainsError> =
751                serde_json::from_str(&local_var_content).ok();
752            let local_var_error = ResponseContent {
753                status: local_var_status,
754                content: local_var_content,
755                entity: local_var_entity,
756            };
757            Err(Error::ResponseError(local_var_error))
758        }
759    }
760
761    /// Registers a new asset to a workspace and retrieves the newly created
762    /// asset's details. Currently supported chains are:    - EVM-based chains
763    /// - Algorand   - NEAR   - Solana   - Stellar   - Sui   - TRON  **Endpoint
764    /// Permissions:** Owner, Admin, Non-Signing Admin, NCW Admin, Editor,
765    /// Signer.
766    async fn register_new_asset(
767        &self,
768        params: RegisterNewAssetParams,
769    ) -> Result<models::AssetResponse, Error<RegisterNewAssetError>> {
770        let RegisterNewAssetParams {
771            idempotency_key,
772            register_new_asset_request,
773        } = params;
774
775        let local_var_configuration = &self.configuration;
776
777        let local_var_client = &local_var_configuration.client;
778
779        let local_var_uri_str = format!("{}/assets", local_var_configuration.base_path);
780        let mut local_var_req_builder =
781            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
782
783        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
784            local_var_req_builder = local_var_req_builder
785                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
786        }
787        if let Some(local_var_param_value) = idempotency_key {
788            local_var_req_builder =
789                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
790        }
791        local_var_req_builder = local_var_req_builder.json(&register_new_asset_request);
792
793        let local_var_req = local_var_req_builder.build()?;
794        let local_var_resp = local_var_client.execute(local_var_req).await?;
795
796        let local_var_status = local_var_resp.status();
797        let local_var_content_type = local_var_resp
798            .headers()
799            .get("content-type")
800            .and_then(|v| v.to_str().ok())
801            .unwrap_or("application/octet-stream");
802        let local_var_content_type = super::ContentType::from(local_var_content_type);
803        let local_var_content = local_var_resp.text().await?;
804
805        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
806            match local_var_content_type {
807                ContentType::Json => {
808                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
809                }
810                ContentType::Text => {
811                    return Err(Error::from(serde_json::Error::custom(
812                        "Received `text/plain` content type response that cannot be converted to \
813                         `models::AssetResponse`",
814                    )));
815                }
816                ContentType::Unsupported(local_var_unknown_type) => {
817                    return Err(Error::from(serde_json::Error::custom(format!(
818                        "Received `{local_var_unknown_type}` content type response that cannot be \
819                         converted to `models::AssetResponse`"
820                    ))));
821                }
822            }
823        } else {
824            let local_var_entity: Option<RegisterNewAssetError> =
825                serde_json::from_str(&local_var_content).ok();
826            let local_var_error = ResponseContent {
827                status: local_var_status,
828                content: local_var_content,
829                entity: local_var_entity,
830            };
831            Err(Error::ResponseError(local_var_error))
832        }
833    }
834
835    /// Set asset price for the given asset id. Returns the asset price
836    /// response.
837    async fn set_asset_price(
838        &self,
839        params: SetAssetPriceParams,
840    ) -> Result<models::AssetPriceResponse, Error<SetAssetPriceError>> {
841        let SetAssetPriceParams {
842            id,
843            idempotency_key,
844            set_asset_price_request,
845        } = params;
846
847        let local_var_configuration = &self.configuration;
848
849        let local_var_client = &local_var_configuration.client;
850
851        let local_var_uri_str = format!(
852            "{}/assets/prices/{id}",
853            local_var_configuration.base_path,
854            id = crate::apis::urlencode(id)
855        );
856        let mut local_var_req_builder =
857            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
858
859        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
860            local_var_req_builder = local_var_req_builder
861                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
862        }
863        if let Some(local_var_param_value) = idempotency_key {
864            local_var_req_builder =
865                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
866        }
867        local_var_req_builder = local_var_req_builder.json(&set_asset_price_request);
868
869        let local_var_req = local_var_req_builder.build()?;
870        let local_var_resp = local_var_client.execute(local_var_req).await?;
871
872        let local_var_status = local_var_resp.status();
873        let local_var_content_type = local_var_resp
874            .headers()
875            .get("content-type")
876            .and_then(|v| v.to_str().ok())
877            .unwrap_or("application/octet-stream");
878        let local_var_content_type = super::ContentType::from(local_var_content_type);
879        let local_var_content = local_var_resp.text().await?;
880
881        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
882            match local_var_content_type {
883                ContentType::Json => {
884                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
885                }
886                ContentType::Text => {
887                    return Err(Error::from(serde_json::Error::custom(
888                        "Received `text/plain` content type response that cannot be converted to \
889                         `models::AssetPriceResponse`",
890                    )));
891                }
892                ContentType::Unsupported(local_var_unknown_type) => {
893                    return Err(Error::from(serde_json::Error::custom(format!(
894                        "Received `{local_var_unknown_type}` content type response that cannot be \
895                         converted to `models::AssetPriceResponse`"
896                    ))));
897                }
898            }
899        } else {
900            let local_var_entity: Option<SetAssetPriceError> =
901                serde_json::from_str(&local_var_content).ok();
902            let local_var_error = ResponseContent {
903                status: local_var_status,
904                content: local_var_content,
905                entity: local_var_entity,
906            };
907            Err(Error::ResponseError(local_var_error))
908        }
909    }
910
911    /// Update the user’s metadata for an asset.  **Endpoint Permissions:**
912    /// Owner, Admin, Non-Signing Admin, NCW Admin, Signer, Editor.
913    async fn update_asset_user_metadata(
914        &self,
915        params: UpdateAssetUserMetadataParams,
916    ) -> Result<models::Asset, Error<UpdateAssetUserMetadataError>> {
917        let UpdateAssetUserMetadataParams {
918            id,
919            idempotency_key,
920            update_asset_user_metadata_request,
921        } = params;
922
923        let local_var_configuration = &self.configuration;
924
925        let local_var_client = &local_var_configuration.client;
926
927        let local_var_uri_str = format!(
928            "{}/assets/{id}",
929            local_var_configuration.base_path,
930            id = crate::apis::urlencode(id)
931        );
932        let mut local_var_req_builder =
933            local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
934
935        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
936            local_var_req_builder = local_var_req_builder
937                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
938        }
939        if let Some(local_var_param_value) = idempotency_key {
940            local_var_req_builder =
941                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
942        }
943        local_var_req_builder = local_var_req_builder.json(&update_asset_user_metadata_request);
944
945        let local_var_req = local_var_req_builder.build()?;
946        let local_var_resp = local_var_client.execute(local_var_req).await?;
947
948        let local_var_status = local_var_resp.status();
949        let local_var_content_type = local_var_resp
950            .headers()
951            .get("content-type")
952            .and_then(|v| v.to_str().ok())
953            .unwrap_or("application/octet-stream");
954        let local_var_content_type = super::ContentType::from(local_var_content_type);
955        let local_var_content = local_var_resp.text().await?;
956
957        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
958            match local_var_content_type {
959                ContentType::Json => {
960                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
961                }
962                ContentType::Text => {
963                    return Err(Error::from(serde_json::Error::custom(
964                        "Received `text/plain` content type response that cannot be converted to \
965                         `models::Asset`",
966                    )));
967                }
968                ContentType::Unsupported(local_var_unknown_type) => {
969                    return Err(Error::from(serde_json::Error::custom(format!(
970                        "Received `{local_var_unknown_type}` content type response that cannot be \
971                         converted to `models::Asset`"
972                    ))));
973                }
974            }
975        } else {
976            let local_var_entity: Option<UpdateAssetUserMetadataError> =
977                serde_json::from_str(&local_var_content).ok();
978            let local_var_error = ResponseContent {
979                status: local_var_status,
980                content: local_var_content,
981                entity: local_var_entity,
982            };
983            Err(Error::ResponseError(local_var_error))
984        }
985    }
986
987    /// Checks if an address is valid and active (for XRP, DOT, XLM, and EOS).
988    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
989    /// Editor.
990    async fn validate_address(
991        &self,
992        params: ValidateAddressParams,
993    ) -> Result<models::ValidateAddressResponse, Error<ValidateAddressError>> {
994        let ValidateAddressParams { asset_id, address } = params;
995
996        let local_var_configuration = &self.configuration;
997
998        let local_var_client = &local_var_configuration.client;
999
1000        let local_var_uri_str = format!(
1001            "{}/transactions/validate_address/{assetId}/{address}",
1002            local_var_configuration.base_path,
1003            assetId = crate::apis::urlencode(asset_id),
1004            address = crate::apis::urlencode(address)
1005        );
1006        let mut local_var_req_builder =
1007            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1008
1009        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1010            local_var_req_builder = local_var_req_builder
1011                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1012        }
1013
1014        let local_var_req = local_var_req_builder.build()?;
1015        let local_var_resp = local_var_client.execute(local_var_req).await?;
1016
1017        let local_var_status = local_var_resp.status();
1018        let local_var_content_type = local_var_resp
1019            .headers()
1020            .get("content-type")
1021            .and_then(|v| v.to_str().ok())
1022            .unwrap_or("application/octet-stream");
1023        let local_var_content_type = super::ContentType::from(local_var_content_type);
1024        let local_var_content = local_var_resp.text().await?;
1025
1026        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1027            match local_var_content_type {
1028                ContentType::Json => {
1029                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1030                }
1031                ContentType::Text => {
1032                    return Err(Error::from(serde_json::Error::custom(
1033                        "Received `text/plain` content type response that cannot be converted to \
1034                         `models::ValidateAddressResponse`",
1035                    )));
1036                }
1037                ContentType::Unsupported(local_var_unknown_type) => {
1038                    return Err(Error::from(serde_json::Error::custom(format!(
1039                        "Received `{local_var_unknown_type}` content type response that cannot be \
1040                         converted to `models::ValidateAddressResponse`"
1041                    ))));
1042                }
1043            }
1044        } else {
1045            let local_var_entity: Option<ValidateAddressError> =
1046                serde_json::from_str(&local_var_content).ok();
1047            let local_var_error = ResponseContent {
1048                status: local_var_status,
1049                content: local_var_content,
1050                entity: local_var_entity,
1051            };
1052            Err(Error::ResponseError(local_var_error))
1053        }
1054    }
1055}
1056
1057/// struct for typed errors of method
1058/// [`BlockchainsAssetsApi::estimate_network_fee`]
1059#[derive(Debug, Clone, Serialize, Deserialize)]
1060#[serde(untagged)]
1061pub enum EstimateNetworkFeeError {
1062    DefaultResponse(models::ErrorSchema),
1063    UnknownValue(serde_json::Value),
1064}
1065
1066/// struct for typed errors of method [`BlockchainsAssetsApi::get_asset`]
1067#[derive(Debug, Clone, Serialize, Deserialize)]
1068#[serde(untagged)]
1069pub enum GetAssetError {
1070    Status404(models::AssetNotFoundErrorResponse),
1071    Status500(models::AssetInternalServerErrorResponse),
1072    DefaultResponse(models::ErrorSchema),
1073    UnknownValue(serde_json::Value),
1074}
1075
1076/// struct for typed errors of method [`BlockchainsAssetsApi::get_blockchain`]
1077#[derive(Debug, Clone, Serialize, Deserialize)]
1078#[serde(untagged)]
1079pub enum GetBlockchainError {
1080    Status404(models::BlockchainNotFoundErrorResponse),
1081    Status500(models::AssetInternalServerErrorResponse),
1082    DefaultResponse(models::ErrorSchema),
1083    UnknownValue(serde_json::Value),
1084}
1085
1086/// struct for typed errors of method
1087/// [`BlockchainsAssetsApi::get_supported_assets`]
1088#[derive(Debug, Clone, Serialize, Deserialize)]
1089#[serde(untagged)]
1090pub enum GetSupportedAssetsError {
1091    DefaultResponse(models::ErrorSchema),
1092    UnknownValue(serde_json::Value),
1093}
1094
1095/// struct for typed errors of method [`BlockchainsAssetsApi::list_assets`]
1096#[derive(Debug, Clone, Serialize, Deserialize)]
1097#[serde(untagged)]
1098pub enum ListAssetsError {
1099    Status500(models::AssetInternalServerErrorResponse),
1100    DefaultResponse(models::ErrorSchema),
1101    UnknownValue(serde_json::Value),
1102}
1103
1104/// struct for typed errors of method [`BlockchainsAssetsApi::list_blockchains`]
1105#[derive(Debug, Clone, Serialize, Deserialize)]
1106#[serde(untagged)]
1107pub enum ListBlockchainsError {
1108    Status500(models::AssetInternalServerErrorResponse),
1109    DefaultResponse(models::ErrorSchema),
1110    UnknownValue(serde_json::Value),
1111}
1112
1113/// struct for typed errors of method
1114/// [`BlockchainsAssetsApi::register_new_asset`]
1115#[derive(Debug, Clone, Serialize, Deserialize)]
1116#[serde(untagged)]
1117pub enum RegisterNewAssetError {
1118    Status400(models::AssetBadRequestErrorResponse),
1119    Status403(models::AssetForbiddenErrorResponse),
1120    Status404(models::TokenInfoNotFoundErrorResponse),
1121    Status409(models::AssetConflictErrorResponse),
1122    Status500(models::AssetInternalServerErrorResponse),
1123    DefaultResponse(models::ErrorSchema),
1124    UnknownValue(serde_json::Value),
1125}
1126
1127/// struct for typed errors of method [`BlockchainsAssetsApi::set_asset_price`]
1128#[derive(Debug, Clone, Serialize, Deserialize)]
1129#[serde(untagged)]
1130pub enum SetAssetPriceError {
1131    Status403(models::AssetPriceForbiddenErrorResponse),
1132    Status404(models::AssetPriceNotFoundErrorResponse),
1133    DefaultResponse(models::ErrorSchema),
1134    UnknownValue(serde_json::Value),
1135}
1136
1137/// struct for typed errors of method
1138/// [`BlockchainsAssetsApi::update_asset_user_metadata`]
1139#[derive(Debug, Clone, Serialize, Deserialize)]
1140#[serde(untagged)]
1141pub enum UpdateAssetUserMetadataError {
1142    Status404(models::AssetNotFoundErrorResponse),
1143    Status500(models::AssetInternalServerErrorResponse),
1144    DefaultResponse(models::ErrorSchema),
1145    UnknownValue(serde_json::Value),
1146}
1147
1148/// struct for typed errors of method [`BlockchainsAssetsApi::validate_address`]
1149#[derive(Debug, Clone, Serialize, Deserialize)]
1150#[serde(untagged)]
1151pub enum ValidateAddressError {
1152    DefaultResponse(models::ErrorSchema),
1153    UnknownValue(serde_json::Value),
1154}