Quick Integration

Transform your app into an intelligent yield platform with just a few lines of code. Liquid’s SDK and APIs provides autonomous USDC optimization across Base and Ethereum with zero gas fees for your users.

5 minutes

Setup Time From npm install to first deposit

Zero gas fees

Better UX No gas complexity for your users

Installation

1

Install the SDK

npm install @liquid/sdk
3

Initialize the SDK

import { Liquid } from '@liquid/sdk';

const liquid = new Liquid({
  apiKey: 'your-api-key',
  network: 'base', // or 'ethereum'
});

Your First Integration

The simplest way to add autonomous yield optimization:
// Initialize Liquid
const liquid = new Liquid({
  apiKey: 'your-api-key',
  network: 'base'
});

// Deposit USDC - agents take over automatically
try {
  const result = await liquid.deposit(1000, 'agent');
  console.log('Deposit successful:', result.transactionHash);
  console.log('Expected APY:', result.estimatedAPY);
} catch (error) {
  console.error('Deposit failed:', error.message);
}

// Check earnings anytime
const earnings = await liquid.earnings(userAddress);
console.log(`Total earned: $${earnings.total}`);
console.log(`Current APY: ${earnings.currentAPY}%`);

// Withdraw when needed
const withdrawal = await liquid.withdraw(500); // or 'all'
console.log('Withdrawal processed:', withdrawal.transactionHash);
Agent Mode Benefits: Fully autonomous optimization, typically 40-60% better returns than manual strategies, zero maintenance required.

Manual Mode (Advanced Control)

For users who want to control their yield strategy:
// User selects protocol and allocation
const result = await liquid.deposit(5000, 'manual', {
  protocol: 'aave',      // aave, compound, morpho, etc.
  asset: 'usdc',         // usdc, gho, usr, usdbc
  allocation: 100        // percentage (1-100)
});

Core SDK Methods

Real-World Example

Here’s how a neobank might integrate Liquid to offer high-yield USDC accounts:
// User clicks "Start Earning" button
async function startEarning(amount) {
  setLoading(true);
  
  try {
    // Deposit USDC in agent mode
    const result = await liquid.deposit(amount, 'agent');
    
    // Show success message
    showNotification(`
      🤖 Your AI agents are now working! 
      Expected APY: ${result.estimatedAPY}%
      First move typically within 5-10 minutes
    `);
    
    // Redirect to dashboard
    router.push('/dashboard');
    
  } catch (error) {
    showError('Deposit failed: ' + error.message);
  } finally {
    setLoading(false);
  }
}

Understanding User Experience

Your users will experience:

Error Handling

Robust error handling for production apps:
try {
  const result = await liquid.deposit(amount, 'agent');
  return { success: true, data: result };
  
} catch (error) {
  // Handle specific error types
  switch (error.code) {
    case 'INSUFFICIENT_BALANCE':
      return { 
        success: false, 
        message: 'Insufficient USDC balance' 
      };
      
    case 'MINIMUM_DEPOSIT':
      return { 
        success: false, 
        message: 'Minimum deposit is $50 USDC' 
      };
      
    case 'NETWORK_ERROR':
      return { 
        success: false, 
        message: 'Network congestion. Please try again.' 
      };
      
    case 'INVALID_API_KEY':
      return { 
        success: false, 
        message: 'Invalid API key. Contact support.' 
      };
      
    default:
      return { 
        success: false, 
        message: 'Transaction failed. Please try again.' 
      };
  }
}

Next Steps

Support

Questions? We’re here to help you build successfully.Response time: Usually within 1 hour, 7 days a week.

Ready to transform your app with autonomous yield optimization? Start with a simple agent mode integration and watch your users experience effortless earning.