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
Copy file name to clipboardExpand all lines: delegation-toolkit/concepts/smart-accounts.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,11 @@ ERC-4337 introduces the following concepts:
39
39
40
40
The MetaMask Delegation Toolkit supports three types of MetaMask Smart Accounts, each offering unique features and use cases.
41
41
42
-
See [Configure accounts and signers](../how-to/create-smart-account/configure-accounts-signers.md) to learn how to use these different account types.
42
+
See [Create a smart account](../how-to/create-smart-account.md) to learn how to use these different account types.
43
43
44
44
### Hybrid smart account
45
45
46
-
The Hybrid smart account is a flexible implementation that supports both an externally owned account (EOA) "owner" and any number of P256 (passkey) signers.
46
+
The Hybrid smart account is a flexible implementation that supports both an externally owned account (EOA) owner and any number of P256 (passkey) signers.
47
47
You can configure any of these signers as the signatory, and use them to sign any data, including user operations, on behalf of the smart account.
48
48
49
49
This type is referenced in the toolkit as `Implementation.Hybrid`.
Copy file name to clipboardExpand all lines: delegation-toolkit/experimental/erc-7710-redeem-delegations.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ Redeem a delegation with a [MetaMask smart account](#redeem-with-a-metamask-smar
84
84
85
85
### Redeem with a MetaMask smart account
86
86
87
-
To redeem a delegation with a MetaMask smart account, create a [`MetaMaskSmartAccount`](../how-to/create-smart-account/index.md#create-a-metamasksmartaccount)
87
+
To redeem a delegation with a MetaMask smart account, [create a smart account](../how-to/create-smart-account.md)
88
88
and a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler).
89
89
90
90
After setting up your Bundler Client, you can extend its functionality with `erc7710BundlerActions` actions to support ERC-7710. Once extended, use [`sendUserOperationWithDelegation`](../reference/api/experimental-actions/bundler-client.md#senduseroperationwithdelegation) to redeem the permission.
Copy file name to clipboardExpand all lines: delegation-toolkit/how-to/create-smart-account.md
+41-67Lines changed: 41 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,47 +1,29 @@
1
1
---
2
-
sidebar_label: Configure accounts and signers
3
-
description: Learn how to configure different types of MetaMask Smart Accounts and signers using Viem.
4
-
sidebar_position: 1
2
+
description: Learn how to create a MetaMask smart account using Viem.
3
+
sidebar_position: 2
5
4
---
6
5
7
6
import Tabs from "@theme/Tabs";
8
7
import TabItem from "@theme/TabItem";
9
8
10
-
# Configure MetaMask Smart Accounts and signers
9
+
# Create a MetaMask smart account
11
10
12
-
The MetaMask Delegation Toolkit supports different [MetaMask smart account types](../../concepts/smart-accounts.md#smart-account-implementation-types),
13
-
each with its own configuration and support for different signing mechanisms.
14
-
You can create flexible and secure delegator accounts tailored to your specific needs.
11
+
You can enable users to create a [MetaMask smart account](../concepts/smart-accounts.md) directly in your dapp.
12
+
This page provides examples of using [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) with Viem Core SDK to create different types of smart accounts with different types of signatories.
15
13
16
14
## Prerequisites
17
15
18
-
-[Install and set up the Delegation Toolkit.](../../get-started/install.md)
19
-
-[Configure the Delegation Toolkit.](../configure.md)
20
-
-[Create a MetaMask smart account.](index.md)
16
+
-[Install and set up the Delegation Toolkit.](../get-started/install.md)
17
+
-[Configure the Delegation Toolkit.](configure.md)
21
18
22
-
## Configure a Hybrid smart account
19
+
## Create a Hybrid smart account
23
20
24
-
The [Hybrid smart account](../../concepts/smart-accounts.md#hybrid-smart-account) supports both an EOA "owner" and any number of P256 (passkey) signers.
21
+
A Hybrid smart account supports both an externally owned account (EOA) owner and any number of P256 (passkey) signers.
22
+
You can create a Hybrid smart account with the following types of signatories.
25
23
26
-
To configure a Hybrid smart account, provide the following parameters:
24
+
### Create a Hybrid smart account with an Account signatory
27
25
28
-
-`owner`: The owner's account address as a hex string.
29
-
The owner can be the zero address, indicating that there is no owner configured.
30
-
-`p256KeyIds`: An array of key identifiers for P256 signers as hex strings.
31
-
-`p256XValues`: An array of public key x-values for P256 signers as `bigint`s.
32
-
-`p256YValues`: An array of public key y-values for P256 signers as `bigint`s.
33
-
-`signatory`: A signer that will sign on behalf of the smart account.
34
-
35
-
:::note
36
-
You can set all `p256` parameters to empty arrays to configure no WebAuthn signer.
37
-
However, we recommend configuring at least one signer for account recovery.
38
-
:::
39
-
40
-
For a Hybrid smart account, you can configure the following types of signatories:
41
-
42
-
### Configure an account signatory
43
-
44
-
This example creates a signatory from a private key using Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount) function.
26
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) and Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount) to create a Hybrid smart account with a signatory from a private key:
### Create a Hybrid smart account with a Wallet Client signatory
96
78
97
-
This example creates a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) as the signatory,
98
-
using Viem's `createWalletClient` function.
79
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) and Viem's [`createWalletClient`](https://viem.sh/docs/clients/wallet) to create a Hybrid smart account with a Wallet Client signatory:
### Create a Hybrid smart account with a WebAuthn (passkey) signatory
161
142
162
-
This example creates a [Viem WebAuthn Account](https://viem.sh/account-abstraction/accounts/webauthn) as the signatory,
163
-
using Viem's `toWebAuthnAccount` function.
143
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) and Viem's [`toWebAuthnAccount`](https://viem.sh/account-abstraction/accounts/webauthn) to create a Hybrid smart account with a WebAuthn Account signatory:
164
144
165
145
:::info Installation required
166
-
167
146
To work with WebAuthn, install the [Ox SDK](https://oxlib.sh/).
The [Multisig smart account](../../concepts/smart-accounts.md#multisig-smart-account) supports multiple EOA signers with a configurable threshold for execution.
238
-
239
-
To configure a Multisig smart account, provide the following parameters:
240
-
241
-
-`signers`: An array of EOA signer addresses as hex strings.
242
-
-`threshold`: The number of signers required to execute a transaction, as a `bigint`.
243
-
-`signatory`: A signer that will sign on behalf of the smart account.
244
-
245
-
### Configure signatories
246
-
247
-
For a Multisig smart account, you can use a combination of account signatories and Wallet Client signatories.
248
-
For example:
214
+
A [Multisig smart account](../concepts/smart-accounts.md#multisig-smart-account) supports multiple EOA signers with a configurable threshold for execution.
215
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) to create a Multsig smart account with a combination of account signatories and Wallet Client signatories:
The number of signers in the signatories must be at least equal to the threshold for valid signature generation.
317
284
:::
318
285
319
-
## Configure a Stateless 7702 smart account
286
+
## Create a Stateless 7702 smart account
320
287
321
-
The[Stateless 7702 smart account](../../concepts/smart-accounts.md#stateless-7702-smart-account) represents an EOA that has been upgraded to support MetaMask Smart Accounts
322
-
functionality as defined by [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702). This implementation does not handle the upgrade process; see the [EIP-7702 quickstart](./../../get-started/eip7702-quickstart.md) to learn how to upgrade.
288
+
A[Stateless 7702 smart account](../concepts/smart-accounts.md#stateless-7702-smart-account) represents an EOA that has been upgraded to support MetaMask Smart Accounts
289
+
functionality as defined by [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
323
290
324
-
To configure a Stateless 7702 smart account, provide the following parameters:
325
-
326
-
-`address`: The address of the EOA that has been upgraded to a smart account.
327
-
-`signatory`: A signer that will sign on behalf of the smart account.
291
+
:::note
292
+
This implementation does not handle the upgrade process; see the [EIP-7702 quickstart](../get-started/eip7702-quickstart.md) to learn how to upgrade.
293
+
:::
328
294
329
-
For a Stateless 7702 smart account, you can configure the following types of signatories:
295
+
You can create a Stateless 7702 smart account with the following types of signatories.
330
296
331
-
### Configure an account signatory
297
+
### Create a Stateless 7702 smart account with an account signatory
332
298
333
-
This example creates a signatory from a private key using Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount)function.
299
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) and Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount)to create a Stateless 7702 smart account with a signatory from a private key:
334
300
335
301
<Tabs>
336
302
<TabItemvalue="example.ts">
@@ -346,7 +312,7 @@ import {
346
312
const smartAccount =awaittoMetaMaskSmartAccount({
347
313
client: publicClient,
348
314
implementation: Implementation.Stateless7702,
349
-
address: account.address
315
+
address: account.address// Address of the upgraded EOA
### Create a Stateless 7702 smart account with a Wallet Client signatory
384
350
385
-
This example creates a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) as the signatory,
386
-
using Viem's `createWalletClient` function.
351
+
Use [`toMetaMaskSmartAccount`](../reference/api/smart-account.md#tometamasksmartaccount) and Viem's [`createWalletClient`](https://viem.sh/docs/clients/wallet) to create a Stateless 7702 smart account with a Wallet Client signatory:
0 commit comments