mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-28 04:19:29 +00:00
Convert the kernel_api operations — relay/filter/lightpush/store,
peer_manager, discovery, ping, debug/node-info — to typed {.ffi.} procs that
pass parameters directly and ride generic CBOR (no per-op request wrappers).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.1 KiB
Nim
32 lines
1.1 KiB
Nim
proc discv5_update_bootnodes*(
|
|
self: LogosDelivery, bootnodes: string
|
|
): Future[Result[string, string]] {.ffi.} =
|
|
## `bootnodes` is a JSON array of ENRs, e.g. `["enr:...", "enr:..."]`.
|
|
(await self.waku.discv5UpdateBootnodes(bootnodes)).isOkOr:
|
|
return err(error)
|
|
return ok("")
|
|
|
|
proc dns_discovery*(
|
|
self: LogosDelivery, enrTreeUrl: string, nameDnsServer: string, timeoutMs: int
|
|
): Future[Result[string, string]] {.ffi.} =
|
|
let nodes = (await self.waku.dnsDiscovery(enrTreeUrl, nameDnsServer, timeoutMs)).valueOr:
|
|
return err(error)
|
|
return ok(nodes.join(","))
|
|
|
|
proc start_discv5*(self: LogosDelivery): Future[Result[string, string]] {.ffi.} =
|
|
(await self.waku.startDiscv5()).isOkOr:
|
|
return err(error)
|
|
return ok("")
|
|
|
|
proc stop_discv5*(self: LogosDelivery): Future[Result[string, string]] {.ffi.} =
|
|
(await self.waku.stopDiscv5()).isOkOr:
|
|
return err(error)
|
|
return ok("")
|
|
|
|
proc peer_exchange_request*(
|
|
self: LogosDelivery, numPeers: uint64
|
|
): Future[Result[string, string]] {.ffi.} =
|
|
let n = (await self.waku.peerExchangeRequest(numPeers)).valueOr:
|
|
return err(error)
|
|
return ok($n)
|