public async Task <IEnumerable <AddressHistoryModel> > GetAddressHistory(AddressTransaction addressTransactions) { var historyResponseRaw = await _ethereumSamuraiApi.ApiAddressHistoryByAddressGetAsync(addressTransactions.Address, addressTransactions.Count, addressTransactions.Start, null, null); var addressHistoryResponse = historyResponseRaw as FilteredAddressHistoryResponse; ThrowOnError(historyResponseRaw); int responseCount = addressHistoryResponse.History?.Count ?? 0; List <AddressHistoryModel> result = new List <AddressHistoryModel>(responseCount); foreach (var item in addressHistoryResponse.History) { result.Add( new AddressHistoryModel() { MessageIndex = item.MessageIndex, TransactionIndexInBlock = item.TransactionIndex, BlockNumber = (ulong)item.BlockNumber, BlockTimestamp = (uint)item.BlockTimestamp, BlockTimeUtc = DateUtils.UnixTimeStampToDateTimeUtc(item.BlockTimestamp), From = item.FromProperty, HasError = item.HasError, To = item.To, TransactionHash = item.TransactionHash, Value = item.Value, GasPrice = item.GasPrice, GasUsed = item.GasUsed }); } return(result); }
public async Task UpsertAsync(RPC.Eth.DTOs.Transaction transaction, TransactionReceipt transactionReceipt, bool failedCreatingContract, HexBigInteger blockTimestamp, string address, string error = null, bool hasVmStack = false, string newContractAddress = null) { AddressTransaction tx = new AddressTransaction(); tx.Map(transaction, address); tx.UpdateRowDates(); await Write(tx); }
public async Task UpsertAsync(Transaction transaction, TransactionReceipt transactionReceipt, bool failedCreatingContract, HexBigInteger blockTimestamp, string address, string error = null, bool hasVmStack = false, string newContractAddress = null) { var entity = AddressTransaction.CreateAddressTransaction(Table, transaction, transactionReceipt, failedCreatingContract, blockTimestamp, null, null, false, newContractAddress); await entity.InsertOrReplaceAsync().ConfigureAwait(false); }
public async Task EthereumIndexerServiceUnitTest_TestQueryingInternalMessagesForAddress() { int count = 3; int start = 0; AddressTransaction addressTransactions = new AddressTransaction() { Address = TestConstants.PW_ADDRESS, Count = count, Start = start }; IEnumerable <InternalMessageModel> messages = await _ethereumIndexerService.GetInternalMessagesHistory(addressTransactions); Assert.IsTrue(count - start >= messages.Count()); foreach (var message in messages) { Assert.AreEqual(message.ToAddress, TestConstants.PW_ADDRESS); } }
public async Task EthereumIndexerServiceUnitTest_TestQueryingTransactionsForAddress() { int count = 3; int start = 0; AddressTransaction addressTransactions = new AddressTransaction() { Address = TestConstants.PW_ADDRESS, Count = count, Start = start }; IEnumerable <TransactionContentModel> transactions = await _ethereumIndexerService.GetTransactionHistory(addressTransactions); Assert.IsTrue(count - start >= transactions.Count()); foreach (var transaction in transactions) { Assert.AreEqual(transaction.Transaction.From, TestConstants.PW_ADDRESS); } }
public static void Map(this AddressTransaction to, Nethereum.RPC.Eth.DTOs.Transaction @from, string address) { to.BlockNumber = @from.BlockNumber.Value.ToString(); to.Hash = @from.TransactionHash; to.Address = address; }
public async Task <IEnumerable <InternalMessageModel> > GetInternalMessagesHistory(AddressTransaction addressMessages) { var internalMessageResponseRaw = await _ethereumSamuraiApi. ApiInternalMessagesByAddressGetAsync(addressMessages.Address, addressMessages.Count, addressMessages.Start, null, null); FilteredInternalMessageResponse internalMessageResponse = internalMessageResponseRaw as FilteredInternalMessageResponse; ThrowOnError(internalMessageResponseRaw); int responseCount = internalMessageResponse.Messages?.Count ?? 0; List <InternalMessageModel> result = new List <InternalMessageModel>(responseCount); foreach (var message in internalMessageResponse.Messages) { result.Add(MapInternalMessageResponseToModel(message)); } return(result); }
public async Task <IEnumerable <TransactionContentModel> > GetTransactionHistory(AddressTransaction addressTransactions) { var transactionResponseRaw = await _ethereumSamuraiApi.ApiTransactionByAddressGetAsync(addressTransactions.Address, addressTransactions.Start, addressTransactions.Count); var transactionResponse = transactionResponseRaw as FilteredTransactionsResponse; ThrowOnError(transactionResponseRaw); int responseCount = transactionResponse.Transactions?.Count ?? 0; List <TransactionContentModel> result = new List <TransactionContentModel>(responseCount); foreach (var transaction in transactionResponse.Transactions) { result.Add(new TransactionContentModel() { Transaction = MapTransactionResponseToModel(transaction) }); } return(result); }