kkrt-labs / kakarot-rpc

Kakarot ZK EVM Ethereum RPC adapter
MIT License
108 stars 89 forks source link

dev: reorganize and cleanup indexer `transaction.ts` #1221

Closed tcoratger closed 2 weeks ago

tcoratger commented 1 month ago

Describe the Enhancement Request

At the moment, our transaction.ts file contains a lot of different logic in multiple functions.

https://github.com/kkrt-labs/kakarot-rpc/blob/main/indexer/src/types/transaction.ts

As many elements have been added recently, it would be useful to reorganize the contents of this file into modules, structures, and objects to achieve a more functional and idiomatic TypeScript implementation while preserving exactly the same functionalities.

Goals

Action Items

  1. Modularization

    • Identify distinct functionalities and group them into appropriate modules.
    • Create separate files for different logical units.
  2. Refactoring

    • Refactor functions to use TypeScript's features like interfaces, types, and classes.
    • Simplify complex functions for better readability.
  3. Documentation

    • Add detailed comments and JSDoc for better understanding and maintainability.
  4. Testing

    • Ensure all existing tests pass after refactoring.
    • Write new tests if necessary to cover any new code paths introduced during refactoring.

These action items are just ideas, feel free to challenge it and propose something better.

isvallrod commented 1 month ago

Hi, I would like to take a look at this issue and work on it

dznes commented 1 month ago

Hello, i would like to solve this issue.