Yield Trading with Pendle: Let Your AI Agent Optimize Returns
Building a DeFi trading bot used to mean integrating with dozens of different protocols, each with their own SDKs, authentication patterns, and quirks. Your code becomes a mess of Jupiter calls mixed with Aave lending, Lido staking, and Hyperliquid perpetuals — all with different error handling and transaction patterns.
Why Protocol Integration Hell Matters
DeFi's composability promise breaks down at the developer level. You want to build sophisticated yield strategies that can swap on Jupiter, lend on Aave, stake with Lido, and hedge with Hyperliquid perpetuals. But instead of focusing on strategy logic, you're stuck managing 14 different protocol integrations, each requiring separate wallet connections, transaction signing, and error handling.
The result? Most developers stick to single protocols or abandon complex multi-protocol strategies entirely. Your trading algorithms remain simplistic because the integration overhead isn't worth the complexity.
One API for All DeFi Protocols
WAIaaS solves this with a unified REST API that abstracts away protocol differences. Instead of learning 14 different SDKs, you make standard HTTP calls to execute actions across any supported protocol. The system handles wallet management, transaction signing, policy enforcement, and cross-chain bridging automatically.
WAIaaS currently integrates 14 DeFi protocol providers: aave-v3, across, dcent-swap, drift, erc8004, hyperliquid, jito-staking, jupiter-swap, kamino, lido-staking, lifi, pendle, polymarket, and zerox-swap. Whether you're building on EVM or Solana, the API interface remains consistent.
Here's how simple it becomes. Instead of juggling multiple protocol SDKs, you execute any DeFi action with the same pattern:
curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "1000000000"
}'
The same pattern works for Aave lending, Lido staking, or any other protocol. Your code stays clean and focused on strategy logic rather than protocol integration details.
Protocol-Agnostic Policy Engine
Beyond unified APIs, WAIaaS provides risk management through its policy engine with 21 policy types and 4 security tiers. You can set protocol-specific limits that work across all DeFi actions:
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{
"walletId": "<wallet-uuid>",
"type": "LENDING_LTV_LIMIT",
"rules": {
"max_ltv": 0.75
}
}'
This LTV limit applies whether you're lending on Aave, Kamino, or any other lending protocol. You define the risk parameters once, and WAIaaS enforces them across all protocols.
For perpetual trading, you can set leverage and position limits:
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{
"walletId": "<wallet-uuid>",
"type": "PERP_MAX_LEVERAGE",
"rules": {
"max_leverage": 5.0
}
}'
This works across Hyperliquid, Drift, and other perpetual protocols. Your risk management becomes protocol-agnostic.
Cross-Chain Bridge Integration
Multi-protocol strategies often require moving assets between chains. WAIaaS handles this through integrated bridging via LI.FI and Across protocols. You can execute complex strategies that span Ethereum and Solana without managing bridge transactions separately.
The system supports liquid staking on both chains through Lido (EVM) and Jito (Solana), letting you optimize yield across the entire DeFi ecosystem rather than being locked into single-chain protocols.
Real-Time Position Monitoring
Instead of querying each protocol separately to track positions, WAIaaS aggregates everything into a single endpoint:
curl http://127.0.0.1:3100/v1/wallet/defi-positions \
-H "Authorization: Bearer wai_sess_eyJhbGciOiJIUzI1NiJ9..."
This returns lending positions, staking rewards, perpetual trades, and liquidity provider positions across all integrated protocols. Your dashboards and monitoring systems work with one API instead of managing dozens of protocol-specific queries.
TypeScript SDK for Clean Integration
While the REST API works with any language, the TypeScript SDK provides additional convenience for JavaScript applications:
import { WAIaaSClient } from '@waiaas/sdk';
const client = new WAIaaSClient({
baseUrl: 'http://127.0.0.1:3100',
sessionToken: process.env.WAIAAS_SESSION_TOKEN,
});
// Execute any DeFi action through the same interface
const swapResult = await client.executeAction('jupiter-swap', 'swap', {
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: '1000000000'
});
// Get aggregated DeFi positions across all protocols
const positions = await client.getDeFiPositions();
console.log(positions); // Lending, staking, perps, LP positions
The SDK handles session management, error handling, and provides TypeScript types for all protocol actions. Your code becomes much cleaner compared to juggling multiple protocol SDKs.
Quick Start: Multi-Protocol Trading Bot
Here's how to get started with a trading bot that uses multiple DeFi protocols:
Install and initialize WAIaaS:
npm install -g @waiaas/cli waiaas init waiaas start waiaas quickset --mode mainnetCreate policies for risk management:
# Set spending limits curl -X POST http://127.0.0.1:3100/v1/policies \ -H "Content-Type: application/json" \ -H "X-Master-Password: <password>" \ -d '{"walletId": "<uuid>", "type": "SPENDING_LIMIT", "rules": {"daily_limit_usd": 10000}}' # Set leverage limits for perps curl -X POST http://127.0.0.1:3100/v1/policies \ -H "Content-Type: application/json" \ -H "X-Master-Password: <password>" \ -d '{"walletId": "<uuid>", "type": "PERP_MAX_LEVERAGE", "rules": {"max_leverage": 3.0}}'Install the TypeScript SDK:
npm install @waiaas/sdkBuild your strategy:
import { WAIaaSClient } from '@waiaas/sdk'; const client = new WAIaaSClient({ baseUrl: 'http://127.0.0.1:3100', sessionToken: 'your-session-token' }); // Your multi-protocol strategy logic here const positions = await client.getDeFiPositions(); // Rebalance across protocols as neededDeploy with Docker for production:
docker run -d \ --name waiaas \ -p 127.0.0.1:3100:3100 \ -v waiaas-data:/data \ ghcr.io/minhoyoo-iotrust/waiaas:latest
What's Next
WAIaaS provides the unified DeFi API layer you need to build sophisticated multi-protocol strategies without integration headaches. The system handles wallet management, transaction signing, policy enforcement, and cross-chain operations so you can focus on alpha generation.
Get started by exploring the full documentation and examples at the WAIaaS GitHub repository, or visit waiaas.ai for deployment guides and API reference documentation.