]> git.ardis.lu - event-hashes/commitdiff
Parse events with space between name and parenthesis
authorArdis Lu <ardisglu@gmail.com>
Sun, 11 Feb 2024 01:28:38 +0000 (17:28 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sun, 11 Feb 2024 01:28:38 +0000 (17:28 -0800)
E.g. "event Example (address,address,uint);"

index.html

index 2707025ba069774dbf03e3757e6ed8ecaaa808de..e52a15be55fc1df181f032159ec7b7a30e7eb7a1 100644 (file)
 
       // Split the event name and the event topics
       const eventRegex = strict ?
-        /^(event )(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<topics>.*?)(?!.+\))/ :
-        /^(event )?(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<topics>.*?)(?!.+\))/;
+        /^(event )(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<topics>.*?)(?!.+\))/ :
+        /^(event )?(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<topics>.*?)(?!.+\))/;
       const { name, topics } = eventRegex.exec(event).groups;
 
       // Drop parameter names and extraneous whitespace, if there are any. Preserves tuple parentheses.
This page took 0.041236 seconds and 4 git commands to generate.