What We’re Building
A React (Next.js) app that connects Dynamic’s embedded wallets to Pods yield strategies, allowing users to:- Deposit stablecoins into yield strategies
- Withdraw from positions
- Track yields and positions across multiple protocols
Building the Application
Project setup
Follow the JS SDK Quickstart to initialize a Next.js app with Dynamic. Scaffold withcreate-next-app, then continue with the dependencies below.
Dashboard: Under Chains & Networks, enable Ethereum and any other EVM networks you use. Under Sign-in Methods and Wallets, enable what your flow needs (including Embedded wallets). Under Security → Allowed Origins, add the origin where the app runs (for example
http://localhost:3000).Install Dependencies
Configure Dynamic Environment
Create a.env.local file with your Dynamic environment ID and Pods API key:
.env.local
Initialize Dynamic
Createsrc/lib/dynamic.ts:
src/lib/dynamic.ts
Configure Providers
Createsrc/lib/providers.tsx. DynamicProvider owns reactive auth state; InnerProviders reads it via useUser() and useGetWalletAccounts() from @dynamic-labs-sdk/react-hooks:
src/lib/providers.tsx
Create Pods Client
Createsrc/lib/pods.ts for the Pods API client. This file contains all the API communication logic for interacting with the Pods service.
All type definitions are available in src/lib/pods-types.ts in the GitHub repository.
src/lib/pods.ts
Create ZeroDev Batch Helper
Createsrc/lib/zerodev-batch.ts. This is the local helper imported by useTransactionOperations.ts; it converts the complete Pods bytecode array into one ZeroDev call array.
src/lib/zerodev-batch.ts
Create Transaction Operations Hook
Createsrc/lib/useTransactionOperations.ts for handling deposits and withdrawals using the Dynamic ZeroDev smart wallet connector. Pods bytecode must be submitted atomically; convert it to ZeroDev calls and submit the full array once:
src/lib/useTransactionOperations.ts
submitBatchedCalls receives the full calls array once. Do not send each Pods bytecode item as its own transaction.
Build Yield Interface Component
Createsrc/components/YieldInterface.tsx for the main UI. It reads evmAccount from useWallet() instead of useDynamicContext():
src/components/YieldInterface.tsx
Run the Application
Start the development server:http://localhost:3000.