mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-08 00:13:08 +00:00
Merge branch 'feature/replace-event-filter-with-logs'
This commit is contained in:
commit
28fcb32527
@ -110,11 +110,22 @@ namespace NethereumWorkflow
|
|||||||
|
|
||||||
public List<EventLog<TEvent>> GetEvents<TEvent>(string address, ulong fromBlockNumber, ulong toBlockNumber) where TEvent : IEventDTO, new()
|
public List<EventLog<TEvent>> GetEvents<TEvent>(string address, ulong fromBlockNumber, ulong toBlockNumber) where TEvent : IEventDTO, new()
|
||||||
{
|
{
|
||||||
var eventHandler = web3.Eth.GetEvent<TEvent>(address);
|
var logs = new List<FilterLog>();
|
||||||
|
var p = web3.Processing.Logs.CreateProcessor(
|
||||||
|
action: logs.Add,
|
||||||
|
minimumBlockConfirmations: 1,
|
||||||
|
criteria: l => l.IsLogForEvent<TEvent>()
|
||||||
|
);
|
||||||
|
|
||||||
var from = new BlockParameter(fromBlockNumber);
|
var from = new BlockParameter(fromBlockNumber);
|
||||||
var to = new BlockParameter(toBlockNumber);
|
var to = new BlockParameter(toBlockNumber);
|
||||||
var blockFilter = Time.Wait(eventHandler.CreateFilterBlockRangeAsync(from, to));
|
var ct = new CancellationTokenSource().Token;
|
||||||
return Time.Wait(eventHandler.GetAllChangesAsync(blockFilter));
|
Time.Wait(p.ExecuteAsync(toBlockNumber: to.BlockNumber, cancellationToken: ct, startAtBlockNumberIfNotProcessed: from.BlockNumber));
|
||||||
|
|
||||||
|
return logs
|
||||||
|
.Where(l => l.IsLogForEvent<TEvent>())
|
||||||
|
.Select(l => l.DecodeEvent<TEvent>())
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInterval ConvertTimeRangeToBlockRange(TimeRange timeRange)
|
public BlockInterval ConvertTimeRangeToBlockRange(TimeRange timeRange)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public class CodexDockerImage
|
public class CodexDockerImage
|
||||||
{
|
{
|
||||||
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-e324ac8-dist-tests";
|
private const string DefaultDockerImage = "codexstorage/nim-codex:latest-dist-tests";
|
||||||
|
|
||||||
public static string Override { get; set; } = string.Empty;
|
public static string Override { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using BiblioTech.Rewards;
|
|||||||
using Logging;
|
using Logging;
|
||||||
using BiblioTech.CodexChecking;
|
using BiblioTech.CodexChecking;
|
||||||
using Nethereum.Model;
|
using Nethereum.Model;
|
||||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
|
||||||
|
|
||||||
namespace BiblioTech
|
namespace BiblioTech
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user