From fd402b189d48afaaf01ec296fcf890e7659702e8 Mon Sep 17 00:00:00 2001 From: Julian Merlo Date: Tue, 28 Nov 2023 08:52:01 -0300 Subject: [PATCH] Add comments --- .../infrastructure/repositories/StaticJobRepository.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/blockchain-watcher/src/infrastructure/repositories/StaticJobRepository.ts b/blockchain-watcher/src/infrastructure/repositories/StaticJobRepository.ts index 359d2d6b..9142a36d 100644 --- a/blockchain-watcher/src/infrastructure/repositories/StaticJobRepository.ts +++ b/blockchain-watcher/src/infrastructure/repositories/StaticJobRepository.ts @@ -98,6 +98,7 @@ export class StaticJobRepository implements JobRepository { } private fill() { + // Actions const pollEvmLogs = (jobDef: JobDefinition) => new PollEvmLogs( this.blockRepoProvider(jobDef.source.config.chain), @@ -108,7 +109,6 @@ export class StaticJobRepository implements JobRepository { id: jobDef.id, }) ); - const pollSolanaTransactions = (jobDef: JobDefinition) => new PollSolanaTransactions(this.metadataRepo, this.solanaSlotRepo, this.statsRepo, { ...(jobDef.source.config as PollSolanaTransactionsConfig), @@ -117,16 +117,21 @@ export class StaticJobRepository implements JobRepository { this.sources.set("PollEvmLogs", pollEvmLogs); this.sources.set("PollSolanaTransactions", pollSolanaTransactions); + + // Mappers this.mappers.set("evmLogMessagePublishedMapper", evmLogMessagePublishedMapper); this.mappers.set("solanaLogMessagePublishedMapper", solanaLogMessagePublishedMapper); + // Targets const snsTarget = () => this.snsRepo.asTarget(); const dummyTarget = async () => async (events: any[]) => { log.info(`Got ${events.length} events`); }; + this.targets.set("sns", snsTarget); this.targets.set("dummy", dummyTarget); + // Handlers const handleEvmLogs = async (config: any, target: string, mapper: any) => { const instance = new HandleEvmLogs>( config, @@ -139,7 +144,6 @@ export class StaticJobRepository implements JobRepository { const handleSolanaTx = async (config: any, target: string, mapper: any) => { const instance = new HandleSolanaTransactions(config, mapper, await this.getTarget(target)); - return instance.handle.bind(instance); };