Skip to content

Commit 4cc2b68

Browse files
Add ERC-7715 concept page (MetaMask#2345)
* Add ERC-7715 concept page * add technical overview * minor edits * edits and add image * edits * minor edit * minor edits * edits
1 parent 9f00e57 commit 4cc2b68

File tree

5 files changed

+80
-7
lines changed

5 files changed

+80
-7
lines changed
87.3 KB
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
description: Learn about MetaMask ERC-7715 permissions.
3+
keywords: [ERC-7715, 7715, permissions, wallet, smart account]
4+
---
5+
6+
# ERC-7715 permissions
7+
8+
The Delegation Toolkit supports [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715), which lets you request fine-grained permissions from a MetaMask user to execute transactions on their behalf.
9+
For example, a user can grant your dapp permission to spend 10 USDC per day to buy ETH over the course of a month.
10+
Once the permission is granted, your dapp can use the allocated 10 USDC each day to purchase ETH directly from the MetaMask user's account.
11+
12+
ERC-7715 eliminates the need for users to approve every transaction, which is useful for highly interactive dapps.
13+
It also enables dapps to execute transactions for users without an active wallet connection.
14+
15+
:::note
16+
This feature requires [MetaMask Flask 12.14.2](/snaps/get-started/install-flask) or later.
17+
:::
18+
19+
## ERC-7715 technical overview
20+
21+
[ERC-7715](https://eips.ethereum.org/EIPS/eip-7715) defines a JSON-RPC method `wallet_grantPermissions`.
22+
Dapps can use this method to request a wallet to grant the dapp permission to execute transactions on a user's behalf.
23+
`wallet_grantPermissions` requires a `signer` parameter, which identifies the entity requesting or managing the permission.
24+
Common signer implementations include wallet signers, single key and multisig signers, and account signers.
25+
26+
The Delegation Toolkit supports multiple types of signers, but [an account signer is used in this documentation's examples](../guides/erc7715/execute-on-metamask-users-behalf.md) as a common implementation.
27+
With an account signer, a session account is created and used for the single purpose of requesting and redeeming ERC-7715 permissions, and does not contain tokens.
28+
The session account can be granted with permissions and redeem them as specified in [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710).
29+
The session account can be a smart account or an externally owned account (EOA).
30+
31+
The MetaMask user that the session account requests permissions from must be upgraded to a [MetaMask smart account](smart-accounts.md).
32+
33+
## ERC-7715 vs. delegations
34+
35+
ERC-7715 expands on regular [delegations](delegation/index.md) by enabling permission sharing *via the MetaMask browser extension*.
36+
37+
With regular delegations, the dapp constructs a delegation and requests the user to sign it.
38+
These delegations are not human-readable, so it is the dapp's responsibility to provide context for the user.
39+
Regular delegations cannot be signed through the MetaMask extension, because if a dapp requests a delegation without constraints, the whole wallet can be exposed to the dapp.
40+
41+
In contrast, ERC-7715 enables dapps (and AI agents) to request permissions from a user directly via the MetaMask extension.
42+
ERC-7715 requires a permission configuration which displays a human-readable confirmation for the MetaMask user.
43+
The user can modify the permission parameters if the request is configured to allow adjustments.
44+
45+
For example, the following ERC-7715 permission request displays a rich UI including the start time, amount, and period duration for an [ERC-20 token periodic transfer](../guides/erc7715/use-permissions/erc20-token.md#erc-20-periodic-permission):
46+
47+
<p align="center">
48+
<img src={require("../assets/erc7715-request.png").default} alt="ERC-7715 request" width="450px" class="appScreen" />
49+
</p>
50+
51+
## ERC-7715 permissions lifecycle
52+
53+
The ERC-7715 permissions lifecycle is as follows:
54+
55+
1. **Set up a session account** - Set up a session account to execute transactions on behalf of the MetaMask user.
56+
It can be a [smart account](smart-accounts.md) or an externally owned account (EOA).
57+
58+
2. **Request permissions** - Request permissions from the user.
59+
The Delegation Toolkit supports [ERC-20 token permissions](../guides/erc7715/use-permissions/erc20-token.md) and
60+
[native token permissions](../guides/erc7715/use-permissions/native-token.md).
61+
62+
4. **Redeem permissions** - Once the permission is granted, the session account can redeem the permission, executing on the user's behalf.
63+
64+
See [how to perform executions on a MetaMask user's behalf](../guides/erc7715/execute-on-metamask-user-behalf.md) to get started with the ERC-7715 lifecycle.

delegation-toolkit/guides/erc7715/execute-on-metamask-users-behalf.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import TabItem from "@theme/TabItem";
99

1010
# Perform executions on a MetaMask user's behalf
1111

12-
The Delegation Toolkit supports [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715), which lets you request fine-grained permissions from a MetaMask user to execute transactions on their
12+
[ERC-7715 permissions](../../concepts/erc7715.md) are fine-grained permissions that your dapp can request from a MetaMask user to execute transactions on their
1313
behalf. For example, a user can grant your dapp permission to spend 10 USDC per day to buy ETH over the course
1414
of a month. Once the permission is granted, your dapp can use the allocated 10 USDC each day to
1515
purchase ETH directly from the MetaMask user's account.
@@ -41,7 +41,7 @@ const walletClient = createWalletClient({
4141
### 2. Set up a Public Client
4242

4343
Set up a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function.
44-
This client will help you query the account state and interact with blockchain network.
44+
This client will help you query the account state and interact with the blockchain network.
4545

4646
```typescript
4747
import { createPublicClient, http } from "viem";
@@ -60,7 +60,7 @@ to request ERC-7715 permissions. This account is responsible for executing trans
6060
on behalf of the user.
6161

6262
<Tabs>
63-
<TabItem value="Smart Account">
63+
<TabItem value="Smart account">
6464

6565
```typescript
6666
import { privateKeyToAccount } from "viem/accounts";
@@ -97,8 +97,9 @@ const sessionAccount = privateKeyToAccount("0x...");
9797

9898
### 4. Request ERC-7715 permissions
9999

100-
Request ERC-7715 permissions from the user. In this example, you'll request an ERC-20 periodic
101-
permission using the Wallet Client's [`requestExecutionPermissions`](../../reference/erc7715/wallet-client.md#requestexecutionpermissions) action.
100+
Request ERC-7715 permissions from the user. In this example, you'll request an
101+
[ERC-20 periodic permission](use-permissions/erc20-token.md#erc-20-periodic-permission) using the Wallet Client's
102+
[`requestExecutionPermissions`](../../reference/erc7715/wallet-client.md#requestexecutionpermissions) action.
102103

103104
```typescript
104105
import { sepolia as chain } from "viem/chains";
@@ -261,4 +262,9 @@ export const calldata = encodeFunctionData({
261262
```
262263

263264
</TabItem>
264-
</Tabs>
265+
</Tabs>
266+
267+
## Next steps
268+
269+
See how to configure different [ERC-20 token permissions](use-permissions/erc20-token.md) and
270+
[native token permissions](use-permissions/native-token.md).

delegation-toolkit/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords: [MetaMask, delegation toolkit, smart accounts]
77

88
import CardList from "@site/src/components/CardList"
99

10-
# Embed MetaMask Smart Accounts using the Delegation Toolkit
10+
# Create MetaMask Smart Accounts using the Delegation Toolkit
1111

1212
The MetaMask Delegation Toolkit is a [Viem](https://viem.sh/)-based collection of tools for embedding [MetaMask Smart Accounts](concepts/smart-accounts.md) into dapps.
1313
Smart accounts support programmable account behavior and advanced features like delegated permissions, multi-signature approvals, and gas abstraction.
@@ -16,6 +16,8 @@ Smart accounts support programmable account behavior and advanced features like
1616
Delegation is powered by the toolkit's Delegation Framework, which defines how
1717
permissions are created, shared, and enforced.
1818

19+
MetaMask Smart Accounts also support [ERC-7715 permissions](concepts/erc7715.md), which are fine-grained permissions dapps can request from users directly via the MetaMask browser extension.
20+
1921
## Why use the toolkit?
2022

2123
The toolkit enables developers to create frictionless new experiences based on programmable account behavior and granular permission

gator-sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const sidebar = {
4343
'concepts/delegation/caveat-enforcers',
4444
],
4545
},
46+
'concepts/erc7715',
4647
],
4748
},
4849
{

0 commit comments

Comments
 (0)