2026-03-03 19:17:54 +01:00
|
|
|
import chronicles, chronos, results
|
2025-10-01 16:31:34 +10:00
|
|
|
|
|
|
|
|
import waku/factory/waku
|
2026-03-03 19:17:54 +01:00
|
|
|
import ../../tools/confutils/cli_args
|
2025-10-01 16:31:34 +10:00
|
|
|
|
2026-03-03 19:17:54 +01:00
|
|
|
export cli_args
|
|
|
|
|
|
2026-01-30 01:06:00 +01:00
|
|
|
logScope:
|
|
|
|
|
topics = "api"
|
2025-10-01 16:31:34 +10:00
|
|
|
|
2026-03-03 19:17:54 +01:00
|
|
|
proc createNode*(conf: WakuNodeConf): Future[Result[Waku, string]] {.async.} =
|
|
|
|
|
let wakuConf = conf.toWakuConf().valueOr:
|
2025-10-01 16:31:34 +10:00
|
|
|
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)
|