-
Notifications
You must be signed in to change notification settings - Fork 513
Get events from insight #6683
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
Get events from insight #6683
Conversation
🦋 Changeset detectedLatest commit: b6ba290 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 ↗︎
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
size-limit report 📦
|
} | ||
|
||
const clientFetch = getClientFetch(client); | ||
const result = await clientFetch(url.toString()); |
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.
should always check for error on response btw. and parse the error. will fix it when i switch to the autogen api though
throw new Error(result.error.error); | ||
throw new Error( | ||
`${result.response.status} ${result.response.statusText} - ${result.error ? stringify(result.error) : "Unknown error"}`, | ||
); | ||
} | ||
return result.data.data || []; |
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.
There's a potential null reference issue in this code. The expression result.data.data || []
will throw a TypeError if result.data
is undefined.
This pattern is inconsistent with the other insight functions in get-nfts.ts and get-tokens.ts, which use the nullish coalescing operator with optional chaining: result.data?.data ?? []
.
To prevent runtime errors when the API returns a response without a data property, consider updating this line to:
return result.data?.data ?? [];
This change would make the error handling consistent across all insight functions and provide better resilience against unexpected API responses.
return result.data.data || []; | |
return result.data?.data ?? []; |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
PR-Codex overview
This PR focuses on enhancing the
thirdweb
library by introducing new features, improving error handling, and updating existing functionalities related to event fetching and chain services.Detailed summary
ChainService
type totypes.ts
..size-limit.json
.getContractEvents
method inget-events.ts
for fetching indexed events.getOwnedNFTs
andgetOwnedTokens
.useIndexer
parameter for fetching events.getContractEvents
to include indexer functionality.ready-tigers-pump.md
.