Ivan FB 53c83184d0
FFI: typed kernel_api operations (nim-ffi v0.2.0)
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>
2026-06-25 04:18:56 +02:00

33 lines
902 B
Nim

## The waku api getters are synchronous and can't fail, so the bodies just wrap
## the value; the `{.ffi.}` macro wraps it into the `Future` it must expose.
proc version*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok(self.waku.version())
proc listen_addresses*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok(self.waku.listenAddresses().join(","))
proc get_my_enr*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok(self.waku.myEnr())
proc get_my_peerid*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok(self.waku.myPeerId())
proc get_metrics*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok(self.waku.metrics())
proc is_online*(
self: LogosDelivery
): Future[Result[string, string]] {.ffi.} =
return ok($self.waku.isOnline())