feat(SNM): Install `waku sendMessage` command

This commit is contained in:
Emil Ivanichkov 2024-04-19 14:51:08 +03:00 committed by Emil Ivanichkov
parent 289d42a192
commit 3835458412
1 changed files with 15 additions and 1 deletions

View File

@ -112,6 +112,20 @@ proc doWakuHandshakeExport(config: StatusNodeManagerConfig,
WakuExportHandshakeRequestData(exportFile: $config.handshakeFile)
waitFor wakuExportHandshake(wakuClient, requestData)
proc doWakuSendMessage(config: StatusNodeManagerConfig,
wakuClient: var RestClientRef) =
let contentTopic = if config.contentTopic.isSome:
config.contentTopic.get
else:
defaultWakuContentTopic
let requestData = WakuSendMessageRequestData(
message: config.message,
contentTopic: contentTopic
)
waitFor wakuSendMessage(wakuClient, requestData)
proc doWakuCommand(config: StatusNodeManagerConfig, rng: ref HmacDrbgContext) =
var wakuClient = RestClientRef.new(initTAddress(config.restAddress,
config.restPort))
@ -121,7 +135,7 @@ proc doWakuCommand(config: StatusNodeManagerConfig, rng: ref HmacDrbgContext) =
of WakuCommand.exportHandshake:
doWakuHandshakeExport(config, wakuClient)
of WakuCommand.sendMessage:
discard
doWakuSendMessage(config, wakuClient)
when isMainModule:
setupLogLevel(LogLevel.NOTICE)