get_portfolio_transactions
Retrieve transaction history for a wallet address on Ethereum and Base networks to analyze trading activity and portfolio changes.
Instructions
Get transaction history for a wallet address (BETA: 1 address, ETH/BASE only, uses USER_ADDRESS from env if addresses not provided)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addresses | No | Array with single address and networks (BETA limitation: 1 address, max 2 networks). Optional - uses USER_ADDRESS from env if not provided | |
| networks | No | Network identifiers to use with USER_ADDRESS (BETA: only eth-mainnet and base-mainnet supported). Only used when addresses not provided. Defaults to ['eth-mainnet', 'base-mainnet'] | |
| before | No | Cursor for pagination - get results before this cursor (optional) | |
| after | No | Cursor for pagination - get results after this cursor (optional) | |
| limit | No | Number of transactions to return (optional, default: 25, max: 50) |
Implementation Reference
- src/services/agService.js:311-349 (helper)Helper function in AgService that makes the actual API POST request to the aggregator's /api/portfolio/transactions endpoint.
async getPortfolioTransactions(addresses, options = {}) { try { const requestBody = { addresses, before: options.before, after: options.after, limit: options.limit }; // Remove undefined values Object.keys(requestBody).forEach(key => { if (requestBody[key] === undefined) { delete requestBody[key]; } }); const response = await fetch(`${this.baseUrl}/api/portfolio/transactions`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody) }); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } const data = await response.json(); if (!data.success) { throw new Error(data.error || 'Portfolio transactions request failed'); } return data.data; } catch (error) { throw new Error(`Failed to get portfolio transactions: ${error.message}`); } }