-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Delegtion Toolkit] Improve ERC-7715 guide #2406
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| // If account is not upgraded to MetaMask smart account, you can | ||
| // either upgrade programmatically or ask the user to switch to a smart account manually. | ||
| const isAccountUpgraded = delegatorAddress.toLowerCase() === statelessDelegatorAddress.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incomplete Account Upgrade Handling
The isAccountUpgraded variable is computed but unused, making the account upgrade check incomplete. The guide describes handling both upgraded and non-upgraded accounts, but the code doesn't demonstrate this conditional logic.
Additional Locations (1)
| // represents the delegation. | ||
| // | ||
| // You need to remove the first 8 characters (0xef0100) to get the delegator address. | ||
| const delegatorAddress = `0x${code.substring(8)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Delegation Prefix Validation Missing
The logic for checking EOA account code extracts the delegator address using substring(8) without first validating if the code starts with the EIP-7702 delegation prefix (0xef0100). This can lead to incorrect delegation detection and misidentification of account upgrade status.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some edits and one remaining question.
| Currently, ERC-7715 does not support automatically upgrading a user's account to a [MetaMask smart account](../../concepts/smart-accounts.md). Therefore, you must | ||
| ensure that the user is upgraded to a smart account before requesting ERC-7715 permissions. | ||
|
|
||
| If the user has not yet been upgraded, you can handle the upgrade [programmatically](/wallet/how-to/send-transactions/send-batch-transactions/#about-atomic-batch-transactions) or ask the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you specifically need to do to handle the upgrade programmatically? This links to the wallet api send batch txns page – but is it also possible through the SDK tutorial or the DTK 7702 quickstart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to initiate the wallet_sendCalls (ERC-5792) request. This can’t be done through the DTK 7702 Quickstart, as that guide focuses on upgrading embedded accounts to MetaMask Smart Accounts. Instead, it can be achieved using the SDK tutorial, but the two guides aren’t fully aligned.
In the SDK tutorial, you’ll use Wagmi, connect the wallet, and then interact through hooks. The Wallet API documentation, on the other hand, focuses on using the provider, which you can obtain directly from the WalletClient created earlier, allowing you to follow a single, streamlined flow without needing the extra steps described in the SDK tutorial.
|
@bgravenorst can we get your review? |
Description
Currently, user need to be upgraded MetaMask smart account in order to use the ERC-7715. Adds an additional step for dApp to handle the upgrade.
Issue(s) fixed
Fixes #
Preview
Checklist
Note
Adds a Smart Account upgrade check (with EIP-7702-based code sample) to the ERC‑7715 guide and renumbers subsequent steps in both current and versioned docs.
publicClient.getCode(...), derivedelegatorAddressper EIP-7702, and compare withgetDeleGatorEnvironment(...).implementations.EIP7702StatelessDeleGatorImplto detect upgrade.Request ERC-7715 permissions→ step 5,Set up a Viem client→ step 6,Redeem ERC-7715 permissions→ step 7.delegation-toolkit/guides/erc7715/execute-on-metamask-users-behalf.mdand versioned docs atgator_versioned_docs/version-0.13.0/....Written by Cursor Bugbot for commit 3fce311. This will update automatically on new commits. Configure here.