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);
        }
Exemple #2
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='address'>
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='start'>
 /// </param>
 /// <param name='startBlock'>
 /// </param>
 /// <param name='stopBlock'>
 /// </param>
 public static object ApiAddressHistoryByAddressGet(this IEthereumSamuraiAPI operations, string address, int count, int start, long?startBlock = default(long?), long?stopBlock = default(long?))
 {
     return(operations.ApiAddressHistoryByAddressGetAsync(address, count, start, startBlock, stopBlock).GetAwaiter().GetResult());
 }