Learn how to integrate wallet functionality into Farcaster mini apps using Dynamic
Mini apps are lightweight, purpose-built web applications that can be embedded within social platforms, and they’re becoming increasingly popular. With the rise of Farcaster mini apps, developers can now create seamless wallet-connected experiences directly within these social platforms. Dynamic provides a powerful toolkit for integrating wallet functionality into your mini apps, allowing users to connect wallets, sign messages, and execute transactions without leaving the ecosystem.
In this guide, we’ll walk through building a mini app using Dynamic’s wallet infrastructure integrated with Farcaster mini apps to create a seamless wallet experience that works across multiple blockchain networks. If you want to take a quick look at the final code, check out the GitHub repository.
This guide demonstrates how to build a mini app that supports both Ethereum and Solana wallets using Dynamic’s multi-chain support.
Here’s the file structure we’ll be building:
Our mini app will allow users to:
We’ll implement this using:
Let’s start by creating a new Dynamic project with React, Viem, Wagmi, and support for Ethereum and Solana:
Navigate to your project directory and install the additional Farcaster dependencies:
Create a .env
file in the root of your project with your Dynamic environment ID:
You can find your Environment ID in the Dynamic dashboard under Developer Settings > SDK & API Keys.
First, create a directory structure for the Farcaster mini app configuration:
Then create a farcaster.json
file in the .well-known
directory:
This manifest is required for publishing your mini app to the Farcaster ecosystem. For more details about configuring your application, refer to the Farcaster Mini App Publishing Guide.
Replace https://your-domain.com
with your actual domain or hosting URL.
The iconUrl
, splashImageUrl
, and ogImageUrl
should point to images hosted on your server.
Update the other fields as necessary to match your app’s branding and functionality.
Create a wagmi.ts
file in your src
directory:
This configuration sets up the Wagmi library with the Farcaster frame connector, which enables wallet connections within the Farcaster mini app environment. We’re using Base Sepolia as our example chain, so make sure to enable it in your Dynamic dashboard. If you prefer to use different chains, you can modify this configuration by adding them to the chains
array and enabling them in your Dynamic dashboard.
Add the Farcaster mini app meta tag to your index.html
file:
This is basic information required for a Farcaster mini app. Feel free to update the informating accordingly.
Now, let’s get into the implementation of the mini app. We’ll create a simple React application that integrates with Dynamic to manage wallet connections and transactions.
Let’s start by setting up the main App.tsx
component that will integrate Dynamic with our mini app:
This App component sets up the foundation for our mini app by:
sdk.actions.ready()
callThe component structure ensures that all blockchain interactions are properly initialized before allowing the user to interact with wallet functions.
For styling your mini app, you can either check out the file on the GitHub repository or create your own styles according to your design preferences.
Now, let’s create a component that will handle wallet interactions. First, create a Methods.tsx
file in the components
folder:
This DynamicMethods
component handles the core wallet functionality for our mini app. It leverages several hooks from Dynamic’s SDK to access wallet and user information, and provides a simple interface for users to interact with their wallets.
Key Functions:
useDynamicContext
hook, including their ID, auth method, and other profile detailsuseUserWallets
hook, providing details about addresses, networks, and wallet typesYou can choose to style it as you like in Methods.css
or if you want to use the same styles check out this file on Github.
This code shows how to import and use the DynamicMethods
component within your main App component, placing it after the ConnectMenu
component to create a logical user flow: first connect a wallet, then interact with wallet methods.
For CSS styling, check out the file in the GitHub repository, or feel free to create your own styles as needed.
You can now run your mini app locally:
The app will be available at http://localhost:5173
by default.
To try out the app for testing, you’ll need to expose your local server to the internet. You can use services like cloudflared or ngrok:
When using tools like Cloudflare Tunnel, you’ll need to update your Vite configuration to allow requests from the domain. Add the following to your vite.config.ts
file:
Replace your-tunnel-domain.trycloudflare.com
with your actual tunnel domain. The allowedHosts
setting enables requests from specified domains to your development server, which is essential for testing with tunneling tools.
Once your app is running, copy the public URL provided by cloudflared or ngrok and add it in CORS Origins in your Dynamic dashboard under Developer Settings > CORS Origins. This step is crucial as it allows your mini app to communicate with the Dynamic backend.
To test your mini app in the Farcaster ecosystem, you can use the mini app embed tool. This tool allows you to preview how your mini app would appear and function within Farcaster’s interface.
You’ve now built a complete mini app with Dynamic that works seamlessly with Farcaster! This application enables users to connect different types of wallets, sign messages, and send transactions all within a unified interface.
By leveraging Dynamic’s multi-chain support, your mini app works with both Ethereum and Solana wallets without requiring additional configuration. This flexibility allows your users to interact with their preferred wallets and networks, creating a more inclusive experience.
The mini app you’ve built demonstrates several key capabilities:
For additional help or to join the Dynamic community:
Learn how to integrate wallet functionality into Farcaster mini apps using Dynamic
Mini apps are lightweight, purpose-built web applications that can be embedded within social platforms, and they’re becoming increasingly popular. With the rise of Farcaster mini apps, developers can now create seamless wallet-connected experiences directly within these social platforms. Dynamic provides a powerful toolkit for integrating wallet functionality into your mini apps, allowing users to connect wallets, sign messages, and execute transactions without leaving the ecosystem.
In this guide, we’ll walk through building a mini app using Dynamic’s wallet infrastructure integrated with Farcaster mini apps to create a seamless wallet experience that works across multiple blockchain networks. If you want to take a quick look at the final code, check out the GitHub repository.
This guide demonstrates how to build a mini app that supports both Ethereum and Solana wallets using Dynamic’s multi-chain support.
Here’s the file structure we’ll be building:
Our mini app will allow users to:
We’ll implement this using:
Let’s start by creating a new Dynamic project with React, Viem, Wagmi, and support for Ethereum and Solana:
Navigate to your project directory and install the additional Farcaster dependencies:
Create a .env
file in the root of your project with your Dynamic environment ID:
You can find your Environment ID in the Dynamic dashboard under Developer Settings > SDK & API Keys.
First, create a directory structure for the Farcaster mini app configuration:
Then create a farcaster.json
file in the .well-known
directory:
This manifest is required for publishing your mini app to the Farcaster ecosystem. For more details about configuring your application, refer to the Farcaster Mini App Publishing Guide.
Replace https://your-domain.com
with your actual domain or hosting URL.
The iconUrl
, splashImageUrl
, and ogImageUrl
should point to images hosted on your server.
Update the other fields as necessary to match your app’s branding and functionality.
Create a wagmi.ts
file in your src
directory:
This configuration sets up the Wagmi library with the Farcaster frame connector, which enables wallet connections within the Farcaster mini app environment. We’re using Base Sepolia as our example chain, so make sure to enable it in your Dynamic dashboard. If you prefer to use different chains, you can modify this configuration by adding them to the chains
array and enabling them in your Dynamic dashboard.
Add the Farcaster mini app meta tag to your index.html
file:
This is basic information required for a Farcaster mini app. Feel free to update the informating accordingly.
Now, let’s get into the implementation of the mini app. We’ll create a simple React application that integrates with Dynamic to manage wallet connections and transactions.
Let’s start by setting up the main App.tsx
component that will integrate Dynamic with our mini app:
This App component sets up the foundation for our mini app by:
sdk.actions.ready()
callThe component structure ensures that all blockchain interactions are properly initialized before allowing the user to interact with wallet functions.
For styling your mini app, you can either check out the file on the GitHub repository or create your own styles according to your design preferences.
Now, let’s create a component that will handle wallet interactions. First, create a Methods.tsx
file in the components
folder:
This DynamicMethods
component handles the core wallet functionality for our mini app. It leverages several hooks from Dynamic’s SDK to access wallet and user information, and provides a simple interface for users to interact with their wallets.
Key Functions:
useDynamicContext
hook, including their ID, auth method, and other profile detailsuseUserWallets
hook, providing details about addresses, networks, and wallet typesYou can choose to style it as you like in Methods.css
or if you want to use the same styles check out this file on Github.
This code shows how to import and use the DynamicMethods
component within your main App component, placing it after the ConnectMenu
component to create a logical user flow: first connect a wallet, then interact with wallet methods.
For CSS styling, check out the file in the GitHub repository, or feel free to create your own styles as needed.
You can now run your mini app locally:
The app will be available at http://localhost:5173
by default.
To try out the app for testing, you’ll need to expose your local server to the internet. You can use services like cloudflared or ngrok:
When using tools like Cloudflare Tunnel, you’ll need to update your Vite configuration to allow requests from the domain. Add the following to your vite.config.ts
file:
Replace your-tunnel-domain.trycloudflare.com
with your actual tunnel domain. The allowedHosts
setting enables requests from specified domains to your development server, which is essential for testing with tunneling tools.
Once your app is running, copy the public URL provided by cloudflared or ngrok and add it in CORS Origins in your Dynamic dashboard under Developer Settings > CORS Origins. This step is crucial as it allows your mini app to communicate with the Dynamic backend.
To test your mini app in the Farcaster ecosystem, you can use the mini app embed tool. This tool allows you to preview how your mini app would appear and function within Farcaster’s interface.
You’ve now built a complete mini app with Dynamic that works seamlessly with Farcaster! This application enables users to connect different types of wallets, sign messages, and send transactions all within a unified interface.
By leveraging Dynamic’s multi-chain support, your mini app works with both Ethereum and Solana wallets without requiring additional configuration. This flexibility allows your users to interact with their preferred wallets and networks, creating a more inclusive experience.
The mini app you’ve built demonstrates several key capabilities:
For additional help or to join the Dynamic community: