You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: delegation-toolkit/get-started/delegation-quickstart.md
+29-11Lines changed: 29 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,13 @@ sidebar_position: 3
4
4
sidebar_label: Delegation quickstart
5
5
---
6
6
7
-
# Delegation Toolkit quickstart
7
+
# Delegation quickstart
8
8
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
+
[Delegation](../concepts/delegation.md) is the ability for a [MetaMask smart account](../concepts/smart-accounts.md) to grant permission to another account to perform executions on its behalf.
10
+
11
+
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).
12
+
13
+
This quickstart will refer to the delegator account as "Alice," who grants permission to "Bob," the delegate account, to perform executions on her behalf.
See [how to configure other smart account types](../how-to/create-smart-account/configure-accounts-signers.md).
73
+
:::
74
+
65
75
### 4. Create a delegate account
66
76
67
-
Create a delegate account to receive the delegation. The delegate can be either a smart account or an externally owned account (EOA).
77
+
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).
[Create a root delegation](../how-to/create-delegation/index.md#create-a-root-delegation) from the delegator account to the delegate account.
98
+
[Create a root delegation](../how-to/create-delegation/index.md#create-a-root-delegation) from Alice to Bob.
99
+
A root delegation is a delegation that doesn't derive its authority from another delegation.
100
+
Alice is delegating her own authority away, as opposed to *redelegating* permissions she received from a previous delegation.
89
101
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.
102
+
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.
103
+
For example, Alice can delegate the ability to sepnd her USDC to Bob, limiting the amount to 100 USDC.
91
104
92
105
:::warning Important
93
106
94
-
Before creating a delegation, ensure that the delegator account has been deployed. If the account is not deployed, redeeming the delegation will fail.
107
+
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.
[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.
123
+
[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.
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.
138
+
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.
126
139
127
140
To prepare the calldata for the redeem transaction, use the [`redeemDelegation`](../reference/api/delegation.md#redeemdelegation) utility function from the Delegation Toolkit.
Copy file name to clipboardExpand all lines: delegation-toolkit/how-to/configure.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The MetaMask Delegation Toolkit provides custom middleware for [Pimlico's](https
18
18
## Prerequisites
19
19
20
20
-[Install and set up the Delegation Toolkit](../get-started/install.md).
21
-
- Optionally, complete the [Delegation Toolkit quickstart](../get-started/quickstart.md) to
21
+
- Optionally, complete the [smart account quickstart](../get-started/quickstart.md) or [delegation quickstart](../get-started/delegation-quickstart.md) to
22
22
familiarize yourself with the toolkit's capabilities.
0 commit comments