Skip to content

Commit

Permalink
implemented QueryExecutor for String
Browse files Browse the repository at this point in the history
  • Loading branch information
gfusee committed Nov 11, 2023
1 parent 8a58d10 commit 0705f59
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions executor/src/network/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,15 @@ impl QueryExecutor for &str {
async fn execute<OutputManaged>(&self, request: &ScCallStep) -> Result<OutputManaged::Native, ExecutorError> where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync {
ProxyQueryExecutor::new(self).execute::<OutputManaged>(request).await
}
}

#[async_trait]
impl QueryExecutor for String {
/// Allows using a string representing the gateway URL to execute a query on the real blockchain environment.
///
/// This implementation creates a new `ProxyQueryExecutor` instance using the string as the gateway URL,
/// and delegates the query execution to it.
async fn execute<OutputManaged>(&self, request: &ScCallStep) -> Result<OutputManaged::Native, ExecutorError> where OutputManaged: TopDecodeMulti + NativeConvertible + Send + Sync {
self.as_str().execute::<OutputManaged>(request).await
}
}

0 comments on commit 0705f59

Please sign in to comment.