From 935e2786757e4699e99195e9697d096b033d0ebf Mon Sep 17 00:00:00 2001 From: Emil Ivanichkov Date: Thu, 9 May 2024 15:20:45 +0200 Subject: [PATCH] refactor(SNM): Handle `noise` option of `sendMessage` command --- src/status_node_manager.nim | 8 +++++++- src/status_node_manager/rest/apis/waku/rest_waku_api.nim | 3 ++- src/status_node_manager/rest/apis/waku/types.nim | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/status_node_manager.nim b/src/status_node_manager.nim index cfb0b13..c2f4c2d 100644 --- a/src/status_node_manager.nim +++ b/src/status_node_manager.nim @@ -119,9 +119,15 @@ proc doWakuSendMessage(config: StatusNodeManagerConfig, else: defaultWakuContentTopic + let noise = if config.noise.isSome: + config.noise.get + else: + false + let requestData = WakuSendMessageRequestData( message: config.message, - contentTopic: contentTopic + contentTopic: contentTopic, + noise: noise ) waitFor wakuSendMessage(wakuClient, requestData) diff --git a/src/status_node_manager/rest/apis/waku/rest_waku_api.nim b/src/status_node_manager/rest/apis/waku/rest_waku_api.nim index 4cc9a2c..9370445 100644 --- a/src/status_node_manager/rest/apis/waku/rest_waku_api.nim +++ b/src/status_node_manager/rest/apis/waku/rest_waku_api.nim @@ -101,7 +101,8 @@ proc installWakuApiHandlers*(router: var RestRouter, try: let wakuSendResult = wakuSendMessage(wakuHost, wakuSendMessageData.message, - wakuSendMessageData.contentTopic) + wakuSendMessageData.contentTopic, + wakuSendMessageData.noise) notice "Waku message sent successfully! Request fulfilled." return RestApiResponse.response("Message sent successfully", diff --git a/src/status_node_manager/rest/apis/waku/types.nim b/src/status_node_manager/rest/apis/waku/types.nim index 2bcb4e4..83200e9 100644 --- a/src/status_node_manager/rest/apis/waku/types.nim +++ b/src/status_node_manager/rest/apis/waku/types.nim @@ -11,3 +11,4 @@ type WakuExportHandshakeRequestData* = object type WakuSendMessageRequestData* = object message*: string contentTopic*: string + noise*: bool