public async Task Run() { var web3 = new Web3.Web3(TestConfiguration.BlockchainUrls.Infura.Rinkeby); var transactionHandler = new SimpleTransactionHandler(); var handlers = new HandlerContainer { TransactionHandler = transactionHandler }; //only tx sent to this address var transactionFilter = TransactionFilter.To("0xc0e15e11306334258d61fee52a22d15e6c9c59e0"); var filter = new FilterContainer(transactionFilter); var blockProcessor = BlockProcessorFactory.Create( web3, handlers, filter, processTransactionsInParallel: false); var processingStrategy = new ProcessingStrategy(blockProcessor); var blockchainProcessor = new BlockchainProcessor(processingStrategy); var result = await blockchainProcessor.ExecuteAsync(2830143, 2830153); Assert.True(result); Assert.Equal(12, transactionHandler.TransactionsHandled.Count); Assert.Empty(transactionHandler.ContractCreationTransactionsHandled); }
public async Task Run() { var blockchainProxyService = new BlockchainProxyService("https://rinkeby.infura.io/v3/25e7b6dfc51040b3bfc0e47317d38f60"); var transactionHandler = new SimpleTransactionHandler(); var handlers = new HandlerContainer { TransactionHandler = transactionHandler }; //only tx sent to this address var transactionFilter = TransactionFilter.To("0xc0e15e11306334258d61fee52a22d15e6c9c59e0"); var filter = new FilterContainer(transactionFilter); var blockProcessor = BlockProcessorFactory.Create( blockchainProxyService, handlers, filter, processTransactionsInParallel: false); var processingStrategy = new ProcessingStrategy(blockProcessor); var blockchainProcessor = new BlockchainProcessor(processingStrategy); var result = await blockchainProcessor.ExecuteAsync(2830143, 2830153); Assert.True(result); Assert.Equal(12, transactionHandler.TransactionsHandled.Count); Assert.Empty(transactionHandler.ContractCreationTransactionsHandled); }
public async Task TransactionFilter_To_Reports_Matches() { var tx = new Transaction { To = Address1 }; var filter = TransactionFilter.To(Address1); Assert.True(await filter.IsMatchAsync(tx)); }
public async Task TransactionFilter_To_Reports_Matches_Many() { var tx1 = new Transaction { To = Address1 }; var tx2 = new Transaction { To = Address2 }; var tx3 = new Transaction { To = UnknownAddress }; var filter = TransactionFilter.To(new [] { Address1, Address2 }); Assert.True(await filter.IsMatchAsync(tx1)); Assert.True(await filter.IsMatchAsync(tx2)); Assert.False(await filter.IsMatchAsync(tx3)); }