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]: move autoConnect function into it's own standalone function #5889

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ElasticBottle
Copy link
Contributor

@ElasticBottle ElasticBottle commented Jan 6, 2025


title: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

https://linear.app/thirdweb/issue/TOOL-2697/add-js-autoconnect

Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

How to test

Unit tests, playground, etc.


PR-Codex overview

This PR focuses on refactoring the auto-connect functionality for wallets in the thirdweb library, enhancing the separation of concerns and improving the structure of the code. It introduces a standalone autoConnect function and updates various components to utilize it.

Detailed summary

  • Introduced a standalone autoConnect function in packages/thirdweb/src/wallets/connection/autoConnect.ts.
  • Updated useAutoConnectCore to utilize autoConnectCore.
  • Refactored types and imports for AutoConnectProps to point to the new structure.
  • Modified tests to accommodate the new autoConnect implementation.
  • Changed wallet connection logic to improve clarity and maintainability.
  • Updated multiple components to use the new wallet connection logic.

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

Copy link

linear bot commented Jan 6, 2025

Copy link

changeset-bot bot commented Jan 6, 2025

🦋 Changeset detected

Latest commit: 48a74ba

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Minor
@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

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ❌ Failed (Inspect) Jan 14, 2025 9:54am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 9:54am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 9:54am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 9:54am

Copy link

graphite-app bot commented Jan 6, 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.

fix: import errors
Copy link
Contributor

github-actions bot commented Jan 6, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45.65 KB (0%) 913 ms (0%) 385 ms (+192.24% 🔺) 1.3 s
thirdweb (cjs) 115.43 KB (0%) 2.4 s (0%) 474 ms (+8.94% 🔺) 2.8 s
thirdweb (minimal + tree-shaking) 5.59 KB (0%) 112 ms (0%) 105 ms (+317.21% 🔺) 217 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 7 ms (-12.94% 🔽) 17 ms
thirdweb/react (minimal + tree-shaking) 19.21 KB (0%) 385 ms (0%) 76 ms (+77.22% 🔺) 460 ms

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 86.79245% with 21 lines in your changes missing coverage. Please review.

Project coverage is 54.95%. Comparing base (0682f26) to head (48a74ba).

Files with missing lines Patch % Lines
...thirdweb/src/wallets/connection/autoConnectCore.ts 88.61% 13 Missing and 1 partial ⚠️
...ges/thirdweb/src/wallets/connection/autoConnect.ts 70.83% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5889      +/-   ##
==========================================
+ Coverage   54.85%   54.95%   +0.09%     
==========================================
  Files        1142     1144       +2     
  Lines       60928    60971      +43     
  Branches     5140     5151      +11     
==========================================
+ Hits        33424    33504      +80     
+ Misses      26777    26740      -37     
  Partials      727      727              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 5da7bbb
packages 52.61% <86.79%> (+0.11%) ⬆️

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

Files with missing lines Coverage Δ
...web/src/react/core/hooks/wallets/useAutoConnect.ts 100.00% <100.00%> (+41.35%) ⬆️
...dweb/src/react/web/hooks/wallets/useAutoConnect.ts 94.73% <ø> (ø)
...rdweb/src/react/web/ui/AutoConnect/AutoConnect.tsx 100.00% <ø> (ø)
...b/src/react/web/ui/ConnectWallet/ConnectButton.tsx 49.01% <ø> (ø)
.../react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx 12.44% <ø> (ø)
...tWallet/screens/WalletSwitcherConnectionScreen.tsx 4.00% <ø> (ø)
...irdweb/src/react/web/wallets/in-app/WalletAuth.tsx 1.34% <ø> (ø)
packages/thirdweb/src/utils/timeoutPromise.ts 100.00% <ø> (ø)
packages/thirdweb/src/wallets/defaultWallets.ts 100.00% <100.00%> (ø)
...irdweb/src/wallets/in-app/web/lib/get-url-token.ts 100.00% <100.00%> (ø)
... and 2 more

... and 6 files with indirect coverage changes

feat: expose autoConnect function
@ElasticBottle ElasticBottle marked this pull request as ready for review January 6, 2025 10:15
@ElasticBottle ElasticBottle requested review from a team as code owners January 6, 2025 10:15
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground January 6, 2025 12:25 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 January 6, 2025 12:25 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui January 6, 2025 12:25 Inactive
Copy link
Contributor

This PR has been inactive for 7 days. It is now marked as stale and will be closed in 2 days if no further activity occurs.

@github-actions github-actions bot added the Stale label Jan 14, 2025
refactor: move connection manager into an internal construct
@ElasticBottle ElasticBottle added the merge-queue Adds the pull request to Graphite's merge queue. label Jan 14, 2025
Copy link
Contributor Author

ElasticBottle commented Jan 14, 2025

Merge activity

  • Jan 14, 4:45 AM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 14, 4:45 AM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-queue Adds the pull request to Graphite's merge queue. packages SDK Involves changes to the thirdweb SDK Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants