public async Task <IEnumerable <AddressHistoryModel> > GetAddressHistory(AddressTransaction addressTransactions) { var historyResponseRaw = await _ethereumSamuraiApi.ApiAddressHistoryByAddressGetAsync(addressTransactions.Address, null, null, addressTransactions.Start, addressTransactions.Count); 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.Value, TransactionIndexInBlock = item.TransactionIndex.Value, BlockNumber = (ulong)item.BlockNumber.Value, BlockTimestamp = (uint)item.BlockTimestamp.Value, BlockTimeUtc = DateUtils.UnixTimeStampToDateTimeUtc(item.BlockTimestamp.Value), From = item.FromProperty, HasError = item.HasError.Value, To = item.To, TransactionHash = item.TransactionHash, Value = item.Value, GasPrice = item.GasPrice, GasUsed = item.GasUsed }); } return(result); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='address'> /// </param> /// <param name='startBlock'> /// </param> /// <param name='stopBlock'> /// </param> /// <param name='start'> /// </param> /// <param name='count'> /// </param> public static object ApiAddressHistoryByAddressGet(this IEthereumSamuraiApi operations, string address, long?startBlock = default(long?), long?stopBlock = default(long?), int?start = default(int?), int?count = default(int?)) { return(operations.ApiAddressHistoryByAddressGetAsync(address, startBlock, stopBlock, start, count).GetAwaiter().GetResult()); }