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

[SDK] Fix: Disconnect smart wallet when signer is disconnected #5617

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Dec 4, 2024

PR-Codex overview

This PR focuses on improving the AccountProvider and DetailsModal components in the thirdweb package, adding error handling and enhancing wallet connection management.

Detailed summary

  • Added error handling in AccountProvider for missing address.
  • Updated DetailsModal to use useCallback for closing the modal.
  • Implemented a check to disconnect the smart wallet when the EOA disconnects.
  • Added tests for error handling in AccountProvider and DetailsModal.
  • Refactored wallet connection logic in createConnectionManager.

The following files were skipped due to too many changes: pnpm-lock.yaml

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

Copy link

linear bot commented Dec 4, 2024

Copy link

vercel bot commented Dec 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 Dec 7, 2024 1:31am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 1:31am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 1:31am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2024 1:31am

Copy link

changeset-bot bot commented Dec 4, 2024

🦋 Changeset detected

Latest commit: c48e0c9

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

Copy link
Contributor

github-actions bot commented Dec 4, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 41.13 KB (0%) 823 ms (0%) 1.9 s (+80.87% 🔺) 2.7 s
thirdweb (cjs) 104.48 KB (0%) 2.1 s (0%) 2 s (-17.06% 🔽) 4.1 s
thirdweb (minimal + tree-shaking) 4.37 KB (0%) 88 ms (0%) 88 ms (-11.12% 🔽) 176 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 48 ms (-9.07% 🔽) 58 ms
thirdweb/react (minimal + tree-shaking) 16.99 KB (+0.47% 🔺) 340 ms (+0.47% 🔺) 486 ms (+86.07% 🔺) 826 ms

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 6 lines in your changes missing coverage. Please review.

Project coverage is 48.97%. Comparing base (625febb) to head (c48e0c9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...hirdweb/src/react/web/ui/ConnectWallet/Details.tsx 66.66% 4 Missing ⚠️
packages/thirdweb/src/wallets/manager/index.ts 94.28% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5617      +/-   ##
==========================================
+ Coverage   48.16%   48.97%   +0.80%     
==========================================
  Files        1089     1089              
  Lines       56875    56891      +16     
  Branches     4363     4440      +77     
==========================================
+ Hits        27396    27861     +465     
+ Misses      28779    28325     -454     
- Partials      700      705       +5     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 625febb
packages 45.02% <88.46%> (+0.99%) ⬆️

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

Files with missing lines Coverage Δ
...web/src/react/web/ui/prebuilt/Account/provider.tsx 80.00% <100.00%> (+5.00%) ⬆️
packages/thirdweb/src/wallets/manager/index.ts 84.38% <94.28%> (+18.73%) ⬆️
...hirdweb/src/react/web/ui/ConnectWallet/Details.tsx 31.19% <66.66%> (+30.13%) ⬆️

... and 8 files with indirect coverage changes

addConnectedWallet(wallet);

if (wallet.id !== "smart") {
Copy link
Member

Choose a reason for hiding this comment

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

hmmm i think this check is important. you sure we can remove this? basically we never want to write 'smart' as the LAST_ACTIVE_EOA_ID

Copy link
Member

joaquim-verges commented Dec 7, 2024

Merge activity

  • Dec 6, 7:21 PM EST: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Dec 6, 7:30 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 6, 7:52 PM EST: A user added this pull request to the Graphite merge queue.
  • Dec 6, 7:55 PM EST: The Graphite merge queue couldn't merge this PR because it had conflicts with the trunk branch.
  • Dec 6, 7:55 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 7, 12:55 AM UTC: The merge label 'merge-queue' was removed. This PR will no longer be merged by the Graphite merge queue
  • Dec 6, 7:55 PM EST: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Dec 6, 8:13 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 6, 8:27 PM EST: A user added this pull request to the Graphite merge queue.
  • Dec 6, 8:31 PM EST: A user merged this pull request with the Graphite merge queue.

Copy link

socket-security bot commented Dec 7, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] network +13 7.34 MB jake7
npm/[email protected] environment, network Transitive: eval, filesystem, shell, unsafe +466 181 MB react-native-bot

View full report↗︎

<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on improving error handling and connection management for smart wallets within the `thirdweb` package, enhancing user experience by ensuring proper disconnection and validation of address inputs.

### Detailed summary
- Added error handling in `AccountProvider` for missing addresses.
- Implemented disconnection logic for smart wallets in `handleSmartWalletConnection`.
- Updated tests to cover new error scenarios and connection handling.
- Refactored `DetailsModal` to manage modal state based on active accounts.
- Improved test coverage for `DetailsModal` and connection manager functionalities.

> The following files were skipped due to too many changes: `pnpm-lock.yaml`

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

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix This pull request should be prioritized in the merge queue. merge-queue Adds the pull request to Graphite's merge queue. packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants