Skip to content

Commit b29721c

Browse files
committed
Merge branch 'main' into link-workflow
# Conflicts: # delegation-toolkit/index.md
2 parents c4d91f1 + 5ca5229 commit b29721c

139 files changed

Lines changed: 1827 additions & 942 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ Fixes #
1818

1919
- [ ] If this PR updates or adds documentation content that changes or adds technical meaning, it has received an approval from an engineer or DevRel from the relevant team.
2020
- [ ] If this PR updates or adds documentation content, it has received an approval from a technical writer.
21+
22+
## External contributor checklist
23+
24+
<!-- If you are an external contributor (outside of the MetaMask organization), complete the following checklist. -->
25+
26+
- [ ] I've read the [contribution guidelines](https://github.com/MetaMask/metamask-docs/blob/main/CONTRIBUTING.md).
27+
- [ ] I've created a new issue (or assigned myself to an existing issue) describing what this PR addresses.
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
description: Learn about MetaMask ERC-7715 permissions.
2+
description: Learn about MetaMask Advanced Permissions (ERC-7715).
33
keywords: [ERC-7715, 7715, permissions, wallet, smart account]
44
---
55

6-
# ERC-7715 permissions
6+
# Advanced Permissions (ERC-7715)
77

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.
8+
The Smart Accounts Kit supports Advanced Permissions ([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.
99
For example, a user can grant your dapp permission to spend 10 USDC per day to buy ETH over the course of a month.
1010
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.
1111

12-
ERC-7715 eliminates the need for users to approve every transaction, which is useful for highly interactive dapps.
12+
Advanced Permissions eliminate the need for users to approve every transaction, which is useful for highly interactive dapps.
1313
It also enables dapps to execute transactions for users without an active wallet connection.
1414

1515
:::note
@@ -23,42 +23,42 @@ Dapps can use this method to request a wallet to grant the dapp permission to ex
2323
`wallet_grantPermissions` requires a `signer` parameter, which identifies the entity requesting or managing the permission.
2424
Common signer implementations include wallet signers, single key and multisig signers, and account signers.
2525

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.
26+
Smart Accounts Kit supports multiple signer types. The documentation uses [an account signer](../guides/advanced-permissions/execute-on-metamask-users-behalf.md) as a common implementation example.
27+
When you use an account signer, a session account is created solely to request and redeem Advanced Permissions, and doesn't contain tokens
2828
The session account can be granted with permissions and redeem them as specified in [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710).
2929
The session account can be a smart account or an externally owned account (EOA).
3030

3131
The MetaMask user that the session account requests permissions from must be upgraded to a [MetaMask smart account](smart-accounts.md).
3232

33-
## ERC-7715 vs. delegations
33+
## Advanced Permissions vs. delegations
3434

35-
ERC-7715 expands on regular [delegations](delegation/index.md) by enabling permission sharing *via the MetaMask browser extension*.
35+
Advanced Permissions expand on regular [delegations](delegation/index.md) by enabling permission sharing *via the MetaMask browser extension*.
3636

3737
With regular delegations, the dapp constructs a delegation and requests the user to sign it.
3838
These delegations are not human-readable, so it is the dapp's responsibility to provide context for the user.
3939
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.
4040

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.
41+
In contrast, Advanced Permissions enable dapps (and AI agents) to request permissions from a user directly via the MetaMask extension.
42+
Advanced Permissions require a permission configuration which displays a human-readable confirmation for the MetaMask user.
4343
The user can modify the permission parameters if the request is configured to allow adjustments.
4444

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):
45+
For example, the following Advanced Permissions request displays a rich UI including the start time, amount, and period duration for an [ERC-20 token periodic transfer](../guides/advanced-permissions/use-permissions/erc20-token.md#erc-20-periodic-permission):
4646

4747
<p align="center">
4848
<img src={require("../assets/erc7715-request.png").default} alt="ERC-7715 request" width="450px" class="appScreen" />
4949
</p>
5050

51-
## ERC-7715 permissions lifecycle
51+
## Advanced Permissions lifecycle
5252

53-
The ERC-7715 permissions lifecycle is as follows:
53+
The Advanced Permissions lifecycle is as follows:
5454

5555
1. **Set up a session account** - Set up a session account to execute transactions on behalf of the MetaMask user.
5656
It can be a [smart account](smart-accounts.md) or an externally owned account (EOA).
5757

5858
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).
59+
The Smart Accounts Kit supports [ERC-20 token permissions](../guides/advanced-permissions/use-permissions/erc20-token.md) and
60+
[native token permissions](../guides/advanced-permissions/use-permissions/native-token.md).
6161

6262
4. **Redeem permissions** - Once the permission is granted, the session account can redeem the permission, executing on the user's behalf.
6363

64-
See [how to perform executions on a MetaMask user's behalf](../guides/erc7715/execute-on-metamask-users-behalf.md) to get started with the ERC-7715 lifecycle.
64+
See [how to perform executions on a MetaMask user's behalf](../guides/advanced-permissions/execute-on-metamask-users-behalf.md) to get started with the Advanced Permissions lifecycle.

delegation-toolkit/concepts/delegation/caveat-enforcers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ keywords: [caveats, caveat enforcers, delegation]
55

66
# Caveat enforcers
77

8-
The MetaMask Delegation Toolkit provides *caveat enforcers*, which are smart contracts that implement rules and restrictions (*caveats*) on delegations.
8+
The Smart Accounts Kit provides *caveat enforcers*, which are smart contracts that implement rules and restrictions (*caveats*) on delegations.
99
They serve as the underlying mechanism that enables conditional execution within the [Delegation Framework](./index.md#delegation-framework).
1010

1111
A caveat enforcer acts as a gate that validates whether a delegation can be used for a particular execution. When a delegate attempts to execute an action on behalf of a delegator, each caveat enforcer specified in the delegation evaluates whether the execution meets its defined criteria.
@@ -119,7 +119,7 @@ This "all-or-nothing" approach ensures that delegations only execute exactly as
119119

120120
## Caveat builder
121121

122-
While caveat enforcers operate at the smart contract level, most developers interact with them through the `CaveatBuilder` interface in the MetaMask Delegation Toolkit.
122+
While caveat enforcers operate at the smart contract level, most developers interact with them through the `CaveatBuilder` interface in the Smart Accounts Kit.
123123

124124
The `CaveatBuilder` provides a developer-friendly TypeScript API that:
125125

@@ -152,7 +152,7 @@ When designing delegations with caveats, consider these best practices:
152152

153153
## Available caveat enforcers
154154

155-
The Delegation Toolkit provides [out-of-the-box caveat enforcers](../../reference/delegation/caveats.md)
155+
The Smart Accounts Kit provides [out-of-the-box caveat enforcers](../../reference/delegation/caveats.md)
156156
for common restriction patterns, including:
157157

158158
- Limiting target addresses and methods.

delegation-toolkit/concepts/delegation/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Learn about delegation, the delegation lifecycle, and the Delegation Framework.
33
toc_max_heading_level: 2
4-
keywords: [delegation toolkit, delegation, delegator, delegate, delegation framework]
4+
keywords: [smart accounts kit, delegation, delegator, delegate, delegation framework]
55
---
66

77
import Tabs from "@theme/Tabs";
@@ -14,7 +14,7 @@ or externally owned account (EOA) to perform specific executions on its behalf.
1414
The account that grants the permission is called the *delegator account*, while the account that receives the permission
1515
is called the *delegate account*.
1616

17-
The MetaMask Delegation Toolkit follows the [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710) standard for smart contract delegation.
17+
The Smart Accounts Kit follows the [ERC-7710](https://eips.ethereum.org/EIPS/eip-7710) standard for smart contract delegation.
1818
In addition, users can use [caveat enforcers](caveat-enforcers.md) to apply rules and restrictions to delegations.
1919
For example: Alice delegates the ability to spend her USDC to Bob, limiting the amount to 100 USDC.
2020

@@ -65,7 +65,7 @@ You can create the following delegation types:
6565

6666
## Delegation Framework
6767

68-
The MetaMask Delegation Toolkit includes the Delegation Framework, which is a
68+
The Smart Accounts Kit includes the Delegation Framework, which is a
6969
[set of comprehensively audited smart contracts](https://github.com/MetaMask/delegation-framework) that
7070
collectively handle delegator account creation, the delegation lifecycle,
7171
and caveat enforcement.
@@ -152,7 +152,7 @@ sequenceDiagram
152152
## Execution modes
153153

154154
When redeeming a delegation using [`redeemDelegations`](../../reference/delegation/index.md#redeemdelegations), you must pass an execution mode for each delegation chain you pass to the method.
155-
The Delegation Toolkit supports the following execution modes, based on [ERC-7579](https://erc7579.com/):
155+
The Smart Accounts Kit supports the following execution modes, based on [ERC-7579](https://erc7579.com/):
156156

157157
| Execution mode | Number of delegation chains passed to `redeemDelegations` | Processing method | Does user operation continue execution if redemption reverts? |
158158
|--|--|--|--|

delegation-toolkit/concepts/smart-accounts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ keywords: [MetaMask, smart accounts, account abstraction, ERC-4337]
55

66
# MetaMask Smart Accounts
77

8-
The MetaMask Delegation Toolkit enables you to create and manage MetaMask Smart Accounts.
8+
The Smart Accounts Kit enables you to create and manage *MetaMask Smart Accounts*.
99
MetaMask Smart Accounts are [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) smart contract accounts
1010
that support programmable account behavior and advanced features such as multi-signature approvals,
1111
automated transaction batching, and custom security policies.
@@ -37,7 +37,7 @@ ERC-4337 introduces the following concepts:
3737

3838
## Smart account implementation types
3939

40-
The MetaMask Delegation Toolkit supports three types of MetaMask Smart Accounts, each offering unique features and use cases.
40+
The toolkit supports three types of MetaMask Smart Accounts, each offering unique features and use cases.
4141

4242
See [Create a smart account](../guides/smart-accounts/create-smart-account.md) to learn how to use these different account types.
4343

delegation-toolkit/experimental/erc-7710-redeem-delegations.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is an experimental feature and may change in future releases.
1414
[ERC-7710](https://eip.tools/eip/7710) introduces a standard way for MetaMask Smart Accounts to delegate capabilities to other
1515
smart accounts or externally owned accounts (EOAs).
1616

17-
The MetaMask Delegation Toolkit provides two experimental functions, `erc7710BundlerActions()` and `erc7710WalletActions()`, that let
17+
The MetaMask Smart Accounts Kit provides two experimental functions, `erc7710BundlerActions()` and `erc7710WalletActions()`, that let
1818
a caller redeem delegations granted by MetaMask's permissions system.
1919

2020
## Extract relevant data
@@ -65,7 +65,7 @@ This data encodes the authority that lets the delegate redeem the permission.
6565
### Security considerations for `accountMeta`
6666

6767
When a user grants a permission, they can provide `accountMeta` which is an array of `factory` and `factoryData` values.
68-
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/erc7715/bundler-client.md#senduseroperationwithdelegation)).
68+
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/advanced-permissions/bundler-client.md#senduseroperationwithdelegation)).
6969

7070
Because each `accountMeta` is an arbitrary call specified by the granter, it is important that these are executed carefully.
7171
We recommend taking the following precautions:
@@ -86,7 +86,7 @@ Redeem a delegation with a [MetaMask smart account](#redeem-with-a-metamask-smar
8686
To redeem a delegation with a MetaMask smart account, [create a smart account](../guides/smart-accounts/create-smart-account.md)
8787
and a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler).
8888

89-
After setting up your Bundler Client, you can extend its functionality with `erc7710BundlerActions` actions to support ERC-7710. Once extended, use [`sendUserOperationWithDelegation`](../reference/erc7715/bundler-client.md#senduseroperationwithdelegation) to redeem the permission.
89+
After setting up your Bundler Client, you can extend its functionality with `erc7710BundlerActions` actions to support ERC-7710. Once extended, use [`sendUserOperationWithDelegation`](../reference/advanced-permissions/bundler-client.md#senduseroperationwithdelegation) to redeem the permission.
9090

9191
<Tabs>
9292
<TabItem value="example.ts">
@@ -128,8 +128,8 @@ import { createPublicClient, http, createBundlerClient } from "viem";
128128
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
129129
import { sepolia as chain } from "viem/chains";
130130
import { createBundlerClient } from "viem/account-abstraction";
131-
import { erc7710BundlerActions } from "@metamask/delegation-toolkit/experimental";
132-
import { toMetaMaskSmartAccount, Implementation } from "@metamask/delegation-toolkit";
131+
import { erc7710BundlerActions } from "@metamask/smart-accounts-kit/actions";
132+
import { toMetaMaskSmartAccount, Implementation } from "@metamask/smart-accounts-kit";
133133

134134
export const publicClient = createPublicClient({
135135
chain: chain,
@@ -168,7 +168,7 @@ export const bundlerClient = createBundlerClient({
168168

169169
To redeem a delegation with an EOA, create a [Viem Wallet Client](https://viem.sh/docs/clients/wallet).
170170

171-
After creating your Wallet Client, you can extend its functionality with `erc7710WalletActions` actions to support ERC-7710. Once extended, use [`sendTransactionWithDelegation`](../reference/erc7715/wallet-client.md#sendtransactionwithdelegation) to redeem the permission.
171+
After creating your Wallet Client, you can extend its functionality with `erc7710WalletActions` actions to support ERC-7710. Once extended, use [`sendTransactionWithDelegation`](../reference/advanced-permissions/wallet-client.md#sendtransactionwithdelegation) to redeem the permission.
172172

173173
<Tabs>
174174
<TabItem value="example.ts">
@@ -212,7 +212,7 @@ const hash = walletClient.sendTransactionWithDelegation({
212212
import { http, createPublicClient, createWalletClient } from "viem";
213213
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
214214
import { sepolia as chain } from "viem/chains";
215-
import { erc7710WalletActions } from "@metamask/delegation-toolkit/experimental";
215+
import { erc7710WalletActions } from "@metamask/smart-accounts-kit/actions";
216216

217217
export const publicClient = createPublicClient({
218218
chain,

delegation-toolkit/experimental/erc-7715-request-permissions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It requires MetaMask Flask 13.5.0 or later, and may change in future releases.
1515
[ERC-7715](https://eip.tools/eip/7715) introduces a standard way for dapps to request permissions from a wallet to execute
1616
transactions on a user's behalf.
1717

18-
The MetaMask Delegation Toolkit provides the experimental actions for ERC-7715 that lets a caller request permissions from MetaMask's permissions system.
18+
The MetaMask Smart Accounts Kit provides the experimental actions for ERC-7715 that lets a caller request permissions from MetaMask's permissions system.
1919

2020
## Request permissions
2121

@@ -63,8 +63,8 @@ const grantedPermissions = await walletClient.grantPermissions([{
6363
import { createWalletClient, custom, createPublicClient, http } from "viem";
6464
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
6565
import { sepolia as chain } from "viem/chains";
66-
import { erc7715ProviderActions } from "@metamask/delegation-toolkit/experimental";
67-
import { toMetaMaskSmartAccount, Implementation } from "@metamask/delegation-toolkit";
66+
import { erc7715ProviderActions } from "@metamask/smart-accounts-kit/actions";
67+
import { toMetaMaskSmartAccount, Implementation } from "@metamask/smart-accounts-kit";
6868

6969
const publicClient = createPublicClient({
7070
chain: chain,
@@ -165,7 +165,7 @@ You should always verify the granted permissions and adjust your dapp's behavior
165165
## Security considerations for `accountMeta`
166166

167167
When a user grants a permission, they can provide [`accountMeta`](erc-7710-redeem-delegations.md#extract-relevant-data) which is an array of `factory` and `factoryData` values.
168-
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/erc7715/bundler-client.md#senduseroperationwithdelegation)).
168+
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/advanced-permissions/bundler-client.md#senduseroperationwithdelegation)).
169169

170170
Because each `accountMeta` is an arbitrary call specified by the granter, it is important that these are executed carefully.
171171
We recommend taking the following precautions:

delegation-toolkit/experimental/store-retrieve-delegations.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Create the `DelegationStorageClient` instance, and configure it using your API k
2929
import {
3030
DelegationStorageClient,
3131
DelegationStorageEnvironment
32-
} from "@metamask/delegation-toolkit/experimental";
32+
} from "@metamask/smart-accounts-kit/experimental";
3333

3434
const delegationStorageClient = new DelegationStorageClient({
3535
apiKey: "<YOUR-API-KEY>",
@@ -62,7 +62,7 @@ const delegationHash = await delegationStorageClient.storeDelegation(delegation)
6262
import {
6363
DelegationStorageClient,
6464
DelegationStorageEnvironment
65-
} from "@metamask/delegation-toolkit/experimental";
65+
} from "@metamask/smart-accounts-kit/experimental";
6666

6767
export const delegationStorageClient = new DelegationStorageClient({
6868
apiKey: "<YOUR-API-KEY>",
@@ -90,7 +90,7 @@ A delegation can be a root delegation, where its `authority` is `0xfffffffffffff
9090

9191
```typescript
9292
import { delegationStorageClient } from "./config.ts";
93-
import { getDelegationHashOffchain } from "@metamask/delegation-toolkit";
93+
import { getDelegationHashOffchain } from "@metamask/smart-accounts-kit";
9494

9595
// Assuming you have the leaf delegation
9696
const delegationHash = getDelegationHashOffchain(leafDelegation);
@@ -107,7 +107,7 @@ const delegationChain: Delegation[] = await delegationStorageClient.getDelegatio
107107
import {
108108
DelegationStorageClient,
109109
DelegationStorageEnvironment
110-
} from "@metamask/delegation-toolkit/experimental";
110+
} from "@metamask/smart-accounts-kit/experimental";
111111

112112
export const delegationStorageClient = new DelegationStorageClient({
113113
apiKey: "<YOUR-API-KEY>",
@@ -158,7 +158,7 @@ const receivedDelegations = await delegationStore.fetchDelegations(
158158
import {
159159
DelegationStorageClient,
160160
DelegationStorageEnvironment
161-
} from "@metamask/delegation-toolkit/experimental";
161+
} from "@metamask/smart-accounts-kit/experimental";
162162

163163
export const delegationStorageClient = new DelegationStorageClient({
164164
apiKey: "<YOUR-API-KEY>",

0 commit comments

Comments
 (0)