Skip to content

[SDK] Feature: Adds deploySmartAccount and re-adds 1271 signatures #5845

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 27, 2024

PR-Codex overview

This PR introduces the deploySmartAccount function to facilitate the deployment of smart accounts and updates the handling of signatures for already deployed accounts to use ERC-1271 signatures.

Detailed summary

  • Added deploySmartAccount function for deploying smart accounts.
  • Updated createWallet to include connection with smart wallets.
  • Refactored decodeError, decodeFunctionData, and decodeFunctionResult to use ox__Abi.
  • Enhanced error handling in verifyHash and verifyEip1271Signature.
  • Updated tests to validate the new deployment and signature features.

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}

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

linear bot commented Dec 27, 2024

Copy link

changeset-bot bot commented Dec 27, 2024

🦋 Changeset detected

Latest commit: 720f290

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 27, 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 7, 2025 2:07am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 2:07am
thirdweb-www ❌ Failed (Inspect) Jan 7, 2025 2:07am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 2:07am

Copy link
Contributor

graphite-app bot commented Dec 27, 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 27, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45.31 KB (+0.71% 🔺) 907 ms (+0.71% 🔺) 1.8 s (-61.53% 🔽) 2.7 s
thirdweb (cjs) 114.8 KB (+3.61% 🔺) 2.3 s (+3.61% 🔺) 2.9 s (-66.48% 🔽) 5.2 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 104 ms (-75.04% 🔽) 215 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 28 ms (-76.06% 🔽) 38 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (+0.23% 🔺) 383 ms (+0.23% 🔺) 312 ms (-67.51% 🔽) 695 ms

Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 81.94444% with 26 lines in your changes missing coverage. Please review.

Project coverage is 54.56%. Comparing base (7293dfa) to head (4a5b4b4).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/wallets/smart/lib/signing.ts 79.36% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5845      +/-   ##
==========================================
+ Coverage   54.53%   54.56%   +0.03%     
==========================================
  Files        1105     1105              
  Lines       59332    59409      +77     
  Branches     4924     4931       +7     
==========================================
+ Hits        32354    32414      +60     
- Misses      26258    26274      +16     
- Partials      720      721       +1     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 7293dfa
packages 52.06% <81.94%> (+0.04%) ⬆️

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

Files with missing lines Coverage Δ
packages/thirdweb/src/auth/verify-hash.ts 72.82% <100.00%> (+2.03%) ⬆️
packages/thirdweb/src/wallets/create-wallet.ts 26.48% <ø> (ø)
packages/thirdweb/src/wallets/smart/index.ts 56.54% <100.00%> (+0.22%) ⬆️
...ackages/thirdweb/src/wallets/smart/smart-wallet.ts 78.43% <ø> (ø)
packages/thirdweb/src/wallets/smart/types.ts 69.04% <ø> (ø)
packages/thirdweb/src/wallets/smart/lib/signing.ts 85.65% <79.36%> (-1.50%) ⬇️

... and 4 files with indirect coverage changes

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.

conflicts, otherwise LGTM

@@ -129,8 +129,7 @@ export async function verifyHash({
try {
const result = await eth_call(rpcRequest, verificationData);
return hexToBool(result);
} catch (err) {
console.error("Error verifying ERC-6492 signature", err);
} catch {
Copy link
Member

Choose a reason for hiding this comment

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

What was the actual issue here?

6492 should automatically use 1271 if the account is already deployed, the deployed check happens inside the universal validator contract.

We shouldn't need to force it manually ever

contract,
});
return result === EIP_1271_MAGIC_VALUE;
} catch {
Copy link
Member

Choose a reason for hiding this comment

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

Generally really want to log something for the dev to understand why the sig was not valid, same with the catch above

if (!deployTx) {
throw new Error("Create account override not provided");
if (options.eagerDeployment) {
await forceDeploySmartAccount({
Copy link
Member

Choose a reason for hiding this comment

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

You should only do this if the account is not deployed yet

@gregfromstl gregfromstl force-pushed the greg/tool-2837-sdk-smart-accounts-use-6492-even-when-already-deployed branch from 4a5b4b4 to f4678cd Compare January 6, 2025 05:35
@gregfromstl gregfromstl changed the title [SDK] Feature: Adds eagerDeployment on smart account creation [SDK] Feature: Adds deploySmartAccount and re-adds 1271 signatures Jan 6, 2025
@gregfromstl gregfromstl force-pushed the greg/tool-2837-sdk-smart-accounts-use-6492-even-when-already-deployed branch from 3664a2e to ce0a301 Compare January 7, 2025 00:00
Copy link

socket-security bot commented Jan 7, 2025

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

Package New capabilities Transitives Size Publisher
npm/@chakra-ui/cli@2.5.6 Transitive: environment, filesystem, network, shell, unsafe +132 3.2 MB segunadebayo
npm/@chakra-ui/react@2.10.4 Transitive: environment +39 7.76 MB segunadebayo
npm/@hookform/resolvers@3.10.0 None 0 711 kB bluebill1049, jorisre, kotarella1110
npm/@radix-ui/react-dropdown-menu@2.1.4 None +35 1.65 MB andy-hook, benoitgrelard, chancestrickland, ...3 more
npm/@radix-ui/react-hover-card@1.1.4 None +20 905 kB chancestrickland
npm/@radix-ui/react-popover@1.1.4 None +31 1.29 MB andy-hook, benoitgrelard, chancestrickland, ...3 more
npm/@radix-ui/react-select@2.1.4 None +35 1.54 MB chancestrickland
npm/@walletconnect/react-native-compat@2.17.3 None +9 403 kB gancho_walletconnect
npm/eslint-plugin-storybook@0.11.2 filesystem Transitive: environment +35 3.93 MB rafaelrozon, yannbf
npm/ethers@6.13.5 network Transitive: environment +8 18.5 MB ricmoo
npm/expo-application@6.0.1 Transitive: environment, eval, filesystem, network, shell, unsafe +594 102 MB brentvatne
npm/input-otp@1.4.2 None 0 111 kB guilhermerodz
npm/ioredis@5.4.2 Transitive: environment +10 917 kB chayimischayim, ioredis-robot, luin
npm/react-markdown@9.0.3 Transitive: environment +80 2.62 MB wooorm

🚮 Removed packages: npm/@chakra-ui/cli@2.5.5, npm/@chakra-ui/react@2.10.3, npm/@hookform/resolvers@3.9.1, npm/@radix-ui/react-dropdown-menu@2.1.3, npm/@radix-ui/react-hover-card@1.1.3, npm/@radix-ui/react-popover@1.1.3, npm/@radix-ui/react-select@2.1.3, npm/@walletconnect/react-native-compat@2.17.2, npm/eslint-plugin-storybook@0.11.1, npm/ethers@6.13.4, npm/expo-application@5.9.1, npm/input-otp@1.4.1, npm/ioredis@5.4.1, npm/react-markdown@9.0.1

View full report↗︎

@gregfromstl gregfromstl force-pushed the greg/tool-2837-sdk-smart-accounts-use-6492-even-when-already-deployed branch from 11aa29f to 720f290 Compare January 7, 2025 01:56
@gregfromstl gregfromstl merged commit b058f68 into main Jan 7, 2025
26 of 28 checks passed
@gregfromstl gregfromstl deleted the greg/tool-2837-sdk-smart-accounts-use-6492-even-when-already-deployed branch January 7, 2025 02:12
@jnsdls jnsdls mentioned this pull request Jan 7, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants