A React application demonstrating how to use the Otim SDK for wallet transfers with Privy authentication and automatic delegation.
- Privy Authentication: Secure authentication using Privy with passkey support
- Automatic Delegation: Automatically sets up EIP-7702 delegation after authentication
- SIWE Integration: Sign-In with Ethereum for secure authentication with Otim
- Transfer Operations: Send tokens using the Otim SDK (coming soon)
- Node.js 20+ and pnpm
- A Privy account and app ID (Get one here)
-
Install dependencies:
pnpm install
-
Configure environment variables:
Create a
.envfile in the project root:VITE_PRIVY_APP_ID=your_privy_app_id_here
-
Configure Privy:
In your Privy dashboard:
- Enable your preferred authentication methods (email, SMS, passkeys, social logins, etc.)
- Configure your app domains - Add both:
http://localhost:5173(fornpm run dev)http://localhost:4173(fornpm run preview)
- Enable embedded wallets with "Create on login" for all users
Important: If you see "origins don't match" errors, make sure both
localhost:5173andlocalhost:4173are added to your Privy app's allowed domains.Note: If you get "Login with passkey not allowed" error, make sure passkeys are enabled in your Privy app settings, or the app will use other available authentication methods.
Start the development server:
pnpm devThe app will be available at http://localhost:5173
- Privy Login: Users authenticate with Privy using passkeys
- Embedded Wallet: Privy creates an embedded wallet for the user
- SIWE Authentication: The app signs a SIWE message with the embedded wallet
- Otim Authentication: The signed message is sent to Otim for authentication
- Automatic Delegation: After authentication, the app automatically sets up EIP-7702 delegation
-
useOtimAuthHook: Manages the entire authentication and delegation flow- Handles Privy authentication
- Signs SIWE messages
- Authenticates with Otim SDK
- Automatically performs delegation
-
MainContentComponent: Main app UI that handles the authentication flow -
AuthenticationPanelComponent: Shows authentication and delegation status -
WalletStatusComponent: Displays the connected wallet information
src/
├── components/
│ ├── app-container.tsx # App wrapper with loading states
│ ├── authentication-panel.tsx # Auth & delegation UI
│ ├── main-content.tsx # Main app content
│ └── wallet-status.tsx # Wallet info display
├── hooks/
│ └── use-otim-auth.ts # Privy + Otim auth hook
├── app.tsx # App entry with providers
└── wagmi.ts # Wagmi configuration
The app uses Sepolia testnet by default. To change the network:
- Update
CHAIN_IDinsrc/hooks/use-otim-auth.ts - Update the chain in
src/wagmi.ts - Update the contract address if needed
- "origins don't match" error: This happens when your app's origin doesn't match Privy's allowed domains. Fix by:
- Go to your Privy dashboard → App Settings → Domains
- Add both
http://localhost:5173(dev server) andhttp://localhost:4173(preview server) - Make sure you're using the correct port (check your terminal output)
- Clear browser cache and restart the dev server
- Ensure your Privy app ID is correctly set in
.env - Check that your domain is whitelisted in Privy dashboard
- Verify that passkeys are enabled in Privy settings
- Make sure the embedded wallet has some ETH for gas
- Check that the contract address is correct for your network
- Verify the chain ID matches your configuration
- Implement token transfer functionality
- Add transaction history
- Support multiple networks
- Add more authentication methods