Overview
This guide walks you through adding Spice Flow to your app. By the end, your users will be able to deposit assets from any chain into your protocol without bridging. What you’ll build:- A wallet connection flow (embedded + external wallet)
- A deposit interface that accepts any token from any supported chain
- Cross chain execution powered by EIP 7702
Step 1: Installation
Install the Spice Flow UI SDK and Privy for wallet management:Step 2: Setup Provider
Wrap your app withSpiceFlowProvider. This sets up wallet connections, chain configuration, and theming:
Step 3: Add Deposit Flow
ImportSpiceDeposit and provide the on chain calls you want executed on the destination chain:
Step 4: Add Withdrawals (Optional)
Let users withdraw their Spice balance back to their wallet:Complete Example
Here’s a complete Next.js page with deposit and withdraw:Environment Setup
Create a.env.local file in your project root:
- Privy: Sign up at privy.io and create an app
- Dynamic: Sign up at dynamic.xyz and get your environment ID
How It Works
- User opens your app and logs in via Privy (creates an embedded wallet)
- User connects their external wallet (MetaMask, etc.)
- User selects a token and amount to deposit
- External wallet sends the token to the embedded wallet, then to the escrow
- SDK signs an EIP 7702 delegation and submits it to the solver
- Solver executes the
depositBatchescalls on the destination chain on behalf of the user - Success callback fires
What’s Next?
Components
Explore all available components and their props
Hooks
Build custom UIs with React hooks
Styling
Customize the appearance to match your brand
Configuration
Configure chains, providers, and execution modes
Using Dynamic Provider
Troubleshooting
”Window is not defined” Error
If you see this in Next.js, ensure you’re using the"use client" directive:
Wallet Not Connecting
- Check that your provider credentials are correct in
.env.local - Ensure you’re using the correct provider name (
"privy"or"dynamic") - Check the browser console for any error messages
Need More Help?
Join our Discord
Get help from the community and our team
