API Reference

Complete API reference for integrating with Yield Delta's AI-powered yield optimization platform on SEI Network.

Base URL

https://api.yielddelta.io/api

Development: http://localhost:3000/api

Chain Information

  • Network: SEI Network
  • Chain ID: 1328 (Testnet) / 1329 (Mainnet)
  • Block Time: ~400ms

Authentication

Some endpoints require API key authentication. Include your API key in the request headers:

javascript
headers: {
  'X-API-Key': 'your-api-key-here',
  'Content-Type': 'application/json'

Public endpoints (no authentication required): /health, /market/data, /vaults

Rate Limiting


Health

GET /health

Check API and service health status.

Response

json
{
  "status": "healthy",
  "timestamp": "2024-01-23T15:30:00Z",
  "version": "1.0.0",
  "chain": "SEI",
  "chainId": 1328,
  "services": {
    "api": "operational",
    "ai_engine": "operational",
    "blockchain": "operational"
  }

Vaults

GET /vaults

List all vaults with optional filtering.

Query Parameters

ParameterTypeDescription
strategystringFilter by strategy type
activebooleanFilter by active status
pagenumberPage number (default: 1)
limitnumberItems per page (default: 50, max: 1000)

Response

json
{
  "success": true,
  "data": [
    {
      "address": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE",
      "name": "SEI-USDC Concentrated LP",
      "strategy": "concentrated_liquidity",
      "tokenA": "SEI",
      "tokenB": "USDC",
      "fee": 0.003,
      "tickSpacing": 60,
      "tvl": 1250000,
      "apy": 0.125,
      "chainId": 1328,
      "active": true,
      "performance": {
        "totalReturn": 0.087,
        "sharpeRatio": 1.45,
        "maxDrawdown": 0.023,
        "winRate": 0.68
      }
    }
  ],
  "count": 1,
  "chainId": 1328

POST /vaults

Create a new vault.

Request Body

json
{
  "name": "SEI-USDC Concentrated LP",
  "strategy": "concentrated_liquidity",
  "tokenA": "SEI",
  "tokenB": "USDC",
  "fee": 0.003,
  "tickSpacing": 60,
  "chainId": 1328

Strategy Types

  • concentrated_liquidity - Concentrated liquidity positions
  • yield_farming - Yield farming strategies
  • arbitrage - Cross-DEX arbitrage
  • hedge - Hedging strategies
  • stable_max - Stablecoin maximizer
  • sei_hypergrowth - High-risk SEI growth strategy
  • blue_chip - Blue-chip token strategy
  • delta_neutral - Delta neutral market making

Response

json
{
  "success": true,
  "data": {
    "address": "0x1234567890123456789012345678901234567890",
    "name": "SEI-USDC Concentrated LP",
    "strategy": "concentrated_liquidity",
    "tokenA": "SEI",
    "tokenB": "USDC",
    "fee": 0.003,
    "tickSpacing": 60,
    "tvl": 0,
    "apy": 0,
    "chainId": 1328,
    "active": true
  },
  "message": "Vault created successfully",
  "chainId": 1328

GET /vaults/{address}

Get detailed vault information.

Parameters

  • address - SEI vault address (required)

Response

json
{
  "success": true,
  "data": {
    "address": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE",
    "name": "SEI-USDC Concentrated LP",
    "strategy": "concentrated_liquidity",
    "tokenA": "SEI",
    "tokenB": "USDC",
    "fee": 0.003,
    "tvl": 1250000,
    "apy": 0.125,
    "position": {
      "lowerTick": -887220,
      "upperTick": 887220,
      "liquidity": "1000000000000000000",
      "tokensOwed0": "50000000",
      "tokensOwed1": "125000000"
    },
    "risk": {
      "impermanentLoss": 0.023,
      "volatility": 0.18
    }
  },
  "chainId": 1328

AI Predictions

POST /ai/predict

Generate AI-powered liquidity range predictions.

Request Body

json
{
  "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE",
  "marketData": {
    "currentPrice": 0.485,
    "volume24h": 15678234,
    "volatility": 0.25,
    "liquidity": 125000000
  },
  "timeframe": "1d",
  "chainId": 1328

Timeframe Options

  • 1h - 1 hour prediction
  • 4h - 4 hour prediction
  • 1d - 1 day prediction (default)
  • 7d - 7 day prediction
  • 30d - 30 day prediction

Response

json
{
  "success": true,
  "data": {
    "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE",
    "prediction": {
      "optimalRange": {
        "lowerPrice": 0.425,
        "upperPrice": 0.545,
        "lowerTick": -12000,
        "upperTick": 12000,
        "currentTick": 0,
        "tickSpacing": 60
      },
      "confidence": 0.87,
      "expectedReturn": {
        "daily": 0.0012,
        "weekly": 0.0084,
        "monthly": 0.036
      },
      "riskMetrics": {
        "impermanentLossRisk": 0.18,
        "rebalanceFrequency": "medium",
        "maxDrawdown": 0.12,
        "sharpeRatio": 1.45
      },
      "seiOptimizations": {
        "gasOptimized": true,
        "fastFinality": true,
        "parallelExecution": true,
        "estimatedGasCost": 0.001,
        "blockConfirmations": 1
      },
      "signals": {
        "action": "balanced",
        "urgency": "medium",
        "nextRebalanceTime": "2024-01-24T03:30:00Z",
        "marketSentiment": "bullish"
      }
    },
    "metadata": {
      "modelVersion": "2.1.0",
      "features": [
        "price_momentum",
        "volatility_clustering",
        "liquidity_depth",
        "sei_specific_metrics"
      ],
      "processingTime": "~500ms",
      "chainOptimized": "SEI"
    }
  },
  "timestamp": "2024-01-23T15:30:00Z",
  "chainId": 1328

POST /ai/rebalance

Trigger or schedule vault rebalancing.

Request Body

json
{
  "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE",
  "strategy": "threshold_based",
  "parameters": {
    "newLowerTick": -15000,
    "newUpperTick": 15000,
    "slippageTolerance": 0.005,
    "maxGasPrice": 0.001,
    "deadline": 1706023800
  },
  "chainId": 1328

Strategy Options

  • immediate - Execute rebalance immediately
  • scheduled - Schedule for future execution
  • threshold_based - Execute when thresholds are met (default)

Response

json
{
  "success": true,
  "data": {
    "transactionHash": "0xabc123...",
    "status": "pending",
    "gasUsed": "0.001",
    "executionTime": "450ms",
    "newPosition": {
      "lowerTick": -15000,
      "upperTick": 15000,
      "liquidity": "1050000000000000000"
    }
  },
  "timestamp": "2024-01-23T15:30:00Z",
  "chainId": 1328

Market Data

GET /market/data

Get current market data for SEI ecosystem tokens.

Query Parameters

ParameterTypeDescription
symbolsstringComma-separated symbols (e.g., "SEI-USDC,ATOM-SEI")
timeframestringData timeframe (1m, 5m, 15m, 1h, 4h, 1d)

Response

json
{
  "success": true,
  "data": [
    {
      "symbol": "SEI-USDC",
      "price": 0.485,
      "change24h": 0.023,
      "changePercent24h": 4.98,
      "volume24h": "14.2M",
      "volumeUSD24h": 14200000,
      "high24h": 0.492,
      "low24h": 0.467,
      "liquidity": {
        "totalLocked": 125000000,
        "sei": 257732474,
        "usdc": 125000000
      },
      "seiMetrics": {
        "blockTime": 0.4,
        "tps": 5000,
        "gasPrice": 0.000001,
        "validators": 100
      },
      "timestamp": "2024-01-23T15:30:00Z",
      "source": "SEI_DEX_AGGREGATOR"
    }
  ],
  "timestamp": "2024-01-23T15:30:00Z",
  "chainId": 1328

POST /market/data

Get historical market data.

Request Body

json
{
  "symbols": ["SEI-USDC", "ATOM-SEI"],
  "timeframe": "1h",
  "limit": 100,
  "chainId": 1328

Response

json
{
  "success": true,
  "data": [
    {
      "symbol": "SEI-USDC",
      "timeframe": "1h",
      "data": [
        {
          "timestamp": "2024-01-23T14:00:00Z",
          "open": 0.483,
          "high": 0.489,
          "low": 0.481,
          "close": 0.485,
          "volume": 7800000,
          "volumeUSD": 3783000,
          "trades": 453
        }
      ]
    }
  ],
  "metadata": {
    "timeframe": "1h",
    "limit": 100,
    "symbols": ["SEI-USDC", "ATOM-SEI"]
  },
  "timestamp": "2024-01-23T15:30:00Z",
  "chainId": 1328

GET /market/arbitrage

Scan for arbitrage opportunities across SEI DEXes.

Query Parameters

ParameterTypeDescription
tokensstringComma-separated token symbols
minProfitnumberMinimum profit threshold (default: 0.005)

Response

json
{
  "success": true,
  "data": [
    {
      "path": ["SEI", "USDC", "SEI"],
      "exchanges": ["DragonSwap", "SeiSwap"],
      "profit": 0.0125,
      "profitUSD": 156.25,
      "confidence": 0.92,
      "gasEstimate": 0.002,
      "netProfit": 0.0105,
      "execution": {
        "optimal": true,
        "urgency": "medium",
        "estimatedTime": "800ms"
      }
    }
  ],
  "scan": {
    "totalOpportunities": 1,
    "avgProfit": 0.0125,
    "timestamp": "2024-01-23T15:30:00Z"
  },
  "chainId": 1328

Smart Contract Integration

Key Contracts

ContractDescriptionInterface
StrategyVaultAI-driven dynamic liquidity vaultIStrategyVault
VaultFactoryFactory for creating vaults-
AIOracleOracle for AI rebalancing decisions-

Core Functions

StrategyVault

javascript
// Deposit tokens and mint vault shares
function deposit(
  uint256 amount0,
  uint256 amount1,
  address recipient
) external returns (uint256 shares)

// Withdraw tokens and burn shares
function withdraw(
  uint256 shares,
  address recipient
) external returns (uint256 amount0, uint256 amount1)

// Execute AI-powered rebalance
function rebalance(
  int24 newTickLower,
  int24 newTickUpper,
  bytes calldata signature
) external

VaultFactory

javascript
// Create a new strategy vault
function createVault(
  VaultCreationParams calldata params
) external payable returns (address vault)

// Get vault by creation salt
function getVault(bytes32 salt) external view returns (address)

// Get total number of vaults
function allVaultsLength() external view returns (uint256)

AIOracle

javascript
// Register AI model
function registerAIModel(
  string calldata model,
  address signer
) external

// Submit rebalance request
function submitRebalanceRequest(
  address vault,
  int24 newTickLower,
  int24 newTickUpper,
  uint256 confidence,
  uint256 deadline
) external returns (bytes32 requestId)

Error Codes

CodeDescription
400Bad Request - Invalid request data
401Unauthorized - Invalid or missing API key
404Not Found - Resource not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

SEI-Specific Features

Network Advantages

  • Fast Finality: 400ms block time enables rapid rebalancing
  • Parallel Execution: Optimized transaction processing
  • Low Gas Costs: Efficient operations at minimal cost
  • MEV Protection: Built-in protection against frontrunning
  • EVM Compatibility: Standard Ethereum tooling works

Gas Estimates (in SEI)

OperationEstimated Cost
Swap0.001 SEI
Add Liquidity0.002 SEI
Remove Liquidity0.002 SEI
Rebalance0.003 SEI
Vault Creation0.005 SEI

Supported Tokens

  • SEI - Native SEI token
  • USDC - USD Coin
  • USDT - Tether USD
  • ATOM - Cosmos Hub
  • ETH - Wrapped Ethereum
  • BTC - Wrapped Bitcoin

Supported DEXes

  • DragonSwap - Primary DEX for SEI
  • SeiSwap - Native AMM
  • AstroPort - Multi-chain DEX
  • WhiteWhale - Cross-chain liquidity

Code Examples

JavaScript/TypeScript

Fetching Vault Data

javascript
const response = await fetch('https://api.yielddelta.io/api/vaults', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
  },
});

const { data } = await response.json();
console.log('Vaults:', data);

Creating a Vault

javascript
const response = await fetch('https://api.yielddelta.io/api/vaults', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key',
  },
  body: JSON.stringify({
    name: 'My SEI Vault',
    strategy: 'concentrated_liquidity',
    tokenA: 'SEI',
    tokenB: 'USDC',
    fee: 0.003,
    tickSpacing: 60,
    chainId: 1328,
  }),
});

const { data } = await response.json();
console.log('Created vault:', data.address);

Getting AI Predictions

javascript
const response = await fetch('https://api.yielddelta.io/api/ai/predict', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your-api-key',
  },
  body: JSON.stringify({
    vaultAddress: '0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE',
    marketData: {
      currentPrice: 0.485,
      volume24h: 15678234,
      volatility: 0.25,
      liquidity: 125000000,
    },
    timeframe: '1d',
    chainId: 1328,
  }),
});

const { data } = await response.json();
console.log('AI Prediction:', data.prediction);

Interacting with Smart Contracts (ethers.js)

javascript
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://evm-rpc-arctic-1.sei-apis.com');
const signer = new ethers.Wallet(privateKey, provider);

const vaultABI = [...]; // Your vault ABI
const vaultAddress = '0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE';
const vault = new ethers.Contract(vaultAddress, vaultABI, signer);

// Deposit into vault
const amount0 = ethers.parseEther('10'); // 10 SEI
const amount1 = ethers.parseUnits('5', 6); // 5 USDC

const tx = await vault.deposit(amount0, amount1, signer.address);
await tx.wait();
console.log('Deposited successfully!');

Next Steps


Need help? Join our Discord or check the documentation.