File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ alloy.workspace = true
13
13
serde.workspace = true
14
14
serde_json.workspace = true
15
15
thiserror.workspace = true
16
-
16
+ reqwest.workspace = true
17
17
18
18
[features ]
19
19
default = []
Original file line number Diff line number Diff line change @@ -44,4 +44,9 @@ impl SignetEnvironmentConstants {
44
44
pub const fn transaction_cache ( & self ) -> & str {
45
45
self . transaction_cache
46
46
}
47
+
48
+ /// Get the transaction cache URL.
49
+ pub fn transaction_cache_url ( & self ) -> reqwest:: Url {
50
+ reqwest:: Url :: parse ( self . transaction_cache ) . expect ( "Invalid transaction cache URL" )
51
+ }
47
52
}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ signet-bundle.workspace = true
15
15
signet-evm.workspace = true
16
16
signet-types.workspace = true
17
17
signet-zenith.workspace = true
18
+ signet-constants.workspace = true
18
19
19
20
ajj.workspace = true
20
21
trevm.workspace = true
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use alloy::consensus::TxEnvelope;
6
6
use eyre:: Error ;
7
7
use serde:: { de:: DeserializeOwned , Serialize } ;
8
8
use signet_bundle:: SignetEthBundle ;
9
+ use signet_constants:: SignetEnvironmentConstants ;
9
10
use signet_types:: SignedOrder ;
10
11
use tracing:: { instrument, warn} ;
11
12
@@ -35,6 +36,19 @@ impl TxCache {
35
36
Self { url, client : reqwest:: Client :: new ( ) }
36
37
}
37
38
39
+ /// Create a new cache for Pecorino.
40
+ pub fn pecorino ( ) -> Self {
41
+ SignetEnvironmentConstants :: pecorino ( ) . into ( )
42
+ }
43
+
44
+ /// Create a new cache for Pecorino and client.
45
+ pub fn pecorino_with_client ( client : reqwest:: Client ) -> Self {
46
+ Self :: new_with_client (
47
+ SignetEnvironmentConstants :: pecorino ( ) . transaction_cache_url ( ) ,
48
+ client,
49
+ )
50
+ }
51
+
38
52
async fn forward_inner < T : Serialize + Send , R : DeserializeOwned > (
39
53
& self ,
40
54
join : & ' static str ,
@@ -136,3 +150,10 @@ impl TxCache {
136
150
Ok ( response. orders )
137
151
}
138
152
}
153
+
154
+ // implement a From trait for TxCache from SignetEnvironmentConstants
155
+ impl From < SignetEnvironmentConstants > for TxCache {
156
+ fn from ( constants : SignetEnvironmentConstants ) -> Self {
157
+ Self :: new ( constants. transaction_cache_url ( ) )
158
+ }
159
+ }
You can’t perform that action at this time.
0 commit comments