feat(cli/pair): Implement `pair` CLI command
This commit is contained in:
parent
b188b19e62
commit
fa6fdc5d53
|
@ -1,13 +1,37 @@
|
|||
# This is just an example to get you started. A typical hybrid package
|
||||
# uses this file as the main entry point of the application.
|
||||
|
||||
import
|
||||
std/[strutils, typetraits],
|
||||
confutils,
|
||||
status_node_manager/[
|
||||
chronos,
|
||||
libp2p/crypto/crypto,
|
||||
eth/[p2p/discoveryv5/enr],
|
||||
chronicles/[log_output, topics_registry],
|
||||
waku/[waku_core]
|
||||
|
||||
import status_node_manager/[
|
||||
config,
|
||||
helpers/submodule # TODO: remove me
|
||||
]
|
||||
|
||||
import ../libs/waku_utils/waku_pair
|
||||
|
||||
proc setupLogLevel*(level: LogLevel) =
|
||||
topics_registry.setLogLevel(level)
|
||||
|
||||
proc doWakuPairing(config: StatusNodeManagerConfig, rng: ref HmacDrbgContext) =
|
||||
let wakuPairResult = waitFor wakuPair(rng, config.qr, config.qrMessageNameTag,
|
||||
config.wakuPort, config.discv5Port,
|
||||
config.requiredConnectedPeers,
|
||||
config.pubSubTopic)
|
||||
echo wakuPairResult.wakuHandshakeResult
|
||||
|
||||
when isMainModule:
|
||||
let conf = load Config
|
||||
echo(getWelcomeMessage()) # TODO: remove me
|
||||
setupLogLevel(LogLevel.NOTICE)
|
||||
|
||||
let rng = crypto.newRng()
|
||||
|
||||
let conf = load StatusNodeManagerConfig
|
||||
|
||||
case conf.cmd
|
||||
of SNMStartUpCmd.noCommand: echo(getWelcomeMessage()) # TODO: remove me
|
||||
of SNMStartUpCmd.pair: doWakuPairing(conf, rng)
|
||||
|
||||
|
|
Loading…
Reference in New Issue