A plugin for Eliza that allows users to fetch portfolio data using the Zapper API.
- Get portfolio data from wallet addresses on networks supported by the Zapper API.
- Get portfolio data from addresses attached to Farcaster profiles.
npm install @elizaos/plugin-zapper
-
Get your API key from Zapper
-
Set up your environment variables:
ZAPPER_API_KEY=your_api_key
- Register the plugin in your Eliza configuration:
import { zapperPlugin } from "@elizaos/plugin-zapper";
// In your Eliza configuration
plugins: [
zapperPlugin,
// ... other plugins
];
The plugin responds to natural language queries about wallet data. Here are some examples:
"Show me the holdings of @vitalik.eth"
"Show me the portfolio of these wallets 0xd8d...045, 0xadd...077"
"Get wallet holdings for HN7cA...WrH"
Fetch the current portfolio of provided addresses.
// Example response format
portfolio: {
tokenBalances: Array<{
address: string;
network: string;
token: {
balance: number;
balanceUSD: number;
baseToken: {
name: string;
symbol: string;
};
};
}>;
nftBalances: Array<{
network: string;
balanceUSD: number;
}>;
totals: {
total: number;
totalWithNFT: number;
totalByNetwork: Array<{
network: string;
total: number;
}>;
holdings: Array<{
label: string;
balanceUSD: number;
pct: number;
}>;
};
};
Fetch the portfolio of addresses attached to Farcaster profiles.
// Example response format
farcasterProfile: {
username: string;
fid: number;
metadata: {
displayName: string;
description: string;
imageUrl: string;
warpcast: string;
};
connectedAddresses: string[];
custodyAddress: string;
};
- Clone the repository.
- Install dependencies:
pnpm install
- Build the plugin:
pnpm build
Variable | Description | Required |
---|---|---|
ZAPPER_API_KEY | Your Zapper API key | Yes |
export type ZapperPortfolioResponse = {
data: {
portfolio: {
tokenBalances: Array<{
address: string;
network: string;
token: {
balance: number;
balanceUSD: number;
baseToken: {
name: string;
symbol: string;
};
};
}>;
nftBalances: Array<{
network: string;
balanceUSD: number;
}>;
totals: {
total: number;
totalWithNFT: number;
totalByNetwork: Array<{
network: string;
total: number;
}>;
holdings: Array<{
label: string;
balanceUSD: number;
pct: number;
}>;
};
};
};
};
export type ZapperFarcasterResponse = {
data: {
accounts: Array<{
farcasterProfile: {
username: string;
fid: number;
metadata: {
displayName: string;
description: string;
imageUrl: string;
warpcast: string;
};
connectedAddresses: string[];
custodyAddress: string;
};
}>;
};
};