Skip to content

Commit bfbdb83

Browse files
authored
Merge branch 'main' into 2483b-embedded-wallets-pass
2 parents a8ea7cd + 1f57f21 commit bfbdb83

File tree

5 files changed

+140
-14
lines changed

5 files changed

+140
-14
lines changed

gator-sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const sidebar = {
6666
items: [
6767
'guides/smart-accounts/signers/dynamic',
6868
'guides/smart-accounts/signers/embedded-wallets',
69+
'guides/smart-accounts/signers/eoa-wallets',
6970
'guides/smart-accounts/signers/privy',
7071
],
7172
},

services/reference/celo/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import CardList from '@site/src/components/CardList'
66

77
# Celo
88

9+
:::note Decentralized Infrastructure Network (DIN)
10+
11+
Celo is supported through the [DIN](https://www.din.build/) service,
12+
meaning calls to the network are routed to [partner infrastructure providers](#partners-and-privacy-policies).
13+
14+
:::
15+
916
Celo is an Ethereum layer-2 network designed for fast, low-cost payments. It offers low fees and fast finality while letting you reuse familiar Ethereum tools and contracts with little or no change.
1017

1118
:::info See also
@@ -35,3 +42,15 @@ Select an option below to get started with the Celo network.
3542
}
3643
]}
3744
/>
45+
46+
## Partners and privacy policies
47+
48+
No personal information is sent as part of partner requests, only information necessary to fulfill your API
49+
request. This means that Infura's partner service provider can service your request, but not store the
50+
content of your request.
51+
52+
The following partners provide access to the BSC network:
53+
<!-- markdown-link-check-disable -->
54+
- BlockPI ([Terms of Use](https://blockpi.io/terms-of-use), [Privacy Policy](https://blockpi.io/privacy-policy))
55+
- 0xFury ([Privacy policy](https://0xfury.com/privacy))
56+
<!-- markdown-link-check-enable -->
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
description: Learn how to use Externally Owned Account (EOA) with MetaMask Smart Accounts.
3+
sidebar_label: EOA (e.g. MetaMask)
4+
keywords: [metamask, smart account, signer, metamask smart account]
5+
---
6+
7+
# Use Externally Owned Account (EOA) with MetaMask Smart Accounts
8+
9+
Externally Owned Accounts (EOAs) are accounts controlled by a user’s private key (paired with a public address) and are typically accessed through wallet apps like MetaMask. MetaMask Smart Accounts is signer-agnostic, so
10+
you can use an EOA as the signer.
11+
12+
:::info
13+
This guide supports React and React-based frameworks. For Vue, see [Wagmi docs](https://wagmi.sh/vue/getting-started).
14+
:::
15+
16+
## Prerequisites
17+
18+
- Install [Node.js](https://nodejs.org/en/blog/release/v18.18.0) v18 or later
19+
- Install [Yarn](https://yarnpkg.com/),
20+
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager
21+
22+
## Steps
23+
24+
### 1. Install dependencies
25+
26+
Install the [Smart Accounts Kit](https://www.npmjs.com/package/@metamask/smart-accounts-kit) and other dependencies in your project:
27+
28+
```bash npm2yarn
29+
npm install @metamask/smart-accounts-kit wagmi @tanstack/react-query viem
30+
```
31+
32+
### 2. Create the App provider
33+
34+
Once you've created the `AppProvider`, wrap it at the root of your application so
35+
that the rest of your application has access to the Wagmi's and TanStack's context.
36+
This will allow every component inside the provider to use the Wagmi hooks.
37+
38+
For the advance configuration, see [Wagmi's createConfig API reference](https://wagmi.sh/react/api/createConfig).
39+
40+
<Tabs>
41+
<TabItem value = "provider.ts">
42+
43+
```ts
44+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
45+
import { ReactNode } from "react";
46+
import { WagmiProvider } from 'wagmi'
47+
import { config } from "./config.ts";
48+
49+
const queryClient = new QueryClient();
50+
51+
export function AppProvider({ children }: { children: ReactNode }) {
52+
return (
53+
<WagmiProvider config={config}>
54+
<QueryClientProvider client={queryClient}>
55+
{children}
56+
</QueryClientProvider>
57+
</WagmiProvider>
58+
);
59+
}
60+
```
61+
62+
</TabItem>
63+
64+
<TabItem value = "config.ts">
65+
66+
```ts
67+
import { createConfig, http } from "wagmi";
68+
import { sepolia } from "viem/chains";
69+
70+
export const config = createConfig({
71+
chains: [sepolia],
72+
transports: {
73+
[sepolia.id]: http(),
74+
},
75+
});
76+
```
77+
78+
</TabItem>
79+
</Tabs>
80+
81+
### 3. Create a smart account
82+
83+
Once the user has connected their wallet, use the [Wallet Client](https://viem.sh/docs/clients/wallet) from Wagmi as the signer to create a
84+
MetaMask smart account.
85+
86+
```ts
87+
import { Implementation, toMetaMaskSmartAccount } from "@metamask/smart-accounts-kit";
88+
import { useAccount, usePublicClient, useWalletClient } from "wagmi";
89+
90+
const { address } = useAccount();
91+
const publicClient = usePublicClient();
92+
const { data: walletClient } = useWalletClient();
93+
94+
// Additional check to make sure the EOA wallet is connected
95+
// and values are available.
96+
if (!address || !walletClient || !publicClient ) {
97+
// Handle the error case
98+
}
99+
100+
const smartAccount = await toMetaMaskSmartAccount({
101+
client: publicClient,
102+
implementation: Implementation.Hybrid,
103+
deployParams: [address, [], [], []],
104+
deploySalt: "0x",
105+
signer: { walletClient },
106+
});
107+
```
108+
109+
## Next steps
110+
111+
- See how to use [MetaMask Embedded Wallets as a signer](./eoa-wallets.md) to make the user onboarding journey easier.
112+
- See how to [send a user operation](../send-user-operation.md).
113+
- To sponsor gas for end users, see how to [send a gasless transaction](../send-gasless-transaction.md).

smart-accounts-kit/guides/smart-accounts/signers/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ Checkout the following guides to learn how to configure different signers:
3535
title: "Dynamic",
3636
description: "Learn how to use Dynamic with MetaMask Smart Accounts.",
3737
},
38+
{
39+
href: "/smart-accounts-kit/development/guides/smart-accounts/signers/eoa-wallets",
40+
title: "EOA (e.g. MetaMask)",
41+
description: "Learn how to use EOAs like MetaMask with MetaMask Smart Accounts.",
42+
},
3843
{
3944
href: "/smart-accounts-kit/development/guides/smart-accounts/signers/privy",
4045
title: "Privy",

smart-accounts-kit/guides/smart-accounts/signers/privy.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ import { PrivyProvider } from '@privy-io/react-auth';
5151
// Make sure to import `WagmiProvider` from `@privy-io/wagmi`, not `wagmi`
5252
import { WagmiProvider } from '@privy-io/wagmi';
5353
import { QueryClientProvider } from '@tanstack/react-query';
54-
import { wagmiConfig, queryClient, privyConfig } from "./config.ts"
54+
import { wagmiConfig, queryClient } from "./config.ts"
5555

5656
export function PrivyAppProvider({ children }: { children: ReactNode }) {
5757
return (
58-
<PrivyProvider appId="<YOUR_PRIVY_APP_ID>" config={privyConfig}>
58+
<PrivyProvider appId="<YOUR_PRIVY_APP_ID>">
5959
<QueryClientProvider client={queryClient}>
6060
<WagmiProvider config={wagmiConfig}>
6161
{children}
@@ -71,7 +71,6 @@ export function PrivyAppProvider({ children }: { children: ReactNode }) {
7171
<TabItem value = "config.ts">
7272

7373
```ts
74-
import type { PrivyClientConfig } from '@privy-io/react-auth';
7574
import { QueryClient } from "@tanstack/react-query";
7675
import { createConfig, http } from "wagmi";
7776
import { sepolia } from "viem/chains";
@@ -85,17 +84,6 @@ export const wagmiConfig = createConfig({
8584
[sepolia.id]: http(),
8685
},
8786
});
88-
89-
export const privyConfig: PrivyClientConfig = {
90-
embeddedWallets: {
91-
createOnLogin: 'users-without-wallets',
92-
showWalletUIs: true
93-
},
94-
loginMethods: ['wallet', 'email', 'sms'],
95-
appearance: {
96-
showWalletLoginFirst: true
97-
}
98-
};
9987
```
10088

10189
</TabItem>

0 commit comments

Comments
 (0)