Skip to content

Commit

Permalink
check if topics is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
mssabr01 committed Dec 11, 2024
1 parent 637ad6f commit e332dfb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e332dfb

Please sign in to comment.