Skip to main content
This example demonstrates how to deposit funds into a DeFi yield strategy using the Pods API and EIP-7702. Instead of sending each transaction individually, EIP-7702 collapses the entire sequence into a single atomic operation executed directly from your EOA — no smart-contract wallet or contract deployment required.

Overview

This example covers:
  • Fetching available strategies
  • Getting strategy details
  • Generating transaction bytecode
  • Batching and executing via EIP-7702
  • Verifying the deposit

Prerequisites

  • Node.js 18+
  • Pods API key
  • Ethereum wallet with USDC balance
  • Basic understanding of async/await

Installation

Environment Variables

Create a .env file:
Never commit your .env file to version control. Add it to .gitignore.

Step-by-Step Walkthrough

1. Initialize API Client

2. Fetch Available Strategies

3. Get Strategy Details

4. Generate Bytecode

The amount parameter is in the token’s base units (e.g. 6 decimals for USDC: 1000000000 = 1000 USDC).

5. Execute Transactions

The standard approach sends each transaction in a loop. With EIP-7702 you encode the entire result.bytecode array into one executeBatch call and send it as a single type-4 transaction. All steps succeed or all revert — no partial failures.

6. Verify Deposit

Error Handling

The example includes comprehensive error handling for both Pods API errors and EIP-7702 wallet errors:

Running the Example

Expected Output

Next Steps

Strategy Withdrawal

Withdraw from strategies, including cross-chain withdrawals

Cross-Chain Swap

Execute cross-chain token swaps

Check Positions

Track wallet positions

API Reference

View complete API documentation