public static bool IsLogForEvent <TEventDTO>(this FilterLogVO filterLogVO) { if (filterLogVO.Log == null) { return(false); } return(filterLogVO.Log.IsLogForEvent <TEventDTO>()); }
public async Task UpsertAsync(FilterLogVO log) { var record = await FindByTransactionHashAndLogIndexAsync(log.Transaction.TransactionHash, log.Log.LogIndex); if (record != null) { Records.Remove(record); } Records.Add(log.MapToStorageEntityForUpsert()); }
public async Task UpsertAsync(FilterLogVO log) { using (var context = _contextFactory.CreateContext()) { var transactionLog = await context.TransactionLogs.FindByTransactionHashAndLogIndex(log.Log.TransactionHash, log.Log.LogIndex.ToLong()).ConfigureAwait(false) ?? new TransactionLog(); transactionLog.MapToStorageEntityForUpsert(log); context.TransactionLogs.AddOrUpdate(transactionLog); await context.SaveChangesAsync().ConfigureAwait(false); } }
public async Task UpsertAsync() { var transactionHash = "0x020af76554bd67c6c716a70bf214eaf7284a483dd8597d7761f78fce11c83a0a"; var address = "0xba0ef20713557e1c28e12464e4310dff04c0b3ba"; var data = "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015426567696e20726567697374657256656869636c650000000000000000000000"; long logIndex = 0; var topic0 = "0x16da62289fb03291b4545b27ad6fd3329305dfae113f331e8523fcb90148cc65"; var topic1 = "0x0000000000000000000000000000000000000000000000000000000000000001"; var topic2 = "0x000000000000000000000000320bd41cba845a47ef34d8218cec1c01728c42ff"; var topic3 = "0x0000000000000000000000005bab3bf57ff717ca6f21d037c6520ab84634897c"; var log = JObject.Parse( $@"{{ transactionHash: '{transactionHash}', address: '{address}', data: '{data}', logIndex: '{logIndex}', topics: [ '{topic0}', '{topic1}', '{topic2}', '{topic3}' ] }}").ToObject <FilterLog>(); var filterLogVO = new FilterLogVO(transaction: null, receipt: null, log: log); await _repo.UpsertAsync(filterLogVO); var storedLog = await _repo.FindByTransactionHashAndLogIndexAsync(transactionHash, logIndex); Assert.NotNull(storedLog); Assert.Equal(transactionHash, storedLog.TransactionHash); Assert.Equal(logIndex.ToString(), storedLog.LogIndex); Assert.Equal(address, storedLog.Address); Assert.Equal(data, storedLog.Data); Assert.Equal(topic0, storedLog.EventHash); Assert.Equal(topic1, storedLog.IndexVal1); Assert.Equal(topic2, storedLog.IndexVal2); Assert.Equal(topic3, storedLog.IndexVal3); }
public static TransactionLog MapToStorageEntityForUpsert(this FilterLogVO filterLog) { return(new TransactionLog().MapToStorageEntityForUpsert(filterLog)); }
public static TEntity MapToStorageEntityForUpsert <TEntity>(this TEntity logEntity, FilterLogVO filterLog) where TEntity : TransactionLog { logEntity.Map(filterLog.Log); logEntity.UpdateRowDates(); return(logEntity); }
public static TEntity MapToStorageEntityForUpsert <TEntity>(this FilterLogVO filterLog) where TEntity : TransactionLog, new() { var logEntity = new TEntity(); return(logEntity.MapToStorageEntityForUpsert(filterLog)); }
public Task UpsertAsync(FilterLogVO log) { return(UpsertDocumentAsync(log.MapToStorageEntityForUpsert <CinderTransactionLog>())); }
public async Task UpsertAsync(FilterLogVO log) { var transactionLog = log.MapToStorageEntityForUpsert(); await Write(transactionLog).ConfigureAwait(false); }
public async Task UpsertAsync(FilterLogVO log) { var transactionLog = log.MapToStorageEntityForUpsert <MongoDbTransactionLog>(); await UpsertDocumentAsync(transactionLog).ConfigureAwait(false); }
public async Task UpsertAsync(FilterLogVO log) { var entity = TransactionLog.CreateTransactionLog(log.Log); await UpsertAsync(entity).ConfigureAwait(false); }
protected override async Task ExecuteInternalAsync(FilterLogVO value) { _logger.LogDebug("Processing filter log"); await base.ExecuteInternalAsync(value).AnyContext(); }