EarnWidget when you want Deframe yield UX in your app while keeping wallet custody and transaction execution in your infrastructure.
What You Own vs What Deframe Owns
| Area | Owner |
|---|---|
| Wallet connection, signatures, tx submission | Your app |
| Strategy data, quote/bytecode generation, protocol routing | Deframe API |
| UI state and yield screens (overview, details, deposit, withdraw) | EarnWidget |
Prerequisites
API Credentials
DEFRAME_API_URL and DEFRAME_API_KEYWallet Adapter
EOA/smart wallet provider capable of
sendTransactionReact App
React 18+ or 19+ host app
User Wallet
Connected wallet address for position and history endpoints
Install
deframe-sdk uses Redux internally. In many host setups, you should install the Redux peer packages explicitly (@reduxjs/toolkit, react-redux, redux) to avoid peer-resolution/runtime issues.Styles and Theme
deframe-sdk loads widget styles from its package entrypoint. For the default integration, you do not need a separate CSS import (for example, deframe-sdk/styles.css).
Treat .deframe-widget as a style boundary owned by the SDK:
- Avoid global resets like
* { ... }or broad element resets that can leak into the widget. - Scope host app styles to your own containers.
- Use
DeframeProvider.config.themeas the source of truth for widget theming.
Environment Variables
Step 1: Implement processBytecode
processBytecode is the host bridge between widget actions and wallet execution.
Step 2: Mount DeframeProvider + EarnWidget
Route Names Exposed by onRouteChange
Common values: overview, details, deposit, withdraw, investment-details, history, history-deposit-details, history-withdraw-details.
Use these to adapt host shell layout, breadcrumbs, and analytics tags.
API Endpoints Used in Earn Flows
GET /strategiesfor strategy discoveryGET /strategies/{strategyId}/bytecodefor deposit/withdraw transaction dataGET /wallets/{wallet}for portfolio stateGET /wallets/{wallet}/history/{strategyId}for investment activity
Customer Integration Checklist
- Create customer + API key and store mapping in your backend.
- Pass the connected wallet address into
DeframeProvider.config.walletAddress. - Implement
processBytecodewith your wallet stack. - Emit all required tx lifecycle statuses back to the widget.
- Track completed transactions in your own ledger for reconciliation/support.