-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
feat: ccip read #427
feat: ccip read #427
Conversation
🦋 Changeset detectedLatest commit: 7188d48 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +5.17 kB (+2%) Total Size: 257 kB
ℹ️ View Unchanged
|
Codecov Report
@@ Coverage Diff @@
## main #427 +/- ##
========================================
Coverage 99.93% 99.93%
========================================
Files 267 269 +2
Lines 22655 22895 +240
Branches 1924 1959 +35
========================================
+ Hits 22641 22881 +240
Misses 14 14
|
src/errors/request.ts
Outdated
].filter(Boolean) as string[], | ||
}) | ||
this.body = body | ||
if (body) this.body = body |
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.
body
undefined
if not provided so seems correct the way it was before.
if (body) this.body = body | |
this.body = body |
@@ -159,6 +161,9 @@ export async function call<TChain extends Chain | undefined>( | |||
if (response === '0x') return { data: undefined } | |||
return { data: response } | |||
} catch (err) { | |||
const data = getRevertErrorData(err) | |||
if (data?.slice(0, 10) === offchainLookupSignature && to) | |||
return { data: await offchainLookup(client, { data, to }) } |
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.
Dynamic import offchainLookup
?
const { args } = decodeErrorResult({ | ||
data, | ||
abi: [offchainLookupAbiItem], | ||
}) as unknown as GetErrorArgs< |
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.
Unrelated to this PR: Wonder if it's worth adding an optional errorName
property to decodeErrorResult
that narrows the return type and adds some runtime validation. Could also make DecodeErrorResultReturnType
generic and return union of possible errors if errorName
isn't provided.
src/utils/ccip.ts
Outdated
const [sender, urls, callData, callbackSelector, extraData] = args | ||
|
||
try { | ||
if (to.toLowerCase() !== sender.toLowerCase()) |
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.
!isAddressEqual(to, sender)
?
PR-Codex overview
This PR adds support for EIP-3668 CCIP Read and introduces an
OffchainLookupExample
contract. It also exportsOffchainLookup
and related functions, and adds several error classes for handling offchain lookup errors.Detailed summary
OffchainLookupExample
contract.OffchainLookup
and related functions.