Integration
Widget and API
Widget SDK Integration
The easiest way to integrate Ditto Yield is via our React SDK. It provides a fully responsive, themed UI for deposits, withdrawals, and analytics.
Installation
npm install @ditto-network/sdk lucide-react
Basic Usage
import { DittoWidget, VaultCard, PositionCard, HistoryCard } from '@ditto-network/sdk';
export default function YieldDashboard() {
return (
<div className="flex flex-col gap-4 max-w-md mx-auto">
{/* 1. Core Interaction */}
<VaultCard
vaultAddress="0x8a...9f2"
theme="dark"
/>
{/* 2. User Stats & Graph */}
<PositionCard theme="dark" />
{/* 3. Analytics */}
<HistoricChart
period="30d"
benchmark="market"
theme="dark"
/>
{/* 4. Activity */}
<HistoryCard limit={5} theme="dark" />
</div>
);
}
Configuration Props
vaultAddress
string
Required
The address of the Ditto Vault.
theme
dark
light
Interface style
primaryColor
string
'text-cyan-400'
Tailwind text color class for accents.
showSwap
boolean
true
Show the Deposit/Withdraw interface.
showChart
boolean
true
Show the historical APY backtest chart.
showPosition
boolean
true
Show user balance and PnL card.
showHistory
boolean
true
Show transaction history list.
REST API Reference
For custom dashboards, use the Data API.
Base URL: https://api.dittonetwork.io
Auth: Bearer Token (Contact Sales for API Key)
1 Get Vault Details
Returns TVL, current APY, and strategy allocation.
Endpoint: GET /vaults/{address}
2 Get Historical APY Series
Returns daily data points for building charts.
Endpoint: GET /series
Query Params:
vault,period(7d, 30d, 1y, all)
3 Get Global Transactions
Returns a paginated list of all vault events (User actions + Protocol actions).
Endpoint: GET /transactions
Query Params:
vault: (string) Vault addressdepositor: (string) Depositor addresstype: (string)DEPOSIT,WITHDRAW,REBALANCE,APR_UPDATElimit: (int) Default 20page: (int) Default 1
Usage Examples
Get all active vaults:
Get specific vault details:
Get specific transactions of the user:
Last updated

