Exemplo n.º 1
0
        public async Task <EventFullName?> ResolveName(OracleInfo eventId)
        {
            var events = await NameRepository.GetIds(Scopes.Events);

            foreach (var ev in events)
            {
                var oracleId = new OracleId(eventId.PubKey);
                if (ev.Key.StartsWith(oracleId.ToString()))
                {
                    if (ev.Value == eventId.RValue.ToString())
                    {
                        var oracleName = await NameRepository.GetName(Scopes.Oracles, oracleId.ToString());

                        if (oracleName is null)
                        {
                            return(null);
                        }
                        var idx = ev.Key.IndexOf('/');
                        return(new EventFullName(oracleName, ev.Key.Substring(idx + 1)));
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 private string GetEventFullName(OracleId oracleId, string name)
 {
     return($"{oracleId.ToString()}/{name}");
 }