private async Task ProduceAvroTransactionAsync(string topic, Core.FullTransaction fullTransaction) { var message = new Message <Null, FullTransaction> { Value = _mapper.MapFullTransaction(fullTransaction) }; var deliveryReport = await _producerTransactions.ProduceAsync(topic, message); if (_logger.IsDebug) { _logger.Debug($"Delivered '{deliveryReport.Value}' to '{deliveryReport.TopicPartitionOffset}'"); } }
public FullTransaction MapFullTransaction(Core.FullTransaction fullTransaction) { var index = fullTransaction.Index; var transaction = fullTransaction.Transaction; var receipt = fullTransaction.Receipt; var removed = !_blockTree.IsMainChain(receipt.BlockHash); return(new FullTransaction { minedAt = (long)_blockTree.FindBlock(receipt.BlockHash, BlockTreeLookupOptions.None).Timestamp, blockNumber = (long)receipt.BlockNumber, receipt = new Receipt { transactionIndex = index, blockNumber = (long)receipt.BlockNumber, toAddr = receipt.Recipient?.ToString() ?? string.Empty, blockHash = receipt.BlockHash.ToString(), fromAddr = receipt.Sender?.ToString() ?? string.Empty, logsBloom = receipt.Bloom.ToString(), gasUsed = receipt.GasUsed, contractAddress = receipt.ContractAddress?.ToString() ?? string.Empty, transactionHash = receipt.TxHash.ToString(), cumulativeGasUsed = receipt.GasUsedTotal, status = receipt.StatusCode, logs = receipt.Logs?.Select((l, i) => new Log { logIndex = i, blockNumber = (long)receipt.BlockNumber, transactionIndex = receipt.Index, blockHash = receipt.BlockHash.ToString(), data = l.Data.ToString(), transactionHash = receipt.TxHash.ToString(), address = l.LoggersAddress.ToString(), logTopics = l.Topics?.Select(t => t.ToString()).ToList() ?? new List <string>(), removed = removed }).ToList() ?? new List <Log>() }, tx = MapTransaction(index, receipt.BlockNumber, receipt.BlockHash, transaction) }); }