-
Notifications
You must be signed in to change notification settings - Fork 8
docs: updating 7702 details #942
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
🌿 Documentation Preview
|
|
|
||
| 1. An authorization signature request | ||
| 2. A user operation signature request | ||
| The authorization signature is **not** a `personal_sign` or `eth_sign` payload. |
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.
This isn't 100% true.
The prepared authorization is technically in this shape:
{
type: "authorization",
data: {
address: "0xDelegationAddress",
nonce: "0xNonce",
},
chainId: "0xChainId",
signatureRequest: {
type: "eip7702Auth",
rawPayload: "0xRawHashToSignWithEthSign"
}
}The rawPayload can be signed by eth_sign if desired. But it's recommended to sign the authorization using the address, nonce, and chainId to remove trust assumptions.
| Signing an authorization signature request requires logic specific to the wallet being used. Examples: | ||
| Examples of signing utilities: | ||
| - [Viem](https://viem.sh/docs/eip7702/signAuthorization) | ||
| - [Cast](https://getfoundry.sh/cast/reference/wallet/sign-auth/) |
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.
Recommending cast wallet sign-auth kinda opens a can of worms, because it technically returns an RLP-encoded authorization_list, which CONTAINS the authorization signature.
If you use that, you'd have to decode it like this (viem example):
import { fromRlp, serializeSignature } from "viem"
const getSig = (authorizationList: Hex) => {
const decoded = fromRlp(authorizationList);
const [chainId, address, nonce, yParity, r, s] = decoded;
const sig = serializeSignature({
r,
s,
yParity: yParity === "0x" ? 0 : Number(yParity),
});
return sig;
};| for Modular Account v2. If you wish to replace or remove this delegation, you'll need to relay the delegation yourself or use a third party service. | ||
| Viem has a guide for this [here](https://viem.sh/docs/eip7702/contract-writes). | ||
| Currently, Wallet APIs only support delegation to the following contract: | ||
| `0x69007702764179f14F51cdce752f4f775d74E139` |
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.
do you think it's worth mentioning here what this contract is?
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.
I feel like it would be good to mention here that it's MAv2 and removing the Wallet APIs currently only support relaying delegations for Modular Account v2. below since it's a bit repetitive.
| Example of signing utility: | ||
|
|
||
| * [Viem](https://viem.sh/docs/eip7702/signAuthorization) | ||
| * [Cast](https://getfoundry.sh/cast/reference/wallet/sign-auth/) |
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.
@jakehobbs Do we want to remove all cast instructions?
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.
i think suggesting cast's sign-auth is a bad idea unless we go into the weeds and explain how to fully use it. see comment here: #942 (comment)
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.
if using cast, it's way easier to just sign the rawPayload. but we don't recommend that for production use.
Description
Related Issues
Changes Made
Testing
pnpm run validate)