mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 05:53:11 +00:00
* chore: rename Waku API's "Waku Config" to "Protocols" Config Make it clearer that with this config, we are configuring the Waku protocols, in contrast to other parameters which are more executable related. * ensure var name matches type * format
41 lines
1.1 KiB
Nim
41 lines
1.1 KiB
Nim
import std/options
|
|
import chronos, results, confutils, confutils/defs
|
|
import waku
|
|
|
|
type CliArgs = object
|
|
ethRpcEndpoint* {.
|
|
defaultValue: "", desc: "ETH RPC Endpoint, if passed, RLN is enabled"
|
|
.}: string
|
|
|
|
when isMainModule:
|
|
let args = CliArgs.load()
|
|
|
|
echo "Starting Waku node..."
|
|
|
|
let config =
|
|
if (args.ethRpcEndpoint == ""):
|
|
# Create a basic configuration for the Waku node
|
|
# No RLN as we don't have an ETH RPC Endpoint
|
|
NodeConfig.init(
|
|
protocolsConfig = ProtocolsConfig.init(entryNodes = @[], clusterId = 42)
|
|
)
|
|
else:
|
|
# Connect to TWN, use ETH RPC Endpoint for RLN
|
|
NodeConfig.init(ethRpcEndpoints = @[args.ethRpcEndpoint])
|
|
|
|
# Create the node using the library API's createNode function
|
|
let node = (waitFor createNode(config)).valueOr:
|
|
echo "Failed to create node: ", error
|
|
quit(QuitFailure)
|
|
|
|
echo("Waku node created successfully!")
|
|
|
|
# Start the node
|
|
(waitFor startWaku(addr node)).isOkOr:
|
|
echo "Failed to start node: ", error
|
|
quit(QuitFailure)
|
|
|
|
echo "Node started successfully!"
|
|
|
|
runForever()
|