Skip to content

[SDK] Feature: Adds getAdminAccount to ecosystem wallets and cleans up smart account creation #5829

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

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Dec 23, 2024

Also Fixes TOOL-2833


PR-Codex overview

This PR introduces the getAdminAccount method to the inAppWallet interface, enhancing the functionality for Account Abstraction (AA) ecosystem wallets. It also refines wallet connection and disconnection processes, improving the overall wallet management experience.

Detailed summary

  • Added getAdminAccount method to inAppWallet.
  • Updated smartWallet to include getAdminAccount and refactored connection methods.
  • Replaced connectSmartWallet with connectSmartAccount across various files.
  • Enhanced test cases for wallet connection and admin account retrieval.
  • Improved handling of wallet state during connection and disconnection.

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

@gregfromstl gregfromstl requested review from a team as code owners December 23, 2024 20:19
Copy link

linear bot commented Dec 23, 2024

Copy link

changeset-bot bot commented Dec 23, 2024

🦋 Changeset detected

Latest commit: a47600a

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

Copy link
Contributor

graphite-app bot commented Dec 23, 2024

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 Dec 23, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45 KB (0%) 900 ms (0%) 283 ms (+63.29% 🔺) 1.2 s
thirdweb (cjs) 110.81 KB (0%) 2.3 s (0%) 405 ms (+32.98% 🔺) 2.7 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 92 ms (+363.23% 🔺) 204 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 59 ms (+607.07% 🔺) 69 ms
thirdweb/react (minimal + tree-shaking) 19.09 KB (-0.2% 🔽) 382 ms (-0.2% 🔽) 97 ms (+224.68% 🔺) 478 ms

Copy link

codecov bot commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 73.21429% with 15 lines in your changes missing coverage. Please review.

Project coverage is 55.29%. Comparing base (1b103d7) to head (a47600a).
Report is 46 commits behind head on main.

Files with missing lines Patch % Lines
...dweb/src/wallets/in-app/core/wallet/in-app-core.ts 66.66% 7 Missing ⚠️
packages/thirdweb/src/wallets/smart/index.ts 75.00% 3 Missing ⚠️
...ackages/thirdweb/src/wallets/smart/smart-wallet.ts 76.92% 3 Missing ⚠️
...s/thirdweb/src/wallets/in-app/core/wallet/index.ts 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5829      +/-   ##
==========================================
+ Coverage   54.11%   55.29%   +1.17%     
==========================================
  Files        1102     1123      +21     
  Lines       59202    59623     +421     
  Branches     4885     5042     +157     
==========================================
+ Hits        32037    32966     +929     
+ Misses      26441    25935     -506     
+ Partials      724      722       -2     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 1b103d7
packages 52.97% <73.21%> (+1.46%) ⬆️

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

Files with missing lines Coverage Δ
...s/thirdweb/src/wallets/in-app/core/wallet/index.ts 73.62% <80.00%> (+67.24%) ⬆️
packages/thirdweb/src/wallets/smart/index.ts 56.81% <75.00%> (+0.49%) ⬆️
...ackages/thirdweb/src/wallets/smart/smart-wallet.ts 78.64% <76.92%> (+0.20%) ⬆️
...dweb/src/wallets/in-app/core/wallet/in-app-core.ts 63.58% <66.66%> (-1.28%) ⬇️

... and 56 files with indirect coverage changes

@gregfromstl gregfromstl added the merge-queue Adds the pull request to Graphite's merge queue. label Dec 27, 2024
Copy link
Member Author

gregfromstl commented Dec 27, 2024

Merge activity

  • Dec 27, 4:20 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 3, 7:23 PM EST: A user added this pull request to the Graphite merge queue.
  • Jan 3, 7:26 PM EST: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Unit Tests').

Copy link
Member

@jnsdls jnsdls left a comment

Choose a reason for hiding this comment

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

I don't have full context but LGTM from what I understand

gregfromstl added a commit that referenced this pull request Jan 4, 2025
… up smart account creation (#5829)

Also Fixes TOOL-2833

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new method, `getAdminAccount`, to the `inAppWallet` interface, enhancing support for account abstraction (AA) wallets. It also refactors existing wallet connection methods to streamline interactions with smart accounts.

### Detailed summary
- Added `getAdminAccount` method to `inAppWallet` interface.
- Refactored wallet connection methods from `connectSmartWallet` to `connectSmartAccount`.
- Updated tests to reflect new connection methods and account handling.
- Enhanced logic to determine if an account is a smart account.
- Improved error handling for personal account connections.

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

<!-- end pr-codex -->
@gregfromstl gregfromstl force-pushed the greg/tool-2832-add-getadminaccount-to-smart-ecosystem-wallets branch from 3a9fa64 to ca3cbca Compare January 4, 2025 00:24
@graphite-app graphite-app bot removed the merge-queue Adds the pull request to Graphite's merge queue. label Jan 4, 2025
@@ -46,6 +47,7 @@ export function createInAppWallet(args: {
const { createOptions: _createOptions, connectorFactory, ecosystem } = args;
const walletId = ecosystem ? ecosystem.id : "inApp";
const emitter = createWalletEmitter<"inApp">();
let isSmartWallet = false;
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this?

return undefined;
} else {
// This might return an admin account (if the main account is a smart account), otherwise it'll return undefined
return getAdminAccountForSmartAccount(account);
Copy link
Member

Choose a reason for hiding this comment

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

How about we just store the admin account the same way we store the active account?

Would rather not rely on an in-memory map if possible.

That way you don't need the boolean flag either, just keep both accounts around

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, I like that much better

@gregfromstl gregfromstl force-pushed the greg/tool-2832-add-getadminaccount-to-smart-ecosystem-wallets branch from db093ab to a47600a Compare January 5, 2025 07:36
@gregfromstl gregfromstl merged commit e01193a into main Jan 6, 2025
30 of 31 checks passed
@gregfromstl gregfromstl deleted the greg/tool-2832-add-getadminaccount-to-smart-ecosystem-wallets branch January 6, 2025 05:40
@jnsdls jnsdls mentioned this pull request Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants