Skip to content

Conversation

@joaquim-verges
Copy link
Member

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

Fixes TOOL-4213


PR-Codex overview

This PR introduces improvements to wallet image fetching by showing the injected wallet icon when available. It modifies the queryFn in the useQuery hook and updates the fetchWalletImage function to include dynamic imports for wallet providers.

Detailed summary

  • Updated queryFn in useQuery to be asynchronous and handle wallet ID validation.
  • Imported getInstalledWalletProviders from ../../../wallets/injected/mipdStore.js.
  • Enhanced logic to retrieve the injected wallet icon based on the wallet ID.
  • Updated fetchWalletImage to include similar changes for fetching wallet images.

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

@vercel
Copy link

vercel bot commented Apr 27, 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 28, 2025 8:10am
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 8:10am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 8:10am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 8:10am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 8:10am

@changeset-bot
Copy link

changeset-bot bot commented Apr 27, 2025

🦋 Changeset detected

Latest commit: e1b341a

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

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Apr 27, 2025
Copy link
Member Author


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.

@linear
Copy link

linear bot commented Apr 27, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 51.19 KB (0%) 1.1 s (0%) 182 ms (+165.11% 🔺) 1.3 s
thirdweb (cjs) 143.86 KB (0%) 2.9 s (0%) 335 ms (+86.22% 🔺) 3.3 s
thirdweb (minimal + tree-shaking) 5.67 KB (0%) 114 ms (0%) 66 ms (+1377.25% 🔺) 180 ms
thirdweb/chains (tree-shaking) 514 B (0%) 11 ms (0%) 25 ms (+1241.94% 🔺) 35 ms
thirdweb/react (minimal + tree-shaking) 19.38 KB (0%) 388 ms (0%) 121 ms (+869.58% 🔺) 509 ms

@codecov
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 8 lines in your changes missing coverage. Please review.

Project coverage is 55.22%. Comparing base (e9069c9) to head (e1b341a).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/react/core/utils/wallet.ts 55.55% 4 Missing ⚠️
...ckages/thirdweb/src/react/core/utils/walletIcon.ts 55.55% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (55.55%) 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    #6871   +/-   ##
=======================================
  Coverage   55.21%   55.22%           
=======================================
  Files         896      896           
  Lines       57040    57055   +15     
  Branches     3952     3958    +6     
=======================================
+ Hits        31497    31508   +11     
- Misses      25446    25450    +4     
  Partials       97       97           
Flag Coverage Δ
packages 55.22% <55.55%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
packages/thirdweb/src/react/core/utils/wallet.ts 41.35% <55.55%> (+0.44%) ⬆️
...ckages/thirdweb/src/react/core/utils/walletIcon.ts 96.42% <55.55%> (-3.58%) ⬇️

... 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.

id: WalletId;
}) {
export async function fetchWalletImage(props: { id: WalletId }) {
const { getInstalledWalletProviders } = await import(
Copy link
Member

Choose a reason for hiding this comment

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

why the async import here? this will ALWAYS be hit when the function is called (not in an optional branch) so it would be more efficient to have it as part of the main bundle regardless

Copy link
Member Author

Choose a reason for hiding this comment

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

because this is core, which is imported by react native and i rather not trigger this import unless i import that function if im just grabbing an icon const

if (!id) {
throw new Error("Wallet id is required");
}
const { getInstalledWalletProviders } = await import(
Copy link
Member

Choose a reason for hiding this comment

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

same question RE async import

Copy link
Member Author

Choose a reason for hiding this comment

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

same answer

@joaquim-verges joaquim-verges merged commit 0aadcd4 into main Apr 29, 2025
22 of 23 checks passed
@joaquim-verges joaquim-verges deleted the _SDK_Show_injected_wallet_icon_when_available branch April 29, 2025 00:03
@joaquim-verges joaquim-verges mentioned this pull request Apr 29, 2025
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.

3 participants