Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions delegation-toolkit/get-started/erc7715-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ This quickstart demonstrates how to request and redeem ERC-7715 permissions.

## Prerequisites

- [Install and set up the Delegation Toolkit.](install.md)
- [Install MetaMask Flask 12.14.2 or later.](/snaps/get-started/install-flask)
- Install [Node.js](https://nodejs.org/en/blog/release/v18.18.0) v18 or later.
- Install [Yarn](https://yarnpkg.com/),
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager.
- [Install MetaMask Flask 12.14.2 or later](/snaps/get-started/install-flask).

## Steps

### 1. Set up a Wallet Client
### 1. Install the toolkit

Install the [MetaMask Delegation Toolkit](https://www.npmjs.com/package/@metamask/delegation-toolkit):

```bash npm2yarn
npm install @metamask/delegation-toolkit
```

### 2. Set up a Wallet Client

Set up a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) using Viem's `createWalletClient` function. This client will help you interact with MetaMask Flask.

Expand All @@ -32,7 +42,7 @@ const walletClient = createWalletClient({
}).extend(erc7715ProviderActions());
```

### 2. Set up a Public Client
### 3. Set up a Public Client

Set up a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function.
This client will help you query the account state and interact with blockchain networks.
Expand All @@ -47,7 +57,7 @@ const publicClient = createPublicClient({
});
```

### 3. Set up a session account
### 4. Set up a session account

Set up a session account which can either be a smart account or an externally owned
account (EOA) to request ERC-7715 permissions. This account is responsible
Expand All @@ -74,7 +84,7 @@ const sessionAccount = await toMetaMaskSmartAccount({
});
```

### 4. Request ERC-7715 permissions
### 5. Request ERC-7715 permissions

Request ERC-7715 permissions from the user. Currently, only the
`native-token-stream` permission type is supported, which allows the dapp to stream
Expand Down Expand Up @@ -106,7 +116,7 @@ const grantedPermissions = await walletClient.grantPermissions([{
}]);
```

### 5. Set up a Bundler Client
### 6. Set up a Bundler Client

Set up a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler)
using Viem's `createBundlerClient` function. This lets you use the bundler service
Expand All @@ -127,7 +137,7 @@ const bundlerClient = createBundlerClient({
}).extend(erc7710BundlerActions());
```

### 6. Redeem ERC-7715 permissions
### 7. Redeem ERC-7715 permissions

The session account can now [redeem the delegation](../experimental/erc-7710-redeem-delegations.md). The redeem transaction is sent to the `DelegationManager` contract, which validates the delegation and executes actions on the user's behalf.

Expand Down
2 changes: 1 addition & 1 deletion delegation-toolkit/get-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This page provides instructions to install and set up the MetaMask Delegation To

### 1. Install the toolkit

Install the [MetaMask Delegation Toolkit](https://github.com/MetaMask/delegation-toolkit) dependencies:
Install the [MetaMask Delegation Toolkit](https://www.npmjs.com/package/@metamask/delegation-toolkit):

```bash npm2yarn
npm install @metamask/delegation-toolkit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ abstraction, such as batch transactions, gas sponsorship, and [delegation capabi

## Prerequisites

- [Install and set up the Delegation Toolkit.](../install.md)
- [Install Viem.](https://viem.sh/)
- Install [Node.js](https://nodejs.org/en/blog/release/v18.18.0) v18 or later.
- Install [Yarn](https://yarnpkg.com/),
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager.
- [Install Viem](https://viem.sh/).

## Steps

### 1. Set up a Public Client
### 1. Install the toolkit

Install the [MetaMask Delegation Toolkit](https://www.npmjs.com/package/@metamask/delegation-toolkit):

```bash npm2yarn
npm install @metamask/delegation-toolkit
```

### 2. Set up a Public Client

Set up a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function.
This client will let the EOA query the account state and interact with blockchain network.
Expand All @@ -31,7 +41,7 @@ const publicClient = createPublicClient({
});
```

### 2. Set up a Bundler Client
### 3. Set up a Bundler Client

Set up a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler) using Viem's `createBundlerClient` function.
This lets you use the bundler service to estimate gas for user operations and submit transactions to the network.
Expand All @@ -45,7 +55,7 @@ const bundlerClient = createBundlerClient({
});
```

### 3. Set up a Wallet Client
### 4. Set up a Wallet Client

Set up [Viem Wallet Client](https://viem.sh/docs/clients/wallet) using Viem's `createWalletClient` function.
This lets you sign and submit EIP-7702 authorization.
Expand All @@ -64,7 +74,7 @@ export const walletClient = createWalletClient({
});
```

### 4. Authorize a 7702 delegation
### 5. Authorize a 7702 delegation

Create an authorization to map the contract code to an EOA, and sign it
using Viem's [`signAuthorization`](https://viem.sh/docs/eip7702/signAuthorization) action. The `signAuthorization` action
Expand Down Expand Up @@ -92,7 +102,7 @@ const authorization = await walletClient.signAuthorization({
});
```

### 5. Submit the authorization
### 6. Submit the authorization

Once you have signed an authorization, you can send an EIP-7702 transaction to set the EOA code.
Since the authorization cannot be sent by itself, you can include it alongside a dummy transaction.
Expand All @@ -107,7 +117,7 @@ const hash = await walletClient.sendTransaction({
});
```

### 6. Create a MetaMask smart account
### 7. Create a MetaMask smart account

Create a smart account instance for the EOA and start
leveraging the benefits of account abstraction.
Expand All @@ -129,7 +139,7 @@ const smartAccount = await toMetaMaskSmartAccount({
});
```

### 7. Send a user operation
### 8. Send a user operation

Send a user operation through the upgraded EOA, using Viem's [`sendUserOperation`](https://viem.sh/account-abstraction/actions/bundler/sendUserOperation) method.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ You can get started quickly with [MetaMask Smart Accounts](../../concepts/smart-

## Prerequisites

[Install and set up the Delegation Toolkit.](../install.md)
- Install [Node.js](https://nodejs.org/en/blog/release/v18.18.0) v18 or later.
- Install [Yarn](https://yarnpkg.com/),
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager.

## Steps

### 1. Set up a Public Client
### 1. Install the toolkit

Install the [MetaMask Delegation Toolkit](https://www.npmjs.com/package/@metamask/delegation-toolkit):

```bash npm2yarn
npm install @metamask/delegation-toolkit
```

### 2. Set up a Public Client

Set up a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function. This client will let the smart account query the signer's account state and interact with blockchain network.

Expand All @@ -27,7 +37,7 @@ const publicClient = createPublicClient({
});
```

### 2. Set up a Bundler Client
### 3. Set up a Bundler Client

Set up a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler) using Viem's `createBundlerClient` function. This lets you use the bundler service to estimate gas for user operations and submit transactions to the network.

Expand All @@ -40,7 +50,7 @@ const bundlerClient = createBundlerClient({
});
```

### 3. Create a MetaMask smart account
### 4. Create a MetaMask smart account

[Create a MetaMask smart account](../../guides/smart-accounts/create-smart-account.md) to send the first user operation.

Expand All @@ -62,7 +72,7 @@ const smartAccount = await toMetaMaskSmartAccount({
});
```

### 4. Send a user operation
### 5. Send a user operation

Send a user operation using Viem's [`sendUserOperation`](https://viem.sh/account-abstraction/actions/bundler/sendUserOperation) method.

Expand Down
15 changes: 0 additions & 15 deletions gator_versioned_docs/version-0.12.0/get-started/llm-context.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/pages/tutorials/use-erc20-paymaster.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ const userOperationHash = await bundlerClient.sendUserOperation({

## Next steps

- See [Create a MetaMask smart account](/delegation-toolkit/development/guides/smart-accounts/create-smart-account) to learn more about smart account implementations.
- See [Send a gasless transaction](/delegation-toolkit/development/guides/smart-accounts/send-gasless-transaction) to learn how to use gasless paymaster.
- Learn more about [smart account implementations](/delegation-toolkit/development/guides/smart-accounts/create-smart-account).
- To sponsor gas for end users, see how to [send a gasless transaction](/delegation-toolkit/development/guides/smart-accounts/send-gasless-transaction).
4 changes: 2 additions & 2 deletions src/pages/tutorials/use-passkey-as-backup-signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ const smartAccount = await toMetaMaskSmartAccount({

## Next steps

- See [Create a MetaMask smart account](/delegation-toolkit/guides/smart-accounts/create-smart-account) to learn more about smart account implementations.
- See [Send a gasless transaction](/delegation-toolkit/guides/smart-accounts/send-gasless-transaction) to learn how to sponsor gas fees when adding a passkey as a backup signer.
- Learn more about [smart account implementations](/delegation-toolkit/development/guides/smart-accounts/create-smart-account).
- To sponsor gas fees when adding a passkey as a backup signer, see how to [send a gasless transaction](/delegation-toolkit/development/guides/smart-accounts/send-gasless-transaction).
Loading