Skip to content

Commit 47e7e92

Browse files
committed
add bundler config and fix links
1 parent 002a5e4 commit 47e7e92

File tree

5 files changed

+66
-10
lines changed

5 files changed

+66
-10
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
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 { sepolia as chain } from "viem/chains";
26+
27+
// Replace these URLs with your actual bundler and paymaster endpoints.
28+
const bundlerUrl = "https://your-bundler-url.com";
29+
const paymasterUrl = "https://your-paymaster-url.com";
30+
31+
// The paymaster is optional.
32+
const paymasterClient = createPaymasterClient({
33+
transport: http(paymasterUrl),
34+
});
35+
36+
const bundlerClient = createBundlerClient({
37+
transport: http(bundlerUrl),
38+
paymaster: paymasterClient,
39+
chain,
40+
});
41+
```
42+
43+
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.
48+
:::

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import TabItem from "@theme/TabItem";
77

88
# Configure the toolkit environment
99

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.
1111

1212
The delegator environment serves several key purposes:
1313

@@ -17,7 +17,7 @@ The delegator environment serves several key purposes:
1717

1818
## Resolve the delegator environment
1919

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
2121
resolves the environment based on the version it requires and the chain configured.
2222
If no environment is found for the specified chain, it throws an error.
2323

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

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.
7272
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).
7474

7575
```typescript
7676
import {
@@ -84,7 +84,7 @@ const environment: DeleGatorEnvironment = getDelegatorEnvironment(11155111);
8484

8585
## Deploy custom delegator environment
8686

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.
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.
8888

8989
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)
9090
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
158158

159159
## Override delegator environment
160160

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
162162
`DeleGatorEnvironment` with specified contracts for the given chain and contract version.
163163

164164
```typescript

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.md), [deploy the smart account](deploy-smart-account.md)
415+
- In conjunction with [Viem Account Abstraction clients](../configure/bundler.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: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ const sidebar = {
5050
label: 'Guides',
5151
collapsed: false,
5252
items: [
53-
'guides/configure-environment',
53+
{
54+
type: 'category',
55+
label: 'Configure the toolkit',
56+
collapsed: false,
57+
items: [
58+
'guides/configure/bundler',
59+
'guides/configure/environment',
60+
],
61+
},
5462
{
5563
type: 'category',
5664
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-environment/"
735+
"destination": "/delegation-toolkit/development/guides/configure/bundler/"
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/environment/"
772772
},
773773
{
774774
"source": "/developer-tools/faucet/sepolia/",

0 commit comments

Comments
 (0)