Earn yield by lending USDC through Lulo protocol
// Lend USDC const signature = await agent.methods.lendAssets(100); // Lend 100 USDC // Get account details const details: LuloAccountDetailsResponse = { totalValue: 100.5, interestEarned: 0.5, realtimeApy: 5.2, settings: { owner: "wallet-address", allowedProtocols: null, homebase: null, minimumRate: "4.8" } };
"Lend 100 USDC to earn yield" "Deposit USDC into Lulo for interest" "Start earning yield on my USDC" "Put my USDC to work in Lulo"
// Basic lending { "amount": 100 } // Alternative format "100" // Direct amount input
{ status: "success", message: "Asset lent successfully", transaction: "5UfgJ5vVZxUx...", amount: 100 }
interface LuloAccountDetailsResponse { totalValue: number; // Total value in USDC interestEarned: number; // Total interest earned realtimeApy: number; // Current APY settings: { owner: string; // Wallet address allowedProtocols: string | null; homebase: string | null; minimumRate: string; // Minimum acceptable APY } }
// Parameters interface LendParams { amount: number; // USDC amount symbol: string; // Always "USDC" account: string; // Wallet address } // Features - Transaction versioning - Blockhash handling - Confirmation tracking - Retry logic
try { const signature = await agent.methods.lendAssets(amount); } catch (error) { if (error.message.includes("insufficient funds")) { // Handle insufficient balance } else if (error.message.includes("slippage")) { // Handle price movement } }
// Verify balance const balance = await getBalance(USDC_MINT); if (balance < amount) throw new Error("Insufficient balance");
// Create and sign transaction const txn = VersionedTransaction.deserialize(buffer); txn.message.recentBlockhash = blockhash; txn.sign([wallet]);
// Wait for confirmation await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight });
getBalance
withdrawAssets
getAccountDetails
checkYield
Was this page helpful?