diff --git a/packages/rs-dapi-client/src/executor.rs b/packages/rs-dapi-client/src/executor.rs index 716a22b5b3..cbb999a3b0 100644 --- a/packages/rs-dapi-client/src/executor.rs +++ b/packages/rs-dapi-client/src/executor.rs @@ -159,7 +159,7 @@ where } /// Convert Result to ExecutionResult, taking context from ExecutionResponse. -pub trait Wrap: Sized { +pub trait WrapToExecutionResult: Sized { /// Convert self (eg. some [Result]) to [ExecutionResult], taking context information from `W` (eg. ExecutionResponse). /// /// This function simplifies processing of results by wrapping them into ExecutionResult. @@ -195,15 +195,15 @@ pub trait Wrap: Sized { /// panic!("Expected error"); /// } /// ``` - fn wrap(self, result: &W) -> ExecutionResult; + fn wrap_to_execution_result(self, result: &W) -> ExecutionResult; } -impl Wrap> for Result +impl WrapToExecutionResult> for Result where R: From, RE: From, { - fn wrap(self, result: &ExecutionResponse) -> ExecutionResult { + fn wrap_to_execution_result(self, result: &ExecutionResponse) -> ExecutionResult { match self { Ok(r) => ExecutionResult::Ok(ExecutionResponse { inner: r.into(), diff --git a/packages/rs-dapi-client/src/lib.rs b/packages/rs-dapi-client/src/lib.rs index 9f5f45e27a..f8c03f3956 100644 --- a/packages/rs-dapi-client/src/lib.rs +++ b/packages/rs-dapi-client/src/lib.rs @@ -22,7 +22,7 @@ pub use dapi_client::{DapiClient, DapiClientError}; pub use dump::DumpData; pub use executor::{ DapiRequestExecutor, ExecutionError, ExecutionResponse, ExecutionResult, InnerInto, IntoInner, - Wrap, + WrapToExecutionResult, }; use futures::{future::BoxFuture, FutureExt}; pub use request_settings::RequestSettings; diff --git a/packages/rs-sdk/src/platform/transition/broadcast.rs b/packages/rs-sdk/src/platform/transition/broadcast.rs index 00f1795645..f41a279b13 100644 --- a/packages/rs-sdk/src/platform/transition/broadcast.rs +++ b/packages/rs-sdk/src/platform/transition/broadcast.rs @@ -10,7 +10,7 @@ use dpp::state_transition::StateTransition; use drive::drive::Drive; use drive_proof_verifier::error::ContextProviderError; use drive_proof_verifier::DataContractProvider; -use rs_dapi_client::Wrap; +use rs_dapi_client::WrapToExecutionResult; use rs_dapi_client::{DapiRequest, ExecutionError, InnerInto, IntoInner, RequestSettings}; #[async_trait::async_trait] @@ -80,9 +80,17 @@ impl BroadcastStateTransition for StateTransition { let response = request.execute(sdk, request_settings).await.inner_into()?; let grpc_response: &WaitForStateTransitionResultResponse = &response.inner; - let metadata = grpc_response.metadata().wrap(&response)?.inner; - let block_info = block_info_from_metadata(metadata).wrap(&response)?.inner; - let proof: &Proof = (*grpc_response).proof().wrap(&response)?.inner; + let metadata = grpc_response + .metadata() + .wrap_to_execution_result(&response)? + .inner; + let block_info = block_info_from_metadata(metadata) + .wrap_to_execution_result(&response)? + .inner; + let proof: &Proof = (*grpc_response) + .proof() + .wrap_to_execution_result(&response)? + .inner; let context_provider = sdk.context_provider().ok_or(ExecutionError { inner: Error::from(ContextProviderError::Config( @@ -99,7 +107,7 @@ impl BroadcastStateTransition for StateTransition { &context_provider.as_contract_lookup_fn(), sdk.version(), ) - .wrap(&response)? + .wrap_to_execution_result(&response)? .inner; let variant_name = result.to_string(); @@ -111,7 +119,7 @@ impl BroadcastStateTransition for StateTransition { std::any::type_name::(), )) }) - .wrap(&response) + .wrap_to_execution_result(&response) }; let future = retry(retry_settings, factory);