Skip to content

Commit

Permalink
Changes wording to requiredTxnList, as it forces these txns and allow…
Browse files Browse the repository at this point in the history
…s any others.
  • Loading branch information
Andrés Elizondo committed Nov 8, 2024
1 parent 425b3a8 commit 617c8ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ export type EventScraperProps = {
deleteOptions?: DeleteOptions;
tokenMetadataMap?: TokenMetadataMap;
postProcess?: any;
filterFunction?: (events: Event[], transaction: Transaction, allowedTxnList?: Set<string>) => Event[];
filterFunction?: (events: Event[], transaction: Transaction, requiredTxnList?: Set<string>) => Event[];
filterFunctionGetContext?: (
events: Event[],
web3Source: Web3Source,
allowedTxnList?: Set<string>,
requiredTxnList?: Set<string>,
) => Promise<Event[]>;
};

Expand Down
10 changes: 5 additions & 5 deletions src/filters/erc20_transfer_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { getParseTxsAsync } from '../scripts/utils/web3_utils';
export async function filterERC20TransferEventsGetContext(
events: Event[],
web3Source: Web3Source,
allowedTxnList?: Set<string>,
requiredTxnList?: Set<string>,
): Promise<Event[]> {
if (events.length > 0) {
const txHashes = events.map((log: Event) => log.transactionHash);
let validTxHashSet: Set<string>;
if (allowedTxnList && allowedTxnList.size > 0) {
validTxHashSet = allowedTxnList;
if (requiredTxnList && requiredTxnList.size > 0) {
validTxHashSet = requiredTxnList;
} else {
const txData = await getParseTxsAsync(web3Source, txHashes);
const filteredTxsHashes = txData.parsedTxs
Expand All @@ -30,11 +30,11 @@ export async function filterERC20TransferEventsGetContext(
export function filterERC20TransferEvents(
events: Event[],
transaction: Transaction,
allowedTxnList?: Set<string>,
requiredTxnList?: Set<string>,
): Event[] {
const filteredEvents = new Set<Event>();

if (allowedTxnList && allowedTxnList.size > 0 && allowedTxnList.has(transaction.transactionHash)) {
if (requiredTxnList && requiredTxnList.size > 0 && requiredTxnList.has(transaction.transactionHash)) {
events.filter((e) => e !== null).forEach((e) => filteredEvents.add(e));
}

Expand Down

0 comments on commit 617c8ee

Please sign in to comment.