Skip to content

[SDK]: move autoConnect function into it's own standalone function #5889

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

Merged
merged 1 commit into from
Jan 14, 2025

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 primarily focuses on refactoring the autoConnect functionality within the thirdweb library, enhancing its usability by exposing it as a standalone function. It also updates the import paths and types related to AutoConnectProps.

Detailed summary

  • Refactored autoConnect to be a standalone function in packages/thirdweb/src/wallets/connection/autoConnect.ts.
  • Updated import paths for AutoConnectProps to point to the wallets directory.
  • Modified components and hooks to use the new autoConnect function.
  • Adjusted test files to ensure compatibility with the new structure and functionality.
  • Removed deprecated code related to wallet connection handling.

✨ 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: 7a3dff0

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 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:59pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:59pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:59pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:59pm

Copy link
Contributor

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.

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) 46.68 KB (0%) 934 ms (0%) 252 ms (+12.49% 🔺) 1.2 s
thirdweb (cjs) 116.72 KB (0%) 2.4 s (0%) 433 ms (-17.35% 🔽) 2.8 s
thirdweb (minimal + tree-shaking) 5.59 KB (0%) 112 ms (0%) 147 ms (+646.24% 🔺) 259 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 6 ms (-16.3% 🔽) 16 ms
thirdweb/react (minimal + tree-shaking) 19.24 KB (0%) 385 ms (0%) 76 ms (+27.71% 🔺) 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.96%. Comparing base (e331e43) to head (7a3dff0).
Report is 1 commits behind head on main.

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.83%   54.96%   +0.13%     
==========================================
  Files        1142     1144       +2     
  Lines       60952    60995      +43     
  Branches     5138     5156      +18     
==========================================
+ Hits        33422    33527     +105     
+ Misses      26806    26740      -66     
- Partials      724      728       +4     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from e331e43
packages 52.63% <86.79%> (+0.16%) ⬆️

*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 7 files with indirect coverage changes

@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.
  • Jan 14, 12:39 PM EST: A user added this pull request to the Graphite merge queue.
  • Jan 14, 1:00 PM EST: A user merged this pull request with the Graphite merge queue.

ElasticBottle added a commit that referenced this pull request Jan 14, 2025
…5889)

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

<!-- start pr-codex -->

---

## 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}`

<!-- end pr-codex -->
@ElasticBottle ElasticBottle force-pushed the winston/tool-2697-add-js-autoconnect branch from 48a74ba to b95c119 Compare January 14, 2025 17:40
…5889)

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

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring the auto-connect functionality for wallets in the `thirdweb` library. It enhances the modularity and usability of the `autoConnect` feature, allowing it to be used outside of React components and streamlining wallet connection processes.

### Detailed summary
- Modified `if` condition in `timeoutPromise.ts` to check for `typeof window`.
- Updated import paths for `AutoConnectProps` in `AutoConnect.tsx` files.
- Exposed `autoConnect` function in `wallets.ts` for external use.
- Adjusted exports in `react.ts` and `react.native.ts` for `AutoConnectProps`.
- Refactored `useAutoConnectCore` to use `autoConnectCore`.
- Consolidated wallet connection logic in `autoConnect` and `autoConnectCore`.
- Updated tests to reflect changes in wallet connection handling and added new test cases for `autoConnect`.
- Enhanced error handling and timeout logic in wallet connection processes.

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