A reference implementation showcasing how to integrate Morpho Vaults (EARN) into any frontend application. This template provides a starting point for building a basic interface for Morpho Vaults.
- React: Frontend framework
- TypeScript: Type-safe development
- Vite: Modern build tooling
- @morpho-org/blue-sdk: Core protocol integration
- @morpho-org/bundler-sdk-viem: Simplifies complex transactions into bundled operations
- @morpho-org/simulation-sdk: Position simulation capabilities
- @morpho-org/blue-sdk-viem: Viem-based fetch methods
- @morpho-org/blue-sdk-wagmi: React hooks for Morpho data
- @morpho-org/simulation-sdk-wagmi: React hooks for simulation state
- @morpho-org/morpho-ts: Time and formatting utilities
- @morpho-org/morpho-test: Test fixtures for E2E testing
- wagmi: React Hooks for Ethereum
- viem: Low-level Ethereum interactions
- RainbowKit: Wallet connection UI
- @tanstack/react-query: Data management
- @apollo/client: GraphQL integration
- Tailwind CSS: Utility-first styling
- Real-time position tracking
- One-click deposits and withdrawals (approvals are handled thanks to the bundler-sdk-viem)
- Built-in transaction bundling
- Automatic approval handling
- Position simulation before execution
- Comprehensive vault details
- Real-time liquidity data
- Asset allocation visualization
- Historical performance metrics
- Metadata display
- Node.js (v16 or higher)
- Yarn
- Web3 wallet (MetaMask, Rabby, or OKX)
# Clone the repository
git clone [repository-url]
# Install dependencies
yarn install# Start development server
yarn devAccess the application at http://localhost:5173
yarn buildThe project includes essential hooks for Morpho integration:
-
useGetUserSDKVaultPosition
- Tracks user's vault positions
- Real-time balance updates
- Share-to-underlying conversion
-
usePopulatedSimulationState
- Pre-transaction simulation
- Gas estimation
- Error prevention
- Position health checks
// Handles deposits, withdrawals, and position management
const TestInterface = () => {
// Integration code...
};// Displays comprehensive vault data
const VaultAPIView = ({ vaultAddress }) => {
// Display code...
};- Default vault: Gauntlet WETH Prime Vault
- Network: Ethereum Mainnet (with Anvil support for testing)
- Supported wallets: MetaMask, Rabby, OKX
Comprehensive error management for:
- Wallet connections
- Transaction failures
- Position validations
- Input verification
This project is licensed under the MIT License - see the LICENSE file for details.

