Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions gator-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ const sidebar = {
'guides/smart-accounts/send-user-operation',
'guides/smart-accounts/send-gasless-transaction',
'guides/smart-accounts/generate-multisig-signature',
{
type: 'category',
label: 'Configure signers',
collapsed: true,
items: [
'guides/smart-accounts/signers/dynamic',
],
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ In this guide, you'll request an ERC-20 periodic transfer permission from a Meta
- [Install and set up the Smart Accounts Kit](../../get-started/install.md)
- [Install MetaMask Flask 13.5.0 or later](/snaps/get-started/install-flask)

## Steps

### 1. 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ In this guide, you'll request an ERC-20 periodic transfer permission from a Meta
- [Install and set up the Smart Accounts Kit](../../get-started/install.md)
- [Install MetaMask Flask 13.5.0 or later](/snaps/get-started/install-flask)

## Steps

### 1. 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
Expand Down
128 changes: 128 additions & 0 deletions smart-accounts-kit/guides/smart-accounts/signers/dynamic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
description: Learn how to use Dynamic signer with MetaMask Smart Accounts.
sidebar_label: Dynamic
keywords: [dynamic, smart account, signer, metamask samrt account]
---

# Use Dynamic with MetaMask Smart Accounts

[Dynamic](https://www.dynamic.xyz/) is an embedded wallet solution that enables seamless social login and passkey based
wallets, making user onboarding easier. MetaMask Smart Accounts is a signer agnostic implementation
that allows you to use Dynamic's EOA wallet as a signer for MetaMask Smart Accounts.

View the complete code for this guide at [gator-examples repository](https://github.com/MetaMask/gator-examples/tree/main/examples/smart-accounts/signers/dynamic).

## Prerequisites

Copy link
Contributor

@m4sterbunny m4sterbunny Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Node.js](https://nodejs.org/en/download/)
- React app
:::note
This guide uses React. However, by installing different dependencies, developers are free to leverage other Dynamic-supported frameworks.
:::

Copy link
Member Author

@AyushBherwani1998 AyushBherwani1998 Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already mentioned, also react app is not Prerequisite. They can use any framework React, Next JS, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit for Node.js requirement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependencies presented in the guide are specifically related to react: @dynamic-labs/sdk-react-core
to use vue or alt, user must adjust, hence suggestion to make clear this is react example AND to state that other frameworks are supported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sdk-react-core is supported for react and other frameworks built on top of it like next js, remix, gatsby, and many others. I'll try to add a note rather than a prerequisite that guide is created for frameworks based on react.

Copy link
Member Author

@AyushBherwani1998 AyushBherwani1998 Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an info note at top of the guide to make sure readers are aware.

- Install [Yarn](https://yarnpkg.com/),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Install [Yarn](https://yarnpkg.com/),
- Package manager such as [Yarn](https://yarnpkg.com/) or

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldnt even bother mentioning yarn, given that the bash example is for npm, the "such as" can do the "go do this with yarn if that pleases you" part

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bash command covers npm, yarn, bun and pnpm. One of the ref.
Screenshot 2025-12-08 at 8 00 13 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, my laser focus! I would still just such as and mention 1 ... everyone has a fav, so the important part is "package manager"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We follow this pattern through out the docs and it's been working so far, so would prefer keeping same.

[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager
[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already mentioned above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per comment

- [Create a Dynamic Environment ID](https://www.dynamic.xyz/docs/developer-dashboard/tokens-api-keys#environment-id)

## Steps

### 1. Install dependencies

Install the following dependencies:

```bash npm2yarn
npm install @dynamic-labs/ethereum @dynamic-labs/sdk-react-core @dynamic-labs/wagmi-connector @metamask/smart-accounts-kit @tanstack/react-query wagmi viem
```

### 2. Create the Dynamic provider

In this step, you'll configure the [`DynamicContextProvider`](https://www.dynamic.xyz/docs/react-sdk/providers/providers-introduction#dynamic-context-provider) component to provide the Dynamic context
to your application. You'll also use the [`DynamicWagmiConnector`](https://www.dynamic.xyz/docs/react-sdk/providers/providers-introduction#dynamic-wagmi-connector) to integrate Dynamic with Wagmi. This
connector enables you to use Wagmi hooks with Dynamic.

Once you have created the `DynamicProvider`, you must wrap it at the root of your application so
that the rest of your application has access to the Dynamic context.

For the advance configuration, see how to [configure Dynamic & Wagmi](https://www.dynamic.xyz/docs/react-sdk/using-wagmi).

<Tabs>
<TabItem value = "provider.ts">

```ts
import { QueryClientProvider } from "@tanstack/react-query";
import { WagmiProvider } from "wagmi";
import { ReactNode } from "react";
import { EthereumWalletConnectors } from "@dynamic-labs/ethereum";
import { DynamicContextProvider } from "@dynamic-labs/sdk-react-core";
import { DynamicWagmiConnector } from "@dynamic-labs/wagmi-connector";
import { wagmiConfig, queryClient } from "./config.ts"

export function DynamicProvider({ children }: { children: ReactNode }) {
return (
<DynamicContextProvider
settings={{
// Get your environment id at https://app.dynamic.xyz/dashboard/developer
environmentId: "YOUR_DYNAMIC_ENVIRONMENT_ID",
walletConnectors: [EthereumWalletConnectors],
}}
>
<QueryClientProvider client={queryClient}>
<WagmiProvider config={wagmiConfig}>
<DynamicWagmiConnector>
{children}
</DynamicWagmiConnector>
</WagmiProvider>
</QueryClientProvider>
</DynamicContextProvider >
);
}
```

</TabItem>

<TabItem value = "config.ts">

```ts
import { QueryClient } from "@tanstack/react-query";
import { createConfig, http } from "wagmi";
import { sepolia } from "viem/chains";

export const queryClient = new QueryClient();

export const wagmiConfig = createConfig({
chains: [sepolia],
ssr: true,
transports: {
[sepolia.id]: http(),
},
});
```

</TabItem>
</Tabs>

### 3. Create a smart account

Once the user has connected their wallet, you can use the [Wallet Client](https://viem.sh/docs/clients/wallet) from Wagmi as the signer to create a
MetaMask smart account.

```ts
import { Implementation, toMetaMaskSmartAccount } from "@metamask/smart-accounts-kit";
import { useAccount, usePublicClient, useWalletClient } from "wagmi";

const { address } = useAccount();
const publicClient = usePublicClient();
const { data: walletClient } = useWalletClient();

// Additional check to make sure the Dyanmic wallet is connected
// and values are available.
if (!address || !walletClient || !publicClient ) {
// Handle the error case
}

const smartAccount = await toMetaMaskSmartAccount({
client: publicClient,
implementation: Implementation.Hybrid,
deployParams: [address, [], [], []],
deploySalt: "0x",
signer: { walletClient },
});
```

## Next steps
- See how to [send a user operations](../send-user-operation.md).
- To sponsor gas for end users, see how to [send a gasless transaction](../send-gasless-transaction.md).
Loading