AegisAEGIS
Zerion API

Zerion Integration

Multi-chain portfolio tracking and DeFi position monitoring for AI agents — unified balances across 10+ EVM chains with real-time USD valuations.


Why Zerion for Agents?

Autonomous agents operating across multiple blockchains need a unified view of their holdings. Querying each chain individually is slow, error-prone, and requires maintaining separate RPC connections. Zerion solves this with a single API call.

Zerion provides the ideal portfolio layer for agent wallets:

Unified Multi-Chain View

One API call returns balances across Ethereum, Base, Polygon, Arbitrum, Optimism, and more. No chain-by-chain queries.

Real-Time USD Valuations

Every token balance comes with its current USD value. Agents can make spending decisions based on actual portfolio worth.

10+ EVM Chains Supported

Ethereum, Base, Polygon, Arbitrum, Optimism, Avalanche, BNB Chain, Fantom, zkSync, and more covered out of the box.

DeFi Position Tracking

Tracks lending, staking, LP positions, and yield farming. Agents see their full financial picture, not just token balances.

Automatic Dust Filtering

Filters out sub-penny token positions automatically. Agents only see meaningful balances that matter for decision-making.

REST API with Simple Auth

Clean REST endpoints with Basic auth. No complex SDK setup, no WebSocket requirements. One API key, one HTTP call.


What Aegis Uses Zerion For

Aegis integrates Zerion as one of three balance providers alongside Uniblock and Allium. Each provider covers different chains and use cases, with Zerion handling the EVM multi-chain aggregation layer.

Multi-Chain EVM Portfolio Aggregation

Zerion queries all EVM chains for a given agent wallet in a single call. This feeds into the unified balance view that powers budget enforcement and spending decisions.

USD-Denominated Balance Tracking

Aegis budget policies operate in USD. Zerion provides real-time token-to-USD conversion so budget thresholds and spending limits work across any token on any chain.

Dashboard Wallet Balance Display

The Aegis Nexus dashboard shows each agent's wallet balances. Zerion data populates the EVM balance cards with chain, token, amount, and USD value.


Use Cases

📊

Agent Portfolio Dashboard

Build a complete view of agent holdings across all EVM chains. See every token, LP position, and staking balance in one place with live USD values.

getZerionPortfolio(agentWallet) → unified balance card

🎯

Budget Monitoring

Track total agent portfolio value against spending limits. Automatically pause agents when their total holdings drop below the configured budget floor.

totalUSD < budgetFloor → agent.pause()

Cross-Chain Arbitrage

Agents monitoring the same token across multiple chains can detect price discrepancies and act on arbitrage opportunities in real time.

ETH on Base vs Arbitrum → price delta alert

🏦

Treasury Management

Aggregate balances across an entire fleet of agents. Track total organization value, identify idle capital, and rebalance across agents.

fleet.map(getZerionPortfolio) → totalTreasury


Portfolio Query

The getZerionPortfolio function queries all positions for a wallet address and returns normalized balance objects.

packages/integrations/src/zerion.ts
import { getZerionPortfolio } from "@aegis-ows/integrations";

const balances = await getZerionPortfolio("0x1234...");
// Returns:
// [
//   {
//     chain: "Ethereum",
//     token: "ETH",
//     balance: "1.500000",
//     usdValue: "4500.00",
//     source: "zerion"
//   },
//   {
//     chain: "Base",
//     token: "USDC",
//     balance: "100.000000",
//     usdValue: "100.00",
//     source: "zerion"
//   }
// ]

How It Works

  1. Queries the Zerion /wallets/{address}/positions/ endpoint with Basic auth
  2. Filters out dust positions with USD value below $0.01
  3. Maps internal chain IDs (e.g. ethereum, base) to human-readable names
  4. Normalizes each position into the shared ChainBalance type with chain, token, balance, usdValue, and source fields

Note: Zerion covers EVM chains only. For Solana balances, Aegis uses Uniblock. For historical and indexed data, Aegis uses Allium. The getAllBalances function combines all three sources automatically.


Multi-Source Deduplication

Aegis queries Zerion, Uniblock, and Allium in parallel and deduplicates the results. When multiple sources report the same token on the same chain, Aegis keeps the entry with the highest USD value (most recent price data).

packages/integrations/src/balances.ts
import { getAllBalances } from "@aegis-ows/integrations";

const balances = await getAllBalances({
  evm: "0x1234...",
  solana: "2G55...",
});
// Queries Zerion + Uniblock + Allium in parallel
// Deduplicates: keeps highest USD value per chain:token pair
// Returns unified ChainBalance[] across all chains

Deduplication Strategy

SourceChains CoveredPrimary Use
ZerionAll EVM chainsReal-time multi-chain EVM portfolio
UniblockEVM + SolanaSolana coverage, EVM fallback
AlliumEVM + SolanaIndexed historical data, analytics

Setup Guide

Getting Zerion working with Aegis requires a single environment variable. The integration handles auth encoding and endpoint configuration automatically.

1. Get Your API Key

Sign up at zerion.io/developers and create a new API key. Free tier is available for development and testing.

2. Set the Environment Variable

.env
ZERION_API_KEY=zk_dev_xxxxxxxxxxxxxxxx

3. Auth Mechanism

Zerion uses Basic auth. The integration base64-encodes your API key with a trailing colon (key + ":") and sends it as the Authorization: Basic ... header. You do not need to handle encoding yourself.

Configuration Reference

VariableRequiredDescription
ZERION_API_KEYYesYour Zerion developer API key from zerion.io/developers

Supported Chains

EthereumBasePolygonArbitrumOptimismAvalancheBNB ChainFantomzkSyncGnosisCelo

Rate limits vary by plan. Check the Zerion developer docs for current limits on your tier.


Hackathon Ideas

Building with Zerion + Aegis for a hackathon? Here are high-impact project ideas organized by track.

DeFi Track

Portfolio-Aware Spending

AI agents that check their Zerion portfolio before making purchases. Budget decisions informed by real-time multi-chain net worth, not just a single wallet balance.

Portfolio Management

Automated Rebalancing

Agents that monitor portfolio allocations via Zerion and automatically rebalance when drift exceeds thresholds. Combine with Aegis budget policies for risk limits.

Analytics

Fleet Wealth Tracking

Cross-chain wealth tracking dashboard for agent fleets. Aggregate Zerion data across dozens of agent wallets to show total organization value, chain distribution, and token exposure.

Risk Management

Value-Based Behavior

Agents that adjust their behavior based on portfolio value. Conservative when holdings are low, aggressive when flush. Zerion provides the real-time valuation input.


API Reference

The Zerion integration exposes a single function. It handles auth, pagination, dust filtering, and chain ID mapping internally.

FunctionParametersReturnsDescription
getZerionPortfoliowalletAddress: stringChainBalance[]Fetches all positions for a wallet across EVM chains. Filters dust, maps chain IDs, returns normalized balances with USD values.

ChainBalance Type

interface ChainBalance {
  chain: string;      // Human-readable chain name ("Ethereum", "Base", ...)
  token: string;      // Token symbol ("ETH", "USDC", ...)
  balance: string;    // Token amount as decimal string
  usdValue: string;   // USD value as decimal string
  source: "zerion" | "uniblock" | "allium";
}