From 22ac838473419636624505c213e0fb5e0be868c4 Mon Sep 17 00:00:00 2001 From: Mehdi Sabraoui Date: Fri, 6 Dec 2024 15:02:39 -0500 Subject: [PATCH] check if topics is an array --- src/api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 1b042467..9cb1faa1 100755 --- a/src/api.ts +++ b/src/api.ts @@ -2892,12 +2892,14 @@ export const methods = { countFailedResponse(api_name, 'filter not found') return } + //address may or may not be an array if (Array.isArray(inputFilter.address) && inputFilter.address.length > 100) { callback({ code: -32000, message: 'Invalid address' }, null) countFailedResponse(api_name, 'Invalid address') return } - if (inputFilter.topics.length > 200) { + //filter topics should always be an array. If not array, or if array bigger than 200 elements, return error + if (!Array.isArray(inputFilter.topics) || inputFilter.topics.length > 200) { callback({ code: -32000, message: 'Invalid topics' }, null) countFailedResponse(api_name, 'Invalid topics') return