Skip to content

Commit 6c47804

Browse files
authored
refactor(tx-cache): rename types for clarity (#194)
* refactor(tx-cache): rename types for clarity Rename tx-cache types to remove redundant TxCache prefix and improve naming: - TxCacheBundle → CachedBundle - TxCacheBundlesResponse → BundleList - TxCacheSendBundleResponse → BundleReceipt - TxCacheTransactionsResponse → TransactionList - TxCacheSendTransactionResponse → TransactionReceipt - TxCacheOrdersResponse → OrderList - TxCacheSendOrderResponse → OrderReceipt Deleted TxCacheBundleResponse as it was just a wrapper around CachedBundle. All old type names are preserved as deprecated type aliases for backwards compatibility. Closes ENG-1569 * fix: correct deprecated since version to 0.16.0 Addresses review feedback from @prestwich - the deprecated type alias annotations incorrectly used 0.2.0 instead of the current workspace version. * refactor(tx-cache): rename Receipt to Response Address PR #194 review feedback from Evalir: rename all *Receipt types to *Response to avoid confusion with Ethereum's transaction receipt concept. Changes: - BundleReceipt → BundleResponse - TransactionReceipt → TransactionResponse - OrderReceipt → OrderResponse Deprecated type aliases are added for backwards compatibility, pointing old names (including the old TxCacheSend* types and *Receipt types) to the new *Response types.
1 parent 3abfad5 commit 6c47804

File tree

3 files changed

+152
-157
lines changed

3 files changed

+152
-157
lines changed

crates/orders/src/impls/tx_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{BundleSubmitter, OrderSource, OrderSubmitter};
22
use futures_util::future::Either;
33
use futures_util::stream::{self, Stream, StreamExt};
44
use signet_bundle::SignetEthBundle;
5-
use signet_tx_cache::{types::TxCacheSendBundleResponse, TxCache, TxCacheError};
5+
use signet_tx_cache::{types::BundleResponse, TxCache, TxCacheError};
66
use signet_types::SignedOrder;
77

88
impl OrderSubmitter for TxCache {
@@ -34,7 +34,7 @@ impl OrderSource for TxCache {
3434
}
3535

3636
impl BundleSubmitter for TxCache {
37-
type Response = TxCacheSendBundleResponse;
37+
type Response = BundleResponse;
3838
type Error = TxCacheError;
3939

4040
async fn submit_bundle(&self, bundle: SignetEthBundle) -> Result<Self::Response, Self::Error> {

crates/tx-cache/src/client.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::error::Result;
22
use crate::types::{
3-
CacheObject, CacheResponse, OrderKey, TxCacheOrdersResponse, TxCacheSendBundleResponse,
4-
TxCacheSendTransactionResponse, TxCacheTransactionsResponse, TxKey,
3+
BundleResponse, CacheObject, CacheResponse, OrderKey, OrderList, TransactionList,
4+
TransactionResponse, TxKey,
55
};
66
use alloy::consensus::TxEnvelope;
77
use serde::{de::DeserializeOwned, Serialize};
@@ -145,18 +145,15 @@ impl TxCache {
145145
///
146146
/// # Returns
147147
///
148-
/// A [`TxCacheSendTransactionResponse`] containing the transaction's cache
148+
/// A [`TransactionResponse`] containing the transaction's cache
149149
/// identifier on success.
150150
///
151151
/// # Errors
152152
///
153153
/// Returns an error if the request fails or the transaction cache rejects
154154
/// the transaction.
155155
#[instrument(skip_all)]
156-
pub async fn forward_raw_transaction(
157-
&self,
158-
tx: TxEnvelope,
159-
) -> Result<TxCacheSendTransactionResponse> {
156+
pub async fn forward_raw_transaction(&self, tx: TxEnvelope) -> Result<TransactionResponse> {
160157
self.forward_inner(TRANSACTIONS, tx).await
161158
}
162159

@@ -172,18 +169,15 @@ impl TxCache {
172169
///
173170
/// # Returns
174171
///
175-
/// A [`TxCacheSendBundleResponse`] containing the bundle's cache identifier
172+
/// A [`BundleResponse`] containing the bundle's cache identifier
176173
/// (UUID) on success.
177174
///
178175
/// # Errors
179176
///
180177
/// Returns an error if the request fails or the transaction cache rejects
181178
/// the bundle.
182179
#[instrument(skip_all)]
183-
pub async fn forward_bundle(
184-
&self,
185-
bundle: SignetEthBundle,
186-
) -> Result<TxCacheSendBundleResponse> {
180+
pub async fn forward_bundle(&self, bundle: SignetEthBundle) -> Result<BundleResponse> {
187181
self.forward_inner(BUNDLES, bundle).await
188182
}
189183

@@ -219,7 +213,7 @@ impl TxCache {
219213
///
220214
/// # Returns
221215
///
222-
/// A [`CacheResponse`] containing a [`TxCacheTransactionsResponse`] with
216+
/// A [`CacheResponse`] containing a [`TransactionList`] with
223217
/// the transactions and pagination information. If more transactions are
224218
/// available, the response will contain a key to fetch the next page.
225219
///
@@ -230,7 +224,7 @@ impl TxCache {
230224
pub async fn get_transactions(
231225
&self,
232226
query: Option<TxKey>,
233-
) -> Result<CacheResponse<TxCacheTransactionsResponse>> {
227+
) -> Result<CacheResponse<TransactionList>> {
234228
self.get_inner(TRANSACTIONS, query).await
235229
}
236230

@@ -248,18 +242,15 @@ impl TxCache {
248242
///
249243
/// # Returns
250244
///
251-
/// A [`CacheResponse`] containing a [`TxCacheOrdersResponse`] with the
245+
/// A [`CacheResponse`] containing an [`OrderList`] with the
252246
/// orders and pagination information. If more orders are available, the
253247
/// response will contain a key to fetch the next page.
254248
///
255249
/// # Errors
256250
///
257251
/// Returns an error if the request fails or the response cannot be parsed.
258252
#[instrument(skip_all)]
259-
pub async fn get_orders(
260-
&self,
261-
query: Option<OrderKey>,
262-
) -> Result<CacheResponse<TxCacheOrdersResponse>> {
253+
pub async fn get_orders(&self, query: Option<OrderKey>) -> Result<CacheResponse<OrderList>> {
263254
self.get_inner(ORDERS, query).await
264255
}
265256
}

0 commit comments

Comments
 (0)