diff --git a/src/test_utils/nim_waku.ts b/src/test_utils/nim_waku.ts index b345087f2c..6136517112 100644 --- a/src/test_utils/nim_waku.ts +++ b/src/test_utils/nim_waku.ts @@ -137,20 +137,13 @@ export class NimWaku { async peers(): Promise { this.checkProcess(); - const res = await this.rpcCall('get_waku_v2_admin_v1_peers', []); - - return res.result; + return this.rpcCall('get_waku_v2_admin_v1_peers', []); } async info(): Promise { this.checkProcess(); - const res = await this.rpcCall( - 'get_waku_v2_debug_v1_info', - [] - ); - - return res.result; + return this.rpcCall('get_waku_v2_debug_v1_info', []); } async sendMessage(message: WakuMessage): Promise { @@ -165,23 +158,18 @@ export class NimWaku { contentTopic: message.contentTopic, }; - const res = await this.rpcCall('post_waku_v2_relay_v1_message', [ + return this.rpcCall('post_waku_v2_relay_v1_message', [ RelayDefaultTopic, rpcMessage, ]); - - return res.result; } async messages(): Promise { this.checkProcess(); - const res = await this.rpcCall( - 'get_waku_v2_relay_v1_messages', - [RelayDefaultTopic] - ); - - return res.result; + return this.rpcCall('get_waku_v2_relay_v1_messages', [ + RelayDefaultTopic, + ]); } async getPeerId(): Promise { @@ -220,7 +208,7 @@ export class NimWaku { private async rpcCall( method: string, params: Array - ): Promise<{ result: T }> { + ): Promise { const res = await axios.post( this.rpcUrl, { @@ -234,7 +222,7 @@ export class NimWaku { } ); - return res.data; + return res.data.result; } private checkProcess(): void {