Skip to content

Commit

Permalink
fix: pass empty array for missing block explorers in wallet_addEthere…
Browse files Browse the repository at this point in the history
…umChain
  • Loading branch information
joaquim-verges committed Oct 4, 2024
1 parent 5211446 commit b26ec13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/poor-trainers-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Pass empty array to wallet_addEthereumChain if no block explorers found
3 changes: 2 additions & 1 deletion packages/thirdweb/src/wallets/injected/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ 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),
// @ts-expect-error - fixes firefox, needs to be null not undefined
blockExplorerUrls: apiChain.explorers?.map((x) => x.url) ?? null,

Check warning on line 275 in packages/thirdweb/src/wallets/injected/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/wallets/injected/index.ts#L275

Added line #L275 was not covered by tests
},
],
});
Expand Down

0 comments on commit b26ec13

Please sign in to comment.