Skip to content

Commit

Permalink
make prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyijing committed Oct 9, 2024
1 parent f0026f2 commit cfc383b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ export type EventScraperProps = {
tokenMetadataMap?: TokenMetadataMap;
postProcess?: any;
filterFunction?: (events: Event[], transaction: Transaction, allowedTxnList?: Set<string>) => Event[];
filterFunctionGetContext?: (events: Event[], web3Source: Web3Source, allowedTxnList?: Set<string>) => Promise<Event[]>;
filterFunctionGetContext?: (
events: Event[],
web3Source: Web3Source,
allowedTxnList?: Set<string>,
) => Promise<Event[]>;
};

export const eventScrperProps: EventScraperProps[] = [
Expand Down
12 changes: 5 additions & 7 deletions src/scripts/pull_and_save_block_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function parseBlockTransactionsEvents(fullBlock: FullBlock, allowedTxnList?: Set
return null;
})
.filter((tx) => tx !== null) as ParsedTransaction[];

const parsedTransactions: Transaction[] = usefullTxs.map((tx) => tx!.parsedTransaction!);
const parsedTransactionHashes: string[] = parsedTransactions.map((tx) => tx.transactionHash);

Expand Down Expand Up @@ -329,9 +329,7 @@ async function getParseSaveBlocksTransactionsEvents(
return { ...newBlocks[blockIndex], transactions: transactionsWithLogs };
});

const parsedFullBlocks = fullBlocks.map((fullBlock) =>
parseBlockTransactionsEvents(fullBlock, allowedTxnList)
);
const parsedFullBlocks = fullBlocks.map((fullBlock) => parseBlockTransactionsEvents(fullBlock, allowedTxnList));

const eventTables = eventScrperProps
.filter((props) => props.enabled)
Expand Down Expand Up @@ -378,11 +376,11 @@ export class BlockEventsScraper {
const allowedTxnListQuery = await connection.query(
`SELECT DISTINCT transaction_hash
FROM ${SCHEMA}.tx_backfill
WHERE block_number IN (${blockNumbers.join(',')}) AND done = false`
WHERE block_number IN (${blockNumbers.join(',')}) AND done = false`,
);

const allowedTxnList = new Set<string>(
allowedTxnListQuery.map((row: { transaction_hash: string }) => row.transaction_hash)
allowedTxnListQuery.map((row: { transaction_hash: string }) => row.transaction_hash),
);

const newBlocks = await web3Source.getBatchBlockInfoAsync(blockNumbers, true);
Expand All @@ -392,7 +390,7 @@ export class BlockEventsScraper {
producer,
newBlocks,
false,
allowedTxnList
allowedTxnList,
);

if (success) {
Expand Down

0 comments on commit cfc383b

Please sign in to comment.