Skip to content

Commit

Permalink
chore(gateway): unify client implementations
Browse files Browse the repository at this point in the history
commit-id:38f81a29
  • Loading branch information
Itay-Tsabary-Starkware committed Nov 17, 2024
1 parent 63f6b70 commit c132efb
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions crates/starknet_gateway_types/src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,10 @@ pub enum GatewayClientError {
}

#[async_trait]
impl GatewayClient for LocalGatewayClient {
#[instrument(skip(self))]
async fn add_tx(&self, gateway_input: GatewayInput) -> GatewayClientResult<TransactionHash> {
let request = GatewayRequest::AddTransaction(gateway_input);
let response = self.send(request).await;
handle_response_variants!(GatewayResponse, AddTransaction, GatewayClientError, GatewayError)
}
}

#[async_trait]
impl GatewayClient for RemoteGatewayClient {
impl<T> GatewayClient for T
where
T: Send + Sync + ComponentClient<GatewayRequest, GatewayResponse>,
{
#[instrument(skip(self))]
async fn add_tx(&self, gateway_input: GatewayInput) -> GatewayClientResult<TransactionHash> {
let request = GatewayRequest::AddTransaction(gateway_input);
Expand Down

0 comments on commit c132efb

Please sign in to comment.