Skip to main content

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
If you want to take a quick look at the final code, check out the GitHub repository.

Building the Application

Project setup

Follow the JS SDK Quickstart to initialize a Next.js app with Dynamic. Scaffold with create-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 SecurityAllowed 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
You can find your Environment ID in the Dynamic dashboard under Developer Settings → SDK & API Keys. For the Pods API key, visit Pods to get your API key. If you use Dynamic with ZeroDev smart wallets, configure the ZeroDev project for the same EVM network enabled in your Dynamic wallet environment. Enable ZeroDev in Dynamic’s smart wallet or sponsor gas settings, save the dashboard changes, then reconnect in the app before running a deposit.

Initialize Dynamic

Create src/lib/dynamic.ts:
src/lib/dynamic.ts

Configure Providers

Create src/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

Create src/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
You can get detailed information about the Pods API here.

Create ZeroDev Batch Helper

Create src/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

Create src/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
The important detail is that submitBatchedCalls receives the full calls array once. Do not send each Pods bytecode item as its own transaction.

Build Yield Interface Component

Create src/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:
The application will be available at http://localhost:3000.

Configure CORS

Add your local development URL to the CORS origins in your Dynamic dashboard under Developer Settings > CORS Origins.

Full source code

GitHub repository →

Additional Resources

Last modified on August 12, 2026