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/guides/configure-toolkit.md
+59-11Lines changed: 59 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,71 @@
1
1
---
2
-
description: Learn about the delegator environment object `DeleGatorEnvironment` and how to use it.
2
+
description: Learn how to configure the bundler client, paymaster client, and toolkit environment.
3
+
sidebar_label: Configure the toolkit
3
4
---
4
5
5
6
import Tabs from "@theme/Tabs";
6
7
import TabItem from "@theme/TabItem";
7
8
8
-
# Delegator environment
9
+
# Configure the Delegation Toolkit
9
10
10
-
The `DeleGatorEnvironment` object is a component of the MetaMask Delegation Toolkit that defines the contract addresses necessary for interacting with the [Delegation Framework](delegation/index.md#delegation-framework) on a specific network.
11
+
The MetaMask Delegation toolkit is highly configurable, providing support for custom [bundlers and paymasters](#configure-the-bundler).
12
+
You can also configure the [toolkit environment](#configure-the-toolkit-environment) to interact with the [Delegation Framework](../concepts/delegation/index.md#delegation-framework).
11
13
12
-
The delegator environment serves several key purposes:
14
+
## Prerequisites
15
+
16
+
[Install and set up the Delegation Toolkit.](../get-started/install.md)
17
+
18
+
## Configure the bundler
19
+
20
+
The toolkit uses Viem's Account Abstraction API to configure custom bundlers and paymasters.
21
+
This provides a robust and flexible foundation for creating and managing [MetaMask Smart Accounts](../concepts/smart-accounts.md).
22
+
See Viem's [account abstraction documentation](https://viem.sh/account-abstraction) for more information on the API's features, methods, and best practices.
23
+
24
+
To use the bundler and paymaster clients with the toolkit, create instances of these clients and configure them as follows:
25
+
26
+
```typescript
27
+
import {
28
+
createPaymasterClient,
29
+
createBundlerClient,
30
+
} from"viem/account-abstraction";
31
+
import { http } from"viem";
32
+
import { sepoliaaschain } from"viem/chains";
33
+
34
+
// Replace these URLs with your actual bundler and paymaster endpoints.
Replace the bundler and paymaster URLs with your bundler and paymaster endpoints.
51
+
For example, you can use endpoints from [Pimlico](https://docs.pimlico.io/references/bundler), [Infura](/services), or [ZeroDev](https://docs.zerodev.app/meta-infra/intro).
52
+
53
+
:::note
54
+
Providing a paymaster is optional when configuring your bundler client. However, if you choose not to use a paymaster, the smart contract account must have enough funds to pay gas fees.
55
+
:::
56
+
57
+
## (Optional) Configure the toolkit environment
58
+
59
+
The toolkit environment (`DeleGatorEnvironment`) defines the contract addresses necessary for interacting with the [Delegation Framework](../concepts/delegation/index.md#delegation-framework) on a specific network.
60
+
It serves several key purposes:
13
61
14
62
- It provides a centralized configuration for all the contract addresses required by the Delegation Framework.
15
63
- It enables easy switching between different networks (for example, Mainnet and testnet) or custom deployments.
16
64
- It ensures consistency across different parts of the application that interact with the Delegation Framework.
17
65
18
-
## Resolve the delegator environment
66
+
###Resolve the environment
19
67
20
-
When you create a [MetaMask smart account](smart-accounts.md), the Delegation Toolkit automatically
68
+
When you create a [MetaMask smart account](../concepts/smart-accounts.md), the toolkit automatically
21
69
resolves the environment based on the version it requires and the chain configured.
22
70
If no environment is found for the specified chain, it throws an error.
23
71
@@ -70,7 +118,7 @@ See the changelog of the toolkit version you are using (in the left sidebar) for
70
118
71
119
Alternatively, you can use the [`getDelegatorEnvironment`](../reference/delegation/index.md#getdelegatorenvironment) function to resolve the environment.
72
120
This function is especially useful if your delegator is not a smart account when
73
-
creating a [redelegation](delegation/index.md#delegation-types).
121
+
creating a [redelegation](../concepts/delegation/index.md#delegation-types).
You can deploy the contracts using any method, but the toolkit provides a convenient [`deployDelegatorEnvironment`](../reference/delegation/index.md#deploydelegatorenvironment) function. This function simplifies deploying the Delegation Framework contracts to your desired EVM chain.
Once the contracts are deployed, you can use them to override the delegator environment.
205
+
Once the contracts are deployed, you can use them to override the environment.
158
206
159
-
## Override delegator environment
207
+
###Override the environment
160
208
161
-
To override the delegator environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/delegation/index.md#overridedeployedenvironment) function to resolve
209
+
To override the environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/api/delegation.md#overridedeployedenvironment) function to resolve
162
210
`DeleGatorEnvironment` with specified contracts for the given chain and contract version.
0 commit comments