mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
* introduce createNode # Conflicts: # apps/wakunode2/cli_args.nim * remove confutils dependency on the library * test: remove websocket in default test config * update to latest specs * test: cli_args * align to spec changes (sovereign, message conf, entrypoints * accept enr, entree and multiaddr as entry points * post rebase * format * change from "sovereign" to "core" * add example * get example to continue running * nitpicks * idiomatic constructors * fix enum naming * replace procs with consts * remove messageConfirmation * use pure enum * rename example file
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)
|