From 16f63cf0d048d379ed6af2da526dd4d54a8712f2 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Mon, 23 Dec 2024 17:03:04 +0300 Subject: [PATCH 01/11] wip, started changing handler --- .../rust/private/src/apis/chainstate_api.rs | 95 ++----- .../rust/private/src/apis/configuration.rs | 6 +- .../client/rust/private/src/apis/cors_api.rs | 237 +++++----------- .../rust/private/src/apis/deposit_api.rs | 140 +++------- .../rust/private/src/apis/health_api.rs | 29 +- .../rust/private/src/apis/limits_api.rs | 102 ++----- .../emily/client/rust/private/src/apis/mod.rs | 18 +- .../rust/private/src/apis/withdrawal_api.rs | 104 ++----- .../emily/client/rust/private/src/lib.rs | 4 +- .../rust/private/src/models/account_limits.rs | 31 +-- .../rust/private/src/models/chainstate.rs | 3 +- .../src/models/create_deposit_request_body.rs | 10 +- .../models/create_withdrawal_request_body.rs | 12 +- .../client/rust/private/src/models/deposit.rs | 24 +- .../rust/private/src/models/deposit_info.rs | 15 +- .../private/src/models/deposit_parameters.rs | 8 +- .../rust/private/src/models/deposit_update.rs | 19 +- .../rust/private/src/models/error_response.rs | 7 +- .../rust/private/src/models/fulfillment.rs | 12 +- .../get_deposits_for_transaction_response.rs | 15 +- .../src/models/get_deposits_response.rs | 15 +- .../src/models/get_withdrawals_response.rs | 15 +- .../rust/private/src/models/health_data.rs | 7 +- .../client/rust/private/src/models/limits.rs | 31 +-- .../client/rust/private/src/models/status.rs | 4 +- .../models/update_deposits_request_body.rs | 7 +- .../src/models/update_deposits_response.rs | 7 +- .../models/update_withdrawals_request_body.rs | 7 +- .../src/models/update_withdrawals_response.rs | 7 +- .../rust/private/src/models/withdrawal.rs | 23 +- .../private/src/models/withdrawal_info.rs | 14 +- .../src/models/withdrawal_parameters.rs | 7 +- .../private/src/models/withdrawal_update.rs | 18 +- .../rust/testing/src/apis/chainstate_api.rs | 95 ++----- .../rust/testing/src/apis/configuration.rs | 6 +- .../client/rust/testing/src/apis/cors_api.rs | 256 +++++------------- .../rust/testing/src/apis/deposit_api.rs | 140 +++------- .../rust/testing/src/apis/health_api.rs | 29 +- .../rust/testing/src/apis/limits_api.rs | 102 ++----- .../emily/client/rust/testing/src/apis/mod.rs | 18 +- .../rust/testing/src/apis/testing_api.rs | 29 +- .../rust/testing/src/apis/withdrawal_api.rs | 104 ++----- .../emily/client/rust/testing/src/lib.rs | 4 +- .../rust/testing/src/models/account_limits.rs | 31 +-- .../rust/testing/src/models/chainstate.rs | 3 +- .../src/models/create_deposit_request_body.rs | 10 +- .../models/create_withdrawal_request_body.rs | 12 +- .../client/rust/testing/src/models/deposit.rs | 24 +- .../rust/testing/src/models/deposit_info.rs | 15 +- .../testing/src/models/deposit_parameters.rs | 8 +- .../rust/testing/src/models/deposit_update.rs | 19 +- .../rust/testing/src/models/error_response.rs | 7 +- .../rust/testing/src/models/fulfillment.rs | 12 +- .../get_deposits_for_transaction_response.rs | 15 +- .../src/models/get_deposits_response.rs | 15 +- .../src/models/get_withdrawals_response.rs | 15 +- .../rust/testing/src/models/health_data.rs | 7 +- .../client/rust/testing/src/models/limits.rs | 31 +-- .../client/rust/testing/src/models/status.rs | 4 +- .../models/update_deposits_request_body.rs | 7 +- .../src/models/update_deposits_response.rs | 7 +- .../models/update_withdrawals_request_body.rs | 7 +- .../src/models/update_withdrawals_response.rs | 7 +- .../rust/testing/src/models/withdrawal.rs | 23 +- .../testing/src/models/withdrawal_info.rs | 14 +- .../src/models/withdrawal_parameters.rs | 7 +- .../testing/src/models/withdrawal_update.rs | 18 +- .../private-emily-openapi-spec.json | 10 + .../public-emily-openapi-spec.json | 10 + .../testing-emily-openapi-spec.json | 10 + emily/handler/src/api/handlers/deposit.rs | 28 +- emily/handler/tests/integration/deposit.rs | 78 ++++++ 72 files changed, 800 insertions(+), 1490 deletions(-) diff --git a/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs b/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs index 32cc62c9b..268420335 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_chain_tip`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -56,20 +58,17 @@ pub enum UpdateChainstateError { UnknownValue(serde_json::Value), } -pub async fn get_chain_tip( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -81,36 +80,22 @@ pub async fn get_chain_tip( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_chainstate_at_height( - configuration: &configuration::Configuration, - height: u64, -) -> Result> { +pub async fn get_chainstate_at_height(configuration: &configuration::Configuration, height: u64) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/chainstate/{height}", - local_var_configuration.base_path, - height = height - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -122,32 +107,22 @@ pub async fn get_chainstate_at_height( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_chainstate( - configuration: &configuration::Configuration, - chainstate: models::Chainstate, -) -> Result> { +pub async fn set_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -168,32 +143,22 @@ pub async fn set_chainstate( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_chainstate( - configuration: &configuration::Configuration, - chainstate: models::Chainstate, -) -> Result> { +pub async fn update_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -214,13 +179,9 @@ pub async fn update_chainstate( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/apis/configuration.rs b/.generated-sources/emily/client/rust/private/src/apis/configuration.rs index 1e893a0e4..0acbf82b7 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/configuration.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/configuration.rs @@ -4,10 +4,12 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ + + #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -28,6 +30,7 @@ pub struct ApiKey { pub key: String, } + impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -44,6 +47,7 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, + } } } diff --git a/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs b/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs index 22fe9f7fa..841359ee3 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`chainstate_height_options`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -83,26 +85,18 @@ pub enum WithdrawalOptionsError { UnknownValue(serde_json::Value), } + /// Handles CORS preflight requests -pub async fn chainstate_height_options( - configuration: &configuration::Configuration, - height: u64, -) -> Result<(), Error> { +pub async fn chainstate_height_options(configuration: &configuration::Configuration, height: u64) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/chainstate/{height}", - local_var_configuration.base_path, - height = height - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -114,32 +108,23 @@ pub async fn chainstate_height_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn chainstate_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn chainstate_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -151,32 +136,23 @@ pub async fn chainstate_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn deposit_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -188,39 +164,23 @@ pub async fn deposit_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_index_options( - configuration: &configuration::Configuration, - txid: &str, - index: &str, -) -> Result<(), Error> { +pub async fn deposit_txid_index_options(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}/{index}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid), - index = crate::apis::urlencode(index) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -232,37 +192,23 @@ pub async fn deposit_txid_index_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_options( - configuration: &configuration::Configuration, - txid: &str, -) -> Result<(), Error> { +pub async fn deposit_txid_options(configuration: &configuration::Configuration, txid: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -274,32 +220,23 @@ pub async fn deposit_txid_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn health_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn health_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -311,37 +248,23 @@ pub async fn health_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_account_options( - configuration: &configuration::Configuration, - account: &str, -) -> Result<(), Error> { +pub async fn limits_account_options(configuration: &configuration::Configuration, account: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -353,32 +276,23 @@ pub async fn limits_account_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn limits_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -390,37 +304,23 @@ pub async fn limits_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_id_options( - configuration: &configuration::Configuration, - id: u64, -) -> Result<(), Error> { +pub async fn withdrawal_id_options(configuration: &configuration::Configuration, id: u64) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/withdrawal/{id}", - local_var_configuration.base_path, - id = id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -432,32 +332,23 @@ pub async fn withdrawal_id_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn withdrawal_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -469,13 +360,9 @@ pub async fn withdrawal_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs b/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs index ed7f027a9..5a475a44c 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_deposit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -68,21 +70,17 @@ pub enum UpdateDepositsError { UnknownValue(serde_json::Value), } -pub async fn create_deposit( - configuration: &configuration::Configuration, - create_deposit_request_body: models::CreateDepositRequestBody, -) -> Result> { + +pub async fn create_deposit(configuration: &configuration::Configuration, create_deposit_request_body: models::CreateDepositRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_deposit_request_body); @@ -95,38 +93,22 @@ pub async fn create_deposit( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposit( - configuration: &configuration::Configuration, - txid: &str, - index: &str, -) -> Result> { +pub async fn get_deposit(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}/{index}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid), - index = crate::apis::urlencode(index) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -138,43 +120,29 @@ pub async fn get_deposit( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits( - configuration: &configuration::Configuration, - status: models::Status, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_deposits(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -186,46 +154,28 @@ pub async fn get_deposits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits_for_transaction( - configuration: &configuration::Configuration, - txid: &str, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_deposits_for_transaction(configuration: &configuration::Configuration, txid: &str, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -237,32 +187,22 @@ pub async fn get_deposits_for_transaction( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_deposits( - configuration: &configuration::Configuration, - update_deposits_request_body: models::UpdateDepositsRequestBody, -) -> Result> { +pub async fn update_deposits(configuration: &configuration::Configuration, update_deposits_request_body: models::UpdateDepositsRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -283,13 +223,9 @@ pub async fn update_deposits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/apis/health_api.rs b/.generated-sources/emily/client/rust/private/src/apis/health_api.rs index 16f08f69e..3733852b0 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/health_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/health_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`check_health`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,20 +26,17 @@ pub enum CheckHealthError { UnknownValue(serde_json::Value), } -pub async fn check_health( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn check_health(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -57,13 +56,9 @@ pub async fn check_health( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs b/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs index 860cc87e5..f71e9c700 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_limits`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -55,20 +57,17 @@ pub enum SetLimitsForAccountError { UnknownValue(serde_json::Value), } -pub async fn get_limits( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn get_limits(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,36 +79,22 @@ pub async fn get_limits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_limits_for_account( - configuration: &configuration::Configuration, - account: &str, -) -> Result> { +pub async fn get_limits_for_account(configuration: &configuration::Configuration, account: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -121,32 +106,22 @@ pub async fn get_limits_for_account( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits( - configuration: &configuration::Configuration, - limits: models::Limits, -) -> Result> { +pub async fn set_limits(configuration: &configuration::Configuration, limits: models::Limits) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -167,37 +142,22 @@ pub async fn set_limits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits_for_account( - configuration: &configuration::Configuration, - account: &str, - account_limits: models::AccountLimits, -) -> Result> { +pub async fn set_limits_for_account(configuration: &configuration::Configuration, account: &str, account_limits: models::AccountLimits) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -218,13 +178,9 @@ pub async fn set_limits_for_account( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/apis/mod.rs b/.generated-sources/emily/client/rust/private/src/apis/mod.rs index 60946c381..c548e32fe 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/mod.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,10 +78,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -92,8 +90,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String unimplemented!("Only objects are supported with style=deepObject") } -pub mod chainstate_api; pub mod cors_api; +pub mod chainstate_api; pub mod deposit_api; pub mod health_api; pub mod limits_api; diff --git a/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs b/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs index 3631fedb0..fba1d59ab 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_withdrawal`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -57,21 +59,17 @@ pub enum UpdateWithdrawalsError { UnknownValue(serde_json::Value), } -pub async fn create_withdrawal( - configuration: &configuration::Configuration, - create_withdrawal_request_body: models::CreateWithdrawalRequestBody, -) -> Result> { + +pub async fn create_withdrawal(configuration: &configuration::Configuration, create_withdrawal_request_body: models::CreateWithdrawalRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -92,36 +90,22 @@ pub async fn create_withdrawal( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawal( - configuration: &configuration::Configuration, - id: u64, -) -> Result> { +pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u64) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/withdrawal/{id}", - local_var_configuration.base_path, - id = id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -133,43 +117,29 @@ pub async fn get_withdrawal( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawals( - configuration: &configuration::Configuration, - status: models::Status, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_withdrawals(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -181,32 +151,22 @@ pub async fn get_withdrawals( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_withdrawals( - configuration: &configuration::Configuration, - update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody, -) -> Result> { +pub async fn update_withdrawals(configuration: &configuration::Configuration, update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -227,13 +187,9 @@ pub async fn update_withdrawals( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/private/src/lib.rs b/.generated-sources/emily/client/rust/private/src/lib.rs index 9556a0a13..e1520628d 100644 --- a/.generated-sources/emily/client/rust/private/src/lib.rs +++ b/.generated-sources/emily/client/rust/private/src/lib.rs @@ -1,11 +1,11 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -extern crate reqwest; +extern crate serde_repr; extern crate serde; extern crate serde_json; -extern crate serde_repr; extern crate url; +extern crate reqwest; pub mod apis; pub mod models; diff --git a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs index ed77256bb..2f60a52ce 100644 --- a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,36 +15,16 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AccountLimits { /// Represents the current sBTC limits. - #[serde( - rename = "pegCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub peg_cap: Option>, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. - #[serde( - rename = "perDepositCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde( - rename = "perDepositMinimum", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. - #[serde( - rename = "perWithdrawalCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_withdrawal_cap: Option>, } @@ -59,3 +39,4 @@ impl AccountLimits { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/chainstate.rs b/.generated-sources/emily/client/rust/private/src/models/chainstate.rs index b0e2e57f6..836ad6361 100644 --- a/.generated-sources/emily/client/rust/private/src/models/chainstate.rs +++ b/.generated-sources/emily/client/rust/private/src/models/chainstate.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -31,3 +31,4 @@ impl Chainstate { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs index 8e53dc90e..6b9361d97 100644 --- a/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,12 +30,7 @@ pub struct CreateDepositRequestBody { impl CreateDepositRequestBody { /// Request structure for create deposit request. - pub fn new( - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - reclaim_script: String, - ) -> CreateDepositRequestBody { + pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, reclaim_script: String) -> CreateDepositRequestBody { CreateDepositRequestBody { bitcoin_tx_output_index, bitcoin_txid, @@ -44,3 +39,4 @@ impl CreateDepositRequestBody { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs index d95da9ed4..ccd05d5b2 100644 --- a/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -35,14 +35,7 @@ pub struct CreateWithdrawalRequestBody { impl CreateWithdrawalRequestBody { /// Request structure for the create withdrawal request. - pub fn new( - amount: u64, - parameters: models::WithdrawalParameters, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - ) -> CreateWithdrawalRequestBody { + pub fn new(amount: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64) -> CreateWithdrawalRequestBody { CreateWithdrawalRequestBody { amount, parameters: Box::new(parameters), @@ -53,3 +46,4 @@ impl CreateWithdrawalRequestBody { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit.rs b/.generated-sources/emily/client/rust/private/src/models/deposit.rs index 9c5896d0a..4983d7225 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,12 +26,7 @@ pub struct Deposit { /// Raw deposit script binary in hex. #[serde(rename = "depositScript")] pub deposit_script: String, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -56,19 +51,7 @@ pub struct Deposit { impl Deposit { /// Deposit. - pub fn new( - amount: u64, - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - last_update_block_hash: String, - last_update_height: u64, - parameters: models::DepositParameters, - recipient: String, - reclaim_script: String, - status: models::Status, - status_message: String, - ) -> Deposit { + pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, parameters: models::DepositParameters, recipient: String, reclaim_script: String, status: models::Status, status_message: String) -> Deposit { Deposit { amount, bitcoin_tx_output_index, @@ -85,3 +68,4 @@ impl Deposit { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs index e009b119e..32f89ca35 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -44,17 +44,7 @@ pub struct DepositInfo { impl DepositInfo { /// Reduced version of the Deposit data. - pub fn new( - amount: u64, - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - last_update_block_hash: String, - last_update_height: u64, - recipient: String, - reclaim_script: String, - status: models::Status, - ) -> DepositInfo { + pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, recipient: String, reclaim_script: String, status: models::Status) -> DepositInfo { DepositInfo { amount, bitcoin_tx_output_index, @@ -68,3 +58,4 @@ impl DepositInfo { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs index fc45f1cf3..d09933373 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,6 +25,10 @@ pub struct DepositParameters { impl DepositParameters { /// Deposit parameters. pub fn new(lock_time: u32, max_fee: u64) -> DepositParameters { - DepositParameters { lock_time, max_fee } + DepositParameters { + lock_time, + max_fee, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs index b3ac099c9..55cb0f193 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,12 +20,7 @@ pub struct DepositUpdate { /// Bitcoin transaction id. #[serde(rename = "bitcoinTxid")] pub bitcoin_txid: String, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -42,14 +37,7 @@ pub struct DepositUpdate { impl DepositUpdate { /// A singlular Deposit update that contains only the fields pertinent to updating the status of a deposit. This includes the key related data in addition to status history related data. - pub fn new( - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - last_update_block_hash: String, - last_update_height: u64, - status: models::Status, - status_message: String, - ) -> DepositUpdate { + pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, last_update_block_hash: String, last_update_height: u64, status: models::Status, status_message: String) -> DepositUpdate { DepositUpdate { bitcoin_tx_output_index, bitcoin_txid, @@ -61,3 +49,4 @@ impl DepositUpdate { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/error_response.rs b/.generated-sources/emily/client/rust/private/src/models/error_response.rs index 5043d7373..d15dd0016 100644 --- a/.generated-sources/emily/client/rust/private/src/models/error_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/error_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,6 +21,9 @@ pub struct ErrorResponse { impl ErrorResponse { /// Structure representing an error response This is used to serialize error messages in HTTP responses pub fn new(message: String) -> ErrorResponse { - ErrorResponse { message } + ErrorResponse { + message, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs b/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs index 3da4d346d..8f2c5976b 100644 --- a/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs +++ b/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,14 +36,7 @@ pub struct Fulfillment { impl Fulfillment { /// Data about the fulfillment of an sBTC Operation. - pub fn new( - bitcoin_block_hash: String, - bitcoin_block_height: u64, - bitcoin_tx_index: u32, - bitcoin_txid: String, - btc_fee: u64, - stacks_txid: String, - ) -> Fulfillment { + pub fn new(bitcoin_block_hash: String, bitcoin_block_height: u64, bitcoin_tx_index: u32, bitcoin_txid: String, btc_fee: u64, stacks_txid: String) -> Fulfillment { Fulfillment { bitcoin_block_hash, bitcoin_block_height, @@ -54,3 +47,4 @@ impl Fulfillment { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs index 304d7527d..f1a9f65e9 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,18 +18,17 @@ pub struct GetDepositsForTransactionResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, } impl GetDepositsForTransactionResponse { /// Response to get deposits for transaction request. pub fn new(deposits: Vec) -> GetDepositsForTransactionResponse { - GetDepositsForTransactionResponse { deposits, next_token: None } + GetDepositsForTransactionResponse { + deposits, + next_token: None, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs index b2b30669b..4f6b7c7b7 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,18 +18,17 @@ pub struct GetDepositsResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, } impl GetDepositsResponse { /// Response to get deposits request. pub fn new(deposits: Vec) -> GetDepositsResponse { - GetDepositsResponse { deposits, next_token: None } + GetDepositsResponse { + deposits, + next_token: None, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs index da4bd2603..c2486d34e 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,12 +15,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetWithdrawalsResponse { /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, /// Withdrawal infos: withdrawals with a little less data. #[serde(rename = "withdrawals")] @@ -30,6 +25,10 @@ pub struct GetWithdrawalsResponse { impl GetWithdrawalsResponse { /// Response to get withdrawals request. pub fn new(withdrawals: Vec) -> GetWithdrawalsResponse { - GetWithdrawalsResponse { next_token: None, withdrawals } + GetWithdrawalsResponse { + next_token: None, + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/health_data.rs b/.generated-sources/emily/client/rust/private/src/models/health_data.rs index 56f3505f9..260c3d340 100644 --- a/.generated-sources/emily/client/rust/private/src/models/health_data.rs +++ b/.generated-sources/emily/client/rust/private/src/models/health_data.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct HealthData { impl HealthData { /// Struct that represents the current status of the API. pub fn new(is_okay: bool) -> HealthData { - HealthData { is_okay } + HealthData { + is_okay, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/limits.rs b/.generated-sources/emily/client/rust/private/src/models/limits.rs index a1c51485a..ddf9d721d 100644 --- a/.generated-sources/emily/client/rust/private/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,36 +18,16 @@ pub struct Limits { #[serde(rename = "accountCaps")] pub account_caps: std::collections::HashMap, /// Represents the total cap for all pegged-in BTC/sBTC. - #[serde( - rename = "pegCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub peg_cap: Option>, /// Per deposit cap. If none then there is no cap. - #[serde( - rename = "perDepositCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde( - rename = "perDepositMinimum", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. - #[serde( - rename = "perWithdrawalCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_withdrawal_cap: Option>, } @@ -63,3 +43,4 @@ impl Limits { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/status.rs b/.generated-sources/emily/client/rust/private/src/models/status.rs index f0a85fc8a..2e040902b 100644 --- a/.generated-sources/emily/client/rust/private/src/models/status.rs +++ b/.generated-sources/emily/client/rust/private/src/models/status.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,6 +25,7 @@ pub enum Status { Confirmed, #[serde(rename = "failed")] Failed, + } impl std::fmt::Display for Status { @@ -44,3 +45,4 @@ impl Default for Status { Self::Pending } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs index 6bbc07a29..505de2823 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateDepositsRequestBody { impl UpdateDepositsRequestBody { /// Request structure for update deposit request. pub fn new(deposits: Vec) -> UpdateDepositsRequestBody { - UpdateDepositsRequestBody { deposits } + UpdateDepositsRequestBody { + deposits, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs b/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs index 654d42717..e788f55b8 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateDepositsResponse { impl UpdateDepositsResponse { /// Response to update deposits request. pub fn new(deposits: Vec) -> UpdateDepositsResponse { - UpdateDepositsResponse { deposits } + UpdateDepositsResponse { + deposits, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs index 03e176947..1f7f611a8 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateWithdrawalsRequestBody { impl UpdateWithdrawalsRequestBody { /// Request structure for the create withdrawal request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsRequestBody { - UpdateWithdrawalsRequestBody { withdrawals } + UpdateWithdrawalsRequestBody { + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs index 7a8b6c603..0a5b8a406 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateWithdrawalsResponse { impl UpdateWithdrawalsResponse { /// Response to update withdrawals request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsResponse { - UpdateWithdrawalsResponse { withdrawals } + UpdateWithdrawalsResponse { + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs index 15d517cf1..b9791edb5 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,12 +17,7 @@ pub struct Withdrawal { /// Amount of BTC being withdrawn in satoshis. #[serde(rename = "amount")] pub amount: u64, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -53,18 +48,7 @@ pub struct Withdrawal { impl Withdrawal { /// Withdrawal. - pub fn new( - amount: u64, - last_update_block_hash: String, - last_update_height: u64, - parameters: models::WithdrawalParameters, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - status: models::Status, - status_message: String, - ) -> Withdrawal { + pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status, status_message: String) -> Withdrawal { Withdrawal { amount, fulfillment: None, @@ -80,3 +64,4 @@ impl Withdrawal { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs index 26c2c6526..3ac4d2f02 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -41,16 +41,7 @@ pub struct WithdrawalInfo { impl WithdrawalInfo { /// Reduced version of the Withdrawal. - pub fn new( - amount: u64, - last_update_block_hash: String, - last_update_height: u64, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - status: models::Status, - ) -> WithdrawalInfo { + pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status) -> WithdrawalInfo { WithdrawalInfo { amount, last_update_block_hash, @@ -63,3 +54,4 @@ impl WithdrawalInfo { } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs index 970677244..cd73a7c64 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct WithdrawalParameters { impl WithdrawalParameters { /// Withdrawal parameters. pub fn new(max_fee: u64) -> WithdrawalParameters { - WithdrawalParameters { max_fee } + WithdrawalParameters { + max_fee, + } } } + diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs index ca70785d2..5d78e2d20 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,7 @@ use serde::{Deserialize, Serialize}; /// WithdrawalUpdate : A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WithdrawalUpdate { - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -39,13 +34,7 @@ pub struct WithdrawalUpdate { impl WithdrawalUpdate { /// A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. - pub fn new( - last_update_block_hash: String, - last_update_height: u64, - request_id: u64, - status: models::Status, - status_message: String, - ) -> WithdrawalUpdate { + pub fn new(last_update_block_hash: String, last_update_height: u64, request_id: u64, status: models::Status, status_message: String) -> WithdrawalUpdate { WithdrawalUpdate { fulfillment: None, last_update_block_hash, @@ -56,3 +45,4 @@ impl WithdrawalUpdate { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs index 32cc62c9b..268420335 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_chain_tip`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -56,20 +58,17 @@ pub enum UpdateChainstateError { UnknownValue(serde_json::Value), } -pub async fn get_chain_tip( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -81,36 +80,22 @@ pub async fn get_chain_tip( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_chainstate_at_height( - configuration: &configuration::Configuration, - height: u64, -) -> Result> { +pub async fn get_chainstate_at_height(configuration: &configuration::Configuration, height: u64) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/chainstate/{height}", - local_var_configuration.base_path, - height = height - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -122,32 +107,22 @@ pub async fn get_chainstate_at_height( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_chainstate( - configuration: &configuration::Configuration, - chainstate: models::Chainstate, -) -> Result> { +pub async fn set_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -168,32 +143,22 @@ pub async fn set_chainstate( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_chainstate( - configuration: &configuration::Configuration, - chainstate: models::Chainstate, -) -> Result> { +pub async fn update_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -214,13 +179,9 @@ pub async fn update_chainstate( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs b/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs index 1e893a0e4..0acbf82b7 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs @@ -4,10 +4,12 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ + + #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -28,6 +30,7 @@ pub struct ApiKey { pub key: String, } + impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -44,6 +47,7 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, + } } } diff --git a/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs index b8a403634..452d23031 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`chainstate_height_options`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -90,26 +92,18 @@ pub enum WithdrawalOptionsError { UnknownValue(serde_json::Value), } + /// Handles CORS preflight requests -pub async fn chainstate_height_options( - configuration: &configuration::Configuration, - height: u64, -) -> Result<(), Error> { +pub async fn chainstate_height_options(configuration: &configuration::Configuration, height: u64) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/chainstate/{height}", - local_var_configuration.base_path, - height = height - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -121,32 +115,23 @@ pub async fn chainstate_height_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn chainstate_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn chainstate_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -158,32 +143,23 @@ pub async fn chainstate_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn deposit_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -195,39 +171,23 @@ pub async fn deposit_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_index_options( - configuration: &configuration::Configuration, - txid: &str, - index: &str, -) -> Result<(), Error> { +pub async fn deposit_txid_index_options(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}/{index}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid), - index = crate::apis::urlencode(index) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -239,37 +199,23 @@ pub async fn deposit_txid_index_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_options( - configuration: &configuration::Configuration, - txid: &str, -) -> Result<(), Error> { +pub async fn deposit_txid_options(configuration: &configuration::Configuration, txid: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -281,32 +227,23 @@ pub async fn deposit_txid_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn health_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn health_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -318,37 +255,23 @@ pub async fn health_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_account_options( - configuration: &configuration::Configuration, - account: &str, -) -> Result<(), Error> { +pub async fn limits_account_options(configuration: &configuration::Configuration, account: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -360,32 +283,23 @@ pub async fn limits_account_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn limits_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -397,32 +311,23 @@ pub async fn limits_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn testing_wipe_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn testing_wipe_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/testing/wipe", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -434,37 +339,23 @@ pub async fn testing_wipe_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_id_options( - configuration: &configuration::Configuration, - id: u64, -) -> Result<(), Error> { +pub async fn withdrawal_id_options(configuration: &configuration::Configuration, id: u64) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/withdrawal/{id}", - local_var_configuration.base_path, - id = id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -476,32 +367,23 @@ pub async fn withdrawal_id_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_options( - configuration: &configuration::Configuration, -) -> Result<(), Error> { +pub async fn withdrawal_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -513,13 +395,9 @@ pub async fn withdrawal_options( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs index ed7f027a9..5a475a44c 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_deposit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -68,21 +70,17 @@ pub enum UpdateDepositsError { UnknownValue(serde_json::Value), } -pub async fn create_deposit( - configuration: &configuration::Configuration, - create_deposit_request_body: models::CreateDepositRequestBody, -) -> Result> { + +pub async fn create_deposit(configuration: &configuration::Configuration, create_deposit_request_body: models::CreateDepositRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_deposit_request_body); @@ -95,38 +93,22 @@ pub async fn create_deposit( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposit( - configuration: &configuration::Configuration, - txid: &str, - index: &str, -) -> Result> { +pub async fn get_deposit(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}/{index}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid), - index = crate::apis::urlencode(index) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -138,43 +120,29 @@ pub async fn get_deposit( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits( - configuration: &configuration::Configuration, - status: models::Status, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_deposits(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -186,46 +154,28 @@ pub async fn get_deposits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits_for_transaction( - configuration: &configuration::Configuration, - txid: &str, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_deposits_for_transaction(configuration: &configuration::Configuration, txid: &str, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/deposit/{txid}", - local_var_configuration.base_path, - txid = crate::apis::urlencode(txid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -237,32 +187,22 @@ pub async fn get_deposits_for_transaction( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_deposits( - configuration: &configuration::Configuration, - update_deposits_request_body: models::UpdateDepositsRequestBody, -) -> Result> { +pub async fn update_deposits(configuration: &configuration::Configuration, update_deposits_request_body: models::UpdateDepositsRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -283,13 +223,9 @@ pub async fn update_deposits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs index 16f08f69e..3733852b0 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`check_health`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,20 +26,17 @@ pub enum CheckHealthError { UnknownValue(serde_json::Value), } -pub async fn check_health( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn check_health(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -57,13 +56,9 @@ pub async fn check_health( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs index 860cc87e5..f71e9c700 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_limits`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -55,20 +57,17 @@ pub enum SetLimitsForAccountError { UnknownValue(serde_json::Value), } -pub async fn get_limits( - configuration: &configuration::Configuration, -) -> Result> { + +pub async fn get_limits(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,36 +79,22 @@ pub async fn get_limits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_limits_for_account( - configuration: &configuration::Configuration, - account: &str, -) -> Result> { +pub async fn get_limits_for_account(configuration: &configuration::Configuration, account: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -121,32 +106,22 @@ pub async fn get_limits_for_account( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits( - configuration: &configuration::Configuration, - limits: models::Limits, -) -> Result> { +pub async fn set_limits(configuration: &configuration::Configuration, limits: models::Limits) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -167,37 +142,22 @@ pub async fn set_limits( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits_for_account( - configuration: &configuration::Configuration, - account: &str, - account_limits: models::AccountLimits, -) -> Result> { +pub async fn set_limits_for_account(configuration: &configuration::Configuration, account: &str, account_limits: models::AccountLimits) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/limits/{account}", - local_var_configuration.base_path, - account = crate::apis::urlencode(account) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -218,13 +178,9 @@ pub async fn set_limits_for_account( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/mod.rs b/.generated-sources/emily/client/rust/testing/src/apis/mod.rs index dbd548803..3c055ba7a 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/mod.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,10 +78,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -92,8 +90,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String unimplemented!("Only objects are supported with style=deepObject") } -pub mod chainstate_api; pub mod cors_api; +pub mod chainstate_api; pub mod deposit_api; pub mod health_api; pub mod limits_api; diff --git a/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs index 7f45b6f96..c67bb4ad1 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`wipe_databases`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -24,20 +26,17 @@ pub enum WipeDatabasesError { UnknownValue(serde_json::Value), } -pub async fn wipe_databases( - configuration: &configuration::Configuration, -) -> Result<(), Error> { + +pub async fn wipe_databases(configuration: &configuration::Configuration, ) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/testing/wipe", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -57,13 +56,9 @@ pub async fn wipe_databases( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs index 3631fedb0..fba1d59ab 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs @@ -4,14 +4,16 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_withdrawal`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -57,21 +59,17 @@ pub enum UpdateWithdrawalsError { UnknownValue(serde_json::Value), } -pub async fn create_withdrawal( - configuration: &configuration::Configuration, - create_withdrawal_request_body: models::CreateWithdrawalRequestBody, -) -> Result> { + +pub async fn create_withdrawal(configuration: &configuration::Configuration, create_withdrawal_request_body: models::CreateWithdrawalRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -92,36 +90,22 @@ pub async fn create_withdrawal( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawal( - configuration: &configuration::Configuration, - id: u64, -) -> Result> { +pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u64) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/withdrawal/{id}", - local_var_configuration.base_path, - id = id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -133,43 +117,29 @@ pub async fn get_withdrawal( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawals( - configuration: &configuration::Configuration, - status: models::Status, - next_token: Option<&str>, - page_size: Option, -) -> Result> { +pub async fn get_withdrawals(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = - local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = - local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -181,32 +151,22 @@ pub async fn get_withdrawals( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_withdrawals( - configuration: &configuration::Configuration, - update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody, -) -> Result> { +pub async fn update_withdrawals(configuration: &configuration::Configuration, update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -227,13 +187,9 @@ pub async fn update_withdrawals( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/.generated-sources/emily/client/rust/testing/src/lib.rs b/.generated-sources/emily/client/rust/testing/src/lib.rs index 9556a0a13..e1520628d 100644 --- a/.generated-sources/emily/client/rust/testing/src/lib.rs +++ b/.generated-sources/emily/client/rust/testing/src/lib.rs @@ -1,11 +1,11 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -extern crate reqwest; +extern crate serde_repr; extern crate serde; extern crate serde_json; -extern crate serde_repr; extern crate url; +extern crate reqwest; pub mod apis; pub mod models; diff --git a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs index ed77256bb..2f60a52ce 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,36 +15,16 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AccountLimits { /// Represents the current sBTC limits. - #[serde( - rename = "pegCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub peg_cap: Option>, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. - #[serde( - rename = "perDepositCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde( - rename = "perDepositMinimum", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. - #[serde( - rename = "perWithdrawalCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_withdrawal_cap: Option>, } @@ -59,3 +39,4 @@ impl AccountLimits { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs b/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs index b0e2e57f6..836ad6361 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -31,3 +31,4 @@ impl Chainstate { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs index 8e53dc90e..6b9361d97 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,12 +30,7 @@ pub struct CreateDepositRequestBody { impl CreateDepositRequestBody { /// Request structure for create deposit request. - pub fn new( - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - reclaim_script: String, - ) -> CreateDepositRequestBody { + pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, reclaim_script: String) -> CreateDepositRequestBody { CreateDepositRequestBody { bitcoin_tx_output_index, bitcoin_txid, @@ -44,3 +39,4 @@ impl CreateDepositRequestBody { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs index d95da9ed4..ccd05d5b2 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -35,14 +35,7 @@ pub struct CreateWithdrawalRequestBody { impl CreateWithdrawalRequestBody { /// Request structure for the create withdrawal request. - pub fn new( - amount: u64, - parameters: models::WithdrawalParameters, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - ) -> CreateWithdrawalRequestBody { + pub fn new(amount: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64) -> CreateWithdrawalRequestBody { CreateWithdrawalRequestBody { amount, parameters: Box::new(parameters), @@ -53,3 +46,4 @@ impl CreateWithdrawalRequestBody { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit.rs index 9c5896d0a..4983d7225 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,12 +26,7 @@ pub struct Deposit { /// Raw deposit script binary in hex. #[serde(rename = "depositScript")] pub deposit_script: String, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -56,19 +51,7 @@ pub struct Deposit { impl Deposit { /// Deposit. - pub fn new( - amount: u64, - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - last_update_block_hash: String, - last_update_height: u64, - parameters: models::DepositParameters, - recipient: String, - reclaim_script: String, - status: models::Status, - status_message: String, - ) -> Deposit { + pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, parameters: models::DepositParameters, recipient: String, reclaim_script: String, status: models::Status, status_message: String) -> Deposit { Deposit { amount, bitcoin_tx_output_index, @@ -85,3 +68,4 @@ impl Deposit { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs index e009b119e..32f89ca35 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -44,17 +44,7 @@ pub struct DepositInfo { impl DepositInfo { /// Reduced version of the Deposit data. - pub fn new( - amount: u64, - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - deposit_script: String, - last_update_block_hash: String, - last_update_height: u64, - recipient: String, - reclaim_script: String, - status: models::Status, - ) -> DepositInfo { + pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, recipient: String, reclaim_script: String, status: models::Status) -> DepositInfo { DepositInfo { amount, bitcoin_tx_output_index, @@ -68,3 +58,4 @@ impl DepositInfo { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs index fc45f1cf3..d09933373 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,6 +25,10 @@ pub struct DepositParameters { impl DepositParameters { /// Deposit parameters. pub fn new(lock_time: u32, max_fee: u64) -> DepositParameters { - DepositParameters { lock_time, max_fee } + DepositParameters { + lock_time, + max_fee, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs index b3ac099c9..55cb0f193 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,12 +20,7 @@ pub struct DepositUpdate { /// Bitcoin transaction id. #[serde(rename = "bitcoinTxid")] pub bitcoin_txid: String, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -42,14 +37,7 @@ pub struct DepositUpdate { impl DepositUpdate { /// A singlular Deposit update that contains only the fields pertinent to updating the status of a deposit. This includes the key related data in addition to status history related data. - pub fn new( - bitcoin_tx_output_index: u32, - bitcoin_txid: String, - last_update_block_hash: String, - last_update_height: u64, - status: models::Status, - status_message: String, - ) -> DepositUpdate { + pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, last_update_block_hash: String, last_update_height: u64, status: models::Status, status_message: String) -> DepositUpdate { DepositUpdate { bitcoin_tx_output_index, bitcoin_txid, @@ -61,3 +49,4 @@ impl DepositUpdate { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/error_response.rs b/.generated-sources/emily/client/rust/testing/src/models/error_response.rs index 5043d7373..d15dd0016 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/error_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/error_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,6 +21,9 @@ pub struct ErrorResponse { impl ErrorResponse { /// Structure representing an error response This is used to serialize error messages in HTTP responses pub fn new(message: String) -> ErrorResponse { - ErrorResponse { message } + ErrorResponse { + message, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs b/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs index 3da4d346d..8f2c5976b 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,14 +36,7 @@ pub struct Fulfillment { impl Fulfillment { /// Data about the fulfillment of an sBTC Operation. - pub fn new( - bitcoin_block_hash: String, - bitcoin_block_height: u64, - bitcoin_tx_index: u32, - bitcoin_txid: String, - btc_fee: u64, - stacks_txid: String, - ) -> Fulfillment { + pub fn new(bitcoin_block_hash: String, bitcoin_block_height: u64, bitcoin_tx_index: u32, bitcoin_txid: String, btc_fee: u64, stacks_txid: String) -> Fulfillment { Fulfillment { bitcoin_block_hash, bitcoin_block_height, @@ -54,3 +47,4 @@ impl Fulfillment { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs index 304d7527d..f1a9f65e9 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,18 +18,17 @@ pub struct GetDepositsForTransactionResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, } impl GetDepositsForTransactionResponse { /// Response to get deposits for transaction request. pub fn new(deposits: Vec) -> GetDepositsForTransactionResponse { - GetDepositsForTransactionResponse { deposits, next_token: None } + GetDepositsForTransactionResponse { + deposits, + next_token: None, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs index b2b30669b..4f6b7c7b7 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,18 +18,17 @@ pub struct GetDepositsResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, } impl GetDepositsResponse { /// Response to get deposits request. pub fn new(deposits: Vec) -> GetDepositsResponse { - GetDepositsResponse { deposits, next_token: None } + GetDepositsResponse { + deposits, + next_token: None, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs index da4bd2603..c2486d34e 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,12 +15,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetWithdrawalsResponse { /// Next token for the search. - #[serde( - rename = "nextToken", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub next_token: Option>, /// Withdrawal infos: withdrawals with a little less data. #[serde(rename = "withdrawals")] @@ -30,6 +25,10 @@ pub struct GetWithdrawalsResponse { impl GetWithdrawalsResponse { /// Response to get withdrawals request. pub fn new(withdrawals: Vec) -> GetWithdrawalsResponse { - GetWithdrawalsResponse { next_token: None, withdrawals } + GetWithdrawalsResponse { + next_token: None, + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/health_data.rs b/.generated-sources/emily/client/rust/testing/src/models/health_data.rs index 56f3505f9..260c3d340 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/health_data.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/health_data.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct HealthData { impl HealthData { /// Struct that represents the current status of the API. pub fn new(is_okay: bool) -> HealthData { - HealthData { is_okay } + HealthData { + is_okay, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/limits.rs b/.generated-sources/emily/client/rust/testing/src/models/limits.rs index a1c51485a..ddf9d721d 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,36 +18,16 @@ pub struct Limits { #[serde(rename = "accountCaps")] pub account_caps: std::collections::HashMap, /// Represents the total cap for all pegged-in BTC/sBTC. - #[serde( - rename = "pegCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub peg_cap: Option>, /// Per deposit cap. If none then there is no cap. - #[serde( - rename = "perDepositCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde( - rename = "perDepositMinimum", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. - #[serde( - rename = "perWithdrawalCap", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub per_withdrawal_cap: Option>, } @@ -63,3 +43,4 @@ impl Limits { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/status.rs b/.generated-sources/emily/client/rust/testing/src/models/status.rs index f0a85fc8a..2e040902b 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/status.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/status.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,6 +25,7 @@ pub enum Status { Confirmed, #[serde(rename = "failed")] Failed, + } impl std::fmt::Display for Status { @@ -44,3 +45,4 @@ impl Default for Status { Self::Pending } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs index 6bbc07a29..505de2823 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateDepositsRequestBody { impl UpdateDepositsRequestBody { /// Request structure for update deposit request. pub fn new(deposits: Vec) -> UpdateDepositsRequestBody { - UpdateDepositsRequestBody { deposits } + UpdateDepositsRequestBody { + deposits, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs index 654d42717..e788f55b8 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateDepositsResponse { impl UpdateDepositsResponse { /// Response to update deposits request. pub fn new(deposits: Vec) -> UpdateDepositsResponse { - UpdateDepositsResponse { deposits } + UpdateDepositsResponse { + deposits, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs index 03e176947..1f7f611a8 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateWithdrawalsRequestBody { impl UpdateWithdrawalsRequestBody { /// Request structure for the create withdrawal request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsRequestBody { - UpdateWithdrawalsRequestBody { withdrawals } + UpdateWithdrawalsRequestBody { + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs index 7a8b6c603..0a5b8a406 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct UpdateWithdrawalsResponse { impl UpdateWithdrawalsResponse { /// Response to update withdrawals request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsResponse { - UpdateWithdrawalsResponse { withdrawals } + UpdateWithdrawalsResponse { + withdrawals, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs index 15d517cf1..b9791edb5 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,12 +17,7 @@ pub struct Withdrawal { /// Amount of BTC being withdrawn in satoshis. #[serde(rename = "amount")] pub amount: u64, - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -53,18 +48,7 @@ pub struct Withdrawal { impl Withdrawal { /// Withdrawal. - pub fn new( - amount: u64, - last_update_block_hash: String, - last_update_height: u64, - parameters: models::WithdrawalParameters, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - status: models::Status, - status_message: String, - ) -> Withdrawal { + pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status, status_message: String) -> Withdrawal { Withdrawal { amount, fulfillment: None, @@ -80,3 +64,4 @@ impl Withdrawal { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs index 26c2c6526..3ac4d2f02 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -41,16 +41,7 @@ pub struct WithdrawalInfo { impl WithdrawalInfo { /// Reduced version of the Withdrawal. - pub fn new( - amount: u64, - last_update_block_hash: String, - last_update_height: u64, - recipient: String, - request_id: u64, - stacks_block_hash: String, - stacks_block_height: u64, - status: models::Status, - ) -> WithdrawalInfo { + pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status) -> WithdrawalInfo { WithdrawalInfo { amount, last_update_block_hash, @@ -63,3 +54,4 @@ impl WithdrawalInfo { } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs index 970677244..cd73a7c64 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,6 +22,9 @@ pub struct WithdrawalParameters { impl WithdrawalParameters { /// Withdrawal parameters. pub fn new(max_fee: u64) -> WithdrawalParameters { - WithdrawalParameters { max_fee } + WithdrawalParameters { + max_fee, + } } } + diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs index ca70785d2..5d78e2d20 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -14,12 +14,7 @@ use serde::{Deserialize, Serialize}; /// WithdrawalUpdate : A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WithdrawalUpdate { - #[serde( - rename = "fulfillment", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -39,13 +34,7 @@ pub struct WithdrawalUpdate { impl WithdrawalUpdate { /// A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. - pub fn new( - last_update_block_hash: String, - last_update_height: u64, - request_id: u64, - status: models::Status, - status_message: String, - ) -> WithdrawalUpdate { + pub fn new(last_update_block_hash: String, last_update_height: u64, request_id: u64, status: models::Status, status_message: String) -> WithdrawalUpdate { WithdrawalUpdate { fulfillment: None, last_update_block_hash, @@ -56,3 +45,4 @@ impl WithdrawalUpdate { } } } + diff --git a/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json index 36f2ba90d..617b36448 100644 --- a/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/private-emily-openapi-spec.json @@ -510,6 +510,16 @@ } } }, + "409": { + "description": "Duplicate request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "500": { "description": "Internal server error", "content": { diff --git a/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json index a8e13245b..8435ed92f 100644 --- a/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/public-emily-openapi-spec.json @@ -429,6 +429,16 @@ } } }, + "409": { + "description": "Duplicate request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "500": { "description": "Internal server error", "content": { diff --git a/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json b/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json index 9bcf0fffb..ce0758285 100644 --- a/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json +++ b/.generated-sources/emily/openapi/generated-specs/testing-emily-openapi-spec.json @@ -510,6 +510,16 @@ } } }, + "409": { + "description": "Duplicate request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, "500": { "description": "Internal server error", "content": { diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index b7eab43f6..009ad492d 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -199,6 +199,7 @@ pub async fn get_deposits( (status = 400, description = "Invalid request body", body = ErrorResponse), (status = 404, description = "Address not found", body = ErrorResponse), (status = 405, description = "Method not allowed", body = ErrorResponse), + (status = 409, description = "Duplicate request", body = ErrorResponse), (status = 500, description = "Internal server error", body = ErrorResponse) ) )] @@ -213,7 +214,32 @@ pub async fn create_deposit( context: EmilyContext, body: CreateDepositRequestBody, ) -> Result { - // Set variables. + // Reject dups. + let query = GetDepositsQuery { + status: Status::Accepted, + next_token: None, + page_size: None, + }; + let (entries, _next_token) = accessors::get_deposit_entries( + &context, + &query.status, + query.next_token, + query.page_size, + ) + .await?; + let deposits: Vec = entries.into_iter().map(|entry| entry.into()).collect(); + for deposit in deposits { + if deposit.bitcoin_txid == body.bitcoin_txid + && deposit.bitcoin_tx_output_index == body.bitcoin_tx_output_index + && deposit.status == Status::Pending + { + return Ok(with_status( + json(&409), + StatusCode::CONFLICT, + )); + } + } + let api_state = accessors::get_api_state(&context).await?; api_state.error_if_reorganizing()?; diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index 66b3e6d42..763bc68e8 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -548,3 +548,81 @@ async fn update_deposits_updates_chainstate() { ); } } + +#[cfg_attr(not(feature = "integration-tests"), ignore)] +#[tokio::test] +async fn overwrite_deposit() { + let configuration = clean_setup().await; + + // Arrange. + // -------- + let bitcoin_txid: &str = "bitcoin_txid_overwrite_deposit"; + let bitcoin_tx_output_index = 0; + + // Setup test deposit transaction. + let DepositTxnData { + reclaim_script, deposit_script, .. + } = DepositTxnData::new(DEPOSIT_LOCK_TIME, DEPOSIT_MAX_FEE, DEPOSIT_AMOUNT_SATS); + + let create_deposit_body = CreateDepositRequestBody { + bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + deposit_script: deposit_script.clone(), + reclaim_script: reclaim_script.clone(), + }; + + apis::deposit_api::create_deposit(&configuration, create_deposit_body.clone()) + .await + .expect("Received an error after making a valid create deposit request api call."); + + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, Status::Pending); + + apis::deposit_api::update_deposits( + &configuration, + UpdateDepositsRequestBody { + deposits: vec![DepositUpdate { + bitcoin_tx_output_index: bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + fulfillment: None, + last_update_block_hash: "update_block_hash".into(), + last_update_height: 34, + status: Status::Accepted, + status_message: "foo".into(), + }], + }, + ) + .await + .expect("Received an error after making a valid update deposit request api call."); + + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, Status::Accepted); + + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect_err("We should reject duplicate deposits, if old one is accepted."); + + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, Status::Accepted); +} From 2f29e8c742fb22edc36b06a94f944aa4c36769d6 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Mon, 23 Dec 2024 17:18:14 +0300 Subject: [PATCH 02/11] test works now --- .../rust/private/src/apis/chainstate_api.rs | 95 +++++-- .../rust/private/src/apis/configuration.rs | 6 +- .../client/rust/private/src/apis/cors_api.rs | 237 +++++++++++----- .../rust/private/src/apis/deposit_api.rs | 140 +++++++--- .../rust/private/src/apis/health_api.rs | 29 +- .../rust/private/src/apis/limits_api.rs | 102 +++++-- .../emily/client/rust/private/src/apis/mod.rs | 18 +- .../rust/private/src/apis/withdrawal_api.rs | 104 +++++-- .../emily/client/rust/private/src/lib.rs | 4 +- .../rust/private/src/models/account_limits.rs | 31 ++- .../rust/private/src/models/chainstate.rs | 3 +- .../src/models/create_deposit_request_body.rs | 10 +- .../models/create_withdrawal_request_body.rs | 12 +- .../client/rust/private/src/models/deposit.rs | 24 +- .../rust/private/src/models/deposit_info.rs | 15 +- .../private/src/models/deposit_parameters.rs | 8 +- .../rust/private/src/models/deposit_update.rs | 19 +- .../rust/private/src/models/error_response.rs | 7 +- .../rust/private/src/models/fulfillment.rs | 12 +- .../get_deposits_for_transaction_response.rs | 15 +- .../src/models/get_deposits_response.rs | 15 +- .../src/models/get_withdrawals_response.rs | 15 +- .../rust/private/src/models/health_data.rs | 7 +- .../client/rust/private/src/models/limits.rs | 31 ++- .../client/rust/private/src/models/status.rs | 4 +- .../models/update_deposits_request_body.rs | 7 +- .../src/models/update_deposits_response.rs | 7 +- .../models/update_withdrawals_request_body.rs | 7 +- .../src/models/update_withdrawals_response.rs | 7 +- .../rust/private/src/models/withdrawal.rs | 23 +- .../private/src/models/withdrawal_info.rs | 14 +- .../src/models/withdrawal_parameters.rs | 7 +- .../private/src/models/withdrawal_update.rs | 18 +- .../rust/testing/src/apis/chainstate_api.rs | 95 +++++-- .../rust/testing/src/apis/configuration.rs | 6 +- .../client/rust/testing/src/apis/cors_api.rs | 256 +++++++++++++----- .../rust/testing/src/apis/deposit_api.rs | 140 +++++++--- .../rust/testing/src/apis/health_api.rs | 29 +- .../rust/testing/src/apis/limits_api.rs | 102 +++++-- .../emily/client/rust/testing/src/apis/mod.rs | 18 +- .../rust/testing/src/apis/testing_api.rs | 29 +- .../rust/testing/src/apis/withdrawal_api.rs | 104 +++++-- .../emily/client/rust/testing/src/lib.rs | 4 +- .../rust/testing/src/models/account_limits.rs | 31 ++- .../rust/testing/src/models/chainstate.rs | 3 +- .../src/models/create_deposit_request_body.rs | 10 +- .../models/create_withdrawal_request_body.rs | 12 +- .../client/rust/testing/src/models/deposit.rs | 24 +- .../rust/testing/src/models/deposit_info.rs | 15 +- .../testing/src/models/deposit_parameters.rs | 8 +- .../rust/testing/src/models/deposit_update.rs | 19 +- .../rust/testing/src/models/error_response.rs | 7 +- .../rust/testing/src/models/fulfillment.rs | 12 +- .../get_deposits_for_transaction_response.rs | 15 +- .../src/models/get_deposits_response.rs | 15 +- .../src/models/get_withdrawals_response.rs | 15 +- .../rust/testing/src/models/health_data.rs | 7 +- .../client/rust/testing/src/models/limits.rs | 31 ++- .../client/rust/testing/src/models/status.rs | 4 +- .../models/update_deposits_request_body.rs | 7 +- .../src/models/update_deposits_response.rs | 7 +- .../models/update_withdrawals_request_body.rs | 7 +- .../src/models/update_withdrawals_response.rs | 7 +- .../rust/testing/src/models/withdrawal.rs | 23 +- .../testing/src/models/withdrawal_info.rs | 14 +- .../src/models/withdrawal_parameters.rs | 7 +- .../testing/src/models/withdrawal_update.rs | 18 +- emily/handler/src/api/handlers/deposit.rs | 27 +- 68 files changed, 1496 insertions(+), 685 deletions(-) diff --git a/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs b/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs index 268420335..32cc62c9b 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/chainstate_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_chain_tip`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -58,17 +56,20 @@ pub enum UpdateChainstateError { UnknownValue(serde_json::Value), } - -pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_chain_tip( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,22 +81,36 @@ pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Re if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_chainstate_at_height(configuration: &configuration::Configuration, height: u64) -> Result> { +pub async fn get_chainstate_at_height( + configuration: &configuration::Configuration, + height: u64, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/chainstate/{height}", + local_var_configuration.base_path, + height = height + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -107,22 +122,32 @@ pub async fn get_chainstate_at_height(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { +pub async fn set_chainstate( + configuration: &configuration::Configuration, + chainstate: models::Chainstate, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -143,22 +168,32 @@ pub async fn set_chainstate(configuration: &configuration::Configuration, chains if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { +pub async fn update_chainstate( + configuration: &configuration::Configuration, + chainstate: models::Chainstate, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -179,9 +214,13 @@ pub async fn update_chainstate(configuration: &configuration::Configuration, cha if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/apis/configuration.rs b/.generated-sources/emily/client/rust/private/src/apis/configuration.rs index 0acbf82b7..1e893a0e4 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/configuration.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/configuration.rs @@ -4,12 +4,10 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - - #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -30,7 +28,6 @@ pub struct ApiKey { pub key: String, } - impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -47,7 +44,6 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, - } } } diff --git a/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs b/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs index 841359ee3..22fe9f7fa 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/cors_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`chainstate_height_options`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -85,18 +83,26 @@ pub enum WithdrawalOptionsError { UnknownValue(serde_json::Value), } - /// Handles CORS preflight requests -pub async fn chainstate_height_options(configuration: &configuration::Configuration, height: u64) -> Result<(), Error> { +pub async fn chainstate_height_options( + configuration: &configuration::Configuration, + height: u64, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/chainstate/{height}", + local_var_configuration.base_path, + height = height + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -108,23 +114,32 @@ pub async fn chainstate_height_options(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn chainstate_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn chainstate_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -136,23 +151,32 @@ pub async fn chainstate_options(configuration: &configuration::Configuration, ) if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn deposit_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -164,23 +188,39 @@ pub async fn deposit_options(configuration: &configuration::Configuration, ) -> if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_index_options(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result<(), Error> { +pub async fn deposit_txid_index_options( + configuration: &configuration::Configuration, + txid: &str, + index: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}/{index}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid), + index = crate::apis::urlencode(index) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -192,23 +232,37 @@ pub async fn deposit_txid_index_options(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_options(configuration: &configuration::Configuration, txid: &str) -> Result<(), Error> { +pub async fn deposit_txid_options( + configuration: &configuration::Configuration, + txid: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -220,23 +274,32 @@ pub async fn deposit_txid_options(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn health_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn health_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -248,23 +311,37 @@ pub async fn health_options(configuration: &configuration::Configuration, ) -> R if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_account_options(configuration: &configuration::Configuration, account: &str) -> Result<(), Error> { +pub async fn limits_account_options( + configuration: &configuration::Configuration, + account: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -276,23 +353,32 @@ pub async fn limits_account_options(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn limits_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -304,23 +390,37 @@ pub async fn limits_options(configuration: &configuration::Configuration, ) -> R if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_id_options(configuration: &configuration::Configuration, id: u64) -> Result<(), Error> { +pub async fn withdrawal_id_options( + configuration: &configuration::Configuration, + id: u64, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/withdrawal/{id}", + local_var_configuration.base_path, + id = id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -332,23 +432,32 @@ pub async fn withdrawal_id_options(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn withdrawal_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -360,9 +469,13 @@ pub async fn withdrawal_options(configuration: &configuration::Configuration, ) if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs b/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs index 5a475a44c..ed7f027a9 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/deposit_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_deposit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -70,17 +68,21 @@ pub enum UpdateDepositsError { UnknownValue(serde_json::Value), } - -pub async fn create_deposit(configuration: &configuration::Configuration, create_deposit_request_body: models::CreateDepositRequestBody) -> Result> { +pub async fn create_deposit( + configuration: &configuration::Configuration, + create_deposit_request_body: models::CreateDepositRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_deposit_request_body); @@ -93,22 +95,38 @@ pub async fn create_deposit(configuration: &configuration::Configuration, create if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposit(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result> { +pub async fn get_deposit( + configuration: &configuration::Configuration, + txid: &str, + index: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}/{index}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid), + index = crate::apis::urlencode(index) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -120,29 +138,43 @@ pub async fn get_deposit(configuration: &configuration::Configuration, txid: &st if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_deposits( + configuration: &configuration::Configuration, + status: models::Status, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -154,28 +186,46 @@ pub async fn get_deposits(configuration: &configuration::Configuration, status: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits_for_transaction(configuration: &configuration::Configuration, txid: &str, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_deposits_for_transaction( + configuration: &configuration::Configuration, + txid: &str, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -187,22 +237,32 @@ pub async fn get_deposits_for_transaction(configuration: &configuration::Configu if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_deposits(configuration: &configuration::Configuration, update_deposits_request_body: models::UpdateDepositsRequestBody) -> Result> { +pub async fn update_deposits( + configuration: &configuration::Configuration, + update_deposits_request_body: models::UpdateDepositsRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -223,9 +283,13 @@ pub async fn update_deposits(configuration: &configuration::Configuration, updat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/apis/health_api.rs b/.generated-sources/emily/client/rust/private/src/apis/health_api.rs index 3733852b0..16f08f69e 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/health_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/health_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`check_health`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -26,17 +24,20 @@ pub enum CheckHealthError { UnknownValue(serde_json::Value), } - -pub async fn check_health(configuration: &configuration::Configuration, ) -> Result> { +pub async fn check_health( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -56,9 +57,13 @@ pub async fn check_health(configuration: &configuration::Configuration, ) -> Res if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs b/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs index f71e9c700..860cc87e5 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/limits_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_limits`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -57,17 +55,20 @@ pub enum SetLimitsForAccountError { UnknownValue(serde_json::Value), } - -pub async fn get_limits(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_limits( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -79,22 +80,36 @@ pub async fn get_limits(configuration: &configuration::Configuration, ) -> Resul if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_limits_for_account(configuration: &configuration::Configuration, account: &str) -> Result> { +pub async fn get_limits_for_account( + configuration: &configuration::Configuration, + account: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -106,22 +121,32 @@ pub async fn get_limits_for_account(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits(configuration: &configuration::Configuration, limits: models::Limits) -> Result> { +pub async fn set_limits( + configuration: &configuration::Configuration, + limits: models::Limits, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -142,22 +167,37 @@ pub async fn set_limits(configuration: &configuration::Configuration, limits: mo if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits_for_account(configuration: &configuration::Configuration, account: &str, account_limits: models::AccountLimits) -> Result> { +pub async fn set_limits_for_account( + configuration: &configuration::Configuration, + account: &str, + account_limits: models::AccountLimits, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -178,9 +218,13 @@ pub async fn set_limits_for_account(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/apis/mod.rs b/.generated-sources/emily/client/rust/private/src/apis/mod.rs index c548e32fe..60946c381 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/mod.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -90,8 +92,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String unimplemented!("Only objects are supported with style=deepObject") } -pub mod cors_api; pub mod chainstate_api; +pub mod cors_api; pub mod deposit_api; pub mod health_api; pub mod limits_api; diff --git a/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs b/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs index fba1d59ab..3631fedb0 100644 --- a/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs +++ b/.generated-sources/emily/client/rust/private/src/apis/withdrawal_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_withdrawal`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -59,17 +57,21 @@ pub enum UpdateWithdrawalsError { UnknownValue(serde_json::Value), } - -pub async fn create_withdrawal(configuration: &configuration::Configuration, create_withdrawal_request_body: models::CreateWithdrawalRequestBody) -> Result> { +pub async fn create_withdrawal( + configuration: &configuration::Configuration, + create_withdrawal_request_body: models::CreateWithdrawalRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -90,22 +92,36 @@ pub async fn create_withdrawal(configuration: &configuration::Configuration, cre if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u64) -> Result> { +pub async fn get_withdrawal( + configuration: &configuration::Configuration, + id: u64, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/withdrawal/{id}", + local_var_configuration.base_path, + id = id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -117,29 +133,43 @@ pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u6 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawals(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_withdrawals( + configuration: &configuration::Configuration, + status: models::Status, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -151,22 +181,32 @@ pub async fn get_withdrawals(configuration: &configuration::Configuration, statu if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_withdrawals(configuration: &configuration::Configuration, update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody) -> Result> { +pub async fn update_withdrawals( + configuration: &configuration::Configuration, + update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -187,9 +227,13 @@ pub async fn update_withdrawals(configuration: &configuration::Configuration, up if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/private/src/lib.rs b/.generated-sources/emily/client/rust/private/src/lib.rs index e1520628d..9556a0a13 100644 --- a/.generated-sources/emily/client/rust/private/src/lib.rs +++ b/.generated-sources/emily/client/rust/private/src/lib.rs @@ -1,11 +1,11 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -extern crate serde_repr; +extern crate reqwest; extern crate serde; extern crate serde_json; +extern crate serde_repr; extern crate url; -extern crate reqwest; pub mod apis; pub mod models; diff --git a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs index 2f60a52ce..ed77256bb 100644 --- a/.generated-sources/emily/client/rust/private/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/account_limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,16 +15,36 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AccountLimits { /// Represents the current sBTC limits. - #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "pegCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub peg_cap: Option>, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. - #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. - #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perWithdrawalCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_withdrawal_cap: Option>, } @@ -39,4 +59,3 @@ impl AccountLimits { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/chainstate.rs b/.generated-sources/emily/client/rust/private/src/models/chainstate.rs index 836ad6361..b0e2e57f6 100644 --- a/.generated-sources/emily/client/rust/private/src/models/chainstate.rs +++ b/.generated-sources/emily/client/rust/private/src/models/chainstate.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -31,4 +31,3 @@ impl Chainstate { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs index 6b9361d97..8e53dc90e 100644 --- a/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/create_deposit_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,12 @@ pub struct CreateDepositRequestBody { impl CreateDepositRequestBody { /// Request structure for create deposit request. - pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, reclaim_script: String) -> CreateDepositRequestBody { + pub fn new( + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + reclaim_script: String, + ) -> CreateDepositRequestBody { CreateDepositRequestBody { bitcoin_tx_output_index, bitcoin_txid, @@ -39,4 +44,3 @@ impl CreateDepositRequestBody { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs index ccd05d5b2..d95da9ed4 100644 --- a/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/create_withdrawal_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -35,7 +35,14 @@ pub struct CreateWithdrawalRequestBody { impl CreateWithdrawalRequestBody { /// Request structure for the create withdrawal request. - pub fn new(amount: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64) -> CreateWithdrawalRequestBody { + pub fn new( + amount: u64, + parameters: models::WithdrawalParameters, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + ) -> CreateWithdrawalRequestBody { CreateWithdrawalRequestBody { amount, parameters: Box::new(parameters), @@ -46,4 +53,3 @@ impl CreateWithdrawalRequestBody { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit.rs b/.generated-sources/emily/client/rust/private/src/models/deposit.rs index 4983d7225..9c5896d0a 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,12 @@ pub struct Deposit { /// Raw deposit script binary in hex. #[serde(rename = "depositScript")] pub deposit_script: String, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -51,7 +56,19 @@ pub struct Deposit { impl Deposit { /// Deposit. - pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, parameters: models::DepositParameters, recipient: String, reclaim_script: String, status: models::Status, status_message: String) -> Deposit { + pub fn new( + amount: u64, + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + last_update_block_hash: String, + last_update_height: u64, + parameters: models::DepositParameters, + recipient: String, + reclaim_script: String, + status: models::Status, + status_message: String, + ) -> Deposit { Deposit { amount, bitcoin_tx_output_index, @@ -68,4 +85,3 @@ impl Deposit { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs index 32f89ca35..e009b119e 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -44,7 +44,17 @@ pub struct DepositInfo { impl DepositInfo { /// Reduced version of the Deposit data. - pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, recipient: String, reclaim_script: String, status: models::Status) -> DepositInfo { + pub fn new( + amount: u64, + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + last_update_block_hash: String, + last_update_height: u64, + recipient: String, + reclaim_script: String, + status: models::Status, + ) -> DepositInfo { DepositInfo { amount, bitcoin_tx_output_index, @@ -58,4 +68,3 @@ impl DepositInfo { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs index d09933373..fc45f1cf3 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,10 +25,6 @@ pub struct DepositParameters { impl DepositParameters { /// Deposit parameters. pub fn new(lock_time: u32, max_fee: u64) -> DepositParameters { - DepositParameters { - lock_time, - max_fee, - } + DepositParameters { lock_time, max_fee } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs b/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs index 55cb0f193..b3ac099c9 100644 --- a/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs +++ b/.generated-sources/emily/client/rust/private/src/models/deposit_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,7 +20,12 @@ pub struct DepositUpdate { /// Bitcoin transaction id. #[serde(rename = "bitcoinTxid")] pub bitcoin_txid: String, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -37,7 +42,14 @@ pub struct DepositUpdate { impl DepositUpdate { /// A singlular Deposit update that contains only the fields pertinent to updating the status of a deposit. This includes the key related data in addition to status history related data. - pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, last_update_block_hash: String, last_update_height: u64, status: models::Status, status_message: String) -> DepositUpdate { + pub fn new( + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + last_update_block_hash: String, + last_update_height: u64, + status: models::Status, + status_message: String, + ) -> DepositUpdate { DepositUpdate { bitcoin_tx_output_index, bitcoin_txid, @@ -49,4 +61,3 @@ impl DepositUpdate { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/error_response.rs b/.generated-sources/emily/client/rust/private/src/models/error_response.rs index d15dd0016..5043d7373 100644 --- a/.generated-sources/emily/client/rust/private/src/models/error_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/error_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,9 +21,6 @@ pub struct ErrorResponse { impl ErrorResponse { /// Structure representing an error response This is used to serialize error messages in HTTP responses pub fn new(message: String) -> ErrorResponse { - ErrorResponse { - message, - } + ErrorResponse { message } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs b/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs index 8f2c5976b..3da4d346d 100644 --- a/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs +++ b/.generated-sources/emily/client/rust/private/src/models/fulfillment.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,14 @@ pub struct Fulfillment { impl Fulfillment { /// Data about the fulfillment of an sBTC Operation. - pub fn new(bitcoin_block_hash: String, bitcoin_block_height: u64, bitcoin_tx_index: u32, bitcoin_txid: String, btc_fee: u64, stacks_txid: String) -> Fulfillment { + pub fn new( + bitcoin_block_hash: String, + bitcoin_block_height: u64, + bitcoin_tx_index: u32, + bitcoin_txid: String, + btc_fee: u64, + stacks_txid: String, + ) -> Fulfillment { Fulfillment { bitcoin_block_hash, bitcoin_block_height, @@ -47,4 +54,3 @@ impl Fulfillment { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs index f1a9f65e9..304d7527d 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_deposits_for_transaction_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,17 +18,18 @@ pub struct GetDepositsForTransactionResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, } impl GetDepositsForTransactionResponse { /// Response to get deposits for transaction request. pub fn new(deposits: Vec) -> GetDepositsForTransactionResponse { - GetDepositsForTransactionResponse { - deposits, - next_token: None, - } + GetDepositsForTransactionResponse { deposits, next_token: None } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs index 4f6b7c7b7..b2b30669b 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,17 +18,18 @@ pub struct GetDepositsResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, } impl GetDepositsResponse { /// Response to get deposits request. pub fn new(deposits: Vec) -> GetDepositsResponse { - GetDepositsResponse { - deposits, - next_token: None, - } + GetDepositsResponse { deposits, next_token: None } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs b/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs index c2486d34e..da4bd2603 100644 --- a/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/get_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,7 +15,12 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetWithdrawalsResponse { /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, /// Withdrawal infos: withdrawals with a little less data. #[serde(rename = "withdrawals")] @@ -25,10 +30,6 @@ pub struct GetWithdrawalsResponse { impl GetWithdrawalsResponse { /// Response to get withdrawals request. pub fn new(withdrawals: Vec) -> GetWithdrawalsResponse { - GetWithdrawalsResponse { - next_token: None, - withdrawals, - } + GetWithdrawalsResponse { next_token: None, withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/health_data.rs b/.generated-sources/emily/client/rust/private/src/models/health_data.rs index 260c3d340..56f3505f9 100644 --- a/.generated-sources/emily/client/rust/private/src/models/health_data.rs +++ b/.generated-sources/emily/client/rust/private/src/models/health_data.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct HealthData { impl HealthData { /// Struct that represents the current status of the API. pub fn new(is_okay: bool) -> HealthData { - HealthData { - is_okay, - } + HealthData { is_okay } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/limits.rs b/.generated-sources/emily/client/rust/private/src/models/limits.rs index ddf9d721d..a1c51485a 100644 --- a/.generated-sources/emily/client/rust/private/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/private/src/models/limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,16 +18,36 @@ pub struct Limits { #[serde(rename = "accountCaps")] pub account_caps: std::collections::HashMap, /// Represents the total cap for all pegged-in BTC/sBTC. - #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "pegCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub peg_cap: Option>, /// Per deposit cap. If none then there is no cap. - #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. - #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perWithdrawalCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_withdrawal_cap: Option>, } @@ -43,4 +63,3 @@ impl Limits { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/status.rs b/.generated-sources/emily/client/rust/private/src/models/status.rs index 2e040902b..f0a85fc8a 100644 --- a/.generated-sources/emily/client/rust/private/src/models/status.rs +++ b/.generated-sources/emily/client/rust/private/src/models/status.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,7 +25,6 @@ pub enum Status { Confirmed, #[serde(rename = "failed")] Failed, - } impl std::fmt::Display for Status { @@ -45,4 +44,3 @@ impl Default for Status { Self::Pending } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs index 505de2823..6bbc07a29 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_deposits_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateDepositsRequestBody { impl UpdateDepositsRequestBody { /// Request structure for update deposit request. pub fn new(deposits: Vec) -> UpdateDepositsRequestBody { - UpdateDepositsRequestBody { - deposits, - } + UpdateDepositsRequestBody { deposits } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs b/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs index e788f55b8..654d42717 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateDepositsResponse { impl UpdateDepositsResponse { /// Response to update deposits request. pub fn new(deposits: Vec) -> UpdateDepositsResponse { - UpdateDepositsResponse { - deposits, - } + UpdateDepositsResponse { deposits } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs index 1f7f611a8..03e176947 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateWithdrawalsRequestBody { impl UpdateWithdrawalsRequestBody { /// Request structure for the create withdrawal request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsRequestBody { - UpdateWithdrawalsRequestBody { - withdrawals, - } + UpdateWithdrawalsRequestBody { withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs index 0a5b8a406..7a8b6c603 100644 --- a/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/private/src/models/update_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateWithdrawalsResponse { impl UpdateWithdrawalsResponse { /// Response to update withdrawals request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsResponse { - UpdateWithdrawalsResponse { - withdrawals, - } + UpdateWithdrawalsResponse { withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs index b9791edb5..15d517cf1 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,7 +17,12 @@ pub struct Withdrawal { /// Amount of BTC being withdrawn in satoshis. #[serde(rename = "amount")] pub amount: u64, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -48,7 +53,18 @@ pub struct Withdrawal { impl Withdrawal { /// Withdrawal. - pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status, status_message: String) -> Withdrawal { + pub fn new( + amount: u64, + last_update_block_hash: String, + last_update_height: u64, + parameters: models::WithdrawalParameters, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + status: models::Status, + status_message: String, + ) -> Withdrawal { Withdrawal { amount, fulfillment: None, @@ -64,4 +80,3 @@ impl Withdrawal { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs index 3ac4d2f02..26c2c6526 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -41,7 +41,16 @@ pub struct WithdrawalInfo { impl WithdrawalInfo { /// Reduced version of the Withdrawal. - pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status) -> WithdrawalInfo { + pub fn new( + amount: u64, + last_update_block_hash: String, + last_update_height: u64, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + status: models::Status, + ) -> WithdrawalInfo { WithdrawalInfo { amount, last_update_block_hash, @@ -54,4 +63,3 @@ impl WithdrawalInfo { } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs index cd73a7c64..970677244 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct WithdrawalParameters { impl WithdrawalParameters { /// Withdrawal parameters. pub fn new(max_fee: u64) -> WithdrawalParameters { - WithdrawalParameters { - max_fee, - } + WithdrawalParameters { max_fee } } } - diff --git a/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs b/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs index 5d78e2d20..ca70785d2 100644 --- a/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs +++ b/.generated-sources/emily/client/rust/private/src/models/withdrawal_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -14,7 +14,12 @@ use serde::{Deserialize, Serialize}; /// WithdrawalUpdate : A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WithdrawalUpdate { - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -34,7 +39,13 @@ pub struct WithdrawalUpdate { impl WithdrawalUpdate { /// A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. - pub fn new(last_update_block_hash: String, last_update_height: u64, request_id: u64, status: models::Status, status_message: String) -> WithdrawalUpdate { + pub fn new( + last_update_block_hash: String, + last_update_height: u64, + request_id: u64, + status: models::Status, + status_message: String, + ) -> WithdrawalUpdate { WithdrawalUpdate { fulfillment: None, last_update_block_hash, @@ -45,4 +56,3 @@ impl WithdrawalUpdate { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs index 268420335..32cc62c9b 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/chainstate_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_chain_tip`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -58,17 +56,20 @@ pub enum UpdateChainstateError { UnknownValue(serde_json::Value), } - -pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_chain_tip( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,22 +81,36 @@ pub async fn get_chain_tip(configuration: &configuration::Configuration, ) -> Re if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_chainstate_at_height(configuration: &configuration::Configuration, height: u64) -> Result> { +pub async fn get_chainstate_at_height( + configuration: &configuration::Configuration, + height: u64, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/chainstate/{height}", + local_var_configuration.base_path, + height = height + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -107,22 +122,32 @@ pub async fn get_chainstate_at_height(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { +pub async fn set_chainstate( + configuration: &configuration::Configuration, + chainstate: models::Chainstate, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -143,22 +168,32 @@ pub async fn set_chainstate(configuration: &configuration::Configuration, chains if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_chainstate(configuration: &configuration::Configuration, chainstate: models::Chainstate) -> Result> { +pub async fn update_chainstate( + configuration: &configuration::Configuration, + chainstate: models::Chainstate, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -179,9 +214,13 @@ pub async fn update_chainstate(configuration: &configuration::Configuration, cha if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs b/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs index 0acbf82b7..1e893a0e4 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/configuration.rs @@ -4,12 +4,10 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - - #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -30,7 +28,6 @@ pub struct ApiKey { pub key: String, } - impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -47,7 +44,6 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, - } } } diff --git a/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs index 452d23031..b8a403634 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/cors_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`chainstate_height_options`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -92,18 +90,26 @@ pub enum WithdrawalOptionsError { UnknownValue(serde_json::Value), } - /// Handles CORS preflight requests -pub async fn chainstate_height_options(configuration: &configuration::Configuration, height: u64) -> Result<(), Error> { +pub async fn chainstate_height_options( + configuration: &configuration::Configuration, + height: u64, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/chainstate/{height}", local_var_configuration.base_path, height=height); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/chainstate/{height}", + local_var_configuration.base_path, + height = height + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -115,23 +121,32 @@ pub async fn chainstate_height_options(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn chainstate_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn chainstate_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/chainstate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -143,23 +158,32 @@ pub async fn chainstate_options(configuration: &configuration::Configuration, ) if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn deposit_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -171,23 +195,39 @@ pub async fn deposit_options(configuration: &configuration::Configuration, ) -> if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_index_options(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result<(), Error> { +pub async fn deposit_txid_index_options( + configuration: &configuration::Configuration, + txid: &str, + index: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}/{index}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid), + index = crate::apis::urlencode(index) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -199,23 +239,37 @@ pub async fn deposit_txid_index_options(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn deposit_txid_options(configuration: &configuration::Configuration, txid: &str) -> Result<(), Error> { +pub async fn deposit_txid_options( + configuration: &configuration::Configuration, + txid: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -227,23 +281,32 @@ pub async fn deposit_txid_options(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn health_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn health_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -255,23 +318,37 @@ pub async fn health_options(configuration: &configuration::Configuration, ) -> R if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_account_options(configuration: &configuration::Configuration, account: &str) -> Result<(), Error> { +pub async fn limits_account_options( + configuration: &configuration::Configuration, + account: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -283,23 +360,32 @@ pub async fn limits_account_options(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn limits_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn limits_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -311,23 +397,32 @@ pub async fn limits_options(configuration: &configuration::Configuration, ) -> R if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn testing_wipe_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn testing_wipe_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/testing/wipe", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -339,23 +434,37 @@ pub async fn testing_wipe_options(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_id_options(configuration: &configuration::Configuration, id: u64) -> Result<(), Error> { +pub async fn withdrawal_id_options( + configuration: &configuration::Configuration, + id: u64, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/withdrawal/{id}", + local_var_configuration.base_path, + id = id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -367,23 +476,32 @@ pub async fn withdrawal_id_options(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Handles CORS preflight requests -pub async fn withdrawal_options(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn withdrawal_options( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -395,9 +513,13 @@ pub async fn withdrawal_options(configuration: &configuration::Configuration, ) if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs index 5a475a44c..ed7f027a9 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/deposit_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_deposit`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -70,17 +68,21 @@ pub enum UpdateDepositsError { UnknownValue(serde_json::Value), } - -pub async fn create_deposit(configuration: &configuration::Configuration, create_deposit_request_body: models::CreateDepositRequestBody) -> Result> { +pub async fn create_deposit( + configuration: &configuration::Configuration, + create_deposit_request_body: models::CreateDepositRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_deposit_request_body); @@ -93,22 +95,38 @@ pub async fn create_deposit(configuration: &configuration::Configuration, create if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposit(configuration: &configuration::Configuration, txid: &str, index: &str) -> Result> { +pub async fn get_deposit( + configuration: &configuration::Configuration, + txid: &str, + index: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}/{index}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid), index=crate::apis::urlencode(index)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}/{index}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid), + index = crate::apis::urlencode(index) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -120,29 +138,43 @@ pub async fn get_deposit(configuration: &configuration::Configuration, txid: &st if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_deposits( + configuration: &configuration::Configuration, + status: models::Status, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -154,28 +186,46 @@ pub async fn get_deposits(configuration: &configuration::Configuration, status: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_deposits_for_transaction(configuration: &configuration::Configuration, txid: &str, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_deposits_for_transaction( + configuration: &configuration::Configuration, + txid: &str, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/deposit/{txid}", local_var_configuration.base_path, txid=crate::apis::urlencode(txid)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/deposit/{txid}", + local_var_configuration.base_path, + txid = crate::apis::urlencode(txid) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -187,22 +237,32 @@ pub async fn get_deposits_for_transaction(configuration: &configuration::Configu if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_deposits(configuration: &configuration::Configuration, update_deposits_request_body: models::UpdateDepositsRequestBody) -> Result> { +pub async fn update_deposits( + configuration: &configuration::Configuration, + update_deposits_request_body: models::UpdateDepositsRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/deposit", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -223,9 +283,13 @@ pub async fn update_deposits(configuration: &configuration::Configuration, updat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs index 3733852b0..16f08f69e 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/health_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`check_health`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -26,17 +24,20 @@ pub enum CheckHealthError { UnknownValue(serde_json::Value), } - -pub async fn check_health(configuration: &configuration::Configuration, ) -> Result> { +pub async fn check_health( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -56,9 +57,13 @@ pub async fn check_health(configuration: &configuration::Configuration, ) -> Res if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs index f71e9c700..860cc87e5 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/limits_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_limits`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -57,17 +55,20 @@ pub enum SetLimitsForAccountError { UnknownValue(serde_json::Value), } - -pub async fn get_limits(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_limits( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -79,22 +80,36 @@ pub async fn get_limits(configuration: &configuration::Configuration, ) -> Resul if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_limits_for_account(configuration: &configuration::Configuration, account: &str) -> Result> { +pub async fn get_limits_for_account( + configuration: &configuration::Configuration, + account: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -106,22 +121,32 @@ pub async fn get_limits_for_account(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits(configuration: &configuration::Configuration, limits: models::Limits) -> Result> { +pub async fn set_limits( + configuration: &configuration::Configuration, + limits: models::Limits, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/limits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -142,22 +167,37 @@ pub async fn set_limits(configuration: &configuration::Configuration, limits: mo if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn set_limits_for_account(configuration: &configuration::Configuration, account: &str, account_limits: models::AccountLimits) -> Result> { +pub async fn set_limits_for_account( + configuration: &configuration::Configuration, + account: &str, + account_limits: models::AccountLimits, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/limits/{account}", local_var_configuration.base_path, account=crate::apis::urlencode(account)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/limits/{account}", + local_var_configuration.base_path, + account = crate::apis::urlencode(account) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -178,9 +218,13 @@ pub async fn set_limits_for_account(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/mod.rs b/.generated-sources/emily/client/rust/testing/src/apis/mod.rs index 3c055ba7a..dbd548803 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/mod.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } @@ -90,8 +92,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String unimplemented!("Only objects are supported with style=deepObject") } -pub mod cors_api; pub mod chainstate_api; +pub mod cors_api; pub mod deposit_api; pub mod health_api; pub mod limits_api; diff --git a/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs index c67bb4ad1..7f45b6f96 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/testing_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`wipe_databases`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -26,17 +24,20 @@ pub enum WipeDatabasesError { UnknownValue(serde_json::Value), } - -pub async fn wipe_databases(configuration: &configuration::Configuration, ) -> Result<(), Error> { +pub async fn wipe_databases( + configuration: &configuration::Configuration, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/testing/wipe", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -56,9 +57,13 @@ pub async fn wipe_databases(configuration: &configuration::Configuration, ) -> R if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs b/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs index fba1d59ab..3631fedb0 100644 --- a/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs +++ b/.generated-sources/emily/client/rust/testing/src/apis/withdrawal_api.rs @@ -4,16 +4,14 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_withdrawal`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -59,17 +57,21 @@ pub enum UpdateWithdrawalsError { UnknownValue(serde_json::Value), } - -pub async fn create_withdrawal(configuration: &configuration::Configuration, create_withdrawal_request_body: models::CreateWithdrawalRequestBody) -> Result> { +pub async fn create_withdrawal( + configuration: &configuration::Configuration, + create_withdrawal_request_body: models::CreateWithdrawalRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -90,22 +92,36 @@ pub async fn create_withdrawal(configuration: &configuration::Configuration, cre if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u64) -> Result> { +pub async fn get_withdrawal( + configuration: &configuration::Configuration, + id: u64, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/withdrawal/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/withdrawal/{id}", + local_var_configuration.base_path, + id = id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -117,29 +133,43 @@ pub async fn get_withdrawal(configuration: &configuration::Configuration, id: u6 if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_withdrawals(configuration: &configuration::Configuration, status: models::Status, next_token: Option<&str>, page_size: Option) -> Result> { +pub async fn get_withdrawals( + configuration: &configuration::Configuration, + status: models::Status, + next_token: Option<&str>, + page_size: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder.query(&[("status", &status.to_string())]); if let Some(ref local_var_str) = next_token { - local_var_req_builder = local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page_size { - local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -151,22 +181,32 @@ pub async fn get_withdrawals(configuration: &configuration::Configuration, statu if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_withdrawals(configuration: &configuration::Configuration, update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody) -> Result> { +pub async fn update_withdrawals( + configuration: &configuration::Configuration, + update_withdrawals_request_body: models::UpdateWithdrawalsRequestBody, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/withdrawal", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -187,9 +227,13 @@ pub async fn update_withdrawals(configuration: &configuration::Configuration, up if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/.generated-sources/emily/client/rust/testing/src/lib.rs b/.generated-sources/emily/client/rust/testing/src/lib.rs index e1520628d..9556a0a13 100644 --- a/.generated-sources/emily/client/rust/testing/src/lib.rs +++ b/.generated-sources/emily/client/rust/testing/src/lib.rs @@ -1,11 +1,11 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -extern crate serde_repr; +extern crate reqwest; extern crate serde; extern crate serde_json; +extern crate serde_repr; extern crate url; -extern crate reqwest; pub mod apis; pub mod models; diff --git a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs index 2f60a52ce..ed77256bb 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/account_limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,16 +15,36 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct AccountLimits { /// Represents the current sBTC limits. - #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "pegCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub peg_cap: Option>, /// Per deposit cap. If none then the cap is the same as the global per deposit cap. - #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then the cap is the same as the global per withdrawal cap. - #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perWithdrawalCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_withdrawal_cap: Option>, } @@ -39,4 +59,3 @@ impl AccountLimits { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs b/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs index 836ad6361..b0e2e57f6 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/chainstate.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -31,4 +31,3 @@ impl Chainstate { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs index 6b9361d97..8e53dc90e 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/create_deposit_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -30,7 +30,12 @@ pub struct CreateDepositRequestBody { impl CreateDepositRequestBody { /// Request structure for create deposit request. - pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, reclaim_script: String) -> CreateDepositRequestBody { + pub fn new( + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + reclaim_script: String, + ) -> CreateDepositRequestBody { CreateDepositRequestBody { bitcoin_tx_output_index, bitcoin_txid, @@ -39,4 +44,3 @@ impl CreateDepositRequestBody { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs index ccd05d5b2..d95da9ed4 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/create_withdrawal_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -35,7 +35,14 @@ pub struct CreateWithdrawalRequestBody { impl CreateWithdrawalRequestBody { /// Request structure for the create withdrawal request. - pub fn new(amount: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64) -> CreateWithdrawalRequestBody { + pub fn new( + amount: u64, + parameters: models::WithdrawalParameters, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + ) -> CreateWithdrawalRequestBody { CreateWithdrawalRequestBody { amount, parameters: Box::new(parameters), @@ -46,4 +53,3 @@ impl CreateWithdrawalRequestBody { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit.rs index 4983d7225..9c5896d0a 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -26,7 +26,12 @@ pub struct Deposit { /// Raw deposit script binary in hex. #[serde(rename = "depositScript")] pub deposit_script: String, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -51,7 +56,19 @@ pub struct Deposit { impl Deposit { /// Deposit. - pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, parameters: models::DepositParameters, recipient: String, reclaim_script: String, status: models::Status, status_message: String) -> Deposit { + pub fn new( + amount: u64, + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + last_update_block_hash: String, + last_update_height: u64, + parameters: models::DepositParameters, + recipient: String, + reclaim_script: String, + status: models::Status, + status_message: String, + ) -> Deposit { Deposit { amount, bitcoin_tx_output_index, @@ -68,4 +85,3 @@ impl Deposit { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs index 32f89ca35..e009b119e 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -44,7 +44,17 @@ pub struct DepositInfo { impl DepositInfo { /// Reduced version of the Deposit data. - pub fn new(amount: u64, bitcoin_tx_output_index: u32, bitcoin_txid: String, deposit_script: String, last_update_block_hash: String, last_update_height: u64, recipient: String, reclaim_script: String, status: models::Status) -> DepositInfo { + pub fn new( + amount: u64, + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + deposit_script: String, + last_update_block_hash: String, + last_update_height: u64, + recipient: String, + reclaim_script: String, + status: models::Status, + ) -> DepositInfo { DepositInfo { amount, bitcoin_tx_output_index, @@ -58,4 +68,3 @@ impl DepositInfo { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs index d09933373..fc45f1cf3 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,10 +25,6 @@ pub struct DepositParameters { impl DepositParameters { /// Deposit parameters. pub fn new(lock_time: u32, max_fee: u64) -> DepositParameters { - DepositParameters { - lock_time, - max_fee, - } + DepositParameters { lock_time, max_fee } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs b/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs index 55cb0f193..b3ac099c9 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/deposit_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -20,7 +20,12 @@ pub struct DepositUpdate { /// Bitcoin transaction id. #[serde(rename = "bitcoinTxid")] pub bitcoin_txid: String, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the deposit was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -37,7 +42,14 @@ pub struct DepositUpdate { impl DepositUpdate { /// A singlular Deposit update that contains only the fields pertinent to updating the status of a deposit. This includes the key related data in addition to status history related data. - pub fn new(bitcoin_tx_output_index: u32, bitcoin_txid: String, last_update_block_hash: String, last_update_height: u64, status: models::Status, status_message: String) -> DepositUpdate { + pub fn new( + bitcoin_tx_output_index: u32, + bitcoin_txid: String, + last_update_block_hash: String, + last_update_height: u64, + status: models::Status, + status_message: String, + ) -> DepositUpdate { DepositUpdate { bitcoin_tx_output_index, bitcoin_txid, @@ -49,4 +61,3 @@ impl DepositUpdate { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/error_response.rs b/.generated-sources/emily/client/rust/testing/src/models/error_response.rs index d15dd0016..5043d7373 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/error_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/error_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -21,9 +21,6 @@ pub struct ErrorResponse { impl ErrorResponse { /// Structure representing an error response This is used to serialize error messages in HTTP responses pub fn new(message: String) -> ErrorResponse { - ErrorResponse { - message, - } + ErrorResponse { message } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs b/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs index 8f2c5976b..3da4d346d 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/fulfillment.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -36,7 +36,14 @@ pub struct Fulfillment { impl Fulfillment { /// Data about the fulfillment of an sBTC Operation. - pub fn new(bitcoin_block_hash: String, bitcoin_block_height: u64, bitcoin_tx_index: u32, bitcoin_txid: String, btc_fee: u64, stacks_txid: String) -> Fulfillment { + pub fn new( + bitcoin_block_hash: String, + bitcoin_block_height: u64, + bitcoin_tx_index: u32, + bitcoin_txid: String, + btc_fee: u64, + stacks_txid: String, + ) -> Fulfillment { Fulfillment { bitcoin_block_hash, bitcoin_block_height, @@ -47,4 +54,3 @@ impl Fulfillment { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs index f1a9f65e9..304d7527d 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_for_transaction_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,17 +18,18 @@ pub struct GetDepositsForTransactionResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, } impl GetDepositsForTransactionResponse { /// Response to get deposits for transaction request. pub fn new(deposits: Vec) -> GetDepositsForTransactionResponse { - GetDepositsForTransactionResponse { - deposits, - next_token: None, - } + GetDepositsForTransactionResponse { deposits, next_token: None } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs index 4f6b7c7b7..b2b30669b 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,17 +18,18 @@ pub struct GetDepositsResponse { #[serde(rename = "deposits")] pub deposits: Vec, /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, } impl GetDepositsResponse { /// Response to get deposits request. pub fn new(deposits: Vec) -> GetDepositsResponse { - GetDepositsResponse { - deposits, - next_token: None, - } + GetDepositsResponse { deposits, next_token: None } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs b/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs index c2486d34e..da4bd2603 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/get_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -15,7 +15,12 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct GetWithdrawalsResponse { /// Next token for the search. - #[serde(rename = "nextToken", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nextToken", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub next_token: Option>, /// Withdrawal infos: withdrawals with a little less data. #[serde(rename = "withdrawals")] @@ -25,10 +30,6 @@ pub struct GetWithdrawalsResponse { impl GetWithdrawalsResponse { /// Response to get withdrawals request. pub fn new(withdrawals: Vec) -> GetWithdrawalsResponse { - GetWithdrawalsResponse { - next_token: None, - withdrawals, - } + GetWithdrawalsResponse { next_token: None, withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/health_data.rs b/.generated-sources/emily/client/rust/testing/src/models/health_data.rs index 260c3d340..56f3505f9 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/health_data.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/health_data.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct HealthData { impl HealthData { /// Struct that represents the current status of the API. pub fn new(is_okay: bool) -> HealthData { - HealthData { - is_okay, - } + HealthData { is_okay } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/limits.rs b/.generated-sources/emily/client/rust/testing/src/models/limits.rs index ddf9d721d..a1c51485a 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/limits.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/limits.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -18,16 +18,36 @@ pub struct Limits { #[serde(rename = "accountCaps")] pub account_caps: std::collections::HashMap, /// Represents the total cap for all pegged-in BTC/sBTC. - #[serde(rename = "pegCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "pegCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub peg_cap: Option>, /// Per deposit cap. If none then there is no cap. - #[serde(rename = "perDepositCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_cap: Option>, /// Per deposit minimum. If none then there is no minimum. - #[serde(rename = "perDepositMinimum", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perDepositMinimum", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_deposit_minimum: Option>, /// Per withdrawal cap. If none then there is no cap. - #[serde(rename = "perWithdrawalCap", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "perWithdrawalCap", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub per_withdrawal_cap: Option>, } @@ -43,4 +63,3 @@ impl Limits { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/status.rs b/.generated-sources/emily/client/rust/testing/src/models/status.rs index 2e040902b..f0a85fc8a 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/status.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/status.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -25,7 +25,6 @@ pub enum Status { Confirmed, #[serde(rename = "failed")] Failed, - } impl std::fmt::Display for Status { @@ -45,4 +44,3 @@ impl Default for Status { Self::Pending } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs index 505de2823..6bbc07a29 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateDepositsRequestBody { impl UpdateDepositsRequestBody { /// Request structure for update deposit request. pub fn new(deposits: Vec) -> UpdateDepositsRequestBody { - UpdateDepositsRequestBody { - deposits, - } + UpdateDepositsRequestBody { deposits } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs index e788f55b8..654d42717 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_deposits_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateDepositsResponse { impl UpdateDepositsResponse { /// Response to update deposits request. pub fn new(deposits: Vec) -> UpdateDepositsResponse { - UpdateDepositsResponse { - deposits, - } + UpdateDepositsResponse { deposits } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs index 1f7f611a8..03e176947 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_request_body.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateWithdrawalsRequestBody { impl UpdateWithdrawalsRequestBody { /// Request structure for the create withdrawal request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsRequestBody { - UpdateWithdrawalsRequestBody { - withdrawals, - } + UpdateWithdrawalsRequestBody { withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs index 0a5b8a406..7a8b6c603 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/update_withdrawals_response.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct UpdateWithdrawalsResponse { impl UpdateWithdrawalsResponse { /// Response to update withdrawals request. pub fn new(withdrawals: Vec) -> UpdateWithdrawalsResponse { - UpdateWithdrawalsResponse { - withdrawals, - } + UpdateWithdrawalsResponse { withdrawals } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs index b9791edb5..15d517cf1 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -17,7 +17,12 @@ pub struct Withdrawal { /// Amount of BTC being withdrawn in satoshis. #[serde(rename = "amount")] pub amount: u64, - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -48,7 +53,18 @@ pub struct Withdrawal { impl Withdrawal { /// Withdrawal. - pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, parameters: models::WithdrawalParameters, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status, status_message: String) -> Withdrawal { + pub fn new( + amount: u64, + last_update_block_hash: String, + last_update_height: u64, + parameters: models::WithdrawalParameters, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + status: models::Status, + status_message: String, + ) -> Withdrawal { Withdrawal { amount, fulfillment: None, @@ -64,4 +80,3 @@ impl Withdrawal { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs index 3ac4d2f02..26c2c6526 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_info.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -41,7 +41,16 @@ pub struct WithdrawalInfo { impl WithdrawalInfo { /// Reduced version of the Withdrawal. - pub fn new(amount: u64, last_update_block_hash: String, last_update_height: u64, recipient: String, request_id: u64, stacks_block_hash: String, stacks_block_height: u64, status: models::Status) -> WithdrawalInfo { + pub fn new( + amount: u64, + last_update_block_hash: String, + last_update_height: u64, + recipient: String, + request_id: u64, + stacks_block_hash: String, + stacks_block_height: u64, + status: models::Status, + ) -> WithdrawalInfo { WithdrawalInfo { amount, last_update_block_hash, @@ -54,4 +63,3 @@ impl WithdrawalInfo { } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs index cd73a7c64..970677244 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_parameters.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -22,9 +22,6 @@ pub struct WithdrawalParameters { impl WithdrawalParameters { /// Withdrawal parameters. pub fn new(max_fee: u64) -> WithdrawalParameters { - WithdrawalParameters { - max_fee, - } + WithdrawalParameters { max_fee } } } - diff --git a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs index 5d78e2d20..ca70785d2 100644 --- a/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs +++ b/.generated-sources/emily/client/rust/testing/src/models/withdrawal_update.rs @@ -4,7 +4,7 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 - * + * * Generated by: https://openapi-generator.tech */ @@ -14,7 +14,12 @@ use serde::{Deserialize, Serialize}; /// WithdrawalUpdate : A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct WithdrawalUpdate { - #[serde(rename = "fulfillment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "fulfillment", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub fulfillment: Option>>, /// The most recent Stacks block hash the API was aware of when the withdrawal was last updated. If the most recent update is tied to an artifact on the Stacks blockchain then this hash is the Stacks block hash that contains that artifact. #[serde(rename = "lastUpdateBlockHash")] @@ -34,7 +39,13 @@ pub struct WithdrawalUpdate { impl WithdrawalUpdate { /// A singlular Withdrawal update that contains only the fields pertinent to updating the status of a withdrawal. This includes the key related data in addition to status history related data. - pub fn new(last_update_block_hash: String, last_update_height: u64, request_id: u64, status: models::Status, status_message: String) -> WithdrawalUpdate { + pub fn new( + last_update_block_hash: String, + last_update_height: u64, + request_id: u64, + status: models::Status, + status_message: String, + ) -> WithdrawalUpdate { WithdrawalUpdate { fulfillment: None, last_update_block_hash, @@ -45,4 +56,3 @@ impl WithdrawalUpdate { } } } - diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index 009ad492d..91874155e 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -8,9 +8,6 @@ use stacks_common::codec::StacksMessageCodec as _; use tracing::{debug, instrument}; use warp::reply::{json, with_status, Reply}; -use bitcoin::ScriptBuf; -use warp::http::StatusCode; - use crate::api::models::deposit::{Deposit, DepositInfo}; use crate::api::models::{ deposit::requests::{ @@ -26,6 +23,8 @@ use crate::database::entries::deposit::{ DepositEntry, DepositEntryKey, DepositEvent, DepositParametersEntry, ValidatedUpdateDepositsRequest, }; +use bitcoin::ScriptBuf; +use warp::http::StatusCode; /// Get deposit handler. #[utoipa::path( @@ -215,31 +214,19 @@ pub async fn create_deposit( body: CreateDepositRequestBody, ) -> Result { // Reject dups. - let query = GetDepositsQuery { - status: Status::Accepted, - next_token: None, - page_size: None, - }; - let (entries, _next_token) = accessors::get_deposit_entries( - &context, - &query.status, - query.next_token, - query.page_size, - ) - .await?; + let (entries, _next_token) = + accessors::get_deposit_entries(&context, &Status::Accepted, None, None).await?; let deposits: Vec = entries.into_iter().map(|entry| entry.into()).collect(); for deposit in deposits { if deposit.bitcoin_txid == body.bitcoin_txid && deposit.bitcoin_tx_output_index == body.bitcoin_tx_output_index - && deposit.status == Status::Pending + && deposit.status == Status::Accepted { - return Ok(with_status( - json(&409), - StatusCode::CONFLICT, - )); + return Ok(with_status(json(&409), StatusCode::CONFLICT)); } } + // Create deposit. let api_state = accessors::get_api_state(&context).await?; api_state.error_if_reorganizing()?; From 258283a98a64a96205476e106f1d53b8617d4ea4 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Mon, 23 Dec 2024 17:27:25 +0300 Subject: [PATCH 03/11] enrich error message --- emily/handler/src/api/handlers/deposit.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index 91874155e..f57b048b6 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -222,7 +222,11 @@ pub async fn create_deposit( && deposit.bitcoin_tx_output_index == body.bitcoin_tx_output_index && deposit.status == Status::Accepted { - return Ok(with_status(json(&409), StatusCode::CONFLICT)); + let responce = json(&serde_json::json!({ + "error": "Conflict", + "message": "This deposit already exists and accepted." + })); + return Ok(with_status(responce, StatusCode::CONFLICT)); } } From 7f934067cbb409bf3ce517f503dc11eb5e235e56 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Tue, 7 Jan 2025 13:56:25 +0300 Subject: [PATCH 04/11] fix typo --- emily/handler/src/api/handlers/deposit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index f57b048b6..543414536 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -222,11 +222,11 @@ pub async fn create_deposit( && deposit.bitcoin_tx_output_index == body.bitcoin_tx_output_index && deposit.status == Status::Accepted { - let responce = json(&serde_json::json!({ + let response = json(&serde_json::json!({ "error": "Conflict", "message": "This deposit already exists and accepted." })); - return Ok(with_status(responce, StatusCode::CONFLICT)); + return Ok(with_status(response, StatusCode::CONFLICT)); } } From a1f833119f67ccb00b2e7c56afe36c329b87ba1f Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Wed, 8 Jan 2025 13:21:47 +0300 Subject: [PATCH 05/11] review notes --- emily/handler/src/api/handlers/deposit.rs | 28 ++-- emily/handler/tests/integration/deposit.rs | 145 ++++++++++++--------- 2 files changed, 96 insertions(+), 77 deletions(-) diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index 543414536..f332d10f6 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -213,24 +213,22 @@ pub async fn create_deposit( context: EmilyContext, body: CreateDepositRequestBody, ) -> Result { - // Reject dups. - let (entries, _next_token) = - accessors::get_deposit_entries(&context, &Status::Accepted, None, None).await?; - let deposits: Vec = entries.into_iter().map(|entry| entry.into()).collect(); - for deposit in deposits { - if deposit.bitcoin_txid == body.bitcoin_txid - && deposit.bitcoin_tx_output_index == body.bitcoin_tx_output_index - && deposit.status == Status::Accepted - { - let response = json(&serde_json::json!({ - "error": "Conflict", - "message": "This deposit already exists and accepted." - })); - return Ok(with_status(response, StatusCode::CONFLICT)); + // Reject if we already have a deposit with the same txid and output index and it is NOT pending or reprocessing. + let entry = accessors::get_deposit_entry( + &context, + &DepositEntryKey { + bitcoin_txid: body.bitcoin_txid.clone(), + bitcoin_tx_output_index: body.bitcoin_tx_output_index, + }, + ) + .await; + if let Ok(deposit) = entry { + if deposit.status != Status::Pending && deposit.status != Status::Reprocessing { + return Err(Error::Conflict); } } - // Create deposit. + // Set variables. let api_state = accessors::get_api_state(&context).await?; api_state.error_if_reorganizing()?; diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index 763bc68e8..79d964475 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -552,77 +552,98 @@ async fn update_deposits_updates_chainstate() { #[cfg_attr(not(feature = "integration-tests"), ignore)] #[tokio::test] async fn overwrite_deposit() { - let configuration = clean_setup().await; + async fn assert_duplicate_rejected(status: Status) { + let configuration = clean_setup().await; - // Arrange. - // -------- - let bitcoin_txid: &str = "bitcoin_txid_overwrite_deposit"; - let bitcoin_tx_output_index = 0; + // Arrange. + // -------- + let bitcoin_txid: &str = "bitcoin_txid_overwrite_deposit"; + let bitcoin_tx_output_index = 0; - // Setup test deposit transaction. - let DepositTxnData { - reclaim_script, deposit_script, .. - } = DepositTxnData::new(DEPOSIT_LOCK_TIME, DEPOSIT_MAX_FEE, DEPOSIT_AMOUNT_SATS); + // Setup test deposit transaction. + let DepositTxnData { + reclaim_script, deposit_script, .. + } = DepositTxnData::new(DEPOSIT_LOCK_TIME, DEPOSIT_MAX_FEE, DEPOSIT_AMOUNT_SATS); - let create_deposit_body = CreateDepositRequestBody { - bitcoin_tx_output_index, - bitcoin_txid: bitcoin_txid.into(), - deposit_script: deposit_script.clone(), - reclaim_script: reclaim_script.clone(), - }; + let create_deposit_body = CreateDepositRequestBody { + bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + deposit_script: deposit_script.clone(), + reclaim_script: reclaim_script.clone(), + }; - apis::deposit_api::create_deposit(&configuration, create_deposit_body.clone()) + apis::deposit_api::create_deposit(&configuration, create_deposit_body.clone()) + .await + .expect("Received an error after making a valid create deposit request api call."); + + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) .await - .expect("Received an error after making a valid create deposit request api call."); + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, Status::Pending); + + let mut fulfillment: Option>> = None; + + if status == Status::Confirmed { + fulfillment = Some(Some(Box::new(Fulfillment { + bitcoin_block_hash: "bitcoin_block_hash".to_string(), + bitcoin_block_height: 23, + bitcoin_tx_index: 45, + bitcoin_txid: "test_fulfillment_bitcoin_txid".to_string(), + btc_fee: 2314, + stacks_txid: "test_fulfillment_stacks_txid".to_string(), + }))); + } - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) - .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, Status::Pending); + apis::deposit_api::update_deposits( + &configuration, + UpdateDepositsRequestBody { + deposits: vec![DepositUpdate { + bitcoin_tx_output_index: bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + fulfillment, + last_update_block_hash: "update_block_hash".into(), + last_update_height: 34, + status, + status_message: "foo".into(), + }], + }, + ) + .await + .expect("Received an error after making a valid update deposit request api call."); - apis::deposit_api::update_deposits( - &configuration, - UpdateDepositsRequestBody { - deposits: vec![DepositUpdate { - bitcoin_tx_output_index: bitcoin_tx_output_index, - bitcoin_txid: bitcoin_txid.into(), - fulfillment: None, - last_update_block_hash: "update_block_hash".into(), - last_update_height: 34, - status: Status::Accepted, - status_message: "foo".into(), - }], - }, - ) - .await - .expect("Received an error after making a valid update deposit request api call."); + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, status); - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) - .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, Status::Accepted); + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect_err( + "We should reject duplicate deposits, if old one is not pending or reprocessing.", + ); - apis::deposit_api::create_deposit(&configuration, create_deposit_body) + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) .await - .expect_err("We should reject duplicate deposits, if old one is accepted."); + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, status); + } - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) - .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, Status::Accepted); + for status in vec![Status::Accepted, Status::Confirmed, Status::Failed] { + assert_duplicate_rejected(status).await; + } } From 6efb56c76952206d81b7e575e045d11c33fc18a6 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Wed, 8 Jan 2025 13:38:09 +0300 Subject: [PATCH 06/11] add Pending and Reprocessing statuses to test --- emily/handler/tests/integration/deposit.rs | 45 +++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index 79d964475..379389945 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -552,7 +552,7 @@ async fn update_deposits_updates_chainstate() { #[cfg_attr(not(feature = "integration-tests"), ignore)] #[tokio::test] async fn overwrite_deposit() { - async fn assert_duplicate_rejected(status: Status) { + async fn test_duplicate(status: Status, should_reject: bool) { let configuration = clean_setup().await; // Arrange. @@ -626,11 +626,18 @@ async fn overwrite_deposit() { assert_eq!(response.bitcoin_txid, bitcoin_txid); assert_eq!(response.status, status); - apis::deposit_api::create_deposit(&configuration, create_deposit_body) - .await - .expect_err( - "We should reject duplicate deposits, if old one is not pending or reprocessing.", - ); + if should_reject { + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect_err(&format!( + "We should reject duplicate deposits, if old one is {:#?}", + status + )); + } else { + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect("Received an error after making a valid get deposit api call."); + } let response = apis::deposit_api::get_deposit( &configuration, @@ -640,10 +647,30 @@ async fn overwrite_deposit() { .await .expect("Received an error after making a valid get deposit api call."); assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, status); + let expected_status = if status == Status::Reprocessing { + Status::Pending + } else { + status + }; + assert_eq!(response.status, expected_status); } - for status in vec![Status::Accepted, Status::Confirmed, Status::Failed] { - assert_duplicate_rejected(status).await; + // Maybe looks weird from the first glance, but I like that this won't compile if + // a new option to Status enum will be added and not added to this test. + for status in [ + Status::Accepted, + Status::Confirmed, + Status::Failed, + Status::Pending, + Status::Reprocessing, + ] { + match status { + Status::Accepted | Status::Confirmed | Status::Failed => { + test_duplicate(status, true).await; + } + Status::Pending | Status::Reprocessing => { + test_duplicate(status, false).await; + } + } } } From dabbc6e0739530384412974164fb4a27433b40fe Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Wed, 8 Jan 2025 13:40:23 +0300 Subject: [PATCH 07/11] make comment more beautiul --- emily/handler/tests/integration/deposit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index 379389945..acf8d803b 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -656,7 +656,7 @@ async fn overwrite_deposit() { } // Maybe looks weird from the first glance, but I like that this won't compile if - // a new option to Status enum will be added and not added to this test. + // a new option to Status enum will be added without updating this test. for status in [ Status::Accepted, Status::Confirmed, From 72b0d21fa7f0fc579da2ada04f6b874ff14a69dd Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Wed, 8 Jan 2025 18:25:15 +0300 Subject: [PATCH 08/11] keep stacks block height and hash for pending dups & get_deposit_entry error handling --- emily/handler/src/api/handlers/deposit.rs | 32 +++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/emily/handler/src/api/handlers/deposit.rs b/emily/handler/src/api/handlers/deposit.rs index f332d10f6..c1cceb0cc 100644 --- a/emily/handler/src/api/handlers/deposit.rs +++ b/emily/handler/src/api/handlers/deposit.rs @@ -213,7 +213,15 @@ pub async fn create_deposit( context: EmilyContext, body: CreateDepositRequestBody, ) -> Result { - // Reject if we already have a deposit with the same txid and output index and it is NOT pending or reprocessing. + // Set variables. + let api_state = accessors::get_api_state(&context).await?; + api_state.error_if_reorganizing()?; + + let chaintip = api_state.chaintip(); + let mut stacks_block_hash: String = chaintip.key.hash; + let mut stacks_block_height: u64 = chaintip.key.height; + + // Check if deposit with such txid and outindex already exists. let entry = accessors::get_deposit_entry( &context, &DepositEntryKey { @@ -222,19 +230,21 @@ pub async fn create_deposit( }, ) .await; - if let Ok(deposit) = entry { - if deposit.status != Status::Pending && deposit.status != Status::Reprocessing { - return Err(Error::Conflict); + // Reject if we already have a deposit with the same txid and output index and it is NOT pending or reprocessing. + match entry { + Ok(deposit) => { + if deposit.status != Status::Pending && deposit.status != Status::Reprocessing { + return Err(Error::Conflict); + } else { + // If the deposit is pending or reprocessing, we should keep height and hash same as in the old deposit + stacks_block_hash = deposit.last_update_block_hash; + stacks_block_height = deposit.last_update_height; + } } + Err(Error::NotFound) => {} + Err(e) => return Err(e), } - // Set variables. - let api_state = accessors::get_api_state(&context).await?; - api_state.error_if_reorganizing()?; - - let chaintip = api_state.chaintip(); - let stacks_block_hash: String = chaintip.key.hash; - let stacks_block_height: u64 = chaintip.key.height; let status = Status::Pending; // Get parameters from scripts. From d3d5e253c39ea73ba5fc2b09d06a0b9abb867b63 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Wed, 8 Jan 2025 18:56:20 +0300 Subject: [PATCH 09/11] use test_case macro --- emily/handler/tests/integration/deposit.rs | 211 ++++++++++----------- 1 file changed, 98 insertions(+), 113 deletions(-) diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index acf8d803b..6aa654d91 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -549,128 +549,113 @@ async fn update_deposits_updates_chainstate() { } } -#[cfg_attr(not(feature = "integration-tests"), ignore)] -#[tokio::test] -async fn overwrite_deposit() { - async fn test_duplicate(status: Status, should_reject: bool) { - let configuration = clean_setup().await; +use test_case::test_case; - // Arrange. - // -------- - let bitcoin_txid: &str = "bitcoin_txid_overwrite_deposit"; - let bitcoin_tx_output_index = 0; - - // Setup test deposit transaction. - let DepositTxnData { - reclaim_script, deposit_script, .. - } = DepositTxnData::new(DEPOSIT_LOCK_TIME, DEPOSIT_MAX_FEE, DEPOSIT_AMOUNT_SATS); +#[tokio::test] +#[test_case(Status::Pending, false; "Should not reject pending duplicate")] +#[test_case(Status::Reprocessing, false; "Should not reject reprocessing duplicate")] +#[test_case(Status::Confirmed, true; "Should reject confirmed duplicate")] +#[test_case(Status::Failed, true; "Should reject failed duplicate")] +#[test_case(Status::Accepted, true; "Should reject accepted duplicate")] +#[cfg_attr(not(feature = "integration-tests"), ignore)] +async fn overwrite_deposit(status: Status, should_reject: bool) { + let configuration = clean_setup().await; + // Arrange. + // -------- + let bitcoin_txid: &str = "bitcoin_txid_overwrite_deposit"; + let bitcoin_tx_output_index = 0; - let create_deposit_body = CreateDepositRequestBody { - bitcoin_tx_output_index, - bitcoin_txid: bitcoin_txid.into(), - deposit_script: deposit_script.clone(), - reclaim_script: reclaim_script.clone(), - }; + // Setup test deposit transaction. + let DepositTxnData { + reclaim_script, deposit_script, .. + } = DepositTxnData::new(DEPOSIT_LOCK_TIME, DEPOSIT_MAX_FEE, DEPOSIT_AMOUNT_SATS); - apis::deposit_api::create_deposit(&configuration, create_deposit_body.clone()) - .await - .expect("Received an error after making a valid create deposit request api call."); + let create_deposit_body = CreateDepositRequestBody { + bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + deposit_script: deposit_script.clone(), + reclaim_script: reclaim_script.clone(), + }; - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) + apis::deposit_api::create_deposit(&configuration, create_deposit_body.clone()) .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, Status::Pending); - - let mut fulfillment: Option>> = None; - - if status == Status::Confirmed { - fulfillment = Some(Some(Box::new(Fulfillment { - bitcoin_block_hash: "bitcoin_block_hash".to_string(), - bitcoin_block_height: 23, - bitcoin_tx_index: 45, - bitcoin_txid: "test_fulfillment_bitcoin_txid".to_string(), - btc_fee: 2314, - stacks_txid: "test_fulfillment_stacks_txid".to_string(), - }))); - } + .expect("Received an error after making a valid create deposit request api call."); - apis::deposit_api::update_deposits( - &configuration, - UpdateDepositsRequestBody { - deposits: vec![DepositUpdate { - bitcoin_tx_output_index: bitcoin_tx_output_index, - bitcoin_txid: bitcoin_txid.into(), - fulfillment, - last_update_block_hash: "update_block_hash".into(), - last_update_height: 34, - status, - status_message: "foo".into(), - }], - }, - ) - .await - .expect("Received an error after making a valid update deposit request api call."); + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, Status::Pending); + + let mut fulfillment: Option>> = None; + + if status == Status::Confirmed { + fulfillment = Some(Some(Box::new(Fulfillment { + bitcoin_block_hash: "bitcoin_block_hash".to_string(), + bitcoin_block_height: 23, + bitcoin_tx_index: 45, + bitcoin_txid: "test_fulfillment_bitcoin_txid".to_string(), + btc_fee: 2314, + stacks_txid: "test_fulfillment_stacks_txid".to_string(), + }))); + } - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) - .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - assert_eq!(response.status, status); + apis::deposit_api::update_deposits( + &configuration, + UpdateDepositsRequestBody { + deposits: vec![DepositUpdate { + bitcoin_tx_output_index: bitcoin_tx_output_index, + bitcoin_txid: bitcoin_txid.into(), + fulfillment, + last_update_block_hash: "update_block_hash".into(), + last_update_height: 34, + status, + status_message: "foo".into(), + }], + }, + ) + .await + .expect("Received an error after making a valid update deposit request api call."); - if should_reject { - apis::deposit_api::create_deposit(&configuration, create_deposit_body) - .await - .expect_err(&format!( - "We should reject duplicate deposits, if old one is {:#?}", - status - )); - } else { - apis::deposit_api::create_deposit(&configuration, create_deposit_body) - .await - .expect("Received an error after making a valid get deposit api call."); - } + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + assert_eq!(response.status, status); - let response = apis::deposit_api::get_deposit( - &configuration, - bitcoin_txid, - &bitcoin_tx_output_index.to_string(), - ) - .await - .expect("Received an error after making a valid get deposit api call."); - assert_eq!(response.bitcoin_txid, bitcoin_txid); - let expected_status = if status == Status::Reprocessing { - Status::Pending - } else { - status - }; - assert_eq!(response.status, expected_status); + if should_reject { + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect_err(&format!( + "We should reject duplicate deposits, if old one is {:#?}", + status + )); + } else { + apis::deposit_api::create_deposit(&configuration, create_deposit_body) + .await + .expect("Received an error after making a valid get deposit api call."); } - // Maybe looks weird from the first glance, but I like that this won't compile if - // a new option to Status enum will be added without updating this test. - for status in [ - Status::Accepted, - Status::Confirmed, - Status::Failed, - Status::Pending, - Status::Reprocessing, - ] { - match status { - Status::Accepted | Status::Confirmed | Status::Failed => { - test_duplicate(status, true).await; - } - Status::Pending | Status::Reprocessing => { - test_duplicate(status, false).await; - } - } - } + let response = apis::deposit_api::get_deposit( + &configuration, + bitcoin_txid, + &bitcoin_tx_output_index.to_string(), + ) + .await + .expect("Received an error after making a valid get deposit api call."); + assert_eq!(response.bitcoin_txid, bitcoin_txid); + let expected_status = if status == Status::Reprocessing { + Status::Pending + } else { + status + }; + assert_eq!(response.status, expected_status); } From 8a12224e38e4851d3ca68ddc7426d5c1560f4e76 Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Thu, 9 Jan 2025 04:22:01 +0300 Subject: [PATCH 10/11] move import to file top --- emily/handler/tests/integration/deposit.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index 6aa654d91..ca691775e 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -1,4 +1,5 @@ use std::cmp::Ordering; +use test_case::test_case; use sbtc::testing; use sbtc::testing::deposits::TxSetup; @@ -549,8 +550,6 @@ async fn update_deposits_updates_chainstate() { } } -use test_case::test_case; - #[tokio::test] #[test_case(Status::Pending, false; "Should not reject pending duplicate")] #[test_case(Status::Reprocessing, false; "Should not reject reprocessing duplicate")] From b891381262b1940b0abd89d202df87793c6b42cc Mon Sep 17 00:00:00 2001 From: Viktar Makouski Date: Thu, 9 Jan 2025 04:27:55 +0300 Subject: [PATCH 11/11] small refactoring --- emily/handler/tests/integration/deposit.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/emily/handler/tests/integration/deposit.rs b/emily/handler/tests/integration/deposit.rs index ca691775e..7d9d92c6e 100644 --- a/emily/handler/tests/integration/deposit.rs +++ b/emily/handler/tests/integration/deposit.rs @@ -630,18 +630,12 @@ async fn overwrite_deposit(status: Status, should_reject: bool) { assert_eq!(response.bitcoin_txid, bitcoin_txid); assert_eq!(response.status, status); - if should_reject { + assert_eq!( apis::deposit_api::create_deposit(&configuration, create_deposit_body) .await - .expect_err(&format!( - "We should reject duplicate deposits, if old one is {:#?}", - status - )); - } else { - apis::deposit_api::create_deposit(&configuration, create_deposit_body) - .await - .expect("Received an error after making a valid get deposit api call."); - } + .is_err(), + should_reject + ); let response = apis::deposit_api::get_deposit( &configuration,