mirror of
https://github.com/status-im/status-lib.git
synced 2025-01-13 22:15:24 +00:00
2bb5df3c5f
* wakuv2 connectivity and peer management * feat: wakuv2 light client (#15) Co-authored-by: Richard Ramos <info@richardramos.me>
15 lines
444 B
Nim
15 lines
444 B
Nim
import json
|
|
import base
|
|
import signal_type
|
|
|
|
type PeerStatsSignal* = ref object of Signal
|
|
peers*: seq[string]
|
|
|
|
proc fromEvent*(T: type PeerStatsSignal, jsonSignal: JsonNode): PeerStatsSignal =
|
|
result = PeerStatsSignal()
|
|
result.signalType = SignalType.PeerStats
|
|
if jsonSignal["event"].kind != JNull:
|
|
for (node, protocols) in jsonSignal["event"]["peers"].pairs():
|
|
if protocols.getElems.len != 0:
|
|
result.peers.add(node)
|