4
4
using System ;
5
5
using Microsoft . AspNetCore . Builder ;
6
6
using Microsoft . AspNetCore . Routing ;
7
+ using Microsoft . Extensions . DependencyInjection ;
7
8
using Nethermind . Blockchain ;
8
9
using Nethermind . Blockchain . Receipts ;
9
10
using Nethermind . Consensus . Processing ;
@@ -18,16 +19,17 @@ public static class DataFeedExtensions
18
19
{
19
20
private static DataFeed _dataFeed ;
20
21
21
- public static void MapDataFeeds (
22
- this IEndpointRouteBuilder endpoints ,
23
- ITxPool txPool ,
24
- ISpecProvider specProvider ,
25
- IReceiptFinder receiptFinder ,
26
- IBlockTree blockTree ,
27
- ISyncPeerPool syncPeerPool ,
28
- IBlockchainProcessor blockchainProcessor )
22
+ public static void MapDataFeeds ( this IEndpointRouteBuilder endpoints )
29
23
{
30
24
ArgumentNullException . ThrowIfNull ( endpoints ) ;
25
+ IServiceProvider services = endpoints . ServiceProvider ;
26
+
27
+ ITxPool txPool = services . GetRequiredService < ITxPool > ( ) ;
28
+ ISpecProvider specProvider = services . GetRequiredService < ISpecProvider > ( ) ;
29
+ IReceiptFinder receiptFinder = services . GetRequiredService < IReceiptFinder > ( ) ;
30
+ IBlockTree blockTree = services . GetRequiredService < IBlockTree > ( ) ;
31
+ ISyncPeerPool syncPeerPool = services . GetRequiredService < ISyncPeerPool > ( ) ;
32
+ IBlockchainProcessor blockchainProcessor = services . GetRequiredService < IBlockchainProcessor > ( ) ;
31
33
32
34
_dataFeed = new DataFeed ( txPool , specProvider , receiptFinder , blockTree , syncPeerPool , blockchainProcessor ) ;
33
35
0 commit comments