refactor: waitFinalized#263
Merged
Merged
Conversation
…olling
- Add BlockInfo type ({ number, timestamp }) to chain.ts
- Add abstract getBlockInfo(block) returning Promise<BlockInfo>
- Deprecate getBlockTimestamp as concrete wrapper over getBlockInfo
- Rewrite waitFinalized with block-height poller racing getLogs watch:
- New reorgSafetyBlocks option (default: 10)
- New pollIntervalMs option (default: 5000)
- Widen finality to accept number | 'finalized' | 'latest'
- Re-fetch tx on deadline to handle reorgs to later blocks
- Only abort when tx disappears (getTransaction throws)
- Update all chain implementations: EVM, Solana, Aptos, Canton, Sui, TON
- Update test mock in commits.test.ts
- Add waitFinalized.test.ts with 9 unit tests
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
👋 andrevmatos, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
Coverage Report |
- Chain.waitFinalized now returns Promise<BlockInfo> instead of Promise<true> - Use Parameters<Chain['getBlockInfo']>[0] for finality type - Update all test assertions to check BlockInfo shape instead of true - Add test for standalone waitFinalized returning BlockInfo with values - Fix formatting in test mock
261ca73 to
af27262
Compare
aelmanaa
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getBlockTimestamptogetBlockInfo, returning{ number, timestamp }, acceptingfinalitytagsgetBlockTimestampbecomes simple concrete implementation inChain(for backwards compatibility), offloads togetBlockInfoChain.waitFinalizedgetLogswith pollingfinalizedgetBlockInfo, to fail faster when tx/log gets reorgedgetTransaction