Skip to content

Commit f1126f3

Browse files
committed
Improve delegation quickstarts
1 parent 1bd79ae commit f1126f3

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ sidebar_label: Delegation quickstart
66

77
# Delegation Toolkit quickstart
88

9-
This page demonstrates how to get started quickly with the MetaMask Delegation Toolkit, by creating a delegator account and completing the delegation lifecycle (creating, signing, and redeeming a delegation).
9+
This page demonstrates how to get started quickly with [delegations](../concepts/delegation.md).
10+
Delegation is the ability for a [MetaMask smart account](../concepts/smart-accounts.md) to grant permission to another account to perform executions on their behalf.
11+
12+
In this quickstart, you will create a *delegator account* (the account that grants the permission) and *delegate account* (the account that receives the permission), and complete the delegation lifecycle (create, sign, and redeem a delegation).
13+
14+
This quickstart will refer to the delegator account as "Alice," who grants permission to "Bob," the delegate account, to perform executions on her behalf.
1015

1116
## Prerequisites
1217

@@ -43,9 +48,11 @@ const bundlerClient = createBundlerClient({
4348

4449
### 3. Create a delegator account
4550

46-
[Create a delegator smart account](../how-to/create-smart-account/index.md) to set up a delegation.
51+
Create an account to represent Alice, the delegator who will set up the delegation.
52+
The delegator must be a [smart account](../how-to/create-smart-account/index.md).
4753

48-
This example configures a [Hybrid](../how-to/create-smart-account/configure-accounts-signers.md#configure-a-hybrid-smart-account) delegator account:
54+
This example configures a [Hybrid](../concepts/smart-accounts.md#hybrid-smart-account) smart account,
55+
which is a flexible smart account implementation that supports both an externally owned account (EOA) owner and any number of P256 (passkey) signers:
4956

5057
```typescript
5158
import { Implementation, toMetaMaskSmartAccount } from '@metamask/delegation-toolkit'
@@ -62,11 +69,15 @@ const delegatorSmartAccount = await toMetaMaskSmartAccount({
6269
})
6370
```
6471

72+
:::note
73+
See [how to configure other smart account types](../how-to/create-smart-account/configure-accounts-signers.md).
74+
:::
75+
6576
### 4. Create a delegate account
6677

67-
Create a delegate account to receive the delegation. The delegate can be either a smart account or an externally owned account (EOA).
78+
Create an account to represent Bob, the delegate who will receive the delegation. The delegate can be a smart account or an externally owned account (EOA).
6879

69-
This example uses a smart account:
80+
This example configures a Hybrid smart account:
7081

7182
```typescript
7283
import { Implementation, toMetaMaskSmartAccount } from '@metamask/delegation-toolkit'
@@ -85,13 +96,14 @@ const delegateSmartAccount = await toMetaMaskSmartAccount({
8596

8697
### 5. Create a delegation
8798

88-
[Create a root delegation](../how-to/create-delegation/index.md#create-a-root-delegation) from the delegator account to the delegate account.
99+
[Create a root delegation](../how-to/create-delegation/index.md#create-a-root-delegation) from Alice to Bob.
89100

90-
This example passes an empty `caveats` array, which means the delegate can perform any action on the delegator's behalf. We recommend [restricting the delegation](../how-to/create-delegation/restrict-delegation.md) by adding caveat enforcers.
101+
This example passes an empty `caveats` array, which means Bob can perform any action on Alice's behalf. We recommend [restricting the delegation](../how-to/create-delegation/restrict-delegation.md) by adding caveat enforcers.
102+
For example, Alice can delegate the ability to sepnd her USDC to Bob, limiting the amount to 100 USDC.
91103

92104
:::warning Important
93105

94-
Before creating a delegation, ensure that the delegator account has been deployed. If the account is not deployed, redeeming the delegation will fail.
106+
Before creating a delegation, ensure that the delegator account (in this example, Alice's account) has been deployed. If the account is not deployed, redeeming the delegation will fail.
95107

96108
:::
97109

@@ -107,7 +119,7 @@ const delegation = createDelegation({
107119

108120
### 6. Sign the delegation
109121

110-
[Sign the delegation](../how-to/create-delegation/index.md#sign-a-delegation) using the [`signDelegation`](../reference/api/smart-account.md#signdelegation) method from `MetaMaskSmartAccount`. Alternatively, you can use the Delegation Toolkit's [`signDelegation`](../reference/api/delegation.md#signdelegation) utility. The signed delegation will be used later to perform actions on behalf of the delegator.
122+
[Sign the delegation](../how-to/create-delegation/index.md#sign-a-delegation) with Alice's account, using the [`signDelegation`](../reference/api/smart-account.md#signdelegation) method from `MetaMaskSmartAccount`. Alternatively, you can use the Delegation Toolkit's [`signDelegation`](../reference/api/delegation.md#signdelegation) utility. Bob will later use the signed delegation to perform actions on Alice's behalf.
111123

112124
```typescript
113125
const signature = await delegatorSmartAccount.signDelegation({
@@ -122,7 +134,7 @@ const signedDelegation = {
122134

123135
### 7. Redeem the delegation
124136

125-
The delegate account can now [redeem the delegation](../how-to/redeem-delegation.md). The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on the delegator's behalf.
137+
Bob can now [redeem the delegation](../how-to/redeem-delegation.md). The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on Alice's behalf.
126138

127139
To prepare the calldata for the redeem transaction, use the [`redeemDelegation`](../reference/api/delegation.md#redeemdelegation) utility function from the Delegation Toolkit.
128140

delegation-toolkit/get-started/eip7715-quickstart.md renamed to delegation-toolkit/get-started/erc7715-quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
description: Learn how to use ERC-7715 to request permisisons.
33
sidebar_position: 5
4-
sidebar_label: EIP-7715 quickstart
4+
sidebar_label: ERC-7715 quickstart
55
---
66

7-
# EIP-7715 quickstart
7+
# ERC-7715 quickstart
88

99
This page demonstrates how to use [ERC-7715](https://eips.ethereum.org/EIPS/eip-7715) to request permissions
1010
from a wallet, and execute transactions on a user's behalf.
1111

1212
## Prerequisites
1313

1414
- [Install and set up the Delegation Toolkit.](install.md)
15-
- [Install MetaMask Flask 12.14.2 or later](/snaps/get-started/install-flask.md).
15+
- [Install MetaMask Flask 12.14.2 or later](/snaps/get-started/install-flask).
1616

1717
## Steps
1818

delegation-toolkit/get-started/quickstart.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
description: Get started quickly with the MetaMask Smart Accounts
33
sidebar_position: 2
4-
sidebar_label: Quickstart
4+
sidebar_label: Smart account quickstart
55
---
66

77
# MetaMask Smart Accounts quickstart
88

9-
This page demonstrates how to get started quickly with MetaMask Smart Accounts, and send the first user operation.
9+
This page demonstrates how to get started quickly with [MetaMask Smart Accounts](../concepts/smart-accounts.md), and send the first user operation.
1010

1111
## Prerequisites
1212

@@ -45,7 +45,8 @@ const bundlerClient = createBundlerClient({
4545

4646
[Create a MetaMask smart account](../how-to/create-smart-account/index.md) to send the first user operation.
4747

48-
This example configures a [Hybrid](../how-to/create-smart-account/configure-accounts-signers.md#configure-a-hybrid-smart-account) smart account:
48+
This example configures a [Hybrid](../concepts/smart-accounts.md#hybrid-smart-account) smart account,
49+
which is a flexible smart account implementation that supports both an externally owned account (EOA) owner and any number of P256 (passkey) signers:
4950

5051
```typescript
5152
import { Implementation, toMetaMaskSmartAccount } from "@metamask/delegation-toolkit";
@@ -62,6 +63,10 @@ const smartAccount = await toMetaMaskSmartAccount({
6263
});
6364
```
6465

66+
:::note
67+
See [how to configure other smart account types](../how-to/create-smart-account/configure-accounts-signers.md).
68+
:::
69+
6570
### 4. Send a user operation
6671

6772
Send a user operation using Viem's [`sendUserOperation`](https://viem.sh/account-abstraction/actions/bundler/sendUserOperation) method.

0 commit comments

Comments
 (0)