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:
Step-by-Step Walkthrough
1. Initialize API Client
2. Fetch Available Strategies
3. Get Strategy Details
4. Generate Bytecode
Theamount 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.This pattern is chain-agnostic. To run it on another network, swap the viem
chain import
(polygon → base, arbitrum, mainnet, …) and point RPC_URL at that chain — match the
strategy’s network. The SIMPLE_7702_ACCOUNT_ADDRESS (0x4Cd241E8d1510e30b2076397afc7508Ae59C66c9)
is the same canonical address on every EIP-7702-enabled chain, so it never changes.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