Skip to content

Conversation

@NikolasHaimerl
Copy link
Contributor

The websocket indexer uses the transaction receipt during the processing of events. However, not every event needs the receipt during its processing. To avoid unnecessary RPC calls we make the fetching of the transaction receipt a lazy execution, meaning we only make the call when we actually need it. We use the package https://www.npmjs.com/package/p-lazy?activeTab=readme for this purpose.

@NikolasHaimerl NikolasHaimerl changed the base branch from master to stage January 8, 2026 09:09
@NikolasHaimerl NikolasHaimerl changed the base branch from stage to nikolas/ws-specific-rpc-urls January 8, 2026 09:10
): Promise<boolean> => {
// Check if receipt is present in payload
const receipt = payload.transactionReceipt;
const receipt = await payload.transactionReceipt;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the rpc call is actually made, at the place where we need it.

Copy link
Contributor

@amateima amateima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍 Short but every effective!

@NikolasHaimerl NikolasHaimerl merged commit 64b93d1 into nikolas/ws-specific-rpc-urls Jan 9, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants