Add comments

This commit is contained in:
Julian Merlo 2023-11-28 08:52:01 -03:00
parent ca1be605f1
commit fd402b189d
1 changed files with 6 additions and 2 deletions

View File

@ -98,6 +98,7 @@ export class StaticJobRepository implements JobRepository {
} }
private fill() { private fill() {
// Actions
const pollEvmLogs = (jobDef: JobDefinition) => const pollEvmLogs = (jobDef: JobDefinition) =>
new PollEvmLogs( new PollEvmLogs(
this.blockRepoProvider(jobDef.source.config.chain), this.blockRepoProvider(jobDef.source.config.chain),
@ -108,7 +109,6 @@ export class StaticJobRepository implements JobRepository {
id: jobDef.id, id: jobDef.id,
}) })
); );
const pollSolanaTransactions = (jobDef: JobDefinition) => const pollSolanaTransactions = (jobDef: JobDefinition) =>
new PollSolanaTransactions(this.metadataRepo, this.solanaSlotRepo, this.statsRepo, { new PollSolanaTransactions(this.metadataRepo, this.solanaSlotRepo, this.statsRepo, {
...(jobDef.source.config as PollSolanaTransactionsConfig), ...(jobDef.source.config as PollSolanaTransactionsConfig),
@ -117,16 +117,21 @@ export class StaticJobRepository implements JobRepository {
this.sources.set("PollEvmLogs", pollEvmLogs); this.sources.set("PollEvmLogs", pollEvmLogs);
this.sources.set("PollSolanaTransactions", pollSolanaTransactions); this.sources.set("PollSolanaTransactions", pollSolanaTransactions);
// Mappers
this.mappers.set("evmLogMessagePublishedMapper", evmLogMessagePublishedMapper); this.mappers.set("evmLogMessagePublishedMapper", evmLogMessagePublishedMapper);
this.mappers.set("solanaLogMessagePublishedMapper", solanaLogMessagePublishedMapper); this.mappers.set("solanaLogMessagePublishedMapper", solanaLogMessagePublishedMapper);
// Targets
const snsTarget = () => this.snsRepo.asTarget(); const snsTarget = () => this.snsRepo.asTarget();
const dummyTarget = async () => async (events: any[]) => { const dummyTarget = async () => async (events: any[]) => {
log.info(`Got ${events.length} events`); log.info(`Got ${events.length} events`);
}; };
this.targets.set("sns", snsTarget); this.targets.set("sns", snsTarget);
this.targets.set("dummy", dummyTarget); this.targets.set("dummy", dummyTarget);
// Handlers
const handleEvmLogs = async (config: any, target: string, mapper: any) => { const handleEvmLogs = async (config: any, target: string, mapper: any) => {
const instance = new HandleEvmLogs<LogFoundEvent<any>>( const instance = new HandleEvmLogs<LogFoundEvent<any>>(
config, config,
@ -139,7 +144,6 @@ export class StaticJobRepository implements JobRepository {
const handleSolanaTx = async (config: any, target: string, mapper: any) => { const handleSolanaTx = async (config: any, target: string, mapper: any) => {
const instance = new HandleSolanaTransactions(config, mapper, await this.getTarget(target)); const instance = new HandleSolanaTransactions(config, mapper, await this.getTarget(target));
return instance.handle.bind(instance); return instance.handle.bind(instance);
}; };