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
description: Learn how to configure the bundler client.
3
+
---
4
+
5
+
# Configure the bundler
6
+
7
+
The MetaMask Delegation Toolkit uses Viem's Account Abstraction API to configure custom bundlers and paymasters.
8
+
This provides a robust and flexible foundation for creating and managing [MetaMask Smart Accounts](../../concepts/smart-accounts.md).
9
+
See Viem's [account abstraction documentation](https://viem.sh/account-abstraction) for more information on the API's features, methods, and best practices.
10
+
11
+
## Prerequisites
12
+
13
+
[Install and set up the Delegation Toolkit.](../../get-started/install.md)
14
+
15
+
## Configure Viem bundler and paymaster clients
16
+
17
+
To use the bundler and paymaster clients with the toolkit, create instances of these clients and configure them as follows:
18
+
19
+
```typescript
20
+
import {
21
+
createPaymasterClient,
22
+
createBundlerClient,
23
+
} from"viem/account-abstraction";
24
+
import { http } from"viem";
25
+
import { sepoliaaschain } from"viem/chains";
26
+
27
+
// Replace these URLs with your actual bundler and paymaster endpoints.
Replace the bundler and paymaster URLs with your bundler and paymaster endpoints.
44
+
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).
45
+
46
+
:::note
47
+
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 sufficient funds to pay for gas fees directly.
Copy file name to clipboardExpand all lines: delegation-toolkit/guides/configure/environment.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ import TabItem from "@theme/TabItem";
7
7
8
8
# Configure the toolkit environment
9
9
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.
10
+
The `DeleGatorEnvironment` object is a component of the MetaMask Delegation Toolkit that defines the contract addresses necessary for interacting with the [Delegation Framework](../../concepts/delegation/index.md#delegation-framework) on a specific network.
11
11
12
12
The delegator environment serves several key purposes:
13
13
@@ -17,7 +17,7 @@ The delegator environment serves several key purposes:
17
17
18
18
## Resolve the delegator environment
19
19
20
-
When you create a [MetaMask smart account](smart-accounts.md), the Delegation Toolkit automatically
20
+
When you create a [MetaMask smart account](../../concepts/smart-accounts.md), the Delegation Toolkit automatically
21
21
resolves the environment based on the version it requires and the chain configured.
22
22
If no environment is found for the specified chain, it throws an error.
23
23
@@ -68,9 +68,9 @@ export delegatorSmartAccount;
68
68
See the changelog of the toolkit version you are using (in the left sidebar) for supported chains.
69
69
:::
70
70
71
-
Alternatively, you can use the [`getDelegatorEnvironment`](../reference/api/delegation.md#getdelegatorenvironment) function to resolve the environment.
71
+
Alternatively, you can use the [`getDelegatorEnvironment`](../../reference/api/delegation.md#getdelegatorenvironment) function to resolve the environment.
72
72
This function is especially useful if your delegator is not a smart account when
73
-
creating a [redelegation](delegation/index.md#delegation-types).
73
+
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/api/delegation.md#deploydelegatorenvironment) function. This function simplifies deploying the Delegation Framework contracts to your desired EVM chain.
87
+
You can deploy the contracts using any method, but the toolkit provides a convenient [`deployDelegatorEnvironment`](../../reference/api/delegation.md#deploydelegatorenvironment) function. This function simplifies deploying the Delegation Framework contracts to your desired EVM chain.
88
88
89
89
This function requires a Viem [Public Client](https://viem.sh/docs/clients/public.html), [Wallet Client](https://viem.sh/docs/clients/wallet.html), and [Chain](https://viem.sh/docs/glossary/types#chain)
90
90
to deploy the contracts and resolve the `DeleGatorEnvironment`.
@@ -158,7 +158,7 @@ Once the contracts are deployed, you can use them to override the delegator envi
158
158
159
159
## Override delegator environment
160
160
161
-
To override the delegator environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/api/delegation.md#overridedeployedenvironment) function to resolve
161
+
To override the delegator environment, the toolkit provides an [`overrideDeployedEnvironment`](../../reference/api/delegation.md#overridedeployedenvironment) function to resolve
162
162
`DeleGatorEnvironment` with specified contracts for the given chain and contract version.
0 commit comments