[Proxy colonies] Feat: create proxy chain block ingestor #298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the proxy block ingestor pnpm app into the workspace that will be responsible for processing the proxy colonies related events.
CDapp PR
This is basically reinventing NestJS at this point 😅
The line changes seem absolutely severe, but it's a lot of just moving existing code around, but turning it into classes, and imports, so it's a chonker but not that bad!
We had instances of everything done functional before, which worked fine for a single ingestor, but once we started working on the second one, we quickly realized that we're gonna need dependency injection.
For example,
eventListener
just added handlers to an array, but in order to use it in two apps, we needed to pull it out into a separate package, then instantiate it on each app separately.The
blockListener
previously just directly used the runningeventListener
instance. Now theblockListener
has been turned into a reusable class calledBlockManager
which relies on a renamedeventListener
:eventManager
. How to solve all of this?Create the
BlockManager
with an instance ofeventManager
, so we can have different instances ofBlockManager
which all just receiveeventManager
instances from each app.This way, each app just creates its own
eventManager
and then theBlockManager
with its instance ofeventManager
. Then theBlockManager
won't care about app proprietary logic, it will just call functions on that instance, getting back data specific to the app it's running in!Changes
blockListener
andblockProcessor
into a new entity calledBlockManager
which does the same things as the two before, additionaly it does event matching (so it's easier to call that)eventListener
into a new class, so we can share instances of it across a running chainamplifyClient.mutate
instead of justmutate