-
External Wallet Connection & Embedded Wallets
- Connect users’ existing external wallets (like MetaMask, Rainbow, etc.)
- Create new embedded wallets for users who don’t have one, using their email, phone number, OAuth, etc.
- Manage multiple wallet connections seamlessly
-
Sign-In with Ethereum (SIWE) for World ID Wallets
- Implement secure authentication using World ID wallets
- Enable users to interact with their World ID wallet
- Connect their external wallets or create new embedded wallets
- Sign in with their World ID wallet
- Transfer funds between their Dynamic wallet and World ID wallet
- Support multiple tokens (ETH, WLD, USDC)
Setup
Dynamic Environment Setup
- Navigate to the Dynamic Dashboard
- Copy your
Environment ID
from the SDK and API Keys section - you’ll need this to initialize Dynamic in your World Mini App
Dynamic Next.js Starter
If you don’t have a project yet, create one:Getting Started
1. Install Required Dependencies
First, install the necessary packages:2. Set Up Project Structure
Create the following project structure:3. Configure Environment Variables
Create a.env.local
file with your credentials:
Implementation
1. SIWE Authentication Setup
First, let’s set up the authentication providers that will connect Dynamic’s SIWE functionality with Worldcoin’s wallet:lib/providers.tsx
- Dynamic’s context provider for wallet management
- Wagmi provider for Ethereum interactions
- MiniKit provider for World ID wallet integration
- Eruda for debugging in the World App environment
2. Create Utility Functions
Create the Dynamic API helper and other utility functions:lib/utils.ts
3. Create SIWE Authentication Component
Create a new filecomponents/WorldDynamicSIWE.tsx
that integrates Worldcoin’s MiniKit with Dynamic’s SIWE flow:
app/components/WorldDynamicSIWE.tsx
4. Create Main App Page
Create the main page of your World Mini App:app/page.tsx
5. Add Wallet Transfer Capabilities
Create the cross-wallet transfer component:app/components/WalletTransfers.tsx
- Firstly we have a pretty straight forward logic for handling the UI of which token to transfer from where to where.
- To pay from a user’s dynamic wallet we’re using the
sendTransaction
method from the viem public client. - To pay USDC, and WLD from a user’s world ID wallet we’re using the
pay
method from the MiniKit. Check out the MiniKit documentation for more details. - We’re also using the
ForwardABI
to pay ETH from a user’s world ID wallet. Check out the Send Transaction MiniKit documentation for more details.
Social Redirects Setup
World Mini Apps can integrate with Dynamic’s social authentication system to provide seamless OAuth redirects back to your mini app. This section covers how to configure social redirects to work with the World Mini App deeplink system.Overview
When users authenticate with social providers (Google, Apple, Twitter, etc.) in your World Mini App, Dynamic handles the OAuth flow and redirects users back to your mini app using the World App’s deeplink system. The authentication flow works as follows:- User initiates social login in your World Mini App
- The phone browser opens to show the social provider
- After successful authentication, the World App opens automatically
- The Dynamic SDK completes the authentication inside the World Mini App
Prerequisites
Before setting up social redirects, you need to:- Enable social providers - Configure the social providers you want to use by following the Social Providers documentation
- Have a World Mini App ID - Get your app ID from the Worldcoin Developer Portal
Whitelisting World Mini App Deeplink URLs
For security, you must whitelist your World Mini App deeplink URLs in the Dynamic Dashboard:- Go to Dynamic Dashboard Security
- Navigate to Security → Whitelist Mobile Deeplink
- Enable “Whitelist Mobile Deeplink” and click “Save changes”
- Click the cog icon to open the Mobile Deeplink URL configuration
- Add your World Mini App deeplink URL:
worldapp://mini-app?app_id=${YOUR_APP_ID}&*
- Save the configuration
Make sure to replace
${YOUR_APP_ID}
with your actual World Mini App ID from the Worldcoin Developer Portal.Configuring redirectUrl in DynamicContextProvider
Configure theredirectUrl
property in your DynamicContextProvider
with your mini app deeplink URL:
redirectUrl
should follow this format:
worldapp://mini-app
- The World App deeplink schemeapp_id=${YOUR_APP_ID}
- Your World Mini App ID from the developer portalpath=/auth/callback
- The path within your mini app to handle the auth callback
redirectUrl
property, see the DynamicContextProvider documentation.
Example Implementation
For a complete working example of social redirects in a World Mini App, check out our World Mini App example repository on GitHub. This repository demonstrates the complete integration including social authentication setup and deeplink configuration.Running Your World Mini App
To run your World Mini App with Worldcoin SIWE integration:Forward
contract address to the app under configuration > Advanced > Contract Entrypoints. You can find the contract address here.
Finally, you can open it in the World App by scanning the QR code or entering the URL directly.
Make sure to add your domain to
next.config.js
in allowedDevOrigins
:next.config.js