Skip to content

Commit fa60e76

Browse files
authored
Merge branch 'main' into android-updates
2 parents ae4c3ab + 0479876 commit fa60e76

File tree

210 files changed

+13377
-1463
lines changed

Some content is hidden

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

210 files changed

+13377
-1463
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
description: Learn about caveat enforcers and how they restrict delegations.
3+
keywords: [caveats, caveat enforcers, delegation]
34
---
45

56
# Caveat enforcers
@@ -118,23 +119,23 @@ This "all-or-nothing" approach ensures that delegations only execute exactly as
118119

119120
## Caveat builder
120121

121-
While caveat enforcers operate at the smart contract level, most developers interact with them through the [`CaveatBuilder`](../../guides/delegation/restrict-delegation.md) 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 MetaMask Delegation Toolkit.
122123

123124
The `CaveatBuilder` provides a developer-friendly TypeScript API that:
124125

125126
- Abstracts away the complexity of correctly formatting and encoding caveat terms.
126127
- Provides type-checking and validation for caveat parameters.
127128
- Handles the creation of the `caveats` array needed when creating a delegation.
128129

129-
Each [caveat type](../../reference/caveats.md) in the `CaveatBuilder`
130+
Each [caveat type](../../reference/delegation/caveats.md) in the `CaveatBuilder`
130131
corresponds to a specific caveat enforcer contract. For example, when you use:
131132

132133
```typescript
133134
caveatBuilder.addCaveat("allowedTargets", ["0xc11F3a8E5C7D16b75c9E2F60d26f5321C6Af5E92"]);
134135
```
135136

136137
The builder is creating a caveat that references the
137-
[`AllowedTargetsEnforcer`](../../reference/caveats.md#allowedtargets) contract address and
138+
[`AllowedTargetsEnforcer`](../../reference/delegation/caveats.md#allowedtargets) contract address and
138139
properly encodes the provided addresses as terms for that enforcer.
139140

140141
## Caveat enforcer best practices
@@ -144,14 +145,14 @@ When designing delegations with caveats, consider these best practices:
144145
- **Combine caveat enforcers appropriately** - Use multiple caveat enforcers to create comprehensive restrictions.
145146

146147
- **Consider caveat enforcer order** - When using caveat enforcers that modify external contract states, the order matters.
147-
For example, using [`NativeTokenPaymentEnforcer`](../../reference/caveats.md#nativetokenpayment) before
148-
[`NativeBalanceChangeEnforcer`](../../reference/caveats.md#nativebalancechange) might cause validation failures.
148+
For example, using [`NativeTokenPaymentEnforcer`](../../reference/delegation/caveats.md#nativetokenpayment) before
149+
[`NativeBalanceChangeEnforcer`](../../reference/delegation/caveats.md#nativebalancechange) might cause validation failures.
149150

150151
- **Be careful with unbounded delegations** - Always include appropriate caveat enforcers to limit what a delegate can do.
151152

152153
## Available caveat enforcers
153154

154-
The Delegation Toolkit provides [out-of-the-box caveat enforcers](../../reference/caveats.md)
155+
The Delegation Toolkit provides [out-of-the-box caveat enforcers](../../reference/delegation/caveats.md)
155156
for common restriction patterns, including:
156157

157158
- Limiting target addresses and methods.

delegation-toolkit/concepts/delegation/index.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +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]
45
---
56

67
import Tabs from "@theme/Tabs";
@@ -39,28 +40,28 @@ You can create the following delegation types:
3940
In a chain of delegations, the first delegation is the root delegation.
4041
For example, Alice delegates the ability to spend her USDC to Bob, limiting the amount to 100 USDC.
4142

42-
Use [`createDelegation`](../../reference/api/delegation.md#createdelegation) to create a root delegation.
43+
Use [`createDelegation`](../../reference/delegation/index.md#createdelegation) to create a root delegation.
4344

4445
- **Open root delegation** - An open root delegation is a root delegation that doesn't specify a delegate.
4546
This means that any account can redeem the delegation.
4647
For example, Alice delegates the ability to spend 100 of her USDC to anyone.
4748

4849
You must create open root delegations carefully, to ensure that they are not misused.
49-
Use [`createOpenDelegation`](../../reference/api/delegation.md#createopendelegation) to create an open root delegation.
50+
Use [`createOpenDelegation`](../../reference/delegation/index.md#createopendelegation) to create an open root delegation.
5051

5152
- **Redelegation** - A delegate can redelegate permissions that have been granted to them, creating a chain of delegations across trusted parties.
5253
For example, Alice delegates the ability to spend 100 of her USDC to Bob.
5354
Bob redelegates the ability to spend 50 of Alice's 100 USDC to Carol.
5455

55-
Use [`createDelegation`](../../reference/api/delegation.md#createdelegation) to create a redelegation.
56+
Use [`createDelegation`](../../reference/delegation/index.md#createdelegation) to create a redelegation.
5657

5758
- **Open redelegation** - An open redelegation is a redelegation that doesn't specify a delegate.
5859
This means that any account can redeem the redelegation.
5960
For example, Alice delegates the ability to spend 100 of her USDC to Bob.
6061
Bob redelegates the ability to spend 50 of Alice's 100 USDC to anyone.
6162

6263
As with open root delegations, you must create open redelegations carefully, to ensure that they are not misused.
63-
Use [`createOpenDelegation`](../../reference/api/delegation.md#createopendelegation) to create an open redelegation.
64+
Use [`createOpenDelegation`](../../reference/delegation/index.md#createopendelegation) to create an open redelegation.
6465

6566
## Delegation Framework
6667

@@ -79,7 +80,7 @@ It consists of the following components:
7980
- **Delegation Manager** - The Delegation Manager validates delegations and triggers executions
8081
on behalf of the delegator, ensuring tasks are executed accurately and securely.
8182

82-
When you redeem a delegation using [`redeemDelegations`](../../reference/api/delegation.md#redeemdelegations), the Delegation Manager performs the following steps.
83+
When you redeem a delegation using [`redeemDelegations`](../../reference/delegation/index.md#redeemdelegations), the Delegation Manager performs the following steps.
8384
It processes a single step for all redemptions before proceeding to the next one:
8485

8586
1. Validates the input data by ensuring the lengths of `delegations`, `modes`, and
@@ -150,30 +151,30 @@ sequenceDiagram
150151

151152
## Execution modes
152153

153-
When redeeming a delegation using [`redeemDelegations`](../../reference/api/delegation.md#redeemdelegations), you must pass an execution mode for each delegation chain you pass to the method.
154+
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.
154155
The Delegation Toolkit supports the following execution modes, based on [ERC-7579](https://erc7579.com/):
155156

156157
| Execution mode | Number of delegation chains passed to `redeemDelegations` | Processing method | Does user operation continue execution if redemption reverts? |
157158
|--|--|--|--|
158-
| `SINGLE_DEFAULT_MODE` | One | Sequential | No |
159-
| `SINGLE_TRY_MODE` | One | Sequential | Yes |
160-
| `BATCH_DEFAULT_MODE` | Multiple | Interleaved | No |
161-
| `BATCH_TRY_MODE` | Multiple | Interleaved | Yes |
159+
| `SingleDefault` | One | Sequential | No |
160+
| `SingleTry` | One | Sequential | Yes |
161+
| `BatchDefault` | Multiple | Interleaved | No |
162+
| `BatchTry` | Multiple | Interleaved | Yes |
162163

163164
### Sequential processing
164165

165-
In `SINGLE` modes, processing is sequential:
166+
In `Single` modes, processing is sequential:
166167

167168
1. For each delegation in the chain, all caveats' `before` hooks are called.
168169
2. The single redeemed action is executed.
169170
3. For each delegation in the chain, all caveats' `after` hooks are called.
170171

171172
### Interleaved processing
172173

173-
In `BATCH` modes, processing is interleaved:
174+
In `Batch` modes, processing is interleaved:
174175

175176
1. For each chain in the batch, and each delegation in the chain, all caveats' `before` hooks are called.
176177
2. Each redeemed action is executed.
177178
3. For each chain in the batch, and each delegation in the chain, all caveats' `after` hooks are called.
178179

179-
`BATCH` mode allows for powerful use cases, but the Delegation Framework currently does not include any `BATCH` compatible caveat enforcers.
180+
`Batch` mode allows for powerful use cases, but the Delegation Framework currently does not include any `Batch` compatible caveat enforcers.

delegation-toolkit/concepts/smart-accounts.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
description: Learn about MetaMask Smart Accounts.
3+
keywords: [MetaMask, smart accounts, account abstraction, ERC-4337]
34
---
45

56
# MetaMask Smart Accounts
@@ -43,7 +44,7 @@ See [Create a smart account](../guides/smart-accounts/create-smart-account.md) t
4344
### Hybrid smart account
4445

4546
The Hybrid smart account is a flexible implementation that supports both an externally owned account (EOA) owner and any number of passkey (WebAuthn) signers.
46-
You can configure any of these signers as the signatory, and use them to sign any data, including user operations, on behalf of the smart account.
47+
You can configure any of these signers, and use them to sign any data, including user operations, on behalf of the smart account.
4748

4849
This type is referenced in the toolkit as `Implementation.Hybrid`.
4950

@@ -79,7 +80,7 @@ The MetaMask Smart Accounts flow is as follows:
7980
tokens or third-party sponsorship.
8081

8182
2. **User operation creation** - For actions such as sending transactions, a user operation is created with
82-
necessary details and signed by the configured signatory.
83+
necessary details and signed by the configured signers.
8384

8485
3. **Bundlers and mempool** - The signed user operation is submitted to a special mempool, where bundlers
8586
collect and package multiple user operations into a single transaction to save on gas costs.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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/api/experimental-actions/bundler-client.md#senduseroperationwithdelegation)).
68+
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/erc7715/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/api/experimental-actions/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/erc7715/bundler-client.md#senduseroperationwithdelegation) to redeem the permission.
9090

9191
<Tabs>
9292
<TabItem value="example.ts">
@@ -146,7 +146,7 @@ export const sessionAccount = await toMetaMaskSmartAccount({
146146
implementation: Implementation.Hybrid,
147147
deployParams: [account.address, [], [], []],
148148
deploySalt: "0x",
149-
signatory: { account },
149+
signer: { account },
150150
});
151151

152152
export const bundlerClient = createBundlerClient({
@@ -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/api/experimental-actions/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/erc7715/wallet-client.md#sendtransactionwithdelegation) to redeem the permission.
172172

173173
<Tabs>
174174
<TabItem value="example.ts">

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const sessionAccount = await toMetaMaskSmartAccount({
8080
implementation: Implementation.Hybrid,
8181
deployParams: [account.address, [], [], []],
8282
deploySalt: "0x",
83-
signatory: { account },
83+
signer: { account },
8484
});
8585

8686
export const walletClient = createWalletClient({
@@ -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/api/experimental-actions/bundler-client.md#senduseroperationwithdelegation)).
168+
These calls must be executed before redeeming the permission (this is handled for you in [`sendUserOperationWithDelegation`](../reference/erc7715/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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ You can use methods provided by the `DelegationStorageClient` of the MetaMask De
1818
## Prerequisites
1919

2020
- [Install and set up the Delegation Toolkit.](../get-started/install.md)
21-
- [Configure the Delegation Toolkit.](../guides/configure.md)
2221
- Ensure you have an API key and API key ID to interact with the `DelegationStorageClient`.
2322
If you need to gain access, email [email protected].
2423

delegation-toolkit/get-started/erc7715-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const sessionAccount = await toMetaMaskSmartAccount({
8080
implementation: Implementation.Hybrid,
8181
deployParams: [account.address, [], [], []],
8282
deploySalt: "0x",
83-
signatory: { account },
83+
signer: { account },
8484
});
8585
```
8686

delegation-toolkit/get-started/install.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
sidebar_label: Install and set up
33
description: Learn how to install and set up the MetaMask Delegation Toolkit.
4+
keywords: [install, MetaMask, delegation, toolkit, smart, accounts]
45
---
56

67
import Tabs from "@theme/Tabs";

delegation-toolkit/get-started/smart-account-quickstart/eip7702.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
description: Upgrade an externally owned account (EOA) to a smart account
33
sidebar_label: EIP-7702 quickstart
4+
keywords: [quickstart, EIP-7702, externally owned account, EOA, smart account]
45
---
56

67
# EIP-7702 quickstart
@@ -135,7 +136,7 @@ const smartAccount = await toMetaMaskSmartAccount({
135136
client: publicClient,
136137
implementation: Implementation.Stateless7702,
137138
address,
138-
signatory: { walletClient },
139+
signer: { walletClient },
139140
});
140141
```
141142

delegation-toolkit/get-started/smart-account-quickstart/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
description: Get started quickly with the MetaMask Smart Accounts
33
sidebar_label: Smart account quickstart
4+
keywords: [quickstart, smart accounts, user operation]
45
---
56

67
# MetaMask Smart Accounts quickstart
@@ -68,7 +69,7 @@ const smartAccount = await toMetaMaskSmartAccount({
6869
implementation: Implementation.Hybrid,
6970
deployParams: [account.address, [], [], []],
7071
deploySalt: "0x",
71-
signatory: { account },
72+
signer: { account },
7273
});
7374
```
7475

0 commit comments

Comments
 (0)