public TransactionReceipt MapTransactionReceipt(Keccak hash, Core.TransactionReceipt receipt) { TransactionReceipt mapped = new TransactionReceipt { TransactionHash = new Data(hash), TransactionIndex = new Quantity(receipt.Index), BlockHash = new Data(receipt.BlockHash), BlockNumber = new Quantity(receipt.BlockNumber), CumulativeGasUsed = new Quantity(receipt.GasUsedTotal), GasUsed = new Quantity(receipt.GasUsed), From = new Data(receipt.Sender), To = new Data(receipt.Recipient), ContractAddress = new Data(receipt.ContractAddress), Logs = receipt.Logs?.Select(MapLog).ToArray() ?? Array.Empty <Log>(), LogsBloom = new Data(receipt.Bloom?.Bytes), Status = new Quantity(receipt.StatusCode) }; for (int i = 0; i < mapped.Logs.Length; i++) { mapped.Logs[i].BlockHash = mapped.BlockHash; mapped.Logs[i].BlockNumber = mapped.BlockNumber; mapped.Logs[i].LogIndex = new Quantity(i); mapped.Logs[i].TransactionHash = mapped.TransactionHash; mapped.Logs[i].TransactionIndex = mapped.TransactionIndex; } return(mapped); }
public TransactionReceipt MapTransactionReceipt(Core.TransactionReceipt receipt, Core.Transaction transaction, Core.Block block) { return(new TransactionReceipt { TransactionHash = new Data(transaction.Hash.Bytes), TransactionIndex = block?.Transactions != null ? new Quantity(GetTransactionIndex(transaction, block)) : null, BlockHash = block != null ? new Data(block.Hash.Bytes) : null, BlockNumber = block?.Header != null ? new Quantity(block.Header.Number) : null, //CumulativeGasUsed = new Quantity(receipt.GasUsed), GasUsed = new Quantity(receipt.GasUsed), ContractAddress = transaction.IsContractCreation && receipt.Recipient != null ? new Data(receipt.Recipient.Hex) : null, Logs = receipt.Logs?.Select(MapLog).ToArray(), LogsBloom = new Data(receipt.Bloom?.Bytes), Status = new Quantity(receipt.StatusCode) }); }
public Transaction MapTransaction(Core.TransactionReceipt receipt, Core.Transaction transaction) { return(new Transaction { Hash = new Data(transaction.Hash), Nonce = new Quantity(transaction.Nonce), BlockHash = new Data(receipt.BlockHash), BlockNumber = new Quantity(receipt.BlockNumber), TransactionIndex = new Quantity(receipt.Index), From = new Data(receipt.Sender), To = new Data(receipt.Recipient), Value = new Quantity(transaction.Value), GasPrice = new Quantity(transaction.GasPrice), Gas = new Quantity(transaction.GasLimit), Data = new Data(transaction.Data) }); }