diff --git a/libs/blockscout-client/crate/.openapi-generator/FILES b/libs/blockscout-client/crate/.openapi-generator/FILES index 843044de9..acb7234bd 100644 --- a/libs/blockscout-client/crate/.openapi-generator/FILES +++ b/libs/blockscout-client/crate/.openapi-generator/FILES @@ -7,11 +7,15 @@ src/apis/mod.rs src/apis/search_api.rs src/apis/smart_contracts_api.rs src/apis/stats_api.rs +src/apis/token_transfers_api.rs src/apis/tokens_api.rs src/apis/transactions_api.rs src/apis/withdrawals_api.rs src/models/address.rs src/models/address_counters.rs +src/models/address_nft_collection.rs +src/models/address_nft_instance.rs +src/models/address_nft_instance_collection.rs src/models/address_tag.rs src/models/address_with_tx_count.rs src/models/argument.rs @@ -30,15 +34,15 @@ src/models/get_address_blocks_validated_200_response.rs src/models/get_address_coin_balance_history_200_response.rs src/models/get_address_internal_txs_200_response.rs src/models/get_address_logs_200_response.rs +src/models/get_address_nft_200_response.rs +src/models/get_address_nft_collections_200_response.rs src/models/get_address_token_transfers_200_response.rs src/models/get_address_tokens_200_response.rs src/models/get_addresses_200_response.rs src/models/get_block_txs_200_response.rs src/models/get_block_withdrawals_200_response.rs src/models/get_blocks_200_response.rs -src/models/get_internal_txs_200_response.rs src/models/get_json_rpc_url_200_response.rs -src/models/get_logs_200_response.rs src/models/get_market_chart_200_response.rs src/models/get_nft_instance_transfers_200_response.rs src/models/get_nft_instance_transfers_count_200_response.rs @@ -46,12 +50,15 @@ src/models/get_nft_instances_200_response.rs src/models/get_read_methods_200_response_inner.rs src/models/get_smart_contracts_200_response.rs src/models/get_smart_contracts_counters_200_response.rs -src/models/get_state_changes_200_response.rs src/models/get_token_holders_200_response.rs src/models/get_token_instance_holders_200_response.rs src/models/get_token_token_transfers_200_response.rs src/models/get_token_transfers_200_response.rs src/models/get_tokens_list_200_response.rs +src/models/get_transaction_internal_txs_200_response.rs +src/models/get_transaction_logs_200_response.rs +src/models/get_transaction_state_changes_200_response.rs +src/models/get_transaction_token_transfers_200_response.rs src/models/get_txs_200_response.rs src/models/get_txs_chart_200_response.rs src/models/get_write_methods_200_response_inner.rs @@ -76,6 +83,9 @@ src/models/raw_trace_self_destruct_action.rs src/models/read_method_query_body.rs src/models/read_method_response.rs src/models/read_method_response_result.rs +src/models/recaptcha_body.rs +src/models/refetch_token_instance_metadata_200_response.rs +src/models/refetch_token_instance_metadata_403_response.rs src/models/rpc_status.rs src/models/search_200_response.rs src/models/search_200_response_items_inner.rs @@ -87,10 +97,17 @@ src/models/search_result_transaction.rs src/models/state_change.rs src/models/state_change_change.rs src/models/stats_response.rs +src/models/summary.rs +src/models/summary_template_variables.rs +src/models/summary_variable.rs +src/models/summary_variable_currency.rs +src/models/summary_variable_token.rs src/models/token.rs +src/models/token_address_param.rs src/models/token_balance.rs src/models/token_counters.rs src/models/token_info.rs +src/models/token_info_detailed.rs src/models/token_transfer.rs src/models/token_transfer_total.rs src/models/total_erc1155.rs @@ -104,6 +121,8 @@ src/models/transaction_action_uniswap_v3_bcs.rs src/models/transaction_action_uniswap_v3_mint_nft.rs src/models/transaction_chart_item.rs src/models/transaction_reward.rs +src/models/transaction_summary.rs +src/models/transaction_summary_obj.rs src/models/v1_data.rs src/models/v1_health_check_response.rs src/models/watchlist_name.rs diff --git a/libs/blockscout-client/crate/.openapi-generator/VERSION b/libs/blockscout-client/crate/.openapi-generator/VERSION index 7e7b8b9bc..de37f5c4c 100644 --- a/libs/blockscout-client/crate/.openapi-generator/VERSION +++ b/libs/blockscout-client/crate/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.12.0-SNAPSHOT diff --git a/libs/blockscout-client/crate/src/apis/addresses_api.rs b/libs/blockscout-client/crate/src/apis/addresses_api.rs index 524d9ce13..d9486fea4 100644 --- a/libs/blockscout-client/crate/src/apis/addresses_api.rs +++ b/libs/blockscout-client/crate/src/apis/addresses_api.rs @@ -69,6 +69,22 @@ pub enum GetAddressLogsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_address_nft`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAddressNftError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_address_nft_collections`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAddressNftCollectionsError { + Status400(), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_address_token_balances`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -121,40 +137,36 @@ pub async fn get_address( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -162,40 +174,36 @@ pub async fn get_address_blocks_validated( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/blocks-validated", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -204,40 +212,36 @@ pub async fn get_address_coin_balance_history( address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/coin-balance-history", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -246,40 +250,37 @@ pub async fn get_address_coin_balance_history_by_day( address_hash: &str, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/coin-balance-history-by-day", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = + serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -287,40 +288,36 @@ pub async fn get_address_counters( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/counters", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -329,44 +326,40 @@ pub async fn get_address_internal_txs( address_hash: &str, filter: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_filter = filter; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/internal-transactions", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = filter { - local_var_req_builder = - local_var_req_builder.query(&[("filter", &local_var_str.to_string())]); + if let Some(ref param_value) = p_filter { + req_builder = req_builder.query(&[("filter", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -374,40 +367,120 @@ pub async fn get_address_logs( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/logs", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) + ); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&content).map_err(Error::from) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) + } +} + +pub async fn get_address_nft( + configuration: &configuration::Configuration, + address_hash: &str, + r#type: Option<&str>, +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_type = r#type; + + let uri_str = format!( + "{}/api/v2/addresses/{address_hash}/nft", + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) + } +} + +pub async fn get_address_nft_collections( + configuration: &configuration::Configuration, + address_hash: &str, + r#type: Option<&str>, +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_type = r#type; + + let uri_str = format!( + "{}/api/v2/addresses/{address_hash}/nft/collections", + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) + ); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&content).map_err(Error::from) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -415,40 +488,36 @@ pub async fn get_address_token_balances( configuration: &configuration::Configuration, address_hash: &str, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/token-balances", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -459,52 +528,48 @@ pub async fn get_address_token_transfers( filter: Option<&str>, token: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_type = r#type; + let p_filter = filter; + let p_token = token; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/token-transfers", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = filter { - local_var_req_builder = - local_var_req_builder.query(&[("filter", &local_var_str.to_string())]); + if let Some(ref param_value) = p_filter { + req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = token { - local_var_req_builder = - local_var_req_builder.query(&[("token", &local_var_str.to_string())]); + if let Some(ref param_value) = p_token { + req_builder = req_builder.query(&[("token", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -513,44 +578,40 @@ pub async fn get_address_tokens( address_hash: &str, r#type: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_type = r#type; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/tokens", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -559,44 +620,40 @@ pub async fn get_address_txs( address_hash: &str, filter: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_filter = filter; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/transactions", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = filter { - local_var_req_builder = - local_var_req_builder.query(&[("filter", &local_var_str.to_string())]); + if let Some(ref param_value) = p_filter { + req_builder = req_builder.query(&[("filter", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -604,75 +661,64 @@ pub async fn get_address_withdrawals( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/addresses/{address_hash}/withdrawals", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_addresses( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v2/addresses", 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 uri_str = format!("{}/api/v2/addresses", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/blocks_api.rs b/libs/blockscout-client/crate/src/apis/blocks_api.rs index de2a1849e..edb166a3b 100644 --- a/libs/blockscout-client/crate/src/apis/blocks_api.rs +++ b/libs/blockscout-client/crate/src/apis/blocks_api.rs @@ -49,39 +49,36 @@ pub async fn get_block( configuration: &configuration::Configuration, block_number_or_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_block_number_or_hash = block_number_or_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/blocks/{block_number_or_hash}", - local_var_configuration.base_path, - block_number_or_hash = crate::apis::urlencode(block_number_or_hash) + configuration.base_path, + block_number_or_hash = crate::apis::urlencode(p_block_number_or_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -89,40 +86,36 @@ pub async fn get_block_txs( configuration: &configuration::Configuration, block_number_or_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_block_number_or_hash = block_number_or_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/blocks/{block_number_or_hash}/transactions", - local_var_configuration.base_path, - block_number_or_hash = crate::apis::urlencode(block_number_or_hash) + configuration.base_path, + block_number_or_hash = crate::apis::urlencode(p_block_number_or_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -130,40 +123,36 @@ pub async fn get_block_withdrawals( configuration: &configuration::Configuration, block_number_or_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_block_number_or_hash = block_number_or_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/blocks/{block_number_or_hash}/withdrawals", - local_var_configuration.base_path, - block_number_or_hash = crate::apis::urlencode(block_number_or_hash) + configuration.base_path, + block_number_or_hash = crate::apis::urlencode(p_block_number_or_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -171,39 +160,34 @@ pub async fn get_blocks( configuration: &configuration::Configuration, r#type: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_type = r#type; - let local_var_uri_str = format!("{}/api/v2/blocks", 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 uri_str = format!("{}/api/v2/blocks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/config_api.rs b/libs/blockscout-client/crate/src/apis/config_api.rs index 70b1e0650..4aabfe168 100644 --- a/libs/blockscout-client/crate/src/apis/config_api.rs +++ b/libs/blockscout-client/crate/src/apis/config_api.rs @@ -23,38 +23,28 @@ pub enum GetJsonRpcUrlError { pub async fn get_json_rpc_url( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; + let uri_str = format!("{}/api/v2/config/json-rpc-url", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/api/v2/config/json-rpc-url", - local_var_configuration.base_path - ); - 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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/health_api.rs b/libs/blockscout-client/crate/src/apis/health_api.rs index f539bd7eb..1ee87aa7e 100644 --- a/libs/blockscout-client/crate/src/apis/health_api.rs +++ b/libs/blockscout-client/crate/src/apis/health_api.rs @@ -24,34 +24,28 @@ pub enum HealthError { pub async fn health( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; + let uri_str = format!("{}/api/v1/health", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v1/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()); - - 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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/main_page_api.rs b/libs/blockscout-client/crate/src/apis/main_page_api.rs index 63519f572..4c6f1689f 100644 --- a/libs/blockscout-client/crate/src/apis/main_page_api.rs +++ b/libs/blockscout-client/crate/src/apis/main_page_api.rs @@ -37,116 +37,89 @@ pub enum GetMainPageTxsError { pub async fn get_indexing_status( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/main-page/indexing-status", - local_var_configuration.base_path + configuration.base_path ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_main_page_tokens( configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/api/v2/main-page/blocks", - 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 uri_str = format!("{}/api/v2/main-page/blocks", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_main_page_txs( configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/api/v2/main-page/transactions", - 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 uri_str = format!("{}/api/v2/main-page/transactions", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/mod.rs b/libs/blockscout-client/crate/src/apis/mod.rs index 70eb86308..e994103fd 100644 --- a/libs/blockscout-client/crate/src/apis/mod.rs +++ b/libs/blockscout-client/crate/src/apis/mod.rs @@ -108,6 +108,7 @@ pub mod main_page_api; pub mod search_api; pub mod smart_contracts_api; pub mod stats_api; +pub mod token_transfers_api; pub mod tokens_api; pub mod transactions_api; pub mod withdrawals_api; diff --git a/libs/blockscout-client/crate/src/apis/search_api.rs b/libs/blockscout-client/crate/src/apis/search_api.rs index 84a198a51..c7966600d 100644 --- a/libs/blockscout-client/crate/src/apis/search_api.rs +++ b/libs/blockscout-client/crate/src/apis/search_api.rs @@ -33,38 +33,35 @@ pub async fn search( configuration: &configuration::Configuration, q: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_q = q; - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/api/v2/search", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/api/v2/search", local_var_configuration.base_path); - 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) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_q { + req_builder = req_builder.query(&[("q", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -72,41 +69,34 @@ pub async fn search_redirect( configuration: &configuration::Configuration, q: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_q = q; - let local_var_uri_str = format!( - "{}/api/v2/search/check-redirect", - 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 uri_str = format!("{}/api/v2/search/check-redirect", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_q { + req_builder = req_builder.query(&[("q", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/smart_contracts_api.rs b/libs/blockscout-client/crate/src/apis/smart_contracts_api.rs index 304744554..3935b5170 100644 --- a/libs/blockscout-client/crate/src/apis/smart_contracts_api.rs +++ b/libs/blockscout-client/crate/src/apis/smart_contracts_api.rs @@ -82,48 +82,44 @@ pub async fn get_read_methods( is_custom_abi: Option<&str>, from: Option<&str>, ) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_is_custom_abi = is_custom_abi; + let p_from = from; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}/methods-read", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = is_custom_abi { - local_var_req_builder = - local_var_req_builder.query(&[("is_custom_abi", &local_var_str.to_string())]); + if let Some(ref param_value) = p_is_custom_abi { + req_builder = req_builder.query(&[("is_custom_abi", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = from { - local_var_req_builder = - local_var_req_builder.query(&[("from", &local_var_str.to_string())]); + if let Some(ref param_value) = p_from { + req_builder = req_builder.query(&[("from", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -133,48 +129,44 @@ pub async fn get_read_methods_proxy( is_custom_abi: Option<&str>, from: Option<&str>, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_is_custom_abi = is_custom_abi; + let p_from = from; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}/methods-read-proxy", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = is_custom_abi { - local_var_req_builder = - local_var_req_builder.query(&[("is_custom_abi", &local_var_str.to_string())]); + if let Some(ref param_value) = p_is_custom_abi { + req_builder = req_builder.query(&[("is_custom_abi", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = from { - local_var_req_builder = - local_var_req_builder.query(&[("from", &local_var_str.to_string())]); + if let Some(ref param_value) = p_from { + req_builder = req_builder.query(&[("from", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -182,40 +174,36 @@ pub async fn get_smart_contract( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -224,85 +212,71 @@ pub async fn get_smart_contracts( q: Option<&str>, filter: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_q = q; + let p_filter = filter; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/api/v2/smart-contracts", - 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 uri_str = format!("{}/api/v2/smart-contracts", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = filter { - local_var_req_builder = - local_var_req_builder.query(&[("filter", &local_var_str.to_string())]); + if let Some(ref param_value) = p_filter { + req_builder = req_builder.query(&[("filter", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_smart_contracts_counters( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/counters", - local_var_configuration.base_path + configuration.base_path ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -311,44 +285,40 @@ pub async fn get_write_methods( address_hash: &str, is_custom_abi: Option<&str>, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_is_custom_abi = is_custom_abi; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}/methods-write", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = is_custom_abi { - local_var_req_builder = - local_var_req_builder.query(&[("is_custom_abi", &local_var_str.to_string())]); + if let Some(ref param_value) = p_is_custom_abi { + req_builder = req_builder.query(&[("is_custom_abi", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -357,44 +327,40 @@ pub async fn get_write_methods_proxy( address_hash: &str, is_custom_abi: Option<&str>, ) -> Result, Error> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_is_custom_abi = is_custom_abi; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}/methods-write-proxy", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = is_custom_abi { - local_var_req_builder = - local_var_req_builder.query(&[("is_custom_abi", &local_var_str.to_string())]); + if let Some(ref param_value) = p_is_custom_abi { + req_builder = req_builder.query(&[("is_custom_abi", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -403,40 +369,39 @@ pub async fn query_read_method( address_hash: &str, read_method_query_body: models::ReadMethodQueryBody, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_read_method_query_body = read_method_query_body; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/smart-contracts/{address_hash}/query-read-method", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut req_builder = configuration + .client + .request(reqwest::Method::POST, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - local_var_req_builder = local_var_req_builder.json(&read_method_query_body); + req_builder = req_builder.json(&p_read_method_query_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/stats_api.rs b/libs/blockscout-client/crate/src/apis/stats_api.rs index 67c5f8183..7b9865d9b 100644 --- a/libs/blockscout-client/crate/src/apis/stats_api.rs +++ b/libs/blockscout-client/crate/src/apis/stats_api.rs @@ -37,112 +37,89 @@ pub enum GetTxsChartError { pub async fn get_market_chart( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; + let uri_str = format!("{}/api/v2/stats/charts/market", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/api/v2/stats/charts/market", - local_var_configuration.base_path - ); - 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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_stats( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + let uri_str = format!("{}/api/v2/stats", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_uri_str = format!("{}/api/v2/stats", local_var_configuration.base_path); - 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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } pub async fn get_txs_chart( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/stats/charts/transactions", - local_var_configuration.base_path + configuration.base_path ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/token_transfers_api.rs b/libs/blockscout-client/crate/src/apis/token_transfers_api.rs new file mode 100644 index 000000000..d7ff8cf23 --- /dev/null +++ b/libs/blockscout-client/crate/src/apis/token_transfers_api.rs @@ -0,0 +1,51 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; +use reqwest; +use serde::{Deserialize, Serialize}; + +/// struct for typed errors of method [`get_token_transfers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTokenTransfersError { + Status400(), + UnknownValue(serde_json::Value), +} + +pub async fn get_token_transfers( + configuration: &configuration::Configuration, +) -> Result> { + let uri_str = format!("{}/api/v2/token-transfers", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&content).map_err(Error::from) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) + } +} diff --git a/libs/blockscout-client/crate/src/apis/tokens_api.rs b/libs/blockscout-client/crate/src/apis/tokens_api.rs index 7594472bd..1aae13af3 100644 --- a/libs/blockscout-client/crate/src/apis/tokens_api.rs +++ b/libs/blockscout-client/crate/src/apis/tokens_api.rs @@ -93,46 +93,51 @@ pub enum GetTokensListError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`refetch_token_instance_metadata`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RefetchTokenInstanceMetadataError { + Status403(models::RefetchTokenInstanceMetadata403Response), + UnknownValue(serde_json::Value), +} + pub async fn get_nft_instance( configuration: &configuration::Configuration, address_hash: &str, id: i32, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_id = id; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/instances/{id}", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash), - id = id + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash), + id = p_id ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -141,41 +146,38 @@ pub async fn get_nft_instance_transfers( address_hash: &str, id: i32, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_id = id; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/instances/{id}/transfers", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash), - id = id + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash), + id = p_id ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -185,41 +187,38 @@ pub async fn get_nft_instance_transfers_count( id: i32, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_id = id; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/instances/{id}/transfers-count", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash), - id = id + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash), + id = p_id ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -227,40 +226,36 @@ pub async fn get_nft_instances( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/instances", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -268,39 +263,36 @@ pub async fn get_token( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -308,40 +300,36 @@ pub async fn get_token_counters( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/counters", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -349,40 +337,36 @@ pub async fn get_token_holders( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/holders", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -391,41 +375,38 @@ pub async fn get_token_instance_holders( address_hash: &str, id: i32, ) -> Result> { - let local_var_configuration = configuration; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_id = id; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/instances/{id}/holders", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash), - id = id + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash), + id = p_id ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -433,40 +414,36 @@ pub async fn get_token_token_transfers( configuration: &configuration::Configuration, address_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/tokens/{address_hash}/transfers", - local_var_configuration.base_path, - address_hash = crate::apis::urlencode(address_hash) + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -475,42 +452,84 @@ pub async fn get_tokens_list( q: Option<&str>, r#type: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_q = q; + let p_type = r#type; - let local_var_uri_str = format!("{}/api/v2/tokens", 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 uri_str = format!("{}/api/v2/tokens", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = q { - local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]); + if let Some(ref param_value) = p_q { + req_builder = req_builder.query(&[("q", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&content).map_err(Error::from) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) + } +} + +pub async fn refetch_token_instance_metadata( + configuration: &configuration::Configuration, + address_hash: &str, + id: i32, + recaptcha_body: models::RecaptchaBody, +) -> Result> +{ + // add a prefix to parameters to efficiently prevent name collisions + let p_address_hash = address_hash; + let p_id = id; + let p_recaptcha_body = recaptcha_body; + + let uri_str = format!( + "{}/api/v2/tokens/{address_hash}/instances/{id}/refetch-metadata", + configuration.base_path, + address_hash = crate::apis::urlencode(p_address_hash), + id = p_id + ); + let mut req_builder = configuration + .client + .request(reqwest::Method::PATCH, &uri_str); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } + req_builder = req_builder.json(&p_recaptcha_body); - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/transactions_api.rs b/libs/blockscout-client/crate/src/apis/transactions_api.rs index 7e92e6fd9..bd2bc959c 100644 --- a/libs/blockscout-client/crate/src/apis/transactions_api.rs +++ b/libs/blockscout-client/crate/src/apis/transactions_api.rs @@ -13,42 +13,50 @@ use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -/// struct for typed errors of method [`get_internal_txs`] +/// struct for typed errors of method [`get_transaction_internal_txs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum GetInternalTxsError { +pub enum GetTransactionInternalTxsError { Status400(), UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`get_logs`] +/// struct for typed errors of method [`get_transaction_logs`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum GetLogsError { +pub enum GetTransactionLogsError { Status400(), UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`get_raw_trace`] +/// struct for typed errors of method [`get_transaction_raw_trace`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum GetRawTraceError { +pub enum GetTransactionRawTraceError { Status400(), UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`get_state_changes`] +/// struct for typed errors of method [`get_transaction_state_changes`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum GetStateChangesError { +pub enum GetTransactionStateChangesError { Status400(), UnknownValue(serde_json::Value), } -/// struct for typed errors of method [`get_token_transfers`] +/// struct for typed errors of method [`get_transaction_summary`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum GetTokenTransfersError { +pub enum GetTransactionSummaryError { + Status400(), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_transaction_token_transfers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetTransactionTokenTransfersError { Status400(), UnknownValue(serde_json::Value), } @@ -69,212 +77,231 @@ pub enum GetTxsError { UnknownValue(serde_json::Value), } -pub async fn get_internal_txs( +pub async fn get_transaction_internal_txs( configuration: &configuration::Configuration, transaction_hash: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}/internal-transactions", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn get_logs( +pub async fn get_transaction_logs( configuration: &configuration::Configuration, transaction_hash: &str, -) -> Result> { - let local_var_configuration = configuration; +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}/logs", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn get_raw_trace( +pub async fn get_transaction_raw_trace( configuration: &configuration::Configuration, transaction_hash: &str, -) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; +) -> Result, Error> { + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}/raw-trace", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn get_state_changes( +pub async fn get_transaction_state_changes( configuration: &configuration::Configuration, transaction_hash: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}/state-changes", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } -pub async fn get_token_transfers( +pub async fn get_transaction_summary( configuration: &configuration::Configuration, transaction_hash: &str, - r#type: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; +) -> Result> { + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; + + let uri_str = format!( + "{}/api/v2/transactions/{transaction_hash}/summary", + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) + ); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_client = &local_var_configuration.client; + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } - let local_var_uri_str = format!( + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; + + let status = resp.status(); + + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&content).map_err(Error::from) + } else { + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) + } +} + +pub async fn get_transaction_token_transfers( + configuration: &configuration::Configuration, + transaction_hash: &str, + r#type: Option<&str>, +) -> Result> +{ + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; + let p_type = r#type; + + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}/token-transfers", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -282,39 +309,36 @@ pub async fn get_tx( configuration: &configuration::Configuration, transaction_hash: &str, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_transaction_hash = transaction_hash; - let local_var_uri_str = format!( + let uri_str = format!( "{}/api/v2/transactions/{transaction_hash}", - local_var_configuration.base_path, - transaction_hash = crate::apis::urlencode(transaction_hash) + configuration.base_path, + transaction_hash = crate::apis::urlencode(p_transaction_hash) ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } @@ -324,46 +348,42 @@ pub async fn get_txs( r#type: Option<&str>, method: Option<&str>, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; + // add a prefix to parameters to efficiently prevent name collisions + let p_filter = filter; + let p_type = r#type; + let p_method = method; - let local_var_uri_str = format!("{}/api/v2/transactions", 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 uri_str = format!("{}/api/v2/transactions", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - if let Some(ref local_var_str) = filter { - local_var_req_builder = - local_var_req_builder.query(&[("filter", &local_var_str.to_string())]); + if let Some(ref param_value) = p_filter { + req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + if let Some(ref param_value) = p_type { + req_builder = req_builder.query(&[("type", ¶m_value.to_string())]); } - if let Some(ref local_var_str) = method { - local_var_req_builder = - local_var_req_builder.query(&[("method", &local_var_str.to_string())]); + if let Some(ref param_value) = p_method { + req_builder = req_builder.query(&[("method", ¶m_value.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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/apis/withdrawals_api.rs b/libs/blockscout-client/crate/src/apis/withdrawals_api.rs index 4c57f87c1..fb8f8b7a3 100644 --- a/libs/blockscout-client/crate/src/apis/withdrawals_api.rs +++ b/libs/blockscout-client/crate/src/apis/withdrawals_api.rs @@ -23,35 +23,28 @@ pub enum GetWithdrawalsError { pub async fn get_withdrawals( configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; + let uri_str = format!("{}/api/v2/withdrawals", configuration.base_path); + let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/api/v2/withdrawals", local_var_configuration.base_path); - 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()); + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; + let req = req_builder.build()?; + let resp = configuration.client.execute(req).await?; - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; + let status = resp.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) + if !status.is_client_error() && !status.is_server_error() { + let content = resp.text().await?; + serde_json::from_str(&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, - }; - Err(Error::ResponseError(local_var_error)) + let content = resp.text().await?; + let entity: Option = serde_json::from_str(&content).ok(); + Err(Error::ResponseError(ResponseContent { + status, + content, + entity, + })) } } diff --git a/libs/blockscout-client/crate/src/models/address.rs b/libs/blockscout-client/crate/src/models/address.rs index 1096e15bc..3aa180a68 100644 --- a/libs/blockscout-client/crate/src/models/address.rs +++ b/libs/blockscout-client/crate/src/models/address.rs @@ -18,8 +18,11 @@ pub struct Address { skip_serializing_if = "Option::is_none" )] pub creator_address_hash: Option, - #[serde(rename = "creation_tx_hash", skip_serializing_if = "Option::is_none")] - pub creation_tx_hash: Option, + #[serde( + rename = "creation_transaction_hash", + skip_serializing_if = "Option::is_none" + )] + pub creation_transaction_hash: Option, #[serde(rename = "token", skip_serializing_if = "Option::is_none")] pub token: Option, #[serde(rename = "coin_balance", skip_serializing_if = "Option::is_none")] @@ -109,7 +112,7 @@ impl Address { pub fn new(hash: String) -> Address { Address { creator_address_hash: None, - creation_tx_hash: None, + creation_transaction_hash: None, token: None, coin_balance: None, exchange_rate: None, diff --git a/libs/blockscout-client/crate/src/models/address_nft_collection.rs b/libs/blockscout-client/crate/src/models/address_nft_collection.rs new file mode 100644 index 000000000..b8b8ed99a --- /dev/null +++ b/libs/blockscout-client/crate/src/models/address_nft_collection.rs @@ -0,0 +1,35 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddressNftCollection { + #[serde(rename = "token")] + pub token: models::TokenInfo, + #[serde(rename = "amount", skip_serializing_if = "Option::is_none")] + pub amount: Option, + #[serde(rename = "token_instances")] + pub token_instances: Vec, +} + +impl AddressNftCollection { + pub fn new( + token: models::TokenInfo, + token_instances: Vec, + ) -> AddressNftCollection { + AddressNftCollection { + token, + amount: None, + token_instances, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/address_nft_instance.rs b/libs/blockscout-client/crate/src/models/address_nft_instance.rs new file mode 100644 index 000000000..52cb1ad5b --- /dev/null +++ b/libs/blockscout-client/crate/src/models/address_nft_instance.rs @@ -0,0 +1,66 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddressNftInstance { + #[serde(rename = "is_unique")] + pub is_unique: bool, + #[serde(rename = "id")] + pub id: String, + #[serde( + rename = "holder_address_hash", + skip_serializing_if = "Option::is_none" + )] + pub holder_address_hash: Option, + #[serde(rename = "image_url", skip_serializing_if = "Option::is_none")] + pub image_url: Option, + #[serde(rename = "animation_url", skip_serializing_if = "Option::is_none")] + pub animation_url: Option, + #[serde(rename = "external_app_url", skip_serializing_if = "Option::is_none")] + pub external_app_url: Option, + #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[serde(rename = "owner")] + pub owner: models::AddressParam, + #[serde(rename = "token")] + pub token: models::TokenInfo, + #[serde(rename = "token_type")] + pub token_type: String, + #[serde(rename = "value")] + pub value: String, +} + +impl AddressNftInstance { + pub fn new( + is_unique: bool, + id: String, + owner: models::AddressParam, + token: models::TokenInfo, + token_type: String, + value: String, + ) -> AddressNftInstance { + AddressNftInstance { + is_unique, + id, + holder_address_hash: None, + image_url: None, + animation_url: None, + external_app_url: None, + metadata: None, + owner, + token, + token_type, + value, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/address_nft_instance_collection.rs b/libs/blockscout-client/crate/src/models/address_nft_instance_collection.rs new file mode 100644 index 000000000..91784d836 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/address_nft_instance_collection.rs @@ -0,0 +1,65 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AddressNftInstanceCollection { + #[serde(rename = "is_unique")] + pub is_unique: bool, + #[serde(rename = "id")] + pub id: String, + #[serde( + rename = "holder_address_hash", + skip_serializing_if = "Option::is_none" + )] + pub holder_address_hash: Option, + #[serde(rename = "image_url", skip_serializing_if = "Option::is_none")] + pub image_url: Option, + #[serde(rename = "animation_url", skip_serializing_if = "Option::is_none")] + pub animation_url: Option, + #[serde(rename = "external_app_url", skip_serializing_if = "Option::is_none")] + pub external_app_url: Option, + #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[serde(rename = "owner")] + pub owner: models::AddressParam, + #[serde(rename = "token", skip_serializing_if = "Option::is_none")] + pub token: Option, + #[serde(rename = "token_type")] + pub token_type: String, + #[serde(rename = "value")] + pub value: String, +} + +impl AddressNftInstanceCollection { + pub fn new( + is_unique: bool, + id: String, + owner: models::AddressParam, + token_type: String, + value: String, + ) -> AddressNftInstanceCollection { + AddressNftInstanceCollection { + is_unique, + id, + holder_address_hash: None, + image_url: None, + animation_url: None, + external_app_url: None, + metadata: None, + owner, + token: None, + token_type, + value, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/address_with_tx_count.rs b/libs/blockscout-client/crate/src/models/address_with_tx_count.rs index 058d5d087..7293756d6 100644 --- a/libs/blockscout-client/crate/src/models/address_with_tx_count.rs +++ b/libs/blockscout-client/crate/src/models/address_with_tx_count.rs @@ -18,8 +18,11 @@ pub struct AddressWithTxCount { skip_serializing_if = "Option::is_none" )] pub creator_address_hash: Option, - #[serde(rename = "creation_tx_hash", skip_serializing_if = "Option::is_none")] - pub creation_tx_hash: Option, + #[serde( + rename = "creation_transaction_hash", + skip_serializing_if = "Option::is_none" + )] + pub creation_transaction_hash: Option, #[serde(rename = "token", skip_serializing_if = "Option::is_none")] pub token: Option, #[serde(rename = "coin_balance", skip_serializing_if = "Option::is_none")] @@ -103,15 +106,15 @@ pub struct AddressWithTxCount { skip_serializing_if = "Option::is_none" )] pub has_validated_blocks: Option, - #[serde(rename = "tx_count")] - pub tx_count: String, + #[serde(rename = "transaction_count")] + pub transaction_count: String, } impl AddressWithTxCount { - pub fn new(hash: String, tx_count: String) -> AddressWithTxCount { + pub fn new(hash: String, transaction_count: String) -> AddressWithTxCount { AddressWithTxCount { creator_address_hash: None, - creation_tx_hash: None, + creation_transaction_hash: None, token: None, coin_balance: None, exchange_rate: None, @@ -137,7 +140,7 @@ impl AddressWithTxCount { has_token_transfers: None, has_tokens: None, has_validated_blocks: None, - tx_count, + transaction_count, } } } diff --git a/libs/blockscout-client/crate/src/models/get_address_nft_200_response.rs b/libs/blockscout-client/crate/src/models/get_address_nft_200_response.rs new file mode 100644 index 000000000..ed3b03e57 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_address_nft_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetAddressNft200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetAddressNft200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetAddressNft200Response { + GetAddressNft200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/get_address_nft_collections_200_response.rs b/libs/blockscout-client/crate/src/models/get_address_nft_collections_200_response.rs new file mode 100644 index 000000000..eb3f2e0a0 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_address_nft_collections_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetAddressNftCollections200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetAddressNftCollections200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetAddressNftCollections200Response { + GetAddressNftCollections200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/get_transaction_internal_txs_200_response.rs b/libs/blockscout-client/crate/src/models/get_transaction_internal_txs_200_response.rs new file mode 100644 index 000000000..91998e132 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_transaction_internal_txs_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionInternalTxs200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetTransactionInternalTxs200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetTransactionInternalTxs200Response { + GetTransactionInternalTxs200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/get_transaction_logs_200_response.rs b/libs/blockscout-client/crate/src/models/get_transaction_logs_200_response.rs new file mode 100644 index 000000000..8b4951219 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_transaction_logs_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionLogs200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetTransactionLogs200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetTransactionLogs200Response { + GetTransactionLogs200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/get_transaction_state_changes_200_response.rs b/libs/blockscout-client/crate/src/models/get_transaction_state_changes_200_response.rs new file mode 100644 index 000000000..bcd46c02d --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_transaction_state_changes_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionStateChanges200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetTransactionStateChanges200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetTransactionStateChanges200Response { + GetTransactionStateChanges200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/get_transaction_token_transfers_200_response.rs b/libs/blockscout-client/crate/src/models/get_transaction_token_transfers_200_response.rs new file mode 100644 index 000000000..a95f70c04 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/get_transaction_token_transfers_200_response.rs @@ -0,0 +1,32 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GetTransactionTokenTransfers200Response { + #[serde(rename = "items")] + pub items: Vec, + #[serde(rename = "next_page_params")] + pub next_page_params: serde_json::Value, +} + +impl GetTransactionTokenTransfers200Response { + pub fn new( + items: Vec, + next_page_params: serde_json::Value, + ) -> GetTransactionTokenTransfers200Response { + GetTransactionTokenTransfers200Response { + items, + next_page_params, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/indexing_status.rs b/libs/blockscout-client/crate/src/models/indexing_status.rs index 5507dd04a..59c8b7240 100644 --- a/libs/blockscout-client/crate/src/models/indexing_status.rs +++ b/libs/blockscout-client/crate/src/models/indexing_status.rs @@ -11,7 +11,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -#[derive(derive_new::new, Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct IndexingStatus { #[serde(rename = "finished_indexing")] pub finished_indexing: bool, @@ -22,3 +22,17 @@ pub struct IndexingStatus { #[serde(rename = "indexed_internal_transactions_ratio")] pub indexed_internal_transactions_ratio: Option, // changed } + +impl IndexingStatus { + pub fn new( + finished_indexing: bool, + finished_indexing_blocks: bool, + ) -> IndexingStatus { + IndexingStatus { + finished_indexing, + finished_indexing_blocks, + indexed_blocks_ratio: None, + indexed_internal_transactions_ratio: None, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/log.rs b/libs/blockscout-client/crate/src/models/log.rs index 8bf3283c7..7d8b1242c 100644 --- a/libs/blockscout-client/crate/src/models/log.rs +++ b/libs/blockscout-client/crate/src/models/log.rs @@ -29,8 +29,8 @@ pub struct Log { pub smart_contract: models::AddressParam, #[serde(rename = "topics")] pub topics: Vec, - #[serde(rename = "tx_hash")] - pub tx_hash: String, + #[serde(rename = "transaction_hash")] + pub transaction_hash: String, } impl Log { @@ -41,7 +41,7 @@ impl Log { index: i32, smart_contract: models::AddressParam, topics: Vec, - tx_hash: String, + transaction_hash: String, ) -> Log { Log { address, @@ -52,7 +52,7 @@ impl Log { index, smart_contract, topics, - tx_hash, + transaction_hash, } } } diff --git a/libs/blockscout-client/crate/src/models/mod.rs b/libs/blockscout-client/crate/src/models/mod.rs index 60d9c18c2..59fd95e35 100644 --- a/libs/blockscout-client/crate/src/models/mod.rs +++ b/libs/blockscout-client/crate/src/models/mod.rs @@ -2,6 +2,12 @@ pub mod address; pub use self::address::Address; pub mod address_counters; pub use self::address_counters::AddressCounters; +pub mod address_nft_collection; +pub use self::address_nft_collection::AddressNftCollection; +pub mod address_nft_instance; +pub use self::address_nft_instance::AddressNftInstance; +pub mod address_nft_instance_collection; +pub use self::address_nft_instance_collection::AddressNftInstanceCollection; pub mod address_param; pub use self::address_param::AddressParam; pub mod address_tag; @@ -44,6 +50,10 @@ pub mod get_address_internal_txs_200_response; pub use self::get_address_internal_txs_200_response::GetAddressInternalTxs200Response; pub mod get_address_logs_200_response; pub use self::get_address_logs_200_response::GetAddressLogs200Response; +pub mod get_address_nft_200_response; +pub use self::get_address_nft_200_response::GetAddressNft200Response; +pub mod get_address_nft_collections_200_response; +pub use self::get_address_nft_collections_200_response::GetAddressNftCollections200Response; pub mod get_address_token_transfers_200_response; pub use self::get_address_token_transfers_200_response::GetAddressTokenTransfers200Response; pub mod get_address_tokens_200_response; @@ -56,12 +66,8 @@ pub mod get_block_withdrawals_200_response; pub use self::get_block_withdrawals_200_response::GetBlockWithdrawals200Response; pub mod get_blocks_200_response; pub use self::get_blocks_200_response::GetBlocks200Response; -pub mod get_internal_txs_200_response; -pub use self::get_internal_txs_200_response::GetInternalTxs200Response; pub mod get_json_rpc_url_200_response; pub use self::get_json_rpc_url_200_response::GetJsonRpcUrl200Response; -pub mod get_logs_200_response; -pub use self::get_logs_200_response::GetLogs200Response; pub mod get_market_chart_200_response; pub use self::get_market_chart_200_response::GetMarketChart200Response; pub mod get_nft_instance_transfers_200_response; @@ -76,8 +82,6 @@ pub mod get_smart_contracts_200_response; pub use self::get_smart_contracts_200_response::GetSmartContracts200Response; pub mod get_smart_contracts_counters_200_response; pub use self::get_smart_contracts_counters_200_response::GetSmartContractsCounters200Response; -pub mod get_state_changes_200_response; -pub use self::get_state_changes_200_response::GetStateChanges200Response; pub mod get_token_holders_200_response; pub use self::get_token_holders_200_response::GetTokenHolders200Response; pub mod get_token_instance_holders_200_response; @@ -88,6 +92,14 @@ pub mod get_token_transfers_200_response; pub use self::get_token_transfers_200_response::GetTokenTransfers200Response; pub mod get_tokens_list_200_response; pub use self::get_tokens_list_200_response::GetTokensList200Response; +pub mod get_transaction_internal_txs_200_response; +pub use self::get_transaction_internal_txs_200_response::GetTransactionInternalTxs200Response; +pub mod get_transaction_logs_200_response; +pub use self::get_transaction_logs_200_response::GetTransactionLogs200Response; +pub mod get_transaction_state_changes_200_response; +pub use self::get_transaction_state_changes_200_response::GetTransactionStateChanges200Response; +pub mod get_transaction_token_transfers_200_response; +pub use self::get_transaction_token_transfers_200_response::GetTransactionTokenTransfers200Response; pub mod get_txs_200_response; pub use self::get_txs_200_response::GetTxs200Response; pub mod get_txs_chart_200_response; @@ -136,6 +148,12 @@ pub mod read_method_response; pub use self::read_method_response::ReadMethodResponse; pub mod read_method_response_result; pub use self::read_method_response_result::ReadMethodResponseResult; +pub mod recaptcha_body; +pub use self::recaptcha_body::RecaptchaBody; +pub mod refetch_token_instance_metadata_200_response; +pub use self::refetch_token_instance_metadata_200_response::RefetchTokenInstanceMetadata200Response; +pub mod refetch_token_instance_metadata_403_response; +pub use self::refetch_token_instance_metadata_403_response::RefetchTokenInstanceMetadata403Response; pub mod reward; pub use self::reward::Reward; pub mod rpc_status; @@ -164,14 +182,28 @@ pub mod state_change_change; pub use self::state_change_change::StateChangeChange; pub mod stats_response; pub use self::stats_response::StatsResponse; +pub mod summary; +pub use self::summary::Summary; +pub mod summary_template_variables; +pub use self::summary_template_variables::SummaryTemplateVariables; +pub mod summary_variable; +pub use self::summary_variable::SummaryVariable; +pub mod summary_variable_currency; +pub use self::summary_variable_currency::SummaryVariableCurrency; +pub mod summary_variable_token; +pub use self::summary_variable_token::SummaryVariableToken; pub mod token; pub use self::token::Token; +pub mod token_address_param; +pub use self::token_address_param::TokenAddressParam; pub mod token_balance; pub use self::token_balance::TokenBalance; pub mod token_counters; pub use self::token_counters::TokenCounters; pub mod token_info; pub use self::token_info::TokenInfo; +pub mod token_info_detailed; +pub use self::token_info_detailed::TokenInfoDetailed; pub mod token_transfer; pub use self::token_transfer::TokenTransfer; pub mod token_transfer_total; @@ -200,6 +232,10 @@ pub mod transaction_chart_item; pub use self::transaction_chart_item::TransactionChartItem; pub mod transaction_reward; pub use self::transaction_reward::TransactionReward; +pub mod transaction_summary; +pub use self::transaction_summary::TransactionSummary; +pub mod transaction_summary_obj; +pub use self::transaction_summary_obj::TransactionSummaryObj; pub mod v1_data; pub use self::v1_data::V1Data; pub mod v1_health_check_response; diff --git a/libs/blockscout-client/crate/src/models/recaptcha_body.rs b/libs/blockscout-client/crate/src/models/recaptcha_body.rs new file mode 100644 index 000000000..cd1e20b13 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/recaptcha_body.rs @@ -0,0 +1,24 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RecaptchaBody { + #[serde(rename = "recaptcha_response")] + pub recaptcha_response: String, +} + +impl RecaptchaBody { + pub fn new(recaptcha_response: String) -> RecaptchaBody { + RecaptchaBody { recaptcha_response } + } +} diff --git a/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_200_response.rs b/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_200_response.rs new file mode 100644 index 000000000..4f265d50c --- /dev/null +++ b/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_200_response.rs @@ -0,0 +1,24 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RefetchTokenInstanceMetadata200Response { + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl RefetchTokenInstanceMetadata200Response { + pub fn new() -> RefetchTokenInstanceMetadata200Response { + RefetchTokenInstanceMetadata200Response { message: None } + } +} diff --git a/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_403_response.rs b/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_403_response.rs new file mode 100644 index 000000000..62364da27 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/refetch_token_instance_metadata_403_response.rs @@ -0,0 +1,24 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RefetchTokenInstanceMetadata403Response { + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl RefetchTokenInstanceMetadata403Response { + pub fn new() -> RefetchTokenInstanceMetadata403Response { + RefetchTokenInstanceMetadata403Response { message: None } + } +} diff --git a/libs/blockscout-client/crate/src/models/search_result_transaction.rs b/libs/blockscout-client/crate/src/models/search_result_transaction.rs index f728cb738..4bede5482 100644 --- a/libs/blockscout-client/crate/src/models/search_result_transaction.rs +++ b/libs/blockscout-client/crate/src/models/search_result_transaction.rs @@ -15,8 +15,8 @@ use serde::{Deserialize, Serialize}; pub struct SearchResultTransaction { #[serde(rename = "timestamp")] pub timestamp: String, - #[serde(rename = "tx_hash")] - pub tx_hash: String, + #[serde(rename = "transaction_hash")] + pub transaction_hash: String, #[serde(rename = "type")] pub r#type: String, #[serde(rename = "url")] @@ -26,13 +26,13 @@ pub struct SearchResultTransaction { impl SearchResultTransaction { pub fn new( timestamp: String, - tx_hash: String, + transaction_hash: String, r#type: String, url: String, ) -> SearchResultTransaction { SearchResultTransaction { timestamp, - tx_hash, + transaction_hash, r#type, url, } diff --git a/libs/blockscout-client/crate/src/models/summary.rs b/libs/blockscout-client/crate/src/models/summary.rs new file mode 100644 index 000000000..11844bb5f --- /dev/null +++ b/libs/blockscout-client/crate/src/models/summary.rs @@ -0,0 +1,33 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Summary { + /// Summary template + #[serde(rename = "summary_template")] + pub summary_template: String, + #[serde(rename = "summary_template_variables")] + pub summary_template_variables: models::SummaryTemplateVariables, +} + +impl Summary { + pub fn new( + summary_template: String, + summary_template_variables: models::SummaryTemplateVariables, + ) -> Summary { + Summary { + summary_template, + summary_template_variables, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/summary_template_variables.rs b/libs/blockscout-client/crate/src/models/summary_template_variables.rs new file mode 100644 index 000000000..8761a18a3 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/summary_template_variables.rs @@ -0,0 +1,36 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SummaryTemplateVariables { + #[serde(rename = "action_type")] + pub action_type: models::SummaryVariable, + #[serde(rename = "amount")] + pub amount: models::SummaryVariableCurrency, + #[serde(rename = "token")] + pub token: models::SummaryVariableToken, +} + +impl SummaryTemplateVariables { + pub fn new( + action_type: models::SummaryVariable, + amount: models::SummaryVariableCurrency, + token: models::SummaryVariableToken, + ) -> SummaryTemplateVariables { + SummaryTemplateVariables { + action_type, + amount, + token, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/summary_variable.rs b/libs/blockscout-client/crate/src/models/summary_variable.rs new file mode 100644 index 000000000..d7b6424ea --- /dev/null +++ b/libs/blockscout-client/crate/src/models/summary_variable.rs @@ -0,0 +1,28 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SummaryVariable { + /// Variable type + #[serde(rename = "type")] + pub r#type: String, + /// Action Type + #[serde(rename = "value")] + pub value: String, +} + +impl SummaryVariable { + pub fn new(r#type: String, value: String) -> SummaryVariable { + SummaryVariable { r#type, value } + } +} diff --git a/libs/blockscout-client/crate/src/models/summary_variable_currency.rs b/libs/blockscout-client/crate/src/models/summary_variable_currency.rs new file mode 100644 index 000000000..18714c8ea --- /dev/null +++ b/libs/blockscout-client/crate/src/models/summary_variable_currency.rs @@ -0,0 +1,28 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SummaryVariableCurrency { + /// Currency type + #[serde(rename = "type")] + pub r#type: String, + /// Value + #[serde(rename = "value")] + pub value: String, +} + +impl SummaryVariableCurrency { + pub fn new(r#type: String, value: String) -> SummaryVariableCurrency { + SummaryVariableCurrency { r#type, value } + } +} diff --git a/libs/blockscout-client/crate/src/models/summary_variable_token.rs b/libs/blockscout-client/crate/src/models/summary_variable_token.rs new file mode 100644 index 000000000..f95b2230c --- /dev/null +++ b/libs/blockscout-client/crate/src/models/summary_variable_token.rs @@ -0,0 +1,27 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SummaryVariableToken { + /// Type + #[serde(rename = "type")] + pub r#type: String, + #[serde(rename = "value")] + pub value: models::TokenInfoDetailed, +} + +impl SummaryVariableToken { + pub fn new(r#type: String, value: models::TokenInfoDetailed) -> SummaryVariableToken { + SummaryVariableToken { r#type, value } + } +} diff --git a/libs/blockscout-client/crate/src/models/token_address_param.rs b/libs/blockscout-client/crate/src/models/token_address_param.rs new file mode 100644 index 000000000..250cdb21f --- /dev/null +++ b/libs/blockscout-client/crate/src/models/token_address_param.rs @@ -0,0 +1,60 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenAddressParam { + #[serde(rename = "hash")] + pub hash: String, + #[serde(rename = "implementation_name")] + pub implementation_name: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "is_contract")] + pub is_contract: bool, + #[serde(rename = "is_verified")] + pub is_verified: bool, + #[serde(rename = "private_tags")] + pub private_tags: Vec, + #[serde(rename = "public_tags")] + pub public_tags: Vec, + #[serde(rename = "watchlist_names")] + pub watchlist_names: Vec, + /// Address + #[serde(rename = "address", skip_serializing_if = "Option::is_none")] + pub address: Option, +} + +impl TokenAddressParam { + pub fn new( + hash: String, + implementation_name: String, + name: String, + is_contract: bool, + is_verified: bool, + private_tags: Vec, + public_tags: Vec, + watchlist_names: Vec, + ) -> TokenAddressParam { + TokenAddressParam { + hash, + implementation_name, + name, + is_contract, + is_verified, + private_tags, + public_tags, + watchlist_names, + address: None, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/token_info_detailed.rs b/libs/blockscout-client/crate/src/models/token_info_detailed.rs new file mode 100644 index 000000000..9a19a63c7 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/token_info_detailed.rs @@ -0,0 +1,79 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenInfoDetailed { + /// Token Address + #[serde(rename = "address")] + pub address: String, + /// Token circulating market cap + #[serde(rename = "circulating_market_cap")] + pub circulating_market_cap: String, + /// Token decimals + #[serde(rename = "decimals")] + pub decimals: String, + /// Token exchange rate + #[serde(rename = "exchange_rate")] + pub exchange_rate: String, + /// Token holders amount + #[serde(rename = "holders")] + pub holders: String, + /// Token image URL + #[serde(rename = "icon_url")] + pub icon_url: String, + /// Token name + #[serde(rename = "name")] + pub name: String, + /// Token symbol + #[serde(rename = "symbol")] + pub symbol: String, + /// Token total supply + #[serde(rename = "total_supply")] + pub total_supply: String, + /// Token type + #[serde(rename = "type")] + pub r#type: String, + /// Token trading volume for past 24h + #[serde(rename = "volume_24h")] + pub volume_24h: String, +} + +impl TokenInfoDetailed { + pub fn new( + address: String, + circulating_market_cap: String, + decimals: String, + exchange_rate: String, + holders: String, + icon_url: String, + name: String, + symbol: String, + total_supply: String, + r#type: String, + volume_24h: String, + ) -> TokenInfoDetailed { + TokenInfoDetailed { + address, + circulating_market_cap, + decimals, + exchange_rate, + holders, + icon_url, + name, + symbol, + total_supply, + r#type, + volume_24h, + } + } +} diff --git a/libs/blockscout-client/crate/src/models/token_transfer.rs b/libs/blockscout-client/crate/src/models/token_transfer.rs index d5ecec0be..9d7fd8bec 100644 --- a/libs/blockscout-client/crate/src/models/token_transfer.rs +++ b/libs/blockscout-client/crate/src/models/token_transfer.rs @@ -29,8 +29,8 @@ pub struct TokenTransfer { pub token: models::TokenInfo, #[serde(rename = "total")] pub total: models::TokenTransferTotal, - #[serde(rename = "tx_hash")] - pub tx_hash: String, + #[serde(rename = "transaction_hash")] + pub transaction_hash: String, #[serde(rename = "type")] pub r#type: String, } @@ -45,7 +45,7 @@ impl TokenTransfer { to: models::AddressParam, token: models::TokenInfo, total: models::TokenTransferTotal, - tx_hash: String, + transaction_hash: String, r#type: String, ) -> TokenTransfer { TokenTransfer { @@ -57,7 +57,7 @@ impl TokenTransfer { to, token, total, - tx_hash, + transaction_hash, r#type, } } diff --git a/libs/blockscout-client/crate/src/models/transaction_chart_item.rs b/libs/blockscout-client/crate/src/models/transaction_chart_item.rs index a01757b28..309285dbd 100644 --- a/libs/blockscout-client/crate/src/models/transaction_chart_item.rs +++ b/libs/blockscout-client/crate/src/models/transaction_chart_item.rs @@ -15,12 +15,15 @@ use serde::{Deserialize, Serialize}; pub struct TransactionChartItem { #[serde(rename = "date")] pub date: String, - #[serde(rename = "tx_count")] - pub tx_count: i32, + #[serde(rename = "transaction_count")] + pub transaction_count: i32, } impl TransactionChartItem { - pub fn new(date: String, tx_count: i32) -> TransactionChartItem { - TransactionChartItem { date, tx_count } + pub fn new(date: String, transaction_count: i32) -> TransactionChartItem { + TransactionChartItem { + date, + transaction_count, + } } } diff --git a/libs/blockscout-client/crate/src/models/transaction_summary.rs b/libs/blockscout-client/crate/src/models/transaction_summary.rs new file mode 100644 index 000000000..3d5819a49 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/transaction_summary.rs @@ -0,0 +1,26 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransactionSummary { + #[serde(rename = "success")] + pub success: bool, + #[serde(rename = "data")] + pub data: models::TransactionSummaryObj, +} + +impl TransactionSummary { + pub fn new(success: bool, data: models::TransactionSummaryObj) -> TransactionSummary { + TransactionSummary { success, data } + } +} diff --git a/libs/blockscout-client/crate/src/models/transaction_summary_obj.rs b/libs/blockscout-client/crate/src/models/transaction_summary_obj.rs new file mode 100644 index 000000000..ec6fc4570 --- /dev/null +++ b/libs/blockscout-client/crate/src/models/transaction_summary_obj.rs @@ -0,0 +1,24 @@ +/* + * BlockScout API + * + * API for BlockScout web app + * + * The version of the OpenAPI document: 1.0.0 + * Contact: you@your-company.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TransactionSummaryObj { + #[serde(rename = "summaries", skip_serializing_if = "Option::is_none")] + pub summaries: Option>, +} + +impl TransactionSummaryObj { + pub fn new() -> TransactionSummaryObj { + TransactionSummaryObj { summaries: None } + } +} diff --git a/libs/blockscout-client/crate/tests/it_works.rs b/libs/blockscout-client/crate/tests/it_works.rs index 02b33c90f..11cde285e 100644 --- a/libs/blockscout-client/crate/tests/it_works.rs +++ b/libs/blockscout-client/crate/tests/it_works.rs @@ -42,7 +42,7 @@ async fn transactions(blockscout: Stubr) { #[tokio::test] async fn internal_transactions(blockscout: Stubr) { let config = get_config_from_stubr(&blockscout); - let internal_transactions = transactions_api::get_internal_txs(&config, DEFAULT_TX_HASH) + let internal_transactions = transactions_api::get_transaction_internal_txs(&config, DEFAULT_TX_HASH) .await .expect("Failed to get transactions"); assert!(!internal_transactions.items.is_empty()); diff --git a/libs/blockscout-client/swaggers/blockscout-api-v2.yaml b/libs/blockscout-client/swaggers/blockscout-api-v2.yaml index b2a6fb31b..d7ee3a5b9 100644 --- a/libs/blockscout-client/swaggers/blockscout-api-v2.yaml +++ b/libs/blockscout-client/swaggers/blockscout-api-v2.yaml @@ -56,7 +56,7 @@ paths: items_count: 50 name: RealToken S 13245 Monica St Detroit MI q: '1' - tx_hash: null + transaction_hash: null '400': description: bad input parameter tags: @@ -101,7 +101,7 @@ paths: schema: type: string example: approve,transfer,multicall,mint,commit - summary: get txs + summary: get transactions operationId: get_txs responses: '200': @@ -162,13 +162,41 @@ paths: description: bad input parameter tags: - blocks + /api/v2/token-transfers: + get: + summary: get token transfers + operationId: get_token_transfers + responses: + '200': + description: token transfers + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/TokenTransfer' + next_page_params: + type: object + example: + block_number: 27170298 + index: 0 + '400': + description: bad input parameter + tags: + - token-transfers /api/v2/main-page/transactions: get: - summary: get main page txs + summary: get main page transactions operationId: get_main_page_txs responses: '200': - description: txs + description: transactions content: application/json: schema: @@ -220,11 +248,11 @@ paths: - stats /api/v2/stats/charts/transactions: get: - summary: get txs chart + summary: get transactions chart operationId: get_txs_chart responses: '200': - description: tx chart + description: transaction chart content: application/json: schema: @@ -264,13 +292,13 @@ paths: - stats /api/v2/transactions/{transaction_hash}: get: - summary: get tx info + summary: get transaction info operationId: get_tx parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: tx info + description: transaction info content: application/json: schema: @@ -281,8 +309,8 @@ paths: - transactions /api/v2/transactions/{transaction_hash}/token-transfers: get: - summary: get token transfers - operationId: get_token_transfers + summary: get transaction token transfers + operationId: get_transaction_token_transfers parameters: - $ref: '#/components/parameters/transactionHash' - in: query @@ -327,13 +355,13 @@ paths: - transactions /api/v2/transactions/{transaction_hash}/internal-transactions: get: - summary: get internal txs - operationId: get_internal_txs + summary: get transaction internal transactions + operationId: get_transaction_internal_txs parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: internal txs + description: internal transactions content: application/json: schema: @@ -359,13 +387,13 @@ paths: - transactions /api/v2/transactions/{transaction_hash}/logs: get: - summary: get logs - operationId: get_logs + summary: get transaction logs + operationId: get_transaction_logs parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: internal txs + description: internal transactions content: application/json: schema: @@ -390,8 +418,8 @@ paths: - transactions /api/v2/transactions/{transaction_hash}/raw-trace: get: - summary: get raw trace - operationId: get_raw_trace + summary: get transaction raw trace + operationId: get_transaction_raw_trace parameters: - $ref: '#/components/parameters/transactionHash' responses: @@ -409,8 +437,8 @@ paths: - transactions /api/v2/transactions/{transaction_hash}/state-changes: get: - summary: get state changes - operationId: get_state_changes + summary: get transaction state changes + operationId: get_transaction_state_changes parameters: - $ref: '#/components/parameters/transactionHash' responses: @@ -437,6 +465,23 @@ paths: description: bad input parameter tags: - transactions + /api/v2/transactions/{transaction_hash}/summary: + get: + summary: get human-readable transaction summary + operationId: get_transaction_summary + parameters: + - $ref: '#/components/parameters/transactionHash' + responses: + '200': + description: human-readable transaction summary + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionSummary' + '400': + description: bad input parameter + tags: + - transactions /api/v2/blocks/{block_number_or_hash}: get: summary: get block info @@ -456,7 +501,7 @@ paths: - blocks /api/v2/blocks/{block_number_or_hash}/transactions: get: - summary: get block txs + summary: get block transactions operationId: get_block_txs parameters: - $ref: '#/components/parameters/blockNumberOrHash' @@ -590,7 +635,7 @@ paths: - addresses /api/v2/addresses/{address_hash}/transactions: get: - summary: get address txs + summary: get address transactions operationId: get_address_txs parameters: - $ref: '#/components/parameters/addressHash' @@ -671,7 +716,7 @@ paths: - addresses /api/v2/addresses/{address_hash}/internal-transactions: get: - summary: get address internal txs + summary: get address internal transactions operationId: get_address_internal_txs parameters: - $ref: '#/components/parameters/addressHash' @@ -904,6 +949,77 @@ paths: description: bad input parameter tags: - addresses + /api/v2/addresses/{address_hash}/nft: + get: + summary: get list of NFT owned by address + operationId: get_address_nft + parameters: + - $ref: '#/components/parameters/addressHash' + - in: query + name: type + schema: + type: string + example: ERC-721,ERC-404,ERC-1155 + responses: + '200': + description: address + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/AddressNFTInstance' + next_page_params: + type: object + example: + token_contract_address_hash: '0xb81afe27c103bcd42f4026cf719af6d802928765' + token_id: '1011' + token_type: ERC-721 + '400': + description: bad input parameter + tags: + - addresses + /api/v2/addresses/{address_hash}/nft/collections: + get: + summary: get list of NFT owned by address, grouped by collection + operationId: get_address_nft_collections + parameters: + - $ref: '#/components/parameters/addressHash' + - in: query + name: type + schema: + type: string + example: ERC-721,ERC-404,ERC-1155 + responses: + '200': + description: address + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/AddressNFTCollection' + next_page_params: + type: object + example: + token_contract_address_hash: '0xb81afe27c103bcd42f4026cf719af6d802928765' + token_type: ERC-721 + '400': + description: bad input parameter + tags: + - addresses /api/v2/tokens: get: summary: get tokens list @@ -1176,6 +1292,48 @@ paths: description: bad input parameter tags: - tokens + /api/v2/tokens/{address_hash}/instances/{id}/refetch-metadata: + patch: + summary: re-fetch token instance metadata + operationId: refetch_token_instance_metadata + parameters: + - $ref: '#/components/parameters/addressHash' + - $ref: '#/components/parameters/id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RecaptchaBody' + responses: + '200': + description: ok + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + message: + type: string + example: OK + '403': + description: Invalid reCAPTCHA response + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + message: + type: string + example: Invalid reCAPTCHA response + tags: + - tokens /api/v2/smart-contracts: get: summary: get verified smart contracts @@ -1267,7 +1425,7 @@ paths: - smart-contracts /api/v2/smart-contracts/{address_hash}/methods-read: get: - summary: get read methods + summary: get verified smart-contract read methods operationId: get_read_methods parameters: - $ref: '#/components/parameters/addressHash' @@ -1298,7 +1456,7 @@ paths: - smart-contracts /api/v2/smart-contracts/{address_hash}/methods-read-proxy: get: - summary: get read methods proxy + summary: get verified smart-contract read methods proxy operationId: get_read_methods_proxy parameters: - $ref: '#/components/parameters/addressHash' @@ -1327,7 +1485,7 @@ paths: - smart-contracts /api/v2/smart-contracts/{address_hash}/methods-write: get: - summary: get write methods + summary: get verified smart-contract write methods operationId: get_write_methods parameters: - $ref: '#/components/parameters/addressHash' @@ -1352,7 +1510,7 @@ paths: - smart-contracts /api/v2/smart-contracts/{address_hash}/methods-write-proxy: get: - summary: get write methods proxy + summary: get verified smart-contract write methods proxy operationId: get_write_methods_proxy parameters: - $ref: '#/components/parameters/addressHash' @@ -1377,7 +1535,7 @@ paths: - smart-contracts /api/v2/smart-contracts/{address_hash}/query-read-method: post: - summary: query read method + summary: query verified smart-contract read method operationId: query_read_method parameters: - $ref: '#/components/parameters/addressHash' @@ -1510,8 +1668,8 @@ components: - state_root - timestamp - total_difficulty - - tx_count - - tx_fees + - transaction_count + - transaction_fees - type - uncles_hashes - withdrawals_count @@ -1576,10 +1734,10 @@ components: total_difficulty: type: string example: '58750003716598352816469' - tx_count: + transaction_count: type: integer example: 120 - tx_fees: + transaction_fees: type: string example: '306681898876578498' type: @@ -1604,7 +1762,7 @@ components: - to - token - total - - tx_hash + - transaction_hash - type properties: block_hash: @@ -1631,7 +1789,7 @@ components: - $ref: '#/components/schemas/TotalERC721' - $ref: '#/components/schemas/TotalERC1155' - $ref: '#/components/schemas/TotalERC1155Batch' - tx_hash: + transaction_hash: type: string example: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: @@ -1773,7 +1931,7 @@ components: - index - smart_contract - topics - - tx_hash + - transaction_hash properties: address: $ref: '#/components/schemas/AddressParam' @@ -1810,13 +1968,13 @@ components: items: type: string example: '0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c' - tx_hash: + transaction_hash: type: string example: '0x08ea4d75ad0abe327a7fd368733eaeac43077989e635d800530d7906ebf3bd54' InternalTransaction: type: object required: - - block + - block_number - created_contract - error - from @@ -1829,7 +1987,7 @@ components: - type - value properties: - block: + block_number: type: integer example: 8844586 created_contract: @@ -1880,14 +2038,14 @@ components: - timestamp - fee - gas_limit - - block + - block_number - status - method - confirmations - type - exchange_rate - to - - tx_burnt_fee + - transaction_burnt_fee - max_fee_per_gas - result - hash @@ -1896,12 +2054,12 @@ components: - base_fee_per_gas - from - token_transfers - - tx_types + - transaction_types - gas_used - created_contract - position - nonce - - has_error_in_internal_txs + - has_error_in_internal_transactions - actions - decoded_input - token_transfers_overflow @@ -1910,7 +2068,7 @@ components: - max_priority_fee_per_gas - revert_reason - confirmation_duration - - tx_tag + - transaction_tag properties: timestamp: type: string @@ -1919,7 +2077,7 @@ components: $ref: '#/components/schemas/Fee' gas_limit: type: integer - block: + block_number: type: integer format: int32 example: 23484035 @@ -1940,7 +2098,7 @@ components: example: '1866.51' to: $ref: '#/components/schemas/AddressParam' - tx_burnt_fee: + transaction_burnt_fee: type: string example: '1099596081903840' max_fee_per_gas: @@ -1967,7 +2125,7 @@ components: type: array items: $ref: '#/components/schemas/TokenTransfer' - tx_types: + transaction_types: type: array items: type: string @@ -1988,7 +2146,7 @@ components: nonce: type: integer example: 115 - has_error_in_internal_txs: + has_error_in_internal_transactions: type: boolean example: false actions: @@ -2018,9 +2176,9 @@ components: example: - 0 - 17479 - tx_tag: + transaction_tag: type: string - example: private_tx_tag + example: private_transaction_tag ExtendedRevertReasonAsMap: type: object required: @@ -2090,6 +2248,195 @@ components: type: array items: $ref: '#/components/schemas/DecodedInputParameter' + TokenAddressParam: + type: object + required: + - hash + - implementation_name + - is_contract + - is_verified + - name + - private_tags + - public_tags + - watchlist_names + properties: + hash: + type: string + example: '0xEb533ee5687044E622C69c58B1B12329F56eD9ad' + implementation_name: + type: string + example: implementationName + name: + type: string + example: contractName + is_contract: + type: boolean + is_verified: + type: boolean + private_tags: + type: array + items: + $ref: '#/components/schemas/AddressTag' + public_tags: + type: array + items: + $ref: '#/components/schemas/AddressTag' + watchlist_names: + type: array + items: + $ref: '#/components/schemas/WatchlistName' + address: + type: string + example: 0x123abc... + description: Address + TransactionSummary: + type: object + required: + - success + - data + properties: + success: + type: boolean + example: true + data: + $ref: '#/components/schemas/TransactionSummaryObj' + TransactionSummaryObj: + type: object + properties: + summaries: + type: array + items: + $ref: '#/components/schemas/Summary' + Summary: + type: object + required: + - summary_template + - summary_template_variables + properties: + summary_template: + type: string + example: '{action_type} of {amount} {token}' + description: Summary template + summary_template_variables: + $ref: '#/components/schemas/SummaryTemplateVariables' + description: Variables for summary + SummaryTemplateVariables: + type: object + required: + - action_type + - amount + - token + properties: + action_type: + $ref: '#/components/schemas/SummaryVariable' + description: Action type + amount: + $ref: '#/components/schemas/SummaryVariableCurrency' + description: Amount + token: + $ref: '#/components/schemas/SummaryVariableToken' + description: Token info + SummaryVariable: + type: object + required: + - type + - value + properties: + type: + type: string + example: string + description: Variable type + value: + type: string + example: Registered withdrawal of + description: Action Type + SummaryVariableCurrency: + type: object + required: + - type + - value + properties: + type: + type: string + example: currency + description: Currency type + value: + type: string + example: '0.195999999980484004' + description: Value + SummaryVariableToken: + type: object + required: + - type + - value + properties: + type: + type: string + example: token + description: Type + value: + $ref: '#/components/schemas/TokenInfoDetailed' + description: Token info + TokenInfoDetailed: + type: object + required: + - address + - circulating_market_cap + - decimals + - exchange_rate + - holders + - icon_url + - name + - symbol + - total_supply + - type + - volume_24h + properties: + address: + type: string + example: '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc' + description: Token Address + circulating_market_cap: + type: string + example: '0.0' + description: Token circulating market cap + decimals: + type: string + example: '18' + description: Token decimals + exchange_rate: + type: string + example: '2890.96' + description: Token exchange rate + holders: + type: string + example: '2999' + description: Token holders amount + icon_url: + type: string + example: >- + https://assets.coingecko.com/coins/images/39410/small/Steakhouse_logo-05.jpg?1722053893 + description: 'Token image URL ' + name: + type: string + example: Steakhouse Resteaking Vault + description: Token name + symbol: + type: string + example: steakLRT + description: Token symbol + total_supply: + type: string + example: '9710057205959239302188' + description: Token total supply + type: + type: string + example: ERC-20 + description: Token type + volume_24h: + type: string + example: '24298.765344836862' + description: Token trading volume for past 24h DecodedInputParameter: type: object required: @@ -2215,7 +2562,7 @@ components: creator_address_hash: type: string example: '0xEb533ee5687044E622C69c58B1B12329F56eD9ad' - creation_tx_hash: + creation_transaction_hash: type: string example: '0x1f610ff9c1efad6b5a8bb6afcc0786cd7343f03f9a61e2544fcff908cedee924' token: @@ -2286,9 +2633,9 @@ components: - $ref: '#/components/schemas/Address' - type: object required: - - tx_count + - transaction_count properties: - tx_count: + transaction_count: type: string example: '1234' Reward: @@ -2541,6 +2888,146 @@ components: $ref: '#/components/schemas/AddressParam' token: $ref: '#/components/schemas/TokenInfo' + AddressNFTInstance: + required: + - token_type + - value + - is_unique + - id + - token + - owner + properties: + is_unique: + type: boolean + id: + type: string + example: '431' + holder_address_hash: + type: string + example: '0x394c399dbA25B99Ab7708EdB505d755B3aa29997' + image_url: + type: string + example: example.com/picture.png + animation_url: + type: string + example: example.com/video.mp4 + external_app_url: + type: string + example: d-app.com + metadata: + type: object + example: + year: 2023 + tags: + - poap + - event + name: 'Social Listening Committee #2 Attendees' + image_url: https://assets.poap.xyz/chanel-poap-4c-2023-logo-1675083420470.png + home_url: https://app.poap.xyz/token/6292128 + external_url: https://api.poap.tech/metadata/99010/6292128 + description: >- + This is the POAP for attendees of the second Social Listening + Committee. + attributes: + - value: 01-Feb-2023 + trait_type: startDate + - value: 01-Feb-2023 + trait_type: endDate + - value: 'false' + trait_type: virtualEvent + - value: Paris + trait_type: city + - value: France + trait_type: country + - value: https://www.chanel.com + trait_type: eventURL + owner: + $ref: '#/components/schemas/AddressParam' + token: + $ref: '#/components/schemas/TokenInfo' + token_type: + type: string + example: ERC-721 + value: + type: string + example: '1' + AddressNFTInstanceCollection: + required: + - token_type + - value + - is_unique + - id + - owner + properties: + is_unique: + type: boolean + id: + type: string + example: '431' + holder_address_hash: + type: string + example: '0x394c399dbA25B99Ab7708EdB505d755B3aa29997' + image_url: + type: string + example: example.com/picture.png + animation_url: + type: string + example: example.com/video.mp4 + external_app_url: + type: string + example: d-app.com + metadata: + type: object + example: + year: 2023 + tags: + - poap + - event + name: 'Social Listening Committee #2 Attendees' + image_url: https://assets.poap.xyz/chanel-poap-4c-2023-logo-1675083420470.png + home_url: https://app.poap.xyz/token/6292128 + external_url: https://api.poap.tech/metadata/99010/6292128 + description: >- + This is the POAP for attendees of the second Social Listening + Committee. + attributes: + - value: 01-Feb-2023 + trait_type: startDate + - value: 01-Feb-2023 + trait_type: endDate + - value: 'false' + trait_type: virtualEvent + - value: Paris + trait_type: city + - value: France + trait_type: country + - value: https://www.chanel.com + trait_type: eventURL + owner: + $ref: '#/components/schemas/AddressParam' + token: + type: object + example: null + token_type: + type: string + example: ERC-721 + value: + type: string + example: '1' + AddressNFTCollection: + required: + - token + - token_instances + properties: + token: + $ref: '#/components/schemas/TokenInfo' + amount: + type: string + example: '1' + token_instances: + type: array + items: + $ref: '#/components/schemas/AddressNFTInstanceCollection' SmartContract: properties: verified_twin_address_hash: @@ -2828,14 +3315,14 @@ components: SearchResultTransaction: required: - timestamp - - tx_hash + - transaction_hash - type - url properties: timestamp: type: string example: '2022-10-31T07:18:05.000000Z' - tx_hash: + transaction_hash: type: string example: '0xe38c6772f33edfbd218f59853befe18391cb786f911fb6c0b00ed6dd72ef6e69' type: @@ -2934,12 +3421,12 @@ components: TransactionChartItem: required: - date - - tx_count + - transaction_count properties: date: type: string example: '2022-10-31' - tx_count: + transaction_count: type: integer example: 622 TokenCounters: @@ -2953,6 +3440,13 @@ components: transfers_count: type: string example: '1000' + RecaptchaBody: + required: + - recaptcha_response + properties: + recaptcha_response: + type: string + example: '123' ReadMethodQueryBody: required: - args @@ -3070,7 +3564,7 @@ components: - has_constructor_args - language - optimization_enabled - - tx_count + - transaction_count - verified_at properties: address: @@ -3088,7 +3582,7 @@ components: type: boolean optimization_enabled: type: boolean - tx_count: + transaction_count: type: integer verified_at: type: string @@ -3269,7 +3763,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: batch_block_hash: '0x0000000000000000000000000000000000000000000000000000000000000000' @@ -3315,7 +3809,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: block_number: 4 @@ -3359,7 +3853,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: batch_block_hash: '0x0000000000000000000000000000000000000000000000000000000000000014' diff --git a/libs/blockscout-client/swaggers/blockscout-api.yaml b/libs/blockscout-client/swaggers/blockscout-api.yaml index 0144ffeda..8747ce224 100644 --- a/libs/blockscout-client/swaggers/blockscout-api.yaml +++ b/libs/blockscout-client/swaggers/blockscout-api.yaml @@ -58,7 +58,7 @@ paths: items_count: 50 name: RealToken S 13245 Monica St Detroit MI q: '1' - tx_hash: null + transaction_hash: null '400': description: bad input parameter tags: @@ -103,7 +103,7 @@ paths: schema: type: string example: 'approve,transfer,multicall,mint,commit' - summary: get txs + summary: get transactions operationId: get_txs responses: '200': @@ -164,13 +164,41 @@ paths: description: bad input parameter tags: - blocks + /api/v2/token-transfers: + get: + summary: get token transfers + operationId: get_token_transfers + responses: + '200': + description: token transfers + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/TokenTransfer' + next_page_params: + type: object + example: + block_number: 27170298 + index: 0 + '400': + description: bad input parameter + tags: + - token-transfers /api/v2/main-page/transactions: get: - summary: get main page txs + summary: get main page transactions operationId: get_main_page_txs responses: '200': - description: txs + description: transactions content: application/json: schema: @@ -222,11 +250,11 @@ paths: - stats /api/v2/stats/charts/transactions: get: - summary: get txs chart + summary: get transactions chart operationId: get_txs_chart responses: '200': - description: tx chart + description: transaction chart content: application/json: schema: @@ -266,13 +294,13 @@ paths: - stats '/api/v2/transactions/{transaction_hash}': get: - summary: get tx info + summary: get transaction info operationId: get_tx parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: tx info + description: transaction info content: application/json: schema: @@ -283,8 +311,8 @@ paths: - transactions '/api/v2/transactions/{transaction_hash}/token-transfers': get: - summary: get token transfers - operationId: get_token_transfers + summary: get transaction token transfers + operationId: get_transaction_token_transfers parameters: - $ref: '#/components/parameters/transactionHash' - in: query @@ -329,13 +357,13 @@ paths: - transactions '/api/v2/transactions/{transaction_hash}/internal-transactions': get: - summary: get internal txs - operationId: get_internal_txs + summary: get transaction internal transactions + operationId: get_transaction_internal_txs parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: internal txs + description: internal transactions content: application/json: schema: @@ -361,13 +389,13 @@ paths: - transactions '/api/v2/transactions/{transaction_hash}/logs': get: - summary: get logs - operationId: get_logs + summary: get transaction logs + operationId: get_transaction_logs parameters: - $ref: '#/components/parameters/transactionHash' responses: '200': - description: internal txs + description: internal transactions content: application/json: schema: @@ -392,8 +420,8 @@ paths: - transactions '/api/v2/transactions/{transaction_hash}/raw-trace': get: - summary: get raw trace - operationId: get_raw_trace + summary: get transaction raw trace + operationId: get_transaction_raw_trace parameters: - $ref: '#/components/parameters/transactionHash' responses: @@ -411,8 +439,8 @@ paths: - transactions '/api/v2/transactions/{transaction_hash}/state-changes': get: - summary: get state changes - operationId: get_state_changes + summary: get transaction state changes + operationId: get_transaction_state_changes parameters: - $ref: '#/components/parameters/transactionHash' responses: @@ -439,6 +467,23 @@ paths: description: bad input parameter tags: - transactions + '/api/v2/transactions/{transaction_hash}/summary': + get: + summary: get human-readable transaction summary + operationId: get_transaction_summary + parameters: + - $ref: '#/components/parameters/transactionHash' + responses: + '200': + description: human-readable transaction summary + content: + application/json: + schema: + $ref: '#/components/schemas/TransactionSummary' + '400': + description: bad input parameter + tags: + - transactions '/api/v2/blocks/{block_number_or_hash}': get: summary: get block info @@ -458,7 +503,7 @@ paths: - blocks '/api/v2/blocks/{block_number_or_hash}/transactions': get: - summary: get block txs + summary: get block transactions operationId: get_block_txs parameters: - $ref: '#/components/parameters/blockNumberOrHash' @@ -592,7 +637,7 @@ paths: - addresses '/api/v2/addresses/{address_hash}/transactions': get: - summary: get address txs + summary: get address transactions operationId: get_address_txs parameters: - $ref: '#/components/parameters/addressHash' @@ -673,7 +718,7 @@ paths: - addresses '/api/v2/addresses/{address_hash}/internal-transactions': get: - summary: get address internal txs + summary: get address internal transactions operationId: get_address_internal_txs parameters: - $ref: '#/components/parameters/addressHash' @@ -906,6 +951,77 @@ paths: description: bad input parameter tags: - addresses + '/api/v2/addresses/{address_hash}/nft': + get: + summary: get list of NFT owned by address + operationId: get_address_nft + parameters: + - $ref: '#/components/parameters/addressHash' + - in: query + name: type + schema: + type: string + example: 'ERC-721,ERC-404,ERC-1155' + responses: + '200': + description: address + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/AddressNFTInstance' + next_page_params: + type: object + example: + token_contract_address_hash: '0xb81afe27c103bcd42f4026cf719af6d802928765' + token_id: '1011' + token_type: ERC-721 + '400': + description: bad input parameter + tags: + - addresses + '/api/v2/addresses/{address_hash}/nft/collections': + get: + summary: 'get list of NFT owned by address, grouped by collection' + operationId: get_address_nft_collections + parameters: + - $ref: '#/components/parameters/addressHash' + - in: query + name: type + schema: + type: string + example: 'ERC-721,ERC-404,ERC-1155' + responses: + '200': + description: address + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + items: + type: array + items: + $ref: '#/components/schemas/AddressNFTCollection' + next_page_params: + type: object + example: + token_contract_address_hash: '0xb81afe27c103bcd42f4026cf719af6d802928765' + token_type: ERC-721 + '400': + description: bad input parameter + tags: + - addresses /api/v2/tokens: get: summary: get tokens list @@ -1178,6 +1294,48 @@ paths: description: bad input parameter tags: - tokens + '/api/v2/tokens/{address_hash}/instances/{id}/refetch-metadata': + patch: + summary: re-fetch token instance metadata + operationId: refetch_token_instance_metadata + parameters: + - $ref: '#/components/parameters/addressHash' + - $ref: '#/components/parameters/id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RecaptchaBody' + responses: + '200': + description: ok + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + message: + type: string + example: OK + '403': + description: Invalid reCAPTCHA response + content: + application/json: + schema: + type: object + required: + - items + - next_page_params + properties: + message: + type: string + example: Invalid reCAPTCHA response + tags: + - tokens /api/v2/smart-contracts: get: summary: get verified smart contracts @@ -1269,7 +1427,7 @@ paths: - smart-contracts '/api/v2/smart-contracts/{address_hash}/methods-read': get: - summary: get read methods + summary: get verified smart-contract read methods operationId: get_read_methods parameters: - $ref: '#/components/parameters/addressHash' @@ -1300,7 +1458,7 @@ paths: - smart-contracts '/api/v2/smart-contracts/{address_hash}/methods-read-proxy': get: - summary: get read methods proxy + summary: get verified smart-contract read methods proxy operationId: get_read_methods_proxy parameters: - $ref: '#/components/parameters/addressHash' @@ -1329,7 +1487,7 @@ paths: - smart-contracts '/api/v2/smart-contracts/{address_hash}/methods-write': get: - summary: get write methods + summary: get verified smart-contract write methods operationId: get_write_methods parameters: - $ref: '#/components/parameters/addressHash' @@ -1354,7 +1512,7 @@ paths: - smart-contracts '/api/v2/smart-contracts/{address_hash}/methods-write-proxy': get: - summary: get write methods proxy + summary: get verified smart-contract write methods proxy operationId: get_write_methods_proxy parameters: - $ref: '#/components/parameters/addressHash' @@ -1379,7 +1537,7 @@ paths: - smart-contracts '/api/v2/smart-contracts/{address_hash}/query-read-method': post: - summary: query read method + summary: query verified smart-contract read method operationId: query_read_method parameters: - $ref: '#/components/parameters/addressHash' @@ -1491,8 +1649,8 @@ components: - state_root - timestamp - total_difficulty - - tx_count - - tx_fees + - transaction_count + - transaction_fees - type - uncles_hashes - withdrawals_count @@ -1557,10 +1715,10 @@ components: total_difficulty: type: string example: '58750003716598352816469' - tx_count: + transaction_count: type: integer example: 120 - tx_fees: + transaction_fees: type: string example: '306681898876578498' type: @@ -1585,7 +1743,7 @@ components: - to - token - total - - tx_hash + - transaction_hash - type properties: block_hash: @@ -1612,7 +1770,7 @@ components: - $ref: '#/components/schemas/TotalERC721' - $ref: '#/components/schemas/TotalERC1155' - $ref: '#/components/schemas/TotalERC1155Batch' - tx_hash: + transaction_hash: type: string example: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: @@ -1754,7 +1912,7 @@ components: - index - smart_contract - topics - - tx_hash + - transaction_hash properties: address: $ref: '#/components/schemas/AddressParam' @@ -1791,13 +1949,13 @@ components: items: type: string example: '0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c' - tx_hash: + transaction_hash: type: string example: '0x08ea4d75ad0abe327a7fd368733eaeac43077989e635d800530d7906ebf3bd54' InternalTransaction: type: object required: - - block + - block_number - created_contract - error - from @@ -1810,7 +1968,7 @@ components: - type - value properties: - block: + block_number: type: integer example: 8844586 created_contract: @@ -1861,14 +2019,14 @@ components: - timestamp - fee - gas_limit - - block + - block_number - status - method - confirmations - type - exchange_rate - to - - tx_burnt_fee + - transaction_burnt_fee - max_fee_per_gas - result - hash @@ -1877,12 +2035,12 @@ components: - base_fee_per_gas - from - token_transfers - - tx_types + - transaction_types - gas_used - created_contract - position - nonce - - has_error_in_internal_txs + - has_error_in_internal_transactions - actions - decoded_input - token_transfers_overflow @@ -1891,7 +2049,7 @@ components: - max_priority_fee_per_gas - revert_reason - confirmation_duration - - tx_tag + - transaction_tag properties: timestamp: type: string @@ -1900,7 +2058,7 @@ components: $ref: '#/components/schemas/Fee' gas_limit: type: integer - block: + block_number: type: integer format: int32 example: 23484035 @@ -1921,7 +2079,7 @@ components: example: '1866.51' to: $ref: '#/components/schemas/AddressParam' - tx_burnt_fee: + transaction_burnt_fee: type: string example: '1099596081903840' max_fee_per_gas: @@ -1948,7 +2106,7 @@ components: type: array items: $ref: '#/components/schemas/TokenTransfer' - tx_types: + transaction_types: type: array items: type: string @@ -1969,7 +2127,7 @@ components: nonce: type: integer example: 115 - has_error_in_internal_txs: + has_error_in_internal_transactions: type: boolean example: false actions: @@ -1999,9 +2157,9 @@ components: example: - 0 - 17479 - tx_tag: + transaction_tag: type: string - example: private_tx_tag + example: private_transaction_tag ExtendedRevertReasonAsMap: type: object required: @@ -2071,6 +2229,195 @@ components: type: array items: $ref: '#/components/schemas/DecodedInputParameter' + TokenAddressParam: + type: object + required: + - hash + - implementation_name + - is_contract + - is_verified + - name + - private_tags + - public_tags + - watchlist_names + properties: + hash: + type: string + example: '0xEb533ee5687044E622C69c58B1B12329F56eD9ad' + implementation_name: + type: string + example: implementationName + name: + type: string + example: contractName + is_contract: + type: boolean + is_verified: + type: boolean + private_tags: + type: array + items: + $ref: '#/components/schemas/AddressTag' + public_tags: + type: array + items: + $ref: '#/components/schemas/AddressTag' + watchlist_names: + type: array + items: + $ref: '#/components/schemas/WatchlistName' + address: + type: string + example: 0x123abc... + description: Address + TransactionSummary: + type: object + required: + - success + - data + properties: + success: + type: boolean + example: true + data: + $ref: '#/components/schemas/TransactionSummaryObj' + TransactionSummaryObj: + type: object + properties: + summaries: + type: array + items: + $ref: '#/components/schemas/Summary' + Summary: + type: object + required: + - summary_template + - summary_template_variables + properties: + summary_template: + type: string + example: '{action_type} of {amount} {token}' + description: Summary template + summary_template_variables: + $ref: '#/components/schemas/SummaryTemplateVariables' + description: Variables for summary + SummaryTemplateVariables: + type: object + required: + - action_type + - amount + - token + properties: + action_type: + $ref: '#/components/schemas/SummaryVariable' + description: Action type + amount: + $ref: '#/components/schemas/SummaryVariableCurrency' + description: Amount + token: + $ref: '#/components/schemas/SummaryVariableToken' + description: Token info + SummaryVariable: + type: object + required: + - type + - value + properties: + type: + type: string + example: string + description: Variable type + value: + type: string + example: Registered withdrawal of + description: Action Type + SummaryVariableCurrency: + type: object + required: + - type + - value + properties: + type: + type: string + example: currency + description: Currency type + value: + type: string + example: '0.195999999980484004' + description: Value + SummaryVariableToken: + type: object + required: + - type + - value + properties: + type: + type: string + example: token + description: Type + value: + $ref: '#/components/schemas/TokenInfoDetailed' + description: Token info + TokenInfoDetailed: + type: object + required: + - address + - circulating_market_cap + - decimals + - exchange_rate + - holders + - icon_url + - name + - symbol + - total_supply + - type + - volume_24h + properties: + address: + type: string + example: '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc' + description: Token Address + circulating_market_cap: + type: string + example: '0.0' + description: Token circulating market cap + decimals: + type: string + example: '18' + description: Token decimals + exchange_rate: + type: string + example: '2890.96' + description: Token exchange rate + holders: + type: string + example: '2999' + description: Token holders amount + icon_url: + type: string + example: >- + https://assets.coingecko.com/coins/images/39410/small/Steakhouse_logo-05.jpg?1722053893 + description: 'Token image URL ' + name: + type: string + example: Steakhouse Resteaking Vault + description: Token name + symbol: + type: string + example: steakLRT + description: Token symbol + total_supply: + type: string + example: '9710057205959239302188' + description: Token total supply + type: + type: string + example: ERC-20 + description: Token type + volume_24h: + type: string + example: '24298.765344836862' + description: Token trading volume for past 24h DecodedInputParameter: type: object required: @@ -2196,7 +2543,7 @@ components: creator_address_hash: type: string example: '0xEb533ee5687044E622C69c58B1B12329F56eD9ad' - creation_tx_hash: + creation_transaction_hash: type: string example: '0x1f610ff9c1efad6b5a8bb6afcc0786cd7343f03f9a61e2544fcff908cedee924' token: @@ -2267,9 +2614,9 @@ components: - $ref: '#/components/schemas/Address' - type: object required: - - tx_count + - transaction_count properties: - tx_count: + transaction_count: type: string example: '1234' Reward: @@ -2522,6 +2869,146 @@ components: $ref: '#/components/schemas/AddressParam' token: $ref: '#/components/schemas/TokenInfo' + AddressNFTInstance: + required: + - token_type + - value + - is_unique + - id + - token + - owner + properties: + is_unique: + type: boolean + id: + type: string + example: '431' + holder_address_hash: + type: string + example: '0x394c399dbA25B99Ab7708EdB505d755B3aa29997' + image_url: + type: string + example: example.com/picture.png + animation_url: + type: string + example: example.com/video.mp4 + external_app_url: + type: string + example: d-app.com + metadata: + type: object + example: + year: 2023 + tags: + - poap + - event + name: 'Social Listening Committee #2 Attendees' + image_url: 'https://assets.poap.xyz/chanel-poap-4c-2023-logo-1675083420470.png' + home_url: 'https://app.poap.xyz/token/6292128' + external_url: 'https://api.poap.tech/metadata/99010/6292128' + description: >- + This is the POAP for attendees of the second Social Listening + Committee. + attributes: + - value: 01-Feb-2023 + trait_type: startDate + - value: 01-Feb-2023 + trait_type: endDate + - value: 'false' + trait_type: virtualEvent + - value: Paris + trait_type: city + - value: France + trait_type: country + - value: 'https://www.chanel.com' + trait_type: eventURL + owner: + $ref: '#/components/schemas/AddressParam' + token: + $ref: '#/components/schemas/TokenInfo' + token_type: + type: string + example: ERC-721 + value: + type: string + example: '1' + AddressNFTInstanceCollection: + required: + - token_type + - value + - is_unique + - id + - owner + properties: + is_unique: + type: boolean + id: + type: string + example: '431' + holder_address_hash: + type: string + example: '0x394c399dbA25B99Ab7708EdB505d755B3aa29997' + image_url: + type: string + example: example.com/picture.png + animation_url: + type: string + example: example.com/video.mp4 + external_app_url: + type: string + example: d-app.com + metadata: + type: object + example: + year: 2023 + tags: + - poap + - event + name: 'Social Listening Committee #2 Attendees' + image_url: 'https://assets.poap.xyz/chanel-poap-4c-2023-logo-1675083420470.png' + home_url: 'https://app.poap.xyz/token/6292128' + external_url: 'https://api.poap.tech/metadata/99010/6292128' + description: >- + This is the POAP for attendees of the second Social Listening + Committee. + attributes: + - value: 01-Feb-2023 + trait_type: startDate + - value: 01-Feb-2023 + trait_type: endDate + - value: 'false' + trait_type: virtualEvent + - value: Paris + trait_type: city + - value: France + trait_type: country + - value: 'https://www.chanel.com' + trait_type: eventURL + owner: + $ref: '#/components/schemas/AddressParam' + token: + type: object + example: null + token_type: + type: string + example: ERC-721 + value: + type: string + example: '1' + AddressNFTCollection: + required: + - token + - token_instances + properties: + token: + $ref: '#/components/schemas/TokenInfo' + amount: + type: string + example: '1' + token_instances: + type: array + items: + $ref: '#/components/schemas/AddressNFTInstanceCollection' SmartContract: properties: verified_twin_address_hash: @@ -2809,14 +3296,14 @@ components: SearchResultTransaction: required: - timestamp - - tx_hash + - transaction_hash - type - url properties: timestamp: type: string example: '2022-10-31T07:18:05.000000Z' - tx_hash: + transaction_hash: type: string example: '0xe38c6772f33edfbd218f59853befe18391cb786f911fb6c0b00ed6dd72ef6e69' type: @@ -2915,12 +3402,12 @@ components: TransactionChartItem: required: - date - - tx_count + - transaction_count properties: date: type: string example: '2022-10-31' - tx_count: + transaction_count: type: integer example: 622 TokenCounters: @@ -2934,6 +3421,13 @@ components: transfers_count: type: string example: '1000' + RecaptchaBody: + required: + - recaptcha_response + properties: + recaptcha_response: + type: string + example: '123' ReadMethodQueryBody: required: - args @@ -3051,7 +3545,7 @@ components: - has_constructor_args - language - optimization_enabled - - tx_count + - transaction_count - verified_at properties: address: @@ -3069,7 +3563,7 @@ components: type: boolean optimization_enabled: type: boolean - tx_count: + transaction_count: type: integer verified_at: type: string @@ -3334,7 +3828,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: batch_block_hash: '0x0000000000000000000000000000000000000000000000000000000000000000' @@ -3380,7 +3874,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: block_number: 4 @@ -3424,7 +3918,7 @@ components: total: decimals: '6' value: '830000000' - tx_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' + transaction_hash: '0x6662ad1ad2ea899e9e27832dc202fd2ef915a5d2816c1142e6933cff93f7c592' type: token_transfer next_page_params: batch_block_hash: '0x0000000000000000000000000000000000000000000000000000000000000014'