-
Notifications
You must be signed in to change notification settings - Fork 10
Expose message retrieval by ID (API) as a CCIPAPIClient method #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/APIv2
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| return raw.map((ta) => ({ | ||
| token: ta.tokenAddress, | ||
| amount: BigInt(ta.amount), | ||
| // TODO: API does not provide pool addresses - these require on-chain lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss what's the best approach here.
| ) | ||
| } | ||
|
|
||
| const url = `${this.baseUrl}/v1/messages/${encodeURIComponent(messageId)}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep in mind the order of dependencies between the different components and their rollout plans before merging this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retargeted the PR base to feat/APIv2 (A staging branch for the purpose of behaviour that only works with the new schema)
Coverage Report |
e56402a to
4ccdb3e
Compare
Targeted at a staging branch so we don't merge to
mainchanges that work only for the unreleased API. Unit tested and tested manually through a localhost deployment of the latest CCIP API:What this is
This PR introduces a method to the CCIP API Client that requests a message by messageId, agnostic about any other environment data (CCIP message IDs are unique so this will work across chains and onramps).
To verify the behaviour, I also added a CLI command in the same style as the one for
getLatency. The fields exposed by it are a smaller subset but can be expanded to be more informative if needed.Return type concerns
Currently, the return type of the method is a composite of a
Partialform ofCCIPRequest, and aMetadatatype. The reasons for this are:CCIPRequestis available from the API alone.CCIPRequest.This works fine for now (and could be merged as-is if needed) but ideally we iterate on this until we find a clean common type that we can reuse directly, with the tradeoff of having some optional fields. Reaching this will likely require tweaks on both sides. Here are the rough edges that I found, and how I think we should tackle them:
MessageStatusenum (SDK side) does not yet support 1.7 statuses, where the one in the API does. This is fine and shouldn't be a blocker, because the enums are completely compatible otherwise. Before the SDK supports 1.7, an attempt to retrieve a 1.7 message will fail on validation, which is the expected behaviour.TokenAmountsin the API currently only include the token address on source + the transferred amount, where the SDK expects detailed info including source pool address, destination pool address, extraData and destGasAmount. We could expose this in the API, but I wanted to check with @andrevmatos whether there's a usecase for these fields or whether we can KISS for now. EDIT: Opened a jira ticket to handle the API change needed to expose this data.APICCIPRequestMetadata) which are retrieved from the API and don't exist directly in theCCIPRequesttype. I have no strong opinion on whether these should be integrated intoCCIPRequestor should remain on the side.CCIPRequesttype fields and the API responses. For example, thenonceoronrampmay not exist in the API response whereCCIPRequestexpects it. In case of absence, I've defaulted them to empty values for this draft, but it would be good to make informed decisions on why they're optional or not in either side, unify the ones that can be unified, and converge on what to do otherwise.