diff --git a/delegation-toolkit/experimental/store-retrieve-delegations.md b/delegation-toolkit/experimental/store-retrieve-delegations.md index 8de881b95d3..bfee5f0e458 100644 --- a/delegation-toolkit/experimental/store-retrieve-delegations.md +++ b/delegation-toolkit/experimental/store-retrieve-delegations.md @@ -18,7 +18,6 @@ You can use methods provided by the `DelegationStorageClient` of the MetaMask De ## Prerequisites - [Install and set up the Delegation Toolkit.](../get-started/install.md) -- [Configure the Delegation Toolkit.](../guides/configure.md) - Ensure you have an API key and API key ID to interact with the `DelegationStorageClient`. If you need to gain access, email hellogators@consensys.net. diff --git a/delegation-toolkit/concepts/environment.md b/delegation-toolkit/guides/configure-toolkit.md similarity index 68% rename from delegation-toolkit/concepts/environment.md rename to delegation-toolkit/guides/configure-toolkit.md index b5198bfee73..0d9d3c00c84 100644 --- a/delegation-toolkit/concepts/environment.md +++ b/delegation-toolkit/guides/configure-toolkit.md @@ -1,23 +1,71 @@ --- -description: Learn about the delegator environment object `DeleGatorEnvironment` and how to use it. +description: Learn how to configure the bundler client, paymaster client, and toolkit environment. +sidebar_label: Configure the toolkit --- import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; -# Delegator environment +# Configure the Delegation Toolkit -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. +The MetaMask Delegation toolkit is highly configurable, providing support for custom [bundlers and paymasters](#configure-the-bundler). +You can also configure the [toolkit environment](#configure-the-toolkit-environment) to interact with the [Delegation Framework](../concepts/delegation/index.md#delegation-framework). -The delegator environment serves several key purposes: +## Prerequisites + +[Install and set up the Delegation Toolkit.](../get-started/install.md) + +## Configure the bundler + +The toolkit uses Viem's Account Abstraction API to configure custom bundlers and paymasters. +This provides a robust and flexible foundation for creating and managing [MetaMask Smart Accounts](../concepts/smart-accounts.md). +See Viem's [account abstraction documentation](https://viem.sh/account-abstraction) for more information on the API's features, methods, and best practices. + +To use the bundler and paymaster clients with the toolkit, create instances of these clients and configure them as follows: + +```typescript +import { + createPaymasterClient, + createBundlerClient, +} from "viem/account-abstraction"; +import { http } from "viem"; +import { sepolia as chain } from "viem/chains"; + +// Replace these URLs with your actual bundler and paymaster endpoints. +const bundlerUrl = "https://your-bundler-url.com"; +const paymasterUrl = "https://your-paymaster-url.com"; + +// The paymaster is optional. +const paymasterClient = createPaymasterClient({ + transport: http(paymasterUrl), +}); + +const bundlerClient = createBundlerClient({ + transport: http(bundlerUrl), + paymaster: paymasterClient, + chain, +}); +``` + +Replace the bundler and paymaster URLs with your bundler and paymaster endpoints. +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). + +:::note +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. +::: + +## (Optional) Configure the toolkit environment + +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. +It serves several key purposes: - It provides a centralized configuration for all the contract addresses required by the Delegation Framework. - It enables easy switching between different networks (for example, Mainnet and testnet) or custom deployments. - It ensures consistency across different parts of the application that interact with the Delegation Framework. -## Resolve the delegator environment +### Resolve the environment -When you create a [MetaMask smart account](smart-accounts.md), the Delegation Toolkit automatically +When you create a [MetaMask smart account](../concepts/smart-accounts.md), the toolkit automatically resolves the environment based on the version it requires and the chain configured. If no environment is found for the specified chain, it throws an error. @@ -70,7 +118,7 @@ See the changelog of the toolkit version you are using (in the left sidebar) for Alternatively, you can use the [`getDelegatorEnvironment`](../reference/api/delegation.md#getdelegatorenvironment) function to resolve the environment. This function is especially useful if your delegator is not a smart account when -creating a [redelegation](delegation/index.md#delegation-types). +creating a [redelegation](../concepts/delegation/index.md#delegation-types). ```typescript import { @@ -82,7 +130,7 @@ import { const environment: DeleGatorEnvironment = getDelegatorEnvironment(11155111); ``` -## Deploy custom delegator environment +### Deploy a custom environment 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. @@ -154,11 +202,11 @@ const environment = await deployDeleGatorEnvironment( ); ``` -Once the contracts are deployed, you can use them to override the delegator environment. +Once the contracts are deployed, you can use them to override the environment. -## Override delegator environment +### Override the environment -To override the delegator environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/api/delegation.md#overridedeployedenvironment) function to resolve +To override the environment, the toolkit provides an [`overrideDeployedEnvironment`](../reference/api/delegation.md#overridedeployedenvironment) function to resolve `DeleGatorEnvironment` with specified contracts for the given chain and contract version. ```typescript diff --git a/delegation-toolkit/guides/configure.md b/delegation-toolkit/guides/configure.md deleted file mode 100644 index 57fa1e728b9..00000000000 --- a/delegation-toolkit/guides/configure.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: Learn how to configure the MetaMask Delegation Toolkit using Viem. -sidebar_label: Configure the toolkit ---- - -# Configure the Delegation Toolkit - -The MetaMask Delegation Toolkit enables you to easily integrate [MetaMask Smart Accounts](../concepts/smart-accounts.md) into your dapp, -enabling a more flexible, secure, and frictionless experience for your users. - -The toolkit is highly configurable, allowing you to tailor it to your project's specific needs. It includes support for custom signers, multiple signatory schemes, custom paymasters and bundlers, and more. - -:::note -The MetaMask Delegation Toolkit provides custom middleware for [Pimlico's](https://docs.pimlico.io/) gas fee resolver, paymaster, and bundler. Additional options will be made available soon. -::: - -## Prerequisites - -[Install and set up the Delegation Toolkit.](../get-started/install.md) - -## Viem's Account Abstraction API - -The toolkit uses Viem's Account Abstraction API. This provides a robust and flexible foundation for creating and managing smart contract accounts. -See Viem's [Smart Account documentation](https://viem.sh/account-abstraction/accounts/smart) for more information on the API's features, methods, and best practices. - - -## Configure Viem bundler and paymaster clients - -To use the bundler and paymaster clients with the toolkit, create instances of these clients and configure them as follows: - -```typescript -import { - createPaymasterClient, - createBundlerClient, -} from "viem/account-abstraction"; -import { http } from "viem"; -import { sepolia as chain } from "viem/chains"; - -// Replace these URLs with your actual bundler and paymaster endpoints. -const bundlerUrl = "https://your-bundler-url.com"; -const paymasterUrl = "https://your-paymaster-url.com"; - -// The paymaster is optional. -const paymasterClient = createPaymasterClient({ - transport: http(paymasterUrl), -}); - -const bundlerClient = createBundlerClient({ - transport: http(bundlerUrl), - paymaster: paymasterClient, - chain, -}); -``` - -:::note -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. -::: - diff --git a/delegation-toolkit/guides/smart-accounts/create-smart-account.md b/delegation-toolkit/guides/smart-accounts/create-smart-account.md index df2eca55cc7..56712123e2a 100644 --- a/delegation-toolkit/guides/smart-accounts/create-smart-account.md +++ b/delegation-toolkit/guides/smart-accounts/create-smart-account.md @@ -13,8 +13,7 @@ An account's supported *signatories* can sign data on behalf of the smart accoun ## Prerequisites -- [Install and set up the Delegation Toolkit.](../../get-started/install.md) -- [Configure the Delegation Toolkit.](../configure.md) +[Install and set up the Delegation Toolkit.](../../get-started/install.md) ## Create a Hybrid smart account @@ -413,7 +412,7 @@ export const walletClient = createWalletClient({ With a MetaMask smart account, you can perform the following functions: -- In conjunction with [Viem Account Abstraction clients](../configure.md), [deploy the smart account](deploy-smart-account.md) +- In conjunction with [Viem Account Abstraction clients](../configure-toolkit.md), [deploy the smart account](deploy-smart-account.md) and [send user operations](send-user-operation.md). - [Create delegations](../delegation/execute-on-smart-accounts-behalf.md) that can be used to grant specific rights and permissions to other accounts. Smart accounts that create delegations are called *delegator accounts*. diff --git a/delegation-toolkit/guides/smart-accounts/deploy-smart-account.md b/delegation-toolkit/guides/smart-accounts/deploy-smart-account.md index 23e8b70ceab..135ff40b306 100644 --- a/delegation-toolkit/guides/smart-accounts/deploy-smart-account.md +++ b/delegation-toolkit/guides/smart-accounts/deploy-smart-account.md @@ -13,7 +13,6 @@ the first user operation, or manually deploy the account. ## Prerequisites - [Install and set up the Delegation Toolkit.](../../get-started/install.md) -- [Configure the Delegation Toolkit.](../configure.md) - [Create a MetaMask smart account.](create-smart-account.md) ## Deploy with the first user operation diff --git a/delegation-toolkit/guides/smart-accounts/generate-multisig-signature.md b/delegation-toolkit/guides/smart-accounts/generate-multisig-signature.md index 416dff7cd8a..36ee418a2a8 100644 --- a/delegation-toolkit/guides/smart-accounts/generate-multisig-signature.md +++ b/delegation-toolkit/guides/smart-accounts/generate-multisig-signature.md @@ -17,7 +17,6 @@ into a single aggregated signature. ## Prerequisites - [Install and set up the Delegation Toolkit.](../../get-started/install.md) -- [Configure the Delegation Toolkit.](../configure.md) - [Create a Multisig smart account.](create-smart-account.md#create-a-multisig-smart-account) ## Generate a multisig signature diff --git a/delegation-toolkit/guides/smart-accounts/send-gasless-transaction.md b/delegation-toolkit/guides/smart-accounts/send-gasless-transaction.md index 708573ffb60..93fb019f0e9 100644 --- a/delegation-toolkit/guides/smart-accounts/send-gasless-transaction.md +++ b/delegation-toolkit/guides/smart-accounts/send-gasless-transaction.md @@ -13,7 +13,6 @@ You can use any paymaster service provider, such as [Pimlico](https://docs.pimli ## Prerequisites - [Install and set up the Delegation Toolkit.](../../get-started/install.md) -- [Configure the Delegation Toolkit.](../configure.md) - [Create a MetaMask smart account.](create-smart-account.md) ## Send a gasless transaction diff --git a/delegation-toolkit/guides/smart-accounts/send-user-operation.md b/delegation-toolkit/guides/smart-accounts/send-user-operation.md index 28b00b22b6c..96258d5f347 100644 --- a/delegation-toolkit/guides/smart-accounts/send-user-operation.md +++ b/delegation-toolkit/guides/smart-accounts/send-user-operation.md @@ -25,7 +25,6 @@ If a user operation is sent from a MetaMask smart account that has not been depl ## Prerequisites - [Install and set up the Delegation Toolkit.](../../get-started/install.md) -- [Configure the Delegation Toolkit.](../configure.md) - [Create a MetaMask smart account.](create-smart-account.md) ## Send a user operation diff --git a/gator-sidebar.js b/gator-sidebar.js index ae126472ee1..70cbe0797f4 100644 --- a/gator-sidebar.js +++ b/gator-sidebar.js @@ -43,7 +43,6 @@ const sidebar = { 'concepts/delegation/caveat-enforcers', ], }, - 'concepts/environment', ], }, { @@ -51,7 +50,7 @@ const sidebar = { label: 'Guides', collapsed: false, items: [ - 'guides/configure', + 'guides/configure-toolkit', { type: 'category', label: 'MetaMask Smart Accounts', diff --git a/vercel.json b/vercel.json index 29a35481cc1..125b355eed8 100644 --- a/vercel.json +++ b/vercel.json @@ -732,7 +732,7 @@ }, { "source": "/delegation-toolkit/development/how-to/configure/", - "destination": "/delegation-toolkit/development/guides/configure/" + "destination": "/delegation-toolkit/development/guides/configure-toolkit/" }, { "source": "/delegation-toolkit/development/how-to/create-delegation/", @@ -766,6 +766,10 @@ "source": "/delegation-toolkit/development/concepts/caveat-enforcers/", "destination": "/delegation-toolkit/development/concepts/delegation/caveat-enforcers/" }, + { + "source": "/delegation-toolkit/development/concepts/environment/", + "destination": "/delegation-toolkit/development/guides/configure-toolkit/" + }, { "source": "/developer-tools/faucet/sepolia/", "destination": "/developer-tools/faucet/"