Skip to content

Commit 14eb0e3

Browse files
committed
combine pages and edit
1 parent 47e7e92 commit 14eb0e3

File tree

5 files changed

+65
-73
lines changed

5 files changed

+65
-73
lines changed

delegation-toolkit/guides/configure/environment.md renamed to delegation-toolkit/guides/configure-toolkit.md

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,71 @@
11
---
2-
description: Learn how to configure the toolkit environment to interact with the Delegation Framework.
2+
description: Learn how to configure the bundler client, paymaster client, and toolkit environment.
3+
sidebar_label: Configure the toolkit
34
---
45

56
import Tabs from "@theme/Tabs";
67
import TabItem from "@theme/TabItem";
78

8-
# Configure the toolkit environment
9+
# Configure the Delegation Toolkit
910

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+
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).
1113

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 { sepolia as chain } from "viem/chains";
33+
34+
// Replace these URLs with your actual bundler and paymaster endpoints.
35+
const bundlerUrl = "https://your-bundler-url.com";
36+
const paymasterUrl = "https://your-paymaster-url.com";
37+
38+
// The paymaster is optional.
39+
const paymasterClient = createPaymasterClient({
40+
transport: http(paymasterUrl),
41+
});
42+
43+
const bundlerClient = createBundlerClient({
44+
transport: http(bundlerUrl),
45+
paymaster: paymasterClient,
46+
chain,
47+
});
48+
```
49+
50+
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 sufficient funds to pay for gas fees directly.
55+
:::
56+
57+
## 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:
1361

1462
- It provides a centralized configuration for all the contract addresses required by the Delegation Framework.
1563
- It enables easy switching between different networks (for example, Mainnet and testnet) or custom deployments.
1664
- It ensures consistency across different parts of the application that interact with the Delegation Framework.
1765

18-
## Resolve the delegator environment
66+
### Resolve the environment
1967

20-
When you create a [MetaMask smart account](../../concepts/smart-accounts.md), the Delegation Toolkit automatically
68+
When you create a [MetaMask smart account](../concepts/smart-accounts.md), the toolkit automatically
2169
resolves the environment based on the version it requires and the chain configured.
2270
If no environment is found for the specified chain, it throws an error.
2371

@@ -68,9 +116,9 @@ export delegatorSmartAccount;
68116
See the changelog of the toolkit version you are using (in the left sidebar) for supported chains.
69117
:::
70118

71-
Alternatively, you can use the [`getDelegatorEnvironment`](../../reference/api/delegation.md#getdelegatorenvironment) function to resolve the environment.
119+
Alternatively, you can use the [`getDelegatorEnvironment`](../reference/api/delegation.md#getdelegatorenvironment) function to resolve the environment.
72120
This function is especially useful if your delegator is not a smart account when
73-
creating a [redelegation](../../concepts/delegation/index.md#delegation-types).
121+
creating a [redelegation](../concepts/delegation/index.md#delegation-types).
74122

75123
```typescript
76124
import {
@@ -82,9 +130,9 @@ import {
82130
const environment: DeleGatorEnvironment = getDelegatorEnvironment(11155111);
83131
```
84132

85-
## Deploy custom delegator environment
133+
### Deploy a custom environment
86134

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.
135+
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.
88136

89137
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)
90138
to deploy the contracts and resolve the `DeleGatorEnvironment`.
@@ -154,11 +202,11 @@ const environment = await deployDeleGatorEnvironment(
154202
);
155203
```
156204

157-
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.
158206

159-
## Override delegator environment
207+
### Override the environment
160208

161-
To override the delegator environment, the toolkit provides an [`overrideDeployedEnvironment`](../../reference/api/delegation.md#overridedeployedenvironment) function to resolve
209+
To override the environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/api/delegation.md#overridedeployedenvironment) function to resolve
162210
`DeleGatorEnvironment` with specified contracts for the given chain and contract version.
163211

164212
```typescript

delegation-toolkit/guides/configure/bundler.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

delegation-toolkit/guides/smart-accounts/create-smart-account.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export const walletClient = createWalletClient({
412412

413413
With a MetaMask smart account, you can perform the following functions:
414414

415-
- In conjunction with [Viem Account Abstraction clients](../configure/bundler.md), [deploy the smart account](deploy-smart-account.md)
415+
- In conjunction with [Viem Account Abstraction clients](../configure-toolkit.md), [deploy the smart account](deploy-smart-account.md)
416416
and [send user operations](send-user-operation.md).
417417
- [Create delegations](../delegation/execute-on-smart-accounts-behalf.md) that can be used to grant specific rights and permissions to other accounts.
418418
Smart accounts that create delegations are called *delegator accounts*.

gator-sidebar.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,7 @@ const sidebar = {
5050
label: 'Guides',
5151
collapsed: false,
5252
items: [
53-
{
54-
type: 'category',
55-
label: 'Configure the toolkit',
56-
collapsed: false,
57-
items: [
58-
'guides/configure/bundler',
59-
'guides/configure/environment',
60-
],
61-
},
53+
'guides/configure-toolkit',
6254
{
6355
type: 'category',
6456
label: 'MetaMask Smart Accounts',

vercel.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@
732732
},
733733
{
734734
"source": "/delegation-toolkit/development/how-to/configure/",
735-
"destination": "/delegation-toolkit/development/guides/configure/bundler/"
735+
"destination": "/delegation-toolkit/development/guides/configure-toolkit/"
736736
},
737737
{
738738
"source": "/delegation-toolkit/development/how-to/create-delegation/",
@@ -768,7 +768,7 @@
768768
},
769769
{
770770
"source": "/delegation-toolkit/development/concepts/environment/",
771-
"destination": "/delegation-toolkit/development/guides/configure/environment/"
771+
"destination": "/delegation-toolkit/development/guides/configure-toolkit/"
772772
},
773773
{
774774
"source": "/developer-tools/faucet/sepolia/",

0 commit comments

Comments
 (0)