Skip to content

[SDK] Optimize token balance fetching with Insight API #6923

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

Merged

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented May 2, 2025


PR-Codex overview

This PR focuses on enhancing the insight capabilities in the thirdweb package by introducing new functionality to check if insights are enabled for specific chains and refactoring the token balance fetching mechanism to utilize this feature.

Detailed summary

  • Added isInsightEnabled function to check if the "insight" service is enabled for a chain.
  • Refactored createSupportedTokens to filter out tokens with the ZERO_ADDRESS.
  • Introduced fetchBalancesForWallet to consolidate balance fetching logic.
  • Updated balance fetching to utilize insight-enabled chains.
  • Removed obsolete code related to balance fetching from wallets.

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

Copy link

vercel bot commented May 2, 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 May 2, 2025 2:38am
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 2:38am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 2:38am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 2:38am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 2:38am

Copy link

changeset-bot bot commented May 2, 2025

⚠️ No Changeset found

Latest commit: e4d6a04

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

joaquim-verges commented May 2, 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.

Copy link
Contributor

github-actions bot commented May 2, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 50.93 KB (0%) 1.1 s (0%) 222 ms (+124.44% 🔺) 1.3 s
thirdweb (cjs) 143.02 KB (-0.03% 🔽) 2.9 s (-0.03% 🔽) 376 ms (+46.8% 🔺) 3.3 s
thirdweb (minimal + tree-shaking) 5.67 KB (0%) 114 ms (0%) 90 ms (+1070.84% 🔺) 204 ms
thirdweb/chains (tree-shaking) 514 B (0%) 11 ms (0%) 20 ms (+441.15% 🔺) 30 ms
thirdweb/react (minimal + tree-shaking) 19.47 KB (0%) 390 ms (0%) 90 ms (+447.06% 🔺) 479 ms

Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 8.37989% with 164 lines in your changes missing coverage. Please review.

Project coverage is 55.03%. Comparing base (6e87370) to head (e4d6a04).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...tWallet/screens/Buy/swap/fetchBalancesForWallet.ts 4.92% 135 Missing ⚠️
...ectWallet/screens/Buy/swap/TokenSelectorScreen.tsx 3.70% 26 Missing ⚠️
...act/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx 25.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (8.37%) 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    #6923      +/-   ##
==========================================
- Coverage   55.09%   55.03%   -0.07%     
==========================================
  Files         896      897       +1     
  Lines       57193    57296     +103     
  Branches     3955     3959       +4     
==========================================
+ Hits        31511    31530      +19     
- Misses      25585    25670      +85     
+ Partials       97       96       -1     
Flag Coverage Δ
packages 55.03% <8.37%> (-0.07%) ⬇️
Files with missing lines Coverage Δ
packages/thirdweb/src/insight/common.ts 100.00% <100.00%> (ø)
...act/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx 4.69% <25.00%> (-0.02%) ⬇️
...ectWallet/screens/Buy/swap/TokenSelectorScreen.tsx 6.58% <3.70%> (+0.23%) ⬆️
...tWallet/screens/Buy/swap/fetchBalancesForWallet.ts 4.92% <4.92%> (ø)

... and 5 files 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 a96fa91 into main May 2, 2025
25 of 26 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Optimize_token_balance_fetching_with_Insight_API branch May 2, 2025 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant