mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
18 lines
608 B
Nim
18 lines
608 B
Nim
|
|
import chronicles, chronos, results
|
||
|
|
|
||
|
|
import waku/factory/waku
|
||
|
|
|
||
|
|
import ./api_conf
|
||
|
|
|
||
|
|
# TODO: Specs says it should return a `WakuNode`. As `send` and other APIs are defined, we can align.
|
||
|
|
proc createNode*(config: NodeConfig): Future[Result[Waku, string]] {.async.} =
|
||
|
|
let wakuConf = toWakuConf(config).valueOr:
|
||
|
|
return err("Failed to handle the configuration: " & error)
|
||
|
|
|
||
|
|
## We are not defining app callbacks at node creation
|
||
|
|
let wakuRes = (await Waku.new(wakuConf)).valueOr:
|
||
|
|
error "waku initialization failed", error = error
|
||
|
|
return err("Failed setting up Waku: " & $error)
|
||
|
|
|
||
|
|
return ok(wakuRes)
|