Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Apr 16, 2025


PR-Codex overview

This PR enhances the NFT functionality by integrating an insight API for fetching NFT data across various extensions, allowing for improved performance and reliability when retrieving NFT information.

Detailed summary

  • Added tokenAddress and chainId fields to multiple NFT-related functions.
  • Integrated insight API for getNFT, getNFTs, and getOwnedNFTs.
  • Updated tests to verify functionality with the insight API.
  • Improved error handling for API responses.
  • Refactored code for consistency and clarity.

The following files were skipped due to too many changes: packages/thirdweb/src/extensions/erc721/read/getNFTs.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Apr 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 8:54pm
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 8:54pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 8:54pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 8:54pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 8:54pm

@changeset-bot
Copy link

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: 898404a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

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

@joaquim-verges joaquim-verges marked this pull request as ready for review April 16, 2025 00:06
@joaquim-verges joaquim-verges requested review from a team as code owners April 16, 2025 00:06
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Apr 16, 2025
Copy link
Member Author

joaquim-verges commented Apr 16, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 16, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 50.5 KB (+0.15% 🔺) 1.1 s (+0.15% 🔺) 260 ms (+112.59% 🔺) 1.3 s
thirdweb (cjs) 138.79 KB (+1.43% 🔺) 2.8 s (+1.43% 🔺) 379 ms (+75.33% 🔺) 3.2 s
thirdweb (minimal + tree-shaking) 5.64 KB (0%) 113 ms (0%) 120 ms (+1781.17% 🔺) 233 ms
thirdweb/chains (tree-shaking) 514 B (0%) 11 ms (0%) 68 ms (+2637.81% 🔺) 78 ms
thirdweb/react (minimal + tree-shaking) 19.41 KB (+0.06% 🔺) 389 ms (+0.06% 🔺) 115 ms (+567% 🔺) 503 ms

@joaquim-verges joaquim-verges force-pushed the _SDK_Use_insight_for_erc721/getNFTs_and_erc721/getOwnedNFTs branch from c261d9a to 898404a Compare April 16, 2025 20:41
Comment on lines +117 to +118
// Exponential backoff: 2^(retries + 1) * 200ms (400ms, 800ms, 1600ms)
const delay = 2 ** (retries + 1) * 200;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exponential backoff calculation is correct, but the comment's example values don't match the actual implementation. For retries=0, the delay would be 2^(0+1) * 200ms = 400ms, for retries=1 it would be 2^2 * 200ms = 800ms, and for retries=2 it would be 2^3 * 200ms = 1600ms. The comment should accurately reflect these values.

Suggested change
// Exponential backoff: 2^(retries + 1) * 200ms (400ms, 800ms, 1600ms)
const delay = 2 ** (retries + 1) * 200;
// Exponential backoff: 2^(retries + 1) * 200ms (retries=0: 400ms, retries=1: 800ms, retries=2: 1600ms)
const delay = 2 ** (retries + 1) * 200;

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@codecov
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 65.88694% with 175 lines in your changes missing coverage. Please review.

Project coverage is 55.09%. Comparing base (e29f749) to head (898404a).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/insight/get-tokens.ts 0.00% 42 Missing ⚠️
...rc/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx 0.00% 36 Missing ⚠️
packages/thirdweb/src/insight/get-nfts.ts 87.93% 20 Missing and 1 partial ⚠️
packages/thirdweb/src/insight/get-transactions.ts 0.00% 20 Missing ⚠️
...ages/thirdweb/src/extensions/erc721/read/getNFT.ts 64.58% 17 Missing ⚠️
...c/extensions/marketplace/english-auctions/utils.ts 0.00% 9 Missing ⚠️
...hirdweb/src/extensions/marketplace/offers/utils.ts 0.00% 7 Missing ⚠️
...ges/thirdweb/src/extensions/erc721/read/getNFTs.ts 83.33% 6 Missing ⚠️
packages/thirdweb/src/social/profiles.ts 0.00% 5 Missing ⚠️
.../react/web/ui/ConnectWallet/screens/ViewTokens.tsx 0.00% 4 Missing ⚠️
... and 5 more

❌ Your patch status has failed because the patch coverage (65.88%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6741      +/-   ##
==========================================
+ Coverage   54.80%   55.09%   +0.29%     
==========================================
  Files         895      896       +1     
  Lines       56384    56714     +330     
  Branches     3850     3911      +61     
==========================================
+ Hits        30899    31246     +347     
+ Misses      25390    25372      -18     
- Partials       95       96       +1     
Flag Coverage Δ
packages 55.09% <65.88%> (+0.29%) ⬆️
Files with missing lines Coverage Δ
...ges/thirdweb/src/extensions/erc1155/read/getNFT.ts 92.30% <100.00%> (+0.41%) ⬆️
...s/thirdweb/src/extensions/erc20/read/getBalance.ts 100.00% <100.00%> (ø)
...hirdweb/src/extensions/erc721/read/getOwnedNFTs.ts 100.00% <100.00%> (ø)
...rc/extensions/marketplace/direct-listings/utils.ts 81.69% <100.00%> (+0.39%) ⬆️
packages/thirdweb/src/insight/common.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/insight/get-events.ts 76.59% <100.00%> (+5.54%) ⬆️
packages/thirdweb/src/insight/index.ts 100.00% <100.00%> (ø)
...es/thirdweb/src/react/web/ui/prebuilt/NFT/utils.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/storage/upload/web-node.ts 24.07% <ø> (+0.43%) ⬆️
packages/thirdweb/src/utils/nft/parseNft.ts 83.52% <100.00%> (+0.81%) ⬆️
... and 17 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joaquim-verges joaquim-verges merged commit 8d4d991 into main Apr 16, 2025
23 of 24 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Use_insight_for_erc721/getNFTs_and_erc721/getOwnedNFTs branch April 16, 2025 22:53
@joaquim-verges joaquim-verges mentioned this pull request Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard. packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants