fireblocks_sdk/apis/
transactions_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 TransactionsApi: Send + Sync {
23    /// POST /transactions/{txId}/cancel
24    ///
25    /// Cancels a transaction by Fireblocks Transaction ID.  Can be used only
26    /// for transactions that did not get to the BROADCASTING state.
27    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
28    /// Editor.
29    async fn cancel_transaction(
30        &self,
31        params: CancelTransactionParams,
32    ) -> Result<models::CancelTransactionResponse, Error<CancelTransactionError>>;
33
34    /// POST /transactions
35    ///
36    /// Creates a new transaction. This endpoint can be used for regular Transfers, Contract Calls, Raw & Typed message signing. - For Transfers, the required parameters are: `assetId`, `source`, `destination` and `amount`.  - For Contract Calls, the required parameters are: `operation.CONTRACT_CALL`, `assetId` (Base Asset), `source`, `destination`, `amount` (usually 0) and `extraParameters` object with `contractCallData` string. - For Solana Program Calls, the required parameters are: `operation.PROGRAM_CALL`, `assetId` (SOL/SOL_TEST), `source`,  and `extraParameters` object with `programCallData` key while the value is a Base64 encoded unsigned serialized Solana transaction object.   - Typed Message Signing is supported for the following asset IDs: 'ETH', 'BTC' and 'TRX'. [Typed Message Signing Guide](https://developers.fireblocks.com/docs/typed-message-signing-overview). - To create ZEC transaction, please call [Get unspent UTXO Input endpoint](https://developers.fireblocks.com/reference/getunspentinputs) to get the amount and use it as an input under `networkfee` on this endpoint. Please use this formula `(0.0001 + 0.00005*N) where N is the number of inputs` to calculate the fee needed and use it as an input under networkFee field - When using `maxFee` and a boost is needed, the user should set a custom `gasPrice` to force the override. Learn more about Fireblocks Transactions management in the following [guide](https://developers.fireblocks.com/reference/create-transactions). </br>Endpoint Permission: Admin, Signer, Editor.
37    async fn create_transaction(
38        &self,
39        params: CreateTransactionParams,
40    ) -> Result<models::CreateTransactionResponse, Error<CreateTransactionError>>;
41
42    /// POST /transactions/{txId}/drop
43    ///
44    /// Drops a stuck ETH (EVM) transaction and creates a replacement
45    /// transaction with 0 amount. </br>Endpoint Permission: Admin, Non-Signing
46    /// Admin, Signer, Approver, Editor.
47    async fn drop_transaction(
48        &self,
49        params: DropTransactionParams,
50    ) -> Result<models::DropTransactionResponse, Error<DropTransactionError>>;
51
52    /// POST /transactions/estimate_fee
53    ///
54    /// Estimates the transaction fee for a specific transaction request. This endpoint simulates a transaction which means that the system will expect to have the requested asset and balance in the specified wallet.   **Note**: Supports all Fireblocks assets except ZCash (ZEC). Learn more about Fireblocks Fee Management in the following [guide](https://developers.fireblocks.com/reference/estimate-transaction-fee). </br>Endpoint Permission: Admin, Signer, Approver, Editor.
55    async fn estimate_transaction_fee(
56        &self,
57        params: EstimateTransactionFeeParams,
58    ) -> Result<models::EstimatedTransactionFeeResponse, Error<EstimateTransactionFeeError>>;
59
60    /// POST /transactions/{txId}/freeze
61    ///
62    /// Freezes a transaction by ID.  Usually used for AML integrations when the
63    /// incoming funds should be quarantined. For account based assets - the
64    /// entire amount of the transaction is frozen  For UTXO based assets - all
65    /// UTXOs of the specified transaction are frozen </br>Endpoint Permission:
66    /// Admin, Non-Signing Admin.
67    async fn freeze_transaction(
68        &self,
69        params: FreezeTransactionParams,
70    ) -> Result<models::FreezeTransactionResponse, Error<FreezeTransactionError>>;
71
72    /// GET /transactions/{txId}
73    ///
74    /// Get a specific transaction data by Fireblocks Transaction ID
75    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
76    /// Editor, Viewer.
77    async fn get_transaction(
78        &self,
79        params: GetTransactionParams,
80    ) -> Result<models::TransactionResponse, Error<GetTransactionError>>;
81
82    /// GET /transactions/external_tx_id/{externalTxId}
83    ///
84    /// Returns transaction by external transaction ID. </br>Endpoint
85    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
86    async fn get_transaction_by_external_id(
87        &self,
88        params: GetTransactionByExternalIdParams,
89    ) -> Result<models::TransactionResponse, Error<GetTransactionByExternalIdError>>;
90
91    /// GET /transactions
92    ///
93    /// Get the transaction history for your workspace.  **Endpoint
94    /// Permissions:** Admin, Non-Signing Admin, Signer, Approver, Editor,
95    /// Viewer.
96    async fn get_transactions(
97        &self,
98        params: GetTransactionsParams,
99    ) -> Result<Vec<models::TransactionResponse>, Error<GetTransactionsError>>;
100
101    /// POST /txHash/{txHash}/set_confirmation_threshold
102    ///
103    /// Overrides the required number of confirmations for transaction
104    /// completion by transaction hash. </br>Endpoint Permission: Admin,
105    /// Non-Signing Admin, Signer, Approver, Editor.
106    async fn set_confirmation_threshold_by_transaction_hash(
107        &self,
108        params: SetConfirmationThresholdByTransactionHashParams,
109    ) -> Result<
110        models::SetConfirmationsThresholdResponse,
111        Error<SetConfirmationThresholdByTransactionHashError>,
112    >;
113
114    /// POST /transactions/{txId}/set_confirmation_threshold
115    ///
116    /// Overrides the required number of confirmations for transaction
117    /// completion Fireblocks Transaction ID. </br>Endpoint Permission: Admin,
118    /// Non-Signing Admin, Signer, Approver, Editor.
119    async fn set_transaction_confirmation_threshold(
120        &self,
121        params: SetTransactionConfirmationThresholdParams,
122    ) -> Result<
123        models::SetConfirmationsThresholdResponse,
124        Error<SetTransactionConfirmationThresholdError>,
125    >;
126
127    /// POST /transactions/{txId}/unfreeze
128    ///
129    /// Unfreezes a transaction by Fireblocks Transaction ID and makes the
130    /// transaction available again. </br>Endpoint Permission: Admin,
131    /// Non-Signing Admin.
132    async fn unfreeze_transaction(
133        &self,
134        params: UnfreezeTransactionParams,
135    ) -> Result<models::UnfreezeTransactionResponse, Error<UnfreezeTransactionError>>;
136}
137
138pub struct TransactionsApiClient {
139    configuration: Arc<configuration::Configuration>,
140}
141
142impl TransactionsApiClient {
143    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
144        Self { configuration }
145    }
146}
147
148/// struct for passing parameters to the method
149/// [`TransactionsApi::cancel_transaction`]
150#[derive(Clone, Debug)]
151#[cfg_attr(feature = "bon", derive(::bon::Builder))]
152pub struct CancelTransactionParams {
153    /// The Fireblocks Transaction ID of the transaction to cancel
154    pub tx_id: String,
155    /// Unique ID of the End-User wallet to the API request. Required for
156    /// end-user wallet operations.
157    pub x_end_user_wallet_id: Option<String>,
158    /// A unique identifier for the request. If the request is sent multiple
159    /// times with the same idempotency key, the server will return the same
160    /// response as the first request. The idempotency key is valid for 24
161    /// hours.
162    pub idempotency_key: Option<String>,
163}
164
165/// struct for passing parameters to the method
166/// [`TransactionsApi::create_transaction`]
167#[derive(Clone, Debug)]
168#[cfg_attr(feature = "bon", derive(::bon::Builder))]
169pub struct CreateTransactionParams {
170    pub transaction_request: models::TransactionRequest,
171    /// Unique ID of the End-User wallet to the API request. Required for
172    /// end-user wallet operations.
173    pub x_end_user_wallet_id: Option<String>,
174    /// A unique identifier for the request. If the request is sent multiple
175    /// times with the same idempotency key, the server will return the same
176    /// response as the first request. The idempotency key is valid for 24
177    /// hours.
178    pub idempotency_key: Option<String>,
179}
180
181/// struct for passing parameters to the method
182/// [`TransactionsApi::drop_transaction`]
183#[derive(Clone, Debug)]
184#[cfg_attr(feature = "bon", derive(::bon::Builder))]
185pub struct DropTransactionParams {
186    /// The ID of the transaction
187    pub tx_id: String,
188    /// Unique ID of the End-User wallet to the API request. Required for
189    /// end-user wallet operations.
190    pub x_end_user_wallet_id: Option<String>,
191    /// A unique identifier for the request. If the request is sent multiple
192    /// times with the same idempotency key, the server will return the same
193    /// response as the first request. The idempotency key is valid for 24
194    /// hours.
195    pub idempotency_key: Option<String>,
196    pub drop_transaction_request: Option<models::DropTransactionRequest>,
197}
198
199/// struct for passing parameters to the method
200/// [`TransactionsApi::estimate_transaction_fee`]
201#[derive(Clone, Debug)]
202#[cfg_attr(feature = "bon", derive(::bon::Builder))]
203pub struct EstimateTransactionFeeParams {
204    /// A unique identifier for the request. If the request is sent multiple
205    /// times with the same idempotency key, the server will return the same
206    /// response as the first request. The idempotency key is valid for 24
207    /// hours.
208    pub idempotency_key: Option<String>,
209    pub transaction_request: Option<models::TransactionRequest>,
210}
211
212/// struct for passing parameters to the method
213/// [`TransactionsApi::freeze_transaction`]
214#[derive(Clone, Debug)]
215#[cfg_attr(feature = "bon", derive(::bon::Builder))]
216pub struct FreezeTransactionParams {
217    /// The ID of the transaction to freeze
218    pub tx_id: String,
219    /// Unique ID of the End-User wallet to the API request. Required for
220    /// end-user wallet operations.
221    pub x_end_user_wallet_id: Option<String>,
222    /// A unique identifier for the request. If the request is sent multiple
223    /// times with the same idempotency key, the server will return the same
224    /// response as the first request. The idempotency key is valid for 24
225    /// hours.
226    pub idempotency_key: Option<String>,
227}
228
229/// struct for passing parameters to the method
230/// [`TransactionsApi::get_transaction`]
231#[derive(Clone, Debug)]
232#[cfg_attr(feature = "bon", derive(::bon::Builder))]
233pub struct GetTransactionParams {
234    /// The ID of the transaction to return
235    pub tx_id: String,
236}
237
238/// struct for passing parameters to the method
239/// [`TransactionsApi::get_transaction_by_external_id`]
240#[derive(Clone, Debug)]
241#[cfg_attr(feature = "bon", derive(::bon::Builder))]
242pub struct GetTransactionByExternalIdParams {
243    /// The external ID of the transaction to return
244    pub external_tx_id: String,
245}
246
247/// struct for passing parameters to the method
248/// [`TransactionsApi::get_transactions`]
249#[derive(Clone, Debug)]
250#[cfg_attr(feature = "bon", derive(::bon::Builder))]
251pub struct GetTransactionsParams {
252    /// Unix timestamp in milliseconds. Returns only transactions created before
253    /// the specified date. Provides an explicit end time. If not provided,
254    /// default value will be applied, and may change over time.  The current
255    /// default value is the past 90 days.
256    pub before: Option<String>,
257    /// Unix timestamp in milliseconds. Returns only transactions created after
258    /// the specified date. Provides an explicit start time. If not provided,
259    /// default value will be applied, and may change over time.  The current
260    /// default value is the past 90 days.
261    pub after: Option<String>,
262    /// You can filter by one of the statuses.
263    pub status: Option<models::TransactionStatus>,
264    /// The field to order the results by.  **Note:** Ordering by a field that
265    /// is not `createdAt` may result in transactions that receive updates as
266    /// you request the next or previous pages of results, resulting in missing
267    /// those transactions.
268    pub order_by: Option<String>,
269    /// The direction to order the results by
270    pub sort: Option<String>,
271    /// Limits the number of results. If not provided, a limit of 200 will be
272    /// used. The maximum allowed limit is 500
273    pub limit: Option<u32>,
274    /// The source type of the transaction
275    pub source_type: Option<String>,
276    /// The source ID of the transaction
277    pub source_id: Option<String>,
278    /// The destination type of the transaction
279    pub dest_type: Option<String>,
280    /// The destination ID of the transaction
281    pub dest_id: Option<String>,
282    /// A list of assets to filter by, seperated by commas
283    pub assets: Option<String>,
284    /// Returns only results with a specified txHash
285    pub tx_hash: Option<String>,
286    /// Returns only results where the source is a specific end user wallet
287    pub source_wallet_id: Option<String>,
288    /// Returns only results where the destination is a specific end user wallet
289    pub dest_wallet_id: Option<String>,
290}
291
292/// struct for passing parameters to the method
293/// [`TransactionsApi::set_confirmation_threshold_by_transaction_hash`]
294#[derive(Clone, Debug)]
295#[cfg_attr(feature = "bon", derive(::bon::Builder))]
296pub struct SetConfirmationThresholdByTransactionHashParams {
297    /// The TxHash
298    pub tx_hash: String,
299    /// A unique identifier for the request. If the request is sent multiple
300    /// times with the same idempotency key, the server will return the same
301    /// response as the first request. The idempotency key is valid for 24
302    /// hours.
303    pub idempotency_key: Option<String>,
304    pub set_confirmations_threshold_request: Option<models::SetConfirmationsThresholdRequest>,
305}
306
307/// struct for passing parameters to the method
308/// [`TransactionsApi::set_transaction_confirmation_threshold`]
309#[derive(Clone, Debug)]
310#[cfg_attr(feature = "bon", derive(::bon::Builder))]
311pub struct SetTransactionConfirmationThresholdParams {
312    /// The ID of the transaction
313    pub tx_id: String,
314    /// A unique identifier for the request. If the request is sent multiple
315    /// times with the same idempotency key, the server will return the same
316    /// response as the first request. The idempotency key is valid for 24
317    /// hours.
318    pub idempotency_key: Option<String>,
319    pub set_confirmations_threshold_request: Option<models::SetConfirmationsThresholdRequest>,
320}
321
322/// struct for passing parameters to the method
323/// [`TransactionsApi::unfreeze_transaction`]
324#[derive(Clone, Debug)]
325#[cfg_attr(feature = "bon", derive(::bon::Builder))]
326pub struct UnfreezeTransactionParams {
327    /// The ID of the transaction to unfreeze
328    pub tx_id: String,
329    /// Unique ID of the End-User wallet to the API request. Required for
330    /// end-user wallet operations.
331    pub x_end_user_wallet_id: Option<String>,
332    /// A unique identifier for the request. If the request is sent multiple
333    /// times with the same idempotency key, the server will return the same
334    /// response as the first request. The idempotency key is valid for 24
335    /// hours.
336    pub idempotency_key: Option<String>,
337}
338
339#[async_trait]
340impl TransactionsApi for TransactionsApiClient {
341    /// Cancels a transaction by Fireblocks Transaction ID.  Can be used only
342    /// for transactions that did not get to the BROADCASTING state.
343    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
344    /// Editor.
345    async fn cancel_transaction(
346        &self,
347        params: CancelTransactionParams,
348    ) -> Result<models::CancelTransactionResponse, Error<CancelTransactionError>> {
349        let CancelTransactionParams {
350            tx_id,
351            x_end_user_wallet_id,
352            idempotency_key,
353        } = params;
354
355        let local_var_configuration = &self.configuration;
356
357        let local_var_client = &local_var_configuration.client;
358
359        let local_var_uri_str = format!(
360            "{}/transactions/{txId}/cancel",
361            local_var_configuration.base_path,
362            txId = crate::apis::urlencode(tx_id)
363        );
364        let mut local_var_req_builder =
365            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
366
367        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
368            local_var_req_builder = local_var_req_builder
369                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
370        }
371        if let Some(local_var_param_value) = x_end_user_wallet_id {
372            local_var_req_builder = local_var_req_builder
373                .header("X-End-User-Wallet-Id", local_var_param_value.to_string());
374        }
375        if let Some(local_var_param_value) = idempotency_key {
376            local_var_req_builder =
377                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
378        }
379
380        let local_var_req = local_var_req_builder.build()?;
381        let local_var_resp = local_var_client.execute(local_var_req).await?;
382
383        let local_var_status = local_var_resp.status();
384        let local_var_content_type = local_var_resp
385            .headers()
386            .get("content-type")
387            .and_then(|v| v.to_str().ok())
388            .unwrap_or("application/octet-stream");
389        let local_var_content_type = super::ContentType::from(local_var_content_type);
390        let local_var_content = local_var_resp.text().await?;
391
392        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
393            match local_var_content_type {
394                ContentType::Json => {
395                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
396                }
397                ContentType::Text => {
398                    return Err(Error::from(serde_json::Error::custom(
399                        "Received `text/plain` content type response that cannot be converted to \
400                         `models::CancelTransactionResponse`",
401                    )));
402                }
403                ContentType::Unsupported(local_var_unknown_type) => {
404                    return Err(Error::from(serde_json::Error::custom(format!(
405                        "Received `{local_var_unknown_type}` content type response that cannot be \
406                         converted to `models::CancelTransactionResponse`"
407                    ))));
408                }
409            }
410        } else {
411            let local_var_entity: Option<CancelTransactionError> =
412                serde_json::from_str(&local_var_content).ok();
413            let local_var_error = ResponseContent {
414                status: local_var_status,
415                content: local_var_content,
416                entity: local_var_entity,
417            };
418            Err(Error::ResponseError(local_var_error))
419        }
420    }
421
422    /// Creates a new transaction. This endpoint can be used for regular Transfers, Contract Calls, Raw & Typed message signing. - For Transfers, the required parameters are: `assetId`, `source`, `destination` and `amount`.  - For Contract Calls, the required parameters are: `operation.CONTRACT_CALL`, `assetId` (Base Asset), `source`, `destination`, `amount` (usually 0) and `extraParameters` object with `contractCallData` string. - For Solana Program Calls, the required parameters are: `operation.PROGRAM_CALL`, `assetId` (SOL/SOL_TEST), `source`,  and `extraParameters` object with `programCallData` key while the value is a Base64 encoded unsigned serialized Solana transaction object.   - Typed Message Signing is supported for the following asset IDs: 'ETH', 'BTC' and 'TRX'. [Typed Message Signing Guide](https://developers.fireblocks.com/docs/typed-message-signing-overview). - To create ZEC transaction, please call [Get unspent UTXO Input endpoint](https://developers.fireblocks.com/reference/getunspentinputs) to get the amount and use it as an input under `networkfee` on this endpoint. Please use this formula `(0.0001 + 0.00005*N) where N is the number of inputs` to calculate the fee needed and use it as an input under networkFee field - When using `maxFee` and a boost is needed, the user should set a custom `gasPrice` to force the override. Learn more about Fireblocks Transactions management in the following [guide](https://developers.fireblocks.com/reference/create-transactions). </br>Endpoint Permission: Admin, Signer, Editor.
423    async fn create_transaction(
424        &self,
425        params: CreateTransactionParams,
426    ) -> Result<models::CreateTransactionResponse, Error<CreateTransactionError>> {
427        let CreateTransactionParams {
428            transaction_request,
429            x_end_user_wallet_id,
430            idempotency_key,
431        } = params;
432
433        let local_var_configuration = &self.configuration;
434
435        let local_var_client = &local_var_configuration.client;
436
437        let local_var_uri_str = format!("{}/transactions", local_var_configuration.base_path);
438        let mut local_var_req_builder =
439            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
440
441        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
442            local_var_req_builder = local_var_req_builder
443                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
444        }
445        if let Some(local_var_param_value) = x_end_user_wallet_id {
446            local_var_req_builder = local_var_req_builder
447                .header("X-End-User-Wallet-Id", local_var_param_value.to_string());
448        }
449        if let Some(local_var_param_value) = idempotency_key {
450            local_var_req_builder =
451                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
452        }
453        local_var_req_builder = local_var_req_builder.json(&transaction_request);
454
455        let local_var_req = local_var_req_builder.build()?;
456        let local_var_resp = local_var_client.execute(local_var_req).await?;
457
458        let local_var_status = local_var_resp.status();
459        let local_var_content_type = local_var_resp
460            .headers()
461            .get("content-type")
462            .and_then(|v| v.to_str().ok())
463            .unwrap_or("application/octet-stream");
464        let local_var_content_type = super::ContentType::from(local_var_content_type);
465        let local_var_content = local_var_resp.text().await?;
466
467        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
468            match local_var_content_type {
469                ContentType::Json => {
470                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
471                }
472                ContentType::Text => {
473                    return Err(Error::from(serde_json::Error::custom(
474                        "Received `text/plain` content type response that cannot be converted to \
475                         `models::CreateTransactionResponse`",
476                    )));
477                }
478                ContentType::Unsupported(local_var_unknown_type) => {
479                    return Err(Error::from(serde_json::Error::custom(format!(
480                        "Received `{local_var_unknown_type}` content type response that cannot be \
481                         converted to `models::CreateTransactionResponse`"
482                    ))));
483                }
484            }
485        } else {
486            let local_var_entity: Option<CreateTransactionError> =
487                serde_json::from_str(&local_var_content).ok();
488            let local_var_error = ResponseContent {
489                status: local_var_status,
490                content: local_var_content,
491                entity: local_var_entity,
492            };
493            Err(Error::ResponseError(local_var_error))
494        }
495    }
496
497    /// Drops a stuck ETH (EVM) transaction and creates a replacement
498    /// transaction with 0 amount. </br>Endpoint Permission: Admin, Non-Signing
499    /// Admin, Signer, Approver, Editor.
500    async fn drop_transaction(
501        &self,
502        params: DropTransactionParams,
503    ) -> Result<models::DropTransactionResponse, Error<DropTransactionError>> {
504        let DropTransactionParams {
505            tx_id,
506            x_end_user_wallet_id,
507            idempotency_key,
508            drop_transaction_request,
509        } = params;
510
511        let local_var_configuration = &self.configuration;
512
513        let local_var_client = &local_var_configuration.client;
514
515        let local_var_uri_str = format!(
516            "{}/transactions/{txId}/drop",
517            local_var_configuration.base_path,
518            txId = crate::apis::urlencode(tx_id)
519        );
520        let mut local_var_req_builder =
521            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
522
523        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
524            local_var_req_builder = local_var_req_builder
525                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
526        }
527        if let Some(local_var_param_value) = x_end_user_wallet_id {
528            local_var_req_builder = local_var_req_builder
529                .header("X-End-User-Wallet-Id", local_var_param_value.to_string());
530        }
531        if let Some(local_var_param_value) = idempotency_key {
532            local_var_req_builder =
533                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
534        }
535        local_var_req_builder = local_var_req_builder.json(&drop_transaction_request);
536
537        let local_var_req = local_var_req_builder.build()?;
538        let local_var_resp = local_var_client.execute(local_var_req).await?;
539
540        let local_var_status = local_var_resp.status();
541        let local_var_content_type = local_var_resp
542            .headers()
543            .get("content-type")
544            .and_then(|v| v.to_str().ok())
545            .unwrap_or("application/octet-stream");
546        let local_var_content_type = super::ContentType::from(local_var_content_type);
547        let local_var_content = local_var_resp.text().await?;
548
549        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
550            match local_var_content_type {
551                ContentType::Json => {
552                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
553                }
554                ContentType::Text => {
555                    return Err(Error::from(serde_json::Error::custom(
556                        "Received `text/plain` content type response that cannot be converted to \
557                         `models::DropTransactionResponse`",
558                    )));
559                }
560                ContentType::Unsupported(local_var_unknown_type) => {
561                    return Err(Error::from(serde_json::Error::custom(format!(
562                        "Received `{local_var_unknown_type}` content type response that cannot be \
563                         converted to `models::DropTransactionResponse`"
564                    ))));
565                }
566            }
567        } else {
568            let local_var_entity: Option<DropTransactionError> =
569                serde_json::from_str(&local_var_content).ok();
570            let local_var_error = ResponseContent {
571                status: local_var_status,
572                content: local_var_content,
573                entity: local_var_entity,
574            };
575            Err(Error::ResponseError(local_var_error))
576        }
577    }
578
579    /// Estimates the transaction fee for a specific transaction request. This endpoint simulates a transaction which means that the system will expect to have the requested asset and balance in the specified wallet.   **Note**: Supports all Fireblocks assets except ZCash (ZEC). Learn more about Fireblocks Fee Management in the following [guide](https://developers.fireblocks.com/reference/estimate-transaction-fee). </br>Endpoint Permission: Admin, Signer, Approver, Editor.
580    async fn estimate_transaction_fee(
581        &self,
582        params: EstimateTransactionFeeParams,
583    ) -> Result<models::EstimatedTransactionFeeResponse, Error<EstimateTransactionFeeError>> {
584        let EstimateTransactionFeeParams {
585            idempotency_key,
586            transaction_request,
587        } = params;
588
589        let local_var_configuration = &self.configuration;
590
591        let local_var_client = &local_var_configuration.client;
592
593        let local_var_uri_str = format!(
594            "{}/transactions/estimate_fee",
595            local_var_configuration.base_path
596        );
597        let mut local_var_req_builder =
598            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
599
600        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
601            local_var_req_builder = local_var_req_builder
602                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
603        }
604        if let Some(local_var_param_value) = idempotency_key {
605            local_var_req_builder =
606                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
607        }
608        local_var_req_builder = local_var_req_builder.json(&transaction_request);
609
610        let local_var_req = local_var_req_builder.build()?;
611        let local_var_resp = local_var_client.execute(local_var_req).await?;
612
613        let local_var_status = local_var_resp.status();
614        let local_var_content_type = local_var_resp
615            .headers()
616            .get("content-type")
617            .and_then(|v| v.to_str().ok())
618            .unwrap_or("application/octet-stream");
619        let local_var_content_type = super::ContentType::from(local_var_content_type);
620        let local_var_content = local_var_resp.text().await?;
621
622        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
623            match local_var_content_type {
624                ContentType::Json => {
625                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
626                }
627                ContentType::Text => {
628                    return Err(Error::from(serde_json::Error::custom(
629                        "Received `text/plain` content type response that cannot be converted to \
630                         `models::EstimatedTransactionFeeResponse`",
631                    )));
632                }
633                ContentType::Unsupported(local_var_unknown_type) => {
634                    return Err(Error::from(serde_json::Error::custom(format!(
635                        "Received `{local_var_unknown_type}` content type response that cannot be \
636                         converted to `models::EstimatedTransactionFeeResponse`"
637                    ))));
638                }
639            }
640        } else {
641            let local_var_entity: Option<EstimateTransactionFeeError> =
642                serde_json::from_str(&local_var_content).ok();
643            let local_var_error = ResponseContent {
644                status: local_var_status,
645                content: local_var_content,
646                entity: local_var_entity,
647            };
648            Err(Error::ResponseError(local_var_error))
649        }
650    }
651
652    /// Freezes a transaction by ID.  Usually used for AML integrations when the
653    /// incoming funds should be quarantined. For account based assets - the
654    /// entire amount of the transaction is frozen  For UTXO based assets - all
655    /// UTXOs of the specified transaction are frozen </br>Endpoint Permission:
656    /// Admin, Non-Signing Admin.
657    async fn freeze_transaction(
658        &self,
659        params: FreezeTransactionParams,
660    ) -> Result<models::FreezeTransactionResponse, Error<FreezeTransactionError>> {
661        let FreezeTransactionParams {
662            tx_id,
663            x_end_user_wallet_id,
664            idempotency_key,
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!(
672            "{}/transactions/{txId}/freeze",
673            local_var_configuration.base_path,
674            txId = crate::apis::urlencode(tx_id)
675        );
676        let mut local_var_req_builder =
677            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
678
679        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
680            local_var_req_builder = local_var_req_builder
681                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
682        }
683        if let Some(local_var_param_value) = x_end_user_wallet_id {
684            local_var_req_builder = local_var_req_builder
685                .header("X-End-User-Wallet-Id", local_var_param_value.to_string());
686        }
687        if let Some(local_var_param_value) = idempotency_key {
688            local_var_req_builder =
689                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
690        }
691
692        let local_var_req = local_var_req_builder.build()?;
693        let local_var_resp = local_var_client.execute(local_var_req).await?;
694
695        let local_var_status = local_var_resp.status();
696        let local_var_content_type = local_var_resp
697            .headers()
698            .get("content-type")
699            .and_then(|v| v.to_str().ok())
700            .unwrap_or("application/octet-stream");
701        let local_var_content_type = super::ContentType::from(local_var_content_type);
702        let local_var_content = local_var_resp.text().await?;
703
704        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
705            match local_var_content_type {
706                ContentType::Json => {
707                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
708                }
709                ContentType::Text => {
710                    return Err(Error::from(serde_json::Error::custom(
711                        "Received `text/plain` content type response that cannot be converted to \
712                         `models::FreezeTransactionResponse`",
713                    )));
714                }
715                ContentType::Unsupported(local_var_unknown_type) => {
716                    return Err(Error::from(serde_json::Error::custom(format!(
717                        "Received `{local_var_unknown_type}` content type response that cannot be \
718                         converted to `models::FreezeTransactionResponse`"
719                    ))));
720                }
721            }
722        } else {
723            let local_var_entity: Option<FreezeTransactionError> =
724                serde_json::from_str(&local_var_content).ok();
725            let local_var_error = ResponseContent {
726                status: local_var_status,
727                content: local_var_content,
728                entity: local_var_entity,
729            };
730            Err(Error::ResponseError(local_var_error))
731        }
732    }
733
734    /// Get a specific transaction data by Fireblocks Transaction ID
735    /// </br>Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver,
736    /// Editor, Viewer.
737    async fn get_transaction(
738        &self,
739        params: GetTransactionParams,
740    ) -> Result<models::TransactionResponse, Error<GetTransactionError>> {
741        let GetTransactionParams { tx_id } = params;
742
743        let local_var_configuration = &self.configuration;
744
745        let local_var_client = &local_var_configuration.client;
746
747        let local_var_uri_str = format!(
748            "{}/transactions/{txId}",
749            local_var_configuration.base_path,
750            txId = crate::apis::urlencode(tx_id)
751        );
752        let mut local_var_req_builder =
753            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
754
755        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
756            local_var_req_builder = local_var_req_builder
757                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
758        }
759
760        let local_var_req = local_var_req_builder.build()?;
761        let local_var_resp = local_var_client.execute(local_var_req).await?;
762
763        let local_var_status = local_var_resp.status();
764        let local_var_content_type = local_var_resp
765            .headers()
766            .get("content-type")
767            .and_then(|v| v.to_str().ok())
768            .unwrap_or("application/octet-stream");
769        let local_var_content_type = super::ContentType::from(local_var_content_type);
770        let local_var_content = local_var_resp.text().await?;
771
772        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
773            match local_var_content_type {
774                ContentType::Json => {
775                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
776                }
777                ContentType::Text => {
778                    return Err(Error::from(serde_json::Error::custom(
779                        "Received `text/plain` content type response that cannot be converted to \
780                         `models::TransactionResponse`",
781                    )));
782                }
783                ContentType::Unsupported(local_var_unknown_type) => {
784                    return Err(Error::from(serde_json::Error::custom(format!(
785                        "Received `{local_var_unknown_type}` content type response that cannot be \
786                         converted to `models::TransactionResponse`"
787                    ))));
788                }
789            }
790        } else {
791            let local_var_entity: Option<GetTransactionError> =
792                serde_json::from_str(&local_var_content).ok();
793            let local_var_error = ResponseContent {
794                status: local_var_status,
795                content: local_var_content,
796                entity: local_var_entity,
797            };
798            Err(Error::ResponseError(local_var_error))
799        }
800    }
801
802    /// Returns transaction by external transaction ID. </br>Endpoint
803    /// Permission: Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
804    async fn get_transaction_by_external_id(
805        &self,
806        params: GetTransactionByExternalIdParams,
807    ) -> Result<models::TransactionResponse, Error<GetTransactionByExternalIdError>> {
808        let GetTransactionByExternalIdParams { external_tx_id } = params;
809
810        let local_var_configuration = &self.configuration;
811
812        let local_var_client = &local_var_configuration.client;
813
814        let local_var_uri_str = format!(
815            "{}/transactions/external_tx_id/{externalTxId}",
816            local_var_configuration.base_path,
817            externalTxId = crate::apis::urlencode(external_tx_id)
818        );
819        let mut local_var_req_builder =
820            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
821
822        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
823            local_var_req_builder = local_var_req_builder
824                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
825        }
826
827        let local_var_req = local_var_req_builder.build()?;
828        let local_var_resp = local_var_client.execute(local_var_req).await?;
829
830        let local_var_status = local_var_resp.status();
831        let local_var_content_type = local_var_resp
832            .headers()
833            .get("content-type")
834            .and_then(|v| v.to_str().ok())
835            .unwrap_or("application/octet-stream");
836        let local_var_content_type = super::ContentType::from(local_var_content_type);
837        let local_var_content = local_var_resp.text().await?;
838
839        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
840            match local_var_content_type {
841                ContentType::Json => {
842                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
843                }
844                ContentType::Text => {
845                    return Err(Error::from(serde_json::Error::custom(
846                        "Received `text/plain` content type response that cannot be converted to \
847                         `models::TransactionResponse`",
848                    )));
849                }
850                ContentType::Unsupported(local_var_unknown_type) => {
851                    return Err(Error::from(serde_json::Error::custom(format!(
852                        "Received `{local_var_unknown_type}` content type response that cannot be \
853                         converted to `models::TransactionResponse`"
854                    ))));
855                }
856            }
857        } else {
858            let local_var_entity: Option<GetTransactionByExternalIdError> =
859                serde_json::from_str(&local_var_content).ok();
860            let local_var_error = ResponseContent {
861                status: local_var_status,
862                content: local_var_content,
863                entity: local_var_entity,
864            };
865            Err(Error::ResponseError(local_var_error))
866        }
867    }
868
869    /// Get the transaction history for your workspace.  **Endpoint
870    /// Permissions:** Admin, Non-Signing Admin, Signer, Approver, Editor,
871    /// Viewer.
872    async fn get_transactions(
873        &self,
874        params: GetTransactionsParams,
875    ) -> Result<Vec<models::TransactionResponse>, Error<GetTransactionsError>> {
876        let GetTransactionsParams {
877            before,
878            after,
879            status,
880            order_by,
881            sort,
882            limit,
883            source_type,
884            source_id,
885            dest_type,
886            dest_id,
887            assets,
888            tx_hash,
889            source_wallet_id,
890            dest_wallet_id,
891        } = params;
892
893        let local_var_configuration = &self.configuration;
894
895        let local_var_client = &local_var_configuration.client;
896
897        let local_var_uri_str = format!("{}/transactions", local_var_configuration.base_path);
898        let mut local_var_req_builder =
899            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
900
901        if let Some(ref param_value) = before {
902            local_var_req_builder =
903                local_var_req_builder.query(&[("before", &param_value.to_string())]);
904        }
905        if let Some(ref param_value) = after {
906            local_var_req_builder =
907                local_var_req_builder.query(&[("after", &param_value.to_string())]);
908        }
909        if let Some(ref param_value) = status {
910            local_var_req_builder =
911                local_var_req_builder.query(&[("status", &param_value.to_string())]);
912        }
913        if let Some(ref param_value) = order_by {
914            local_var_req_builder =
915                local_var_req_builder.query(&[("orderBy", &param_value.to_string())]);
916        }
917        if let Some(ref param_value) = sort {
918            local_var_req_builder =
919                local_var_req_builder.query(&[("sort", &param_value.to_string())]);
920        }
921        if let Some(ref param_value) = limit {
922            local_var_req_builder =
923                local_var_req_builder.query(&[("limit", &param_value.to_string())]);
924        }
925        if let Some(ref param_value) = source_type {
926            local_var_req_builder =
927                local_var_req_builder.query(&[("sourceType", &param_value.to_string())]);
928        }
929        if let Some(ref param_value) = source_id {
930            local_var_req_builder =
931                local_var_req_builder.query(&[("sourceId", &param_value.to_string())]);
932        }
933        if let Some(ref param_value) = dest_type {
934            local_var_req_builder =
935                local_var_req_builder.query(&[("destType", &param_value.to_string())]);
936        }
937        if let Some(ref param_value) = dest_id {
938            local_var_req_builder =
939                local_var_req_builder.query(&[("destId", &param_value.to_string())]);
940        }
941        if let Some(ref param_value) = assets {
942            local_var_req_builder =
943                local_var_req_builder.query(&[("assets", &param_value.to_string())]);
944        }
945        if let Some(ref param_value) = tx_hash {
946            local_var_req_builder =
947                local_var_req_builder.query(&[("txHash", &param_value.to_string())]);
948        }
949        if let Some(ref param_value) = source_wallet_id {
950            local_var_req_builder =
951                local_var_req_builder.query(&[("sourceWalletId", &param_value.to_string())]);
952        }
953        if let Some(ref param_value) = dest_wallet_id {
954            local_var_req_builder =
955                local_var_req_builder.query(&[("destWalletId", &param_value.to_string())]);
956        }
957        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
958            local_var_req_builder = local_var_req_builder
959                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
960        }
961
962        let local_var_req = local_var_req_builder.build()?;
963        let local_var_resp = local_var_client.execute(local_var_req).await?;
964
965        let local_var_status = local_var_resp.status();
966        let local_var_content_type = local_var_resp
967            .headers()
968            .get("content-type")
969            .and_then(|v| v.to_str().ok())
970            .unwrap_or("application/octet-stream");
971        let local_var_content_type = super::ContentType::from(local_var_content_type);
972        let local_var_content = local_var_resp.text().await?;
973
974        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
975            match local_var_content_type {
976                ContentType::Json => {
977                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
978                }
979                ContentType::Text => {
980                    return Err(Error::from(serde_json::Error::custom(
981                        "Received `text/plain` content type response that cannot be converted to \
982                         `Vec&lt;models::TransactionResponse&gt;`",
983                    )));
984                }
985                ContentType::Unsupported(local_var_unknown_type) => {
986                    return Err(Error::from(serde_json::Error::custom(format!(
987                        "Received `{local_var_unknown_type}` content type response that cannot be \
988                         converted to `Vec&lt;models::TransactionResponse&gt;`"
989                    ))));
990                }
991            }
992        } else {
993            let local_var_entity: Option<GetTransactionsError> =
994                serde_json::from_str(&local_var_content).ok();
995            let local_var_error = ResponseContent {
996                status: local_var_status,
997                content: local_var_content,
998                entity: local_var_entity,
999            };
1000            Err(Error::ResponseError(local_var_error))
1001        }
1002    }
1003
1004    /// Overrides the required number of confirmations for transaction
1005    /// completion by transaction hash. </br>Endpoint Permission: Admin,
1006    /// Non-Signing Admin, Signer, Approver, Editor.
1007    async fn set_confirmation_threshold_by_transaction_hash(
1008        &self,
1009        params: SetConfirmationThresholdByTransactionHashParams,
1010    ) -> Result<
1011        models::SetConfirmationsThresholdResponse,
1012        Error<SetConfirmationThresholdByTransactionHashError>,
1013    > {
1014        let SetConfirmationThresholdByTransactionHashParams {
1015            tx_hash,
1016            idempotency_key,
1017            set_confirmations_threshold_request,
1018        } = params;
1019
1020        let local_var_configuration = &self.configuration;
1021
1022        let local_var_client = &local_var_configuration.client;
1023
1024        let local_var_uri_str = format!(
1025            "{}/txHash/{txHash}/set_confirmation_threshold",
1026            local_var_configuration.base_path,
1027            txHash = crate::apis::urlencode(tx_hash)
1028        );
1029        let mut local_var_req_builder =
1030            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1031
1032        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1033            local_var_req_builder = local_var_req_builder
1034                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1035        }
1036        if let Some(local_var_param_value) = idempotency_key {
1037            local_var_req_builder =
1038                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1039        }
1040        local_var_req_builder = local_var_req_builder.json(&set_confirmations_threshold_request);
1041
1042        let local_var_req = local_var_req_builder.build()?;
1043        let local_var_resp = local_var_client.execute(local_var_req).await?;
1044
1045        let local_var_status = local_var_resp.status();
1046        let local_var_content_type = local_var_resp
1047            .headers()
1048            .get("content-type")
1049            .and_then(|v| v.to_str().ok())
1050            .unwrap_or("application/octet-stream");
1051        let local_var_content_type = super::ContentType::from(local_var_content_type);
1052        let local_var_content = local_var_resp.text().await?;
1053
1054        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1055            match local_var_content_type {
1056                ContentType::Json => {
1057                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1058                }
1059                ContentType::Text => {
1060                    return Err(Error::from(serde_json::Error::custom(
1061                        "Received `text/plain` content type response that cannot be converted to \
1062                         `models::SetConfirmationsThresholdResponse`",
1063                    )));
1064                }
1065                ContentType::Unsupported(local_var_unknown_type) => {
1066                    return Err(Error::from(serde_json::Error::custom(format!(
1067                        "Received `{local_var_unknown_type}` content type response that cannot be \
1068                         converted to `models::SetConfirmationsThresholdResponse`"
1069                    ))));
1070                }
1071            }
1072        } else {
1073            let local_var_entity: Option<SetConfirmationThresholdByTransactionHashError> =
1074                serde_json::from_str(&local_var_content).ok();
1075            let local_var_error = ResponseContent {
1076                status: local_var_status,
1077                content: local_var_content,
1078                entity: local_var_entity,
1079            };
1080            Err(Error::ResponseError(local_var_error))
1081        }
1082    }
1083
1084    /// Overrides the required number of confirmations for transaction
1085    /// completion Fireblocks Transaction ID. </br>Endpoint Permission: Admin,
1086    /// Non-Signing Admin, Signer, Approver, Editor.
1087    async fn set_transaction_confirmation_threshold(
1088        &self,
1089        params: SetTransactionConfirmationThresholdParams,
1090    ) -> Result<
1091        models::SetConfirmationsThresholdResponse,
1092        Error<SetTransactionConfirmationThresholdError>,
1093    > {
1094        let SetTransactionConfirmationThresholdParams {
1095            tx_id,
1096            idempotency_key,
1097            set_confirmations_threshold_request,
1098        } = params;
1099
1100        let local_var_configuration = &self.configuration;
1101
1102        let local_var_client = &local_var_configuration.client;
1103
1104        let local_var_uri_str = format!(
1105            "{}/transactions/{txId}/set_confirmation_threshold",
1106            local_var_configuration.base_path,
1107            txId = crate::apis::urlencode(tx_id)
1108        );
1109        let mut local_var_req_builder =
1110            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1111
1112        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1113            local_var_req_builder = local_var_req_builder
1114                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1115        }
1116        if let Some(local_var_param_value) = idempotency_key {
1117            local_var_req_builder =
1118                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1119        }
1120        local_var_req_builder = local_var_req_builder.json(&set_confirmations_threshold_request);
1121
1122        let local_var_req = local_var_req_builder.build()?;
1123        let local_var_resp = local_var_client.execute(local_var_req).await?;
1124
1125        let local_var_status = local_var_resp.status();
1126        let local_var_content_type = local_var_resp
1127            .headers()
1128            .get("content-type")
1129            .and_then(|v| v.to_str().ok())
1130            .unwrap_or("application/octet-stream");
1131        let local_var_content_type = super::ContentType::from(local_var_content_type);
1132        let local_var_content = local_var_resp.text().await?;
1133
1134        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1135            match local_var_content_type {
1136                ContentType::Json => {
1137                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1138                }
1139                ContentType::Text => {
1140                    return Err(Error::from(serde_json::Error::custom(
1141                        "Received `text/plain` content type response that cannot be converted to \
1142                         `models::SetConfirmationsThresholdResponse`",
1143                    )));
1144                }
1145                ContentType::Unsupported(local_var_unknown_type) => {
1146                    return Err(Error::from(serde_json::Error::custom(format!(
1147                        "Received `{local_var_unknown_type}` content type response that cannot be \
1148                         converted to `models::SetConfirmationsThresholdResponse`"
1149                    ))));
1150                }
1151            }
1152        } else {
1153            let local_var_entity: Option<SetTransactionConfirmationThresholdError> =
1154                serde_json::from_str(&local_var_content).ok();
1155            let local_var_error = ResponseContent {
1156                status: local_var_status,
1157                content: local_var_content,
1158                entity: local_var_entity,
1159            };
1160            Err(Error::ResponseError(local_var_error))
1161        }
1162    }
1163
1164    /// Unfreezes a transaction by Fireblocks Transaction ID and makes the
1165    /// transaction available again. </br>Endpoint Permission: Admin,
1166    /// Non-Signing Admin.
1167    async fn unfreeze_transaction(
1168        &self,
1169        params: UnfreezeTransactionParams,
1170    ) -> Result<models::UnfreezeTransactionResponse, Error<UnfreezeTransactionError>> {
1171        let UnfreezeTransactionParams {
1172            tx_id,
1173            x_end_user_wallet_id,
1174            idempotency_key,
1175        } = params;
1176
1177        let local_var_configuration = &self.configuration;
1178
1179        let local_var_client = &local_var_configuration.client;
1180
1181        let local_var_uri_str = format!(
1182            "{}/transactions/{txId}/unfreeze",
1183            local_var_configuration.base_path,
1184            txId = crate::apis::urlencode(tx_id)
1185        );
1186        let mut local_var_req_builder =
1187            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1188
1189        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1190            local_var_req_builder = local_var_req_builder
1191                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1192        }
1193        if let Some(local_var_param_value) = x_end_user_wallet_id {
1194            local_var_req_builder = local_var_req_builder
1195                .header("X-End-User-Wallet-Id", local_var_param_value.to_string());
1196        }
1197        if let Some(local_var_param_value) = idempotency_key {
1198            local_var_req_builder =
1199                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1200        }
1201
1202        let local_var_req = local_var_req_builder.build()?;
1203        let local_var_resp = local_var_client.execute(local_var_req).await?;
1204
1205        let local_var_status = local_var_resp.status();
1206        let local_var_content_type = local_var_resp
1207            .headers()
1208            .get("content-type")
1209            .and_then(|v| v.to_str().ok())
1210            .unwrap_or("application/octet-stream");
1211        let local_var_content_type = super::ContentType::from(local_var_content_type);
1212        let local_var_content = local_var_resp.text().await?;
1213
1214        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1215            match local_var_content_type {
1216                ContentType::Json => {
1217                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1218                }
1219                ContentType::Text => {
1220                    return Err(Error::from(serde_json::Error::custom(
1221                        "Received `text/plain` content type response that cannot be converted to \
1222                         `models::UnfreezeTransactionResponse`",
1223                    )));
1224                }
1225                ContentType::Unsupported(local_var_unknown_type) => {
1226                    return Err(Error::from(serde_json::Error::custom(format!(
1227                        "Received `{local_var_unknown_type}` content type response that cannot be \
1228                         converted to `models::UnfreezeTransactionResponse`"
1229                    ))));
1230                }
1231            }
1232        } else {
1233            let local_var_entity: Option<UnfreezeTransactionError> =
1234                serde_json::from_str(&local_var_content).ok();
1235            let local_var_error = ResponseContent {
1236                status: local_var_status,
1237                content: local_var_content,
1238                entity: local_var_entity,
1239            };
1240            Err(Error::ResponseError(local_var_error))
1241        }
1242    }
1243}
1244
1245/// struct for typed errors of method [`TransactionsApi::cancel_transaction`]
1246#[derive(Debug, Clone, Serialize, Deserialize)]
1247#[serde(untagged)]
1248pub enum CancelTransactionError {
1249    DefaultResponse(models::ErrorSchema),
1250    UnknownValue(serde_json::Value),
1251}
1252
1253/// struct for typed errors of method [`TransactionsApi::create_transaction`]
1254#[derive(Debug, Clone, Serialize, Deserialize)]
1255#[serde(untagged)]
1256pub enum CreateTransactionError {
1257    DefaultResponse(models::ErrorSchema),
1258    UnknownValue(serde_json::Value),
1259}
1260
1261/// struct for typed errors of method [`TransactionsApi::drop_transaction`]
1262#[derive(Debug, Clone, Serialize, Deserialize)]
1263#[serde(untagged)]
1264pub enum DropTransactionError {
1265    DefaultResponse(models::ErrorSchema),
1266    UnknownValue(serde_json::Value),
1267}
1268
1269/// struct for typed errors of method
1270/// [`TransactionsApi::estimate_transaction_fee`]
1271#[derive(Debug, Clone, Serialize, Deserialize)]
1272#[serde(untagged)]
1273pub enum EstimateTransactionFeeError {
1274    DefaultResponse(models::ErrorSchema),
1275    UnknownValue(serde_json::Value),
1276}
1277
1278/// struct for typed errors of method [`TransactionsApi::freeze_transaction`]
1279#[derive(Debug, Clone, Serialize, Deserialize)]
1280#[serde(untagged)]
1281pub enum FreezeTransactionError {
1282    UnknownValue(serde_json::Value),
1283}
1284
1285/// struct for typed errors of method [`TransactionsApi::get_transaction`]
1286#[derive(Debug, Clone, Serialize, Deserialize)]
1287#[serde(untagged)]
1288pub enum GetTransactionError {
1289    Status400(models::ErrorSchema),
1290    DefaultResponse(models::ErrorSchema),
1291    UnknownValue(serde_json::Value),
1292}
1293
1294/// struct for typed errors of method
1295/// [`TransactionsApi::get_transaction_by_external_id`]
1296#[derive(Debug, Clone, Serialize, Deserialize)]
1297#[serde(untagged)]
1298pub enum GetTransactionByExternalIdError {
1299    DefaultResponse(models::ErrorSchema),
1300    UnknownValue(serde_json::Value),
1301}
1302
1303/// struct for typed errors of method [`TransactionsApi::get_transactions`]
1304#[derive(Debug, Clone, Serialize, Deserialize)]
1305#[serde(untagged)]
1306pub enum GetTransactionsError {
1307    DefaultResponse(models::ErrorSchema),
1308    UnknownValue(serde_json::Value),
1309}
1310
1311/// struct for typed errors of method
1312/// [`TransactionsApi::set_confirmation_threshold_by_transaction_hash`]
1313#[derive(Debug, Clone, Serialize, Deserialize)]
1314#[serde(untagged)]
1315pub enum SetConfirmationThresholdByTransactionHashError {
1316    DefaultResponse(models::ErrorSchema),
1317    UnknownValue(serde_json::Value),
1318}
1319
1320/// struct for typed errors of method
1321/// [`TransactionsApi::set_transaction_confirmation_threshold`]
1322#[derive(Debug, Clone, Serialize, Deserialize)]
1323#[serde(untagged)]
1324pub enum SetTransactionConfirmationThresholdError {
1325    DefaultResponse(models::ErrorSchema),
1326    UnknownValue(serde_json::Value),
1327}
1328
1329/// struct for typed errors of method [`TransactionsApi::unfreeze_transaction`]
1330#[derive(Debug, Clone, Serialize, Deserialize)]
1331#[serde(untagged)]
1332pub enum UnfreezeTransactionError {
1333    UnknownValue(serde_json::Value),
1334}