returning seqs in libwaku as comma separated strings (#3121)

This commit is contained in:
gabrielmer 2024-10-16 14:07:23 +03:00 committed by GitHub
parent 18c375a5de
commit 3321fd05e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import std/json import std/json
import chronicles, chronos, results, eth/p2p/discoveryv5/enr import chronicles, chronos, results, eth/p2p/discoveryv5/enr, strutils
import ../../../../waku/factory/waku, ../../../../waku/node/waku_node import ../../../../waku/factory/waku, ../../../../waku/node/waku_node
type DebugNodeMsgType* = enum type DebugNodeMsgType* = enum
@ -28,7 +28,8 @@ proc process*(
case self.operation case self.operation
of RETRIEVE_LISTENING_ADDRESSES: of RETRIEVE_LISTENING_ADDRESSES:
return ok($(%*waku.node.getMultiaddresses())) ## returns a comma-separated string of the listen addresses
return ok(waku.node.getMultiaddresses().join(","))
of RETRIEVE_MY_ENR: of RETRIEVE_MY_ENR:
return ok(waku.node.enr.toURI()) return ok(waku.node.enr.toURI())

View File

@ -1,5 +1,5 @@
import std/json import std/json
import chronos, chronicles, results, libp2p/multiaddress import chronos, chronicles, results, strutils, libp2p/multiaddress
import import
../../../../waku/factory/waku, ../../../../waku/factory/waku,
../../../../waku/discovery/waku_dnsdisc, ../../../../waku/discovery/waku_dnsdisc,
@ -129,7 +129,8 @@ proc process*(
error "GET_BOOTSTRAP_NODES failed", error = error error "GET_BOOTSTRAP_NODES failed", error = error
return err($error) return err($error)
return ok($(%*nodes)) ## returns a comma-separated string of bootstrap nodes' multiaddresses
return ok(nodes.join(","))
of UPDATE_DISCV5_BOOTSTRAP_NODES: of UPDATE_DISCV5_BOOTSTRAP_NODES:
updateDiscv5BootstrapNodes($self[].nodes, waku).isOkOr: updateDiscv5BootstrapNodes($self[].nodes, waku).isOkOr:
error "UPDATE_DISCV5_BOOTSTRAP_NODES failed", error = error error "UPDATE_DISCV5_BOOTSTRAP_NODES failed", error = error