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
+45-67Lines changed: 45 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,47 +1,33 @@
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),
11
+
The MetaMask Delegation Toolkit is embedded, meaning that the end user can instantly interact with a dapp without wallet authorization, confirmations, or corporate logos.
12
+
You can enable users to create a [MetaMask smart account](../concepts/smart-accounts.md) directly in your dapp.
13
+
The toolkit supports different [smart account types](../concepts/smart-accounts.md#smart-account-implementation-types),
13
14
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.
15
15
16
-
## Prerequisites
17
-
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)
21
-
22
-
## Configure a Hybrid smart account
16
+
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.
23
17
24
-
The [Hybrid smart account](../../concepts/smart-accounts.md#hybrid-smart-account) supports both an EOA "owner" and any number of P256 (passkey) signers.
25
-
26
-
To configure a Hybrid smart account, provide the following parameters:
18
+
## Prerequisites
27
19
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.
20
+
-[Install and set up the Delegation Toolkit.](../get-started/install.md)
21
+
-[Configure the Delegation Toolkit.](configure.md)
34
22
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
-
:::
23
+
## Create a Hybrid smart account
39
24
40
-
For a Hybrid smart account, you can configure the following types of signatories:
25
+
A Hybrid smart account supports both an externally owned account (EOA) owner and any number of P256 (passkey) signers.
26
+
You can create a Hybrid smart account with the following types of signatories.
41
27
42
-
### Configure an account signatory
28
+
### Create a Hybrid smart account with an account signatory
43
29
44
-
This example creates a signatory from a private key using Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount)function.
30
+
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
82
97
-
This example creates a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) as the signatory,
98
-
using Viem's `createWalletClient` function.
83
+
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
146
162
-
This example creates a [Viem WebAuthn Account](https://viem.sh/account-abstraction/accounts/webauthn) as the signatory,
163
-
using Viem's `toWebAuthnAccount` function.
147
+
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
148
165
149
:::info Installation required
166
-
167
-
To work with WebAuthn, install the [Ox SDK](https://oxlib.sh/).
168
-
150
+
To use 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:
218
+
A [Multisig smart account](../concepts/smart-accounts.md#multisig-smart-account) supports multiple EOA signers with a configurable threshold for execution.
219
+
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
288
:::
318
289
319
-
## Configure a Stateless 7702 smart account
320
-
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.
290
+
## Create a Stateless 7702 smart account
323
291
324
-
To configure a Stateless 7702 smart account, provide the following parameters:
292
+
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
293
+
functionality as defined by [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
325
294
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.
295
+
:::note
296
+
This implementation does not handle the upgrade process; see the [EIP-7702 quickstart](../get-started/eip7702-quickstart.md) to learn how to upgrade.
297
+
:::
328
298
329
-
For a Stateless 7702 smart account, you can configure the following types of signatories:
299
+
You can create a Stateless 7702 smart account with the following types of signatories.
330
300
331
-
### Configure an account signatory
301
+
### Create a Stateless 7702 smart account with an account signatory
332
302
333
-
This example creates a signatory from a private key using Viem's [`privateKeyToAccount`](https://viem.sh/docs/accounts/local/privateKeyToAccount)function.
303
+
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
304
335
305
<Tabs>
336
306
<TabItemvalue="example.ts">
@@ -346,7 +316,7 @@ import {
346
316
const smartAccount =awaittoMetaMaskSmartAccount({
347
317
client: publicClient,
348
318
implementation: Implementation.Stateless7702,
349
-
address: account.address
319
+
address: account.address// Address of the upgraded EOA
### Create a Stateless 7702 smart account with a Wallet Client signatory
384
354
385
-
This example creates a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) as the signatory,
386
-
using Viem's `createWalletClient` function.
355
+
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