feat(sdk): add getMessagesInRange for block/slot-based CCIP message d…#220
Draft
feat(sdk): add getMessagesInRange for block/slot-based CCIP message d…#220
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coverage Report |
1af4090 to
19b6a56
Compare
19b6a56 to
07b40cb
Compare
andrevmatos
reviewed
Apr 10, 2026
| ): AsyncIterableIterator<CCIPRequest> { | ||
| for await (const log of source.getLogs({ | ||
| ...opts, | ||
| topics: opts.topics ?? ['CCIPSendRequested', 'CCIPMessageSent'], |
Collaborator
There was a problem hiding this comment.
Improvement: CCIPSendRequested is for CCIP<=1.5, which is EVM-only;
CCIP v1.6 and v2.0, it's called CCIPMessageSent.
If you inspect on source.network.family to pass/default only the later on anything other than EVM, you may make this function more compatible with all chain families
Context: Aptos (and maybe Sui) can only handle 1 topic in getLogs' opts, because it needs to inspect some "array" of events on-chain which are named and can therefore only handle exactly 1 topic.
Suggested change
| topics: opts.topics ?? ['CCIPSendRequested', 'CCIPMessageSent'], | |
| topics: opts.topics ?? [...(source.network.family === ChainFamily.EVM ? ['CCIPSendRequested'] : []), 'CCIPMessageSent'], |
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.
This pull request introduces a new feature for range-based discovery of CCIP messages in the SDK, along with related updates to the CLI and tests. The main addition is the
getMessagesInRange()method, which enables efficient scanning and decoding of CCIP messages across block/slot ranges. The implementation includes robust test coverage and code refactoring to share lane resolution logic. Additionally, two new Creditcoin networks are added to the chain selectors.CCIP Message Discovery Enhancements
getMessagesInRange()method to the abstractChainclass and exported it from the SDK, enabling range-based CCIP message discovery usinggetLogsanddecodeMessage. This returns anAsyncIterableIterator<CCIPRequest>and is documented for both EVM and Solana chains. (ccip-sdk/src/chain.ts,ccip-sdk/src/requests.ts,ccip-sdk/src/index.ts,CHANGELOG.md) [1] [2] [3] [4]resolveLanehelper to unify lane resolution logic for decoded messages, reducing code duplication in message discovery functions. (ccip-sdk/src/requests.ts) [1] [2] [3]Testing Improvements
getMessagesInRange, covering correct message extraction, lane resolution for different CCIP versions, log filtering, transaction fallback, and empty results. (ccip-sdk/src/requests.test.ts)Chain Selector Updates
ccip-sdk/src/selectors.ts)Minor/Other Changes
ccip-sdk/src/api/index.ts,ccip-cli/src/index.ts) [1] [2]ccip-sdk/src/evm/errors.ts,ccip-sdk/src/requests.ts) [1] [2] [3]These changes collectively improve the SDK's ability to discover and process CCIP messages across block ranges, making it easier to build tools that require historical or batch message analysis.