evm-balance
3
总安装量
2
周安装量
#58035
全站排名
安装命令
npx skills add https://github.com/melonask/evm-balance-skills --skill evm-balance
Agent 安装分布
opencode
2
claude-code
2
github-copilot
2
codex
2
gemini-cli
2
kimi-cli
1
Skill 文档
EVM Balance Skill
Overview
The evm-balance project is a high-performance library and CLI for fetching EVM balances across multiple chains using Multicall3. It supports native and ERC20 token balances, address generation (XPUB, CREATE2), and batch processing.
Key Components:
- SDK (
@evm-balance/sdk): Core library for fetching balances. - CLI (
@evm-balance/cli): Command-line interface for easy interaction. - Contracts: Solidity contracts for Multicall3 interactions.
Project Structure
evm-balance/
âââ packages/
â âââ sdk/ # Core library
â â âââ src/
â â â âââ index.ts # Main exports
â â â âââ types.ts # TypeScript interfaces
â â â âââ balance.ts # Balance fetching logic
â â â âââ multicall.ts # Multicall3 encoding/decoding
â â â âââ chains.ts # Chain utilities
â â â âââ utils.ts # Range parsing, formatting
â â âââ package.json
â âââ cli/ # CLI tool
â âââ src/
â â âââ index.ts # CLI implementation
â âââ package.json
âââ src/ # Solidity contracts
â âââ Multicall3.sol
âââ script/ # Deployment scripts
â âââ DeployTest.s.sol
âââ package.json # Workspace root
CLI Usage
The CLI provides a powerful interface for fetching balances.
Quick Start
# Query multiple chains
evm-balance 0-100 --chain mainnet,optimism,arbitrum --xpub $XPUB
# Query specific tokens
evm-balance 0-100 -c mainnet -t 0xA0b86991...USDC,0xdAC17F9...USDT -X $XPUB
# Filter by minimum balance
evm-balance 0-1000 -c mainnet -t 0xUSDT,0xUSDC --min 0.1
# Output as JSON
evm-balance 0-100 -c mainnet -f json -o balances.json
Common Options
-c, --chains: Comma-separated chain names or IDs (e.g.,mainnet,optimism).-t, --tokens: Comma-separated ERC20 token addresses.-m, --min: Minimum balance filter.-f, --format: Output format (table,json,csv).-X, --xpub: Extended public key for BIP-44 address generation.--mode: Address generation mode (xpuborfactory).
SDK Usage
The SDK allows programmatically fetching balances.
Basic Example
import { createBalanceFetcher, parseRange, mainnet } from "@evm-balance/sdk";
const fetcher = createBalanceFetcher({ chain: mainnet });
const results = await fetcher.fetchBalances({
config: { chain: mainnet },
mode: { type: "xpub", xpub: process.env.XPUB! },
indices: parseRange("0-100"),
options: {
tokens: ["0xA0b86991..."], // USDC
includeNative: true,
},
});
For detailed API documentation, see sdk_api.md.
Development Workflow
Prerequisites
bunfoundry(forge, anvil)
Commands
# Install dependencies
bun install
# Build all packages
bun run build
# Run tests
bun run test
# Run Solidity tests (requires Anvil)
bun run test:sol
# Type check
bun run typecheck
# Format code
bun run fmt
Testing with Anvil
# 1. Start Anvil
anvil
# 2. Deploy test contracts
forge script script/DeployTest.s.sol:DeployTest --rpc-url http://127.0.0.1:8545 --broadcast
# 3. Run tests
bun run test