status-lib/status/signals/discovery_summary.nim

15 lines
445 B
Nim
Raw Normal View History

2021-09-08 18:05:39 +00:00
import json
import base
2021-09-08 20:55:37 +00:00
import signal_type
2021-09-08 18:05:39 +00:00
type DiscoverySummarySignal* = ref object of Signal
enodes*: seq[string]
2021-09-08 20:55:37 +00:00
proc fromEvent*(T: type DiscoverySummarySignal, jsonSignal: JsonNode): DiscoverySummarySignal =
result = DiscoverySummarySignal()
result.signalType = SignalType.DiscoverySummary
2021-09-08 18:05:39 +00:00
if jsonSignal["event"].kind != JNull:
for discoveryItem in jsonSignal["event"]:
2021-09-08 20:55:37 +00:00
result.enodes.add(discoveryItem["enode"].getStr)