@@ -2,11 +2,11 @@ use futures03::{future::BoxFuture, stream::FuturesUnordered};
2
2
use graph:: abi;
3
3
use graph:: abi:: DynSolValueExt ;
4
4
use graph:: abi:: FunctionExt ;
5
- use graph:: alloy_todo;
6
5
use graph:: blockchain:: client:: ChainClient ;
7
6
use graph:: blockchain:: BlockHash ;
8
7
use graph:: blockchain:: ChainIdentifier ;
9
8
use graph:: blockchain:: ExtendedBlockPtr ;
9
+ use graph:: components:: ethereum:: * ;
10
10
use graph:: components:: transaction_receipt:: LightTransactionReceipt ;
11
11
use graph:: data:: store:: ethereum:: call;
12
12
use graph:: data:: store:: scalar;
@@ -52,7 +52,6 @@ use graph::{
52
52
ChainStore , CheapClone , DynTryFuture , Error , EthereumCallCache , Logger , TimeoutError ,
53
53
} ,
54
54
} ;
55
- use graph:: { components:: ethereum:: * , prelude:: web3:: api:: Web3 } ;
56
55
use itertools:: Itertools ;
57
56
use std:: collections:: { BTreeMap , BTreeSet , HashMap , HashSet } ;
58
57
use std:: convert:: TryFrom ;
@@ -92,7 +91,6 @@ type AlloyProvider = FillProvider<
92
91
pub struct EthereumAdapter {
93
92
logger : Logger ,
94
93
provider : String ,
95
- web3 : Arc < Web3 < Transport > > ,
96
94
alloy : Arc < AlloyProvider > ,
97
95
metrics : Arc < ProviderEthRpcMetrics > ,
98
96
supports_eip_1898 : bool ,
@@ -105,7 +103,6 @@ impl std::fmt::Debug for EthereumAdapter {
105
103
f. debug_struct ( "EthereumAdapter" )
106
104
. field ( "logger" , & self . logger )
107
105
. field ( "provider" , & self . provider )
108
- . field ( "web3" , & self . web3 )
109
106
. field ( "alloy" , & "<Provider>" )
110
107
. field ( "metrics" , & self . metrics )
111
108
. field ( "supports_eip_1898" , & self . supports_eip_1898 )
@@ -120,7 +117,6 @@ impl CheapClone for EthereumAdapter {
120
117
Self {
121
118
logger : self . logger . clone ( ) ,
122
119
provider : self . provider . clone ( ) ,
123
- web3 : self . web3 . cheap_clone ( ) ,
124
120
alloy : self . alloy . clone ( ) ,
125
121
metrics : self . metrics . cheap_clone ( ) ,
126
122
supports_eip_1898 : self . supports_eip_1898 ,
@@ -143,28 +139,28 @@ impl EthereumAdapter {
143
139
supports_eip_1898 : bool ,
144
140
call_only : bool ,
145
141
) -> Self {
146
- let rpc_url = match & transport {
147
- Transport :: RPC {
148
- client : _,
149
- metrics : _,
150
- provider : _,
151
- url : rpc_url,
152
- } => rpc_url. clone ( ) ,
153
- Transport :: IPC ( _ipc) => alloy_todo ! ( ) ,
154
- Transport :: WS ( _web_socket) => alloy_todo ! ( ) ,
142
+ let alloy = match & transport {
143
+ Transport :: RPC { client, .. } => Arc :: new (
144
+ alloy:: providers:: ProviderBuilder :: new ( )
145
+ . connect_client ( alloy:: rpc:: client:: RpcClient :: new ( client. clone ( ) , false ) ) ,
146
+ ) ,
147
+ Transport :: IPC ( ipc_connect) => Arc :: new (
148
+ alloy:: providers:: ProviderBuilder :: new ( )
149
+ . connect_ipc ( ipc_connect. clone ( ) )
150
+ . await
151
+ . unwrap ( ) ,
152
+ ) ,
153
+ Transport :: WS ( ws_connect) => Arc :: new (
154
+ alloy:: providers:: ProviderBuilder :: new ( )
155
+ . connect_ws ( ws_connect. clone ( ) )
156
+ . await
157
+ . unwrap ( ) ,
158
+ ) ,
155
159
} ;
156
- let web3 = Arc :: new ( Web3 :: new ( transport) ) ;
157
- let alloy = Arc :: new (
158
- alloy:: providers:: ProviderBuilder :: new ( )
159
- . connect ( & rpc_url)
160
- . await
161
- . unwrap ( ) ,
162
- ) ;
163
160
164
161
EthereumAdapter {
165
162
logger,
166
163
provider,
167
- web3,
168
164
alloy,
169
165
metrics : provider_metrics,
170
166
supports_eip_1898,
@@ -305,7 +301,7 @@ impl EthereumAdapter {
305
301
// cached. The result is not used for anything critical, so it is fine to be lazy.
306
302
async fn check_block_receipt_support_and_update_cache (
307
303
& self ,
308
- alloy : Arc < dyn alloy :: providers :: Provider > ,
304
+ alloy : Arc < dyn Provider > ,
309
305
block_hash : B256 ,
310
306
supports_eip_1898 : bool ,
311
307
call_only : bool ,
@@ -2156,7 +2152,7 @@ async fn filter_call_triggers_from_unsuccessful_transactions(
2156
2152
2157
2153
/// Deprecated. Wraps the [`fetch_transaction_receipts_in_batch`] in a retry loop.
2158
2154
async fn fetch_transaction_receipts_in_batch_with_retry (
2159
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2155
+ alloy : Arc < dyn Provider > ,
2160
2156
hashes : Vec < B256 > ,
2161
2157
block_hash : B256 ,
2162
2158
logger : Logger ,
@@ -2182,7 +2178,7 @@ async fn fetch_transaction_receipts_in_batch_with_retry(
2182
2178
2183
2179
/// Deprecated. Attempts to fetch multiple transaction receipts in a batching context.
2184
2180
async fn fetch_transaction_receipts_in_batch (
2185
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2181
+ alloy : Arc < dyn Provider > ,
2186
2182
hashes : Vec < B256 > ,
2187
2183
block_hash : B256 ,
2188
2184
logger : Logger ,
@@ -2212,7 +2208,7 @@ async fn fetch_transaction_receipts_in_batch(
2212
2208
}
2213
2209
2214
2210
async fn batch_get_transaction_receipts (
2215
- provider : Arc < dyn alloy :: providers :: Provider > ,
2211
+ provider : Arc < dyn Provider > ,
2216
2212
tx_hashes : Vec < B256 > ,
2217
2213
) -> Result < Vec < Option < alloy:: rpc:: types:: TransactionReceipt > > , Box < dyn std:: error:: Error > > {
2218
2214
let mut batch = alloy:: rpc:: client:: BatchRequest :: new ( provider. client ( ) ) ;
@@ -2242,7 +2238,7 @@ async fn batch_get_transaction_receipts(
2242
2238
}
2243
2239
2244
2240
pub ( crate ) async fn check_block_receipt_support (
2245
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2241
+ alloy : Arc < dyn Provider > ,
2246
2242
block_hash : B256 ,
2247
2243
supports_eip_1898 : bool ,
2248
2244
call_only : bool ,
@@ -2271,7 +2267,7 @@ pub(crate) async fn check_block_receipt_support(
2271
2267
// based on whether block receipts are supported or individual transaction receipts
2272
2268
// need to be fetched.
2273
2269
async fn fetch_receipts_with_retry (
2274
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2270
+ alloy : Arc < dyn Provider > ,
2275
2271
hashes : Vec < B256 > ,
2276
2272
block_hash : B256 ,
2277
2273
logger : Logger ,
@@ -2285,7 +2281,7 @@ async fn fetch_receipts_with_retry(
2285
2281
2286
2282
// Fetches receipts for each transaction in the block individually.
2287
2283
async fn fetch_individual_receipts_with_retry (
2288
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2284
+ alloy : Arc < dyn Provider > ,
2289
2285
hashes : Vec < B256 > ,
2290
2286
block_hash : B256 ,
2291
2287
logger : Logger ,
@@ -2316,7 +2312,7 @@ async fn fetch_individual_receipts_with_retry(
2316
2312
2317
2313
/// Fetches transaction receipts of all transactions in a block with `eth_getBlockReceipts` call.
2318
2314
async fn fetch_block_receipts_with_retry (
2319
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2315
+ alloy : Arc < dyn Provider > ,
2320
2316
hashes : Vec < B256 > ,
2321
2317
block_hash : B256 ,
2322
2318
logger : Logger ,
@@ -2361,7 +2357,7 @@ async fn fetch_block_receipts_with_retry(
2361
2357
2362
2358
/// Retries fetching a single transaction receipt using alloy, then converts to web3 format.
2363
2359
async fn fetch_transaction_receipt_with_retry (
2364
- alloy : Arc < dyn alloy :: providers :: Provider > ,
2360
+ alloy : Arc < dyn Provider > ,
2365
2361
transaction_hash : B256 ,
2366
2362
block_hash : B256 ,
2367
2363
logger : Logger ,
0 commit comments