Skip to content
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

fix: pass empty array for missing block explorers in wallet_addEthereumChain #4927

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Oct 4, 2024

Problem solved

Short description of the bug fixed or feature added


PR-Codex overview

This PR focuses on improving the handling of block explorer URLs in the thirdweb wallet integration, specifically addressing compatibility issues with Firefox by ensuring that an empty array is passed when no explorers are found.

Detailed summary

  • Updated the blockExplorerUrls assignment in packages/thirdweb/src/wallets/injected/index.ts to use ?? null instead of potentially undefined.
  • Added a comment indicating the reason for the change, specifically to fix an issue in Firefox.

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

Copy link

vercel bot commented Oct 4, 2024

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 Oct 4, 2024 10:29pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 10:29pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 10:29pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2024 10:29pm

Copy link

changeset-bot bot commented Oct 4, 2024

🦋 Changeset detected

Latest commit: b26ec13

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

This PR includes changesets to release 1 package
Name Type
thirdweb 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

Copy link

graphite-app bot commented Oct 4, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@joaquim-verges joaquim-verges marked this pull request as ready for review October 4, 2024 21:47
Copy link
Member Author

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

Join @joaquim-verges and the rest of your teammates on Graphite Graphite

Copy link
Contributor

github-actions bot commented Oct 4, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 42.1 KB (0%) 842 ms (0%) 3.2 s (+32.06% 🔺) 4 s
thirdweb (cjs) 101.73 KB (0%) 2.1 s (0%) 6.1 s (-0.51% 🔽) 8.2 s
thirdweb (minimal + tree-shaking) 4.82 KB (0%) 97 ms (0%) 331 ms (+82.78% 🔺) 427 ms
thirdweb/chains (tree-shaking) 498 B (0%) 10 ms (0%) 110 ms (+85.33% 🔺) 120 ms
thirdweb/react (minimal + tree-shaking) 17.23 KB (0%) 345 ms (0%) 423 ms (+1.88% 🔺) 768 ms

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 47.61%. Comparing base (d4c423c) to head (b26ec13).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/wallets/injected/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4927      +/-   ##
==========================================
+ Coverage   47.60%   47.61%   +0.01%     
==========================================
  Files        1057     1057              
  Lines       57228    57241      +13     
  Branches     3924     3928       +4     
==========================================
+ Hits        27245    27257      +12     
- Misses      29294    29295       +1     
  Partials      689      689              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from d4c423c
packages 43.37% <0.00%> (+0.01%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
packages/thirdweb/src/wallets/injected/index.ts 4.83% <0.00%> (ø)

... and 3 files with indirect coverage changes

@@ -271,7 +271,7 @@ async function switchChain(provider: Ethereum, chain: Chain) {
chainName: apiChain.name,
nativeCurrency: apiChain.nativeCurrency,
rpcUrls: getValidPublicRPCUrl(apiChain), // no client id on purpose here
blockExplorerUrls: apiChain.explorers?.map((x) => x.url),
blockExplorerUrls: apiChain.explorers?.map((x) => x.url) || [],
Copy link
Member

Choose a reason for hiding this comment

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

null or array of at least 1 element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants