public async Task <IActionResult> GetAddressHistory([FromRoute] string transactionHash) { if (!ModelState.IsValid) { throw new ClientSideException(ExceptionType.WrongParams, JsonConvert.SerializeObject(ModelState.Errors())); } TransactionContentModel transaction = await _ethereumIndexerService.GetTransactionAsync(transactionHash); if (transaction == null) { return(NotFound()); } Models.Indexer.TransactionResponse result = MapTransactionModelContentToResponse(transaction); return(Ok(result)); }
private static Models.Indexer.TransactionResponse MapTransactionModelContentToResponse(TransactionContentModel transactionContent) { var transaction = transactionContent.Transaction; return(new Models.Indexer.TransactionResponse() { BlockHash = transaction.BlockHash, BlockNumber = (ulong)transaction.BlockNumber, BlockTimestamp = transaction.BlockTimestamp, ContractAddress = transaction.ContractAddress, From = transaction.From, Gas = transaction.Gas, To = transaction.To, GasPrice = transaction.GasPrice, GasUsed = transaction.GasUsed, Input = transaction.Input, Nonce = transaction.Nonce, TransactionHash = transaction.TransactionHash, TransactionIndex = transaction.TransactionIndex, Value = transaction.Value, BlockTimeUtc = transaction.BlockTimeUtc, HasError = transaction.HasError, ErcTransfers = transactionContent.ErcTransfer?.Select(MapErcTransferResponse) }); }