This guide assumes you’re using React + TypeScript.
Smart Wallet Onboarding Setup
Before users can supply or borrow assets, they must onboard into a Smart Wallet via a frictionless embedded flow. Powered by Gelato’s SDK and Dynamic, users can create smart accounts using just their email, social login, or passkeys — no browser extensions or seed phrases needed.Key Features of Embedded Wallets
- EIP-7702 & ERC-4337 compliant
- Supports gasless transactions (sponsored execution)
- Runs across 50+ EVM chains
- Session-based login — no need to reconnect every time

Code Snippet
Embed the following setup within your app to configure the provider:- Wallet creation and session
- Transaction preparation and sending
- Provider availability across your components
Part 1: Supply & Earn
Allow users to supply assets (e.g., USDC) and earn yield in Morpho’s vaults — fully onchain, without user signatures or gas fees.Flow Overview
- Approve vault to spend USDC
- Deposit USDC to Morpho vault
- Optionally, record stats to external tracking contract

Code Snippet
Part 2: Borrow
Let users borrow stablecoins (like USDC) using crypto collateral (cbBTC) — trustless, non-custodial, and instant.Flow Overview
- Approve Morpho to move collateral
- Supply collateral to Morpho
- Borrow USDC

Code Snippet
Summary
What You Can Build
Using these flows, your app can now offer:- Embedded lending dashboards
- Crypto credit lines
- Non-custodial stablecoin loans
- Yield vault integrations
- Composable DeFi automations