From 0668f4f7c8c01599d59836d88f1145f6ef6cd09e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 15 Nov 2024 13:37:45 +0100 Subject: [PATCH] refactor --- packages/rs-sdk/src/platform/fetch_many.rs | 46 +++------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/packages/rs-sdk/src/platform/fetch_many.rs b/packages/rs-sdk/src/platform/fetch_many.rs index 1bffd84f50..360a3559b3 100644 --- a/packages/rs-sdk/src/platform/fetch_many.rs +++ b/packages/rs-sdk/src/platform/fetch_many.rs @@ -146,41 +146,9 @@ where sdk: &Sdk, query: Q, ) -> Result { - let request = &query.query(sdk.prove())?; - let closure = |settings: RequestSettings| async move { - let ExecutionResponse { - address, - retries, - inner: response, - } = request - .clone() - .execute(sdk, settings) - .await - .map_err(|e| e.inner_into())?; - - let object_type = std::any::type_name::().to_string(); - tracing::trace!(request = ?request, response = ?response, ?address, retries, object_type, "fetched object from platform"); - - sdk.parse_proof::<>::Request, O>(request.clone(), response) - .await - .map(|o| ExecutionResponse { - inner: o, - retries, - address: address.clone(), - }) - .map_err(|e| ExecutionError { - inner: e, - retries, - address: Some(address), - }) - }; - - let settings = sdk.dapi_client_settings; - - retry(settings, closure) + Self::fetch_many_with_metadata_and_proof(sdk, query, None) .await - .into_inner() - .map(|o| o.unwrap_or_default()) + .map(|(objects, _, _)| objects) } /// Fetch multiple objects from Platform with metadata. @@ -273,12 +241,10 @@ where address: Some(address.clone()), retries, }) - .map(|(o, metadata, proof)| { - (ExecutionResponse { - inner: (o.unwrap_or_default(), metadata, proof), - retries, - address: address.clone(), - }) + .map(|(o, metadata, proof)| ExecutionResponse { + inner: (o.unwrap_or_default(), metadata, proof), + retries, + address: address.clone(), }) };