What We’re Building
A React (Next.js) app that connects Dynamic’s MPC wallets to Aave V3 lending markets, allowing users to:- Supply assets to earn yield
- Borrow against supplied collateral
- Track positions and account health
- Manage deposits and withdrawals
Key Components
- Dynamic MPC Wallets - Embedded, non-custodial wallets with seamless auth
- Dynamic Transaction Simulation - Built-in transaction preview showing asset transfers, fees, and counterparties
- Aave V3 Markets - Lending protocol with supply/borrow functionality
Building the Application
Project setup
Follow the React Quickstart and use the Custom setup path: Ethereum (EVM) with Wagmi and viem. This recipe’s example uses Next.js—scaffold withcreate-next-app and apply the same packages and provider wiring as in the quickstart, or mirror the layout in the GitHub repository linked above.
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 for MPC flows in this guide). Under Security → Allowed Origins, add the origin where the app runs (for example
http://localhost:3000).Install Aave Dependencies
Add the Aave React SDK:Configure Dynamic Environment
Create a.env.local file with your Dynamic environment ID:
.env.local
Enable Transaction Simulation
- Go to your Dynamic dashboard
- Navigate to Developer Settings → Embedded Wallets → Dynamic
- Enable “Show Confirmation UI” and “Transaction Simulation” toggles


Create Aave Client
You’ll also need to create an Aave client configuration. Createsrc/lib/aave.ts:
src/lib/aave.ts
Configure Providers
Add theAaveProvider to the src/lib/providers.tsx file and pass the client that you just created.
src/lib/providers.tsx
Create Transaction Operations Hook
Let’s build the transaction operations hook step by step. First, create the basic structure with imports and state management:src/lib/useTransactionOperations.ts
walletClient parameter comes from the wallet connection, and selectedChainId determines which Aave market to interact with.
Now let’s add the supply function that allows users to deposit assets and earn interest:
src/lib/useTransactionOperations.ts
evmAddress() and structures the amount as an ERC20 object. It uses the user’s wallet address as the supplier and returns the transaction hash.
Add the borrow function for users to borrow assets against their supplied collateral:
src/lib/useTransactionOperations.ts
src/lib/useTransactionOperations.ts
repay function instead.
Finally, add the withdraw function for users to withdraw their supplied assets:
src/lib/useTransactionOperations.ts
withdraw function, using the user’s address as the supplier to withdraw their deposited funds.
Build Market Interface Component
Createsrc/components/MarketsInterface.tsx for the main UI:
src/components/MarketsInterface.tsx
Create Market Card Component
Buildsrc/components/MarketCard.tsx for individual market display:
src/components/MarketCard.tsx
Run the Application
Start the development server:http://localhost:3000.