forked from Zakaria/hermes-agent
Hermes-agent
This commit is contained in:
+227
@@ -0,0 +1,227 @@
|
||||
---
|
||||
title: "Evm — 只读 EVM 客户端:跨 8 条链的钱包、代币、Gas"
|
||||
sidebar_label: "Evm"
|
||||
description: "只读 EVM 客户端:跨 8 条链的钱包、代币、Gas"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Evm
|
||||
|
||||
只读 EVM 客户端:跨 8 条链的钱包、代币、Gas。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/blockchain/evm` 安装 |
|
||||
| 路径 | `optional-skills/blockchain/evm` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | Mibayy (@Mibayy), youssefea (@youssefea), ethernet8023 (@ethernet8023), Hermes Agent |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `EVM`, `Ethereum`, `BNB`, `BSC`, `Base`, `Arbitrum`, `Polygon`, `Optimism`, `Avalanche`, `zkSync`, `Blockchain`, `Crypto`, `Web3`, `DeFi`, `NFT`, `ENS`, `Whale`, `Security` |
|
||||
| 相关 skill | [`solana`](/user-guide/skills/optional/blockchain/blockchain-solana) |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# EVM Blockchain Skill
|
||||
|
||||
跨 8 条链查询 EVM 兼容区块链数据,支持 USD 定价。
|
||||
14 个命令:钱包投资组合、代币信息、交易记录、活动历史、Gas 追踪器、
|
||||
网络统计、价格查询、多链扫描、巨鲸检测、ENS 解析、
|
||||
授权检查器、合约检查器和交易解码器。
|
||||
|
||||
支持 8 条链:Ethereum、BNB Chain (BSC)、Base、Arbitrum One、Polygon、
|
||||
Optimism、Avalanche (C-Chain)、zkSync Era。
|
||||
|
||||
无需 API 密钥。零外部依赖 — 仅使用 Python 标准库
|
||||
(urllib、json、argparse、threading)。
|
||||
|
||||
> **取代独立的 `base` skill。** Base 专属代币(AERO、DEGEN、
|
||||
> TOSHI、BRETT、WELL、cbETH、cbBTC、wstETH、rETH)以及原先位于
|
||||
> `optional-skills/blockchain/base/` 下的所有 Base RPC 功能已整合
|
||||
> 至本 skill。对任意命令传入 `--chain base` 即可覆盖 Base。
|
||||
|
||||
---
|
||||
|
||||
## 使用场景
|
||||
- 用户查询任意 EVM 链上的钱包余额或投资组合
|
||||
- 用户希望同时检查同一钱包在所有链上的情况
|
||||
- 用户想通过交易哈希检查某笔交易(或解码其操作内容)
|
||||
- 用户想查询 ERC-20 代币的元数据、价格、供应量或市值
|
||||
- 用户想查看某地址的近期交易历史
|
||||
- 用户想查询当前 Gas 价格或比较各链手续费
|
||||
- 用户想在近期区块中查找大额巨鲸转账
|
||||
- 用户想解析 ENS 名称(如 vitalik.eth)或反向查询地址
|
||||
- 用户想检查合约是否存在危险的代币授权
|
||||
- 用户想检查智能合约(是否为代理合约?ERC-20?ERC-721?字节码大小?)
|
||||
- 用户想在交易前比较各链 Gas 费用
|
||||
|
||||
---
|
||||
|
||||
## 前置条件
|
||||
仅需 Python 3.8+ 标准库,无需 pip 安装。
|
||||
定价:CoinGecko 免费 API(有速率限制,约 10-30 次请求/分钟)。
|
||||
ENS:ensideas.com 公共 API。
|
||||
交易解码:4byte.directory 公共 API。
|
||||
|
||||
覆盖 RPC 端点:`export EVM_RPC_URL=https://your-rpc.com`
|
||||
|
||||
辅助脚本路径:`~/.hermes/skills/blockchain/evm/scripts/evm_client.py`
|
||||
|
||||
---
|
||||
|
||||
## 快速参考
|
||||
|
||||
```
|
||||
SCRIPT=~/.hermes/skills/blockchain/evm/scripts/evm_client.py
|
||||
|
||||
# 网络与价格
|
||||
python3 $SCRIPT stats # Ethereum 统计
|
||||
python3 $SCRIPT stats --chain arbitrum # Arbitrum 统计
|
||||
python3 $SCRIPT compare # 全部 8 条链的 Gas + 价格
|
||||
|
||||
# 钱包
|
||||
python3 $SCRIPT wallet 0xd8dA...96045 # 投资组合(ETH + ERC-20)
|
||||
python3 $SCRIPT wallet 0xd8dA...96045 --chain bsc
|
||||
python3 $SCRIPT multichain 0xd8dA...96045 # 同一钱包在所有链上的情况
|
||||
|
||||
# 代币与价格
|
||||
python3 $SCRIPT price ETH
|
||||
python3 $SCRIPT price 0xdAC1...1ec7 # 通过合约地址查询
|
||||
python3 $SCRIPT token 0xdAC1...1ec7 # ERC-20 元数据 + 市值
|
||||
|
||||
# 交易
|
||||
python3 $SCRIPT tx 0x5c50...f060 # 交易详情
|
||||
python3 $SCRIPT decode 0x5c50...f060 # 解码输入数据(4byte.directory)
|
||||
python3 $SCRIPT activity 0xd8dA...96045 # 近期交易
|
||||
|
||||
# Gas
|
||||
python3 $SCRIPT gas # Gas 价格 + 费用估算
|
||||
python3 $SCRIPT gas --chain optimism
|
||||
|
||||
# 安全
|
||||
python3 $SCRIPT allowance 0xd8dA...96045 # 危险的 ERC-20 授权
|
||||
python3 $SCRIPT contract 0xdAC1...1ec7 # 合约检查(代理合约?标准?)
|
||||
|
||||
# ENS
|
||||
python3 $SCRIPT ens vitalik.eth # 名称 -> 地址 + 个人资料
|
||||
python3 $SCRIPT ens 0xd8dA...96045 # 地址 -> ENS 名称
|
||||
|
||||
# 巨鲸检测
|
||||
python3 $SCRIPT whale # 大额转账(最近 20 个区块,>$10k)
|
||||
python3 $SCRIPT whale --blocks 50 --min-usd 100000 --chain arbitrum
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 操作流程
|
||||
|
||||
### 0. 环境检查
|
||||
```bash
|
||||
python3 --version # 需要 3.8+
|
||||
python3 ~/.hermes/skills/blockchain/evm/scripts/evm_client.py stats
|
||||
```
|
||||
|
||||
### 1. 钱包投资组合
|
||||
原生余额 + 已知 ERC-20 代币,按 USD 价值排序。
|
||||
```bash
|
||||
python3 $SCRIPT wallet 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
||||
python3 $SCRIPT wallet 0xd8dA... --chain bsc --no-prices # 更快
|
||||
```
|
||||
|
||||
### 2. 多链扫描
|
||||
使用多线程同时扫描同一地址在全部 8 条链上的情况。
|
||||
```bash
|
||||
python3 $SCRIPT multichain 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
|
||||
```
|
||||
输出:每条链的原生余额 + 代币持仓 + USD 总计。
|
||||
|
||||
### 3. 比较(Gas + 价格)
|
||||
并行查询全部 8 条链,显示最便宜/最贵的链。
|
||||
```bash
|
||||
python3 $SCRIPT compare
|
||||
```
|
||||
|
||||
### 4. 交易详情与解码
|
||||
```bash
|
||||
python3 $SCRIPT tx 0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060
|
||||
python3 $SCRIPT decode 0x5c504ed... # 显示人类可读的函数签名
|
||||
```
|
||||
解码使用 4byte.directory 将 0xa9059cbb 转换为 transfer(address,uint256)。
|
||||
|
||||
### 5. ENS 解析
|
||||
```bash
|
||||
python3 $SCRIPT ens vitalik.eth # -> 0xd8dA... + 头像 + 社交链接
|
||||
python3 $SCRIPT ens 0xd8dA...96045 # -> vitalik.eth
|
||||
```
|
||||
|
||||
### 6. 授权检查器(安全)
|
||||
检查已授予已知 DEX/跨链桥合约的 ERC-20 授权。
|
||||
```bash
|
||||
python3 $SCRIPT allowance 0xYourWallet
|
||||
```
|
||||
将无限额授权标记为高风险。
|
||||
|
||||
### 7. 合约检查器
|
||||
```bash
|
||||
python3 $SCRIPT contract 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 # USDC(代理合约)
|
||||
python3 $SCRIPT contract 0xdAC17F958D2ee523a2206206994597C13D831ec7 # USDT(ERC-20)
|
||||
```
|
||||
检测:代理合约(EIP-1967/EIP-1167)、ERC-20、ERC-721、ERC-165。显示字节码大小及代理合约的实现地址。
|
||||
|
||||
### 8. 巨鲸检测
|
||||
```bash
|
||||
python3 $SCRIPT whale # ETH,最近 20 个区块,>$10k
|
||||
python3 $SCRIPT whale --blocks 50 --min-usd 50000 --chain bsc
|
||||
```
|
||||
|
||||
### 9. Gas 追踪器
|
||||
```bash
|
||||
python3 $SCRIPT gas
|
||||
python3 $SCRIPT gas --chain polygon
|
||||
```
|
||||
显示 gwei 价格 + 以下操作的 USD 费用:转账、ERC-20 转账、授权、兑换、NFT 铸造、NFT 转账。
|
||||
|
||||
---
|
||||
|
||||
## 支持的链
|
||||
| 键 | 名称 | 原生代币 | Chain ID |
|
||||
|-----------|----------------|--------|----------|
|
||||
| ethereum | Ethereum | ETH | 1 |
|
||||
| bsc | BNB Chain | BNB | 56 |
|
||||
| base | Base | ETH | 8453 |
|
||||
| arbitrum | Arbitrum One | ETH | 42161 |
|
||||
| polygon | Polygon | POL | 137 |
|
||||
| optimism | Optimism | ETH | 10 |
|
||||
| avalanche | Avalanche C | AVAX | 43114 |
|
||||
| zksync | zkSync Era | ETH | 324 |
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
- CoinGecko 免费套餐:约 10-30 次请求/分钟。使用 `--no-prices` 可加快钱包扫描速度。
|
||||
- 公共 RPC 可能限速。生产环境请将 EVM_RPC_URL 设置为私有端点。
|
||||
- `wallet` 和 `allowance` 仅检查已知代币列表(每条链约 30 个代币)。如需完整代币发现,请使用区块浏览器。
|
||||
- `activity` 仅扫描近期区块(最多 200 个)。如需完整历史记录,请使用 Etherscan API。
|
||||
- `multichain` 运行 8 个并行线程 — 可能触发公共 RPC 的速率限制。
|
||||
- ENS 解析依赖单一公共端点(ensideas.com / ens.vitalik.ca),无备用方案。若该端点不可用,`ens` 命令将失败 — 稍后重试或使用区块浏览器。
|
||||
- 交易解码依赖单一公共端点(4byte.directory),无备用方案。数据库中未收录的选择器将显示为 `unknown`。
|
||||
- **L2 Gas 估算仅为 L2 执行费用。** 在 Base、Arbitrum、Optimism、zkSync 等 rollup 上,实际交易费用还包含取决于 calldata 大小和当前 L1 Gas 价格的 L1 数据发布费用。`gas` 命令不估算该 L1 部分。对于 Base,请参阅网络的 L1 费用预言机(合约 `0x420000000000000000000000000000000000000F`)。
|
||||
- 地址/交易哈希输入会验证 0x 前缀 + 正确长度 + 十六进制格式,但**不**强制执行 EIP-55 校验和大小写(RPC 端点接受任意大小写的十六进制)。
|
||||
|
||||
---
|
||||
|
||||
## 验证
|
||||
```bash
|
||||
# 应输出当前区块、Gas 价格、ETH 价格
|
||||
python3 ~/.hermes/skills/blockchain/evm/scripts/evm_client.py stats
|
||||
|
||||
# 应将 vitalik.eth 解析为 0xd8dA...
|
||||
python3 ~/.hermes/skills/blockchain/evm/scripts/evm_client.py ens vitalik.eth
|
||||
```
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
---
|
||||
title: "Hyperliquid — Hyperliquid 市场数据、账户历史、交易复盘"
|
||||
sidebar_label: "Hyperliquid"
|
||||
description: "Hyperliquid 市场数据、账户历史、交易复盘"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Hyperliquid
|
||||
|
||||
Hyperliquid 市场数据、账户历史、交易复盘。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/blockchain/hyperliquid` 安装 |
|
||||
| 路径 | `optional-skills/blockchain/hyperliquid` |
|
||||
| 版本 | `0.1.0` |
|
||||
| 作者 | Hugo Sequier (Hugo-SEQUIER), Hermes Agent |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `Hyperliquid`, `Blockchain`, `Crypto`, `Trading`, `Perpetuals`, `Spot`, `DeFi` |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Hyperliquid Skill
|
||||
|
||||
通过公开的 `/info` 端点查询 Hyperliquid 市场和账户数据。
|
||||
只读 — 无需 API key,无需签名,不支持下单。
|
||||
|
||||
12 个命令:`dexs`、`markets`、`spots`、`candles`、`funding`、`l2`、`state`、
|
||||
`spot-balances`、`fills`、`orders`、`review`、`export`。仅使用标准库
|
||||
(`urllib`、`json`、`argparse`)。
|
||||
|
||||
---
|
||||
|
||||
## 使用场景
|
||||
|
||||
- 用户请求 Hyperliquid 永续合约或现货市场数据、K 线、资金费率或 L2 盘口
|
||||
- 用户希望查看钱包的永续仓位、现货余额、成交记录或挂单
|
||||
- 用户希望结合近期成交与市场背景进行交易后复盘
|
||||
- 用户希望查看 builder 部署的永续 DEX 或 HIP-3 市场
|
||||
- 用户希望导出标准化的 K 线 + 资金费率 JSON 数据用于回测准备
|
||||
|
||||
---
|
||||
|
||||
## 前置条件
|
||||
|
||||
仅使用标准库 — 无需外部包,无需 API key。
|
||||
|
||||
脚本从 `~/.hermes/.env` 读取两个可选默认值:
|
||||
|
||||
- `HYPERLIQUID_API_URL` — 默认为 `https://api.hyperliquid.xyz`。设置为
|
||||
`https://api.hyperliquid-testnet.xyz` 可切换至测试网。
|
||||
- `HYPERLIQUID_USER_ADDRESS` — `state`、`spot-balances`、`fills`、`orders` 和 `review` 的默认地址。若未设置,则将地址作为第一个位置参数传入。
|
||||
|
||||
当前工作目录中的项目 `.env` 文件作为开发环境的备用配置。
|
||||
|
||||
辅助脚本:`~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py`
|
||||
|
||||
---
|
||||
|
||||
## 运行方式
|
||||
|
||||
通过 `terminal` 工具调用:
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py <command> [args]
|
||||
```
|
||||
|
||||
在任意命令后添加 `--json` 可获得机器可读输出。
|
||||
|
||||
---
|
||||
|
||||
## 快速参考
|
||||
|
||||
```bash
|
||||
hyperliquid_client.py dexs
|
||||
hyperliquid_client.py markets [--dex DEX] [--limit N] [--sort volume|oi|funding_abs|change_abs|name]
|
||||
hyperliquid_client.py spots [--limit N]
|
||||
hyperliquid_client.py candles <coin> [--interval 1h] [--hours 24] [--limit N]
|
||||
hyperliquid_client.py funding <coin> [--hours 72] [--limit N]
|
||||
hyperliquid_client.py l2 <coin> [--levels N]
|
||||
hyperliquid_client.py state [address] [--dex DEX]
|
||||
hyperliquid_client.py spot-balances [address] [--limit N]
|
||||
hyperliquid_client.py fills [address] [--hours N] [--limit N] [--aggregate-by-time]
|
||||
hyperliquid_client.py orders [address] [--limit N]
|
||||
hyperliquid_client.py review [address] [--coin COIN] [--hours N] [--fills N]
|
||||
hyperliquid_client.py export <coin> [--interval 1h] [--hours N] [--output PATH]
|
||||
```
|
||||
|
||||
对于 `state`、`spot-balances`、`fills`、`orders` 和 `review`,当 `~/.hermes/.env` 中设置了 `HYPERLIQUID_USER_ADDRESS` 时,地址参数为可选。
|
||||
|
||||
---
|
||||
|
||||
## 操作流程
|
||||
|
||||
### 1. 发现 DEX 和市场
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py dexs
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
markets --limit 15 --sort volume
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
spots --limit 15
|
||||
```
|
||||
|
||||
- `--dex` 仅适用于永续合约端点;省略则使用第一个永续 DEX。
|
||||
- 现货交易对可能显示为 `PURR/USDC` 或别名如 `@107`。
|
||||
- HIP-3 市场的币种名称带有 DEX 前缀,例如 `mydex:BTC`。
|
||||
|
||||
### 2. 拉取历史市场数据
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
candles BTC --interval 1h --hours 72 --limit 48
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
funding BTC --hours 168 --limit 30
|
||||
```
|
||||
|
||||
时间范围端点支持分页。对于较大的时间窗口,可使用更晚的 `startTime` 重复请求,或使用下方的 `export` 命令。
|
||||
|
||||
### 3. 查看实时盘口
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
l2 BTC --levels 10
|
||||
```
|
||||
|
||||
当用户询问盘口深度、近期流动性或大单市场冲击时使用。
|
||||
|
||||
### 4. 查看账户信息
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
state 0xabc...
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
spot-balances
|
||||
```
|
||||
|
||||
`state` 返回永续仓位;`spot-balances` 返回现货持仓。
|
||||
适用于"我的仓位情况如何"、"我持有什么"、"可提现金额是多少"等问题。
|
||||
|
||||
### 5. 查看成交记录和挂单
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
fills 0xabc... --hours 72 --limit 25
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
orders --limit 25
|
||||
```
|
||||
|
||||
### 6. 生成交易复盘报告
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
review 0xabc... --hours 72 --fills 50
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
review --coin BTC --hours 168
|
||||
```
|
||||
|
||||
报告包含已实现 PnL、手续费、盈亏次数、币种明细、每个交易永续合约的市场趋势和平均资金费率,以及启发式分析(手续费拖累、集中度、逆势亏损)。
|
||||
|
||||
深度交易后分析流程:先用 `review` 找出问题币种或时间段 → 拉取该时段的 `fills` 和 `orders` → 拉取每个交易币种的 `candles` 和 `funding` → 将决策质量与结果质量分开评判。
|
||||
|
||||
### 7. 导出可复用数据集
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
export BTC --interval 1h --hours 168 --output ./btc-1h-7d.json
|
||||
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
export BTC --interval 15m --hours 72 --end-time-ms 1760000000000
|
||||
```
|
||||
|
||||
输出 JSON 包含:schema 版本、数据源元数据、精确时间窗口、标准化 K 线行、标准化资金费率行、汇总统计。使用 `--end-time-ms` 可获得可复现的时间窗口。
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 公开 info 端点有速率限制。大范围历史查询可能返回截断的时间窗口;请使用更晚的 `startTime` 值迭代请求。
|
||||
- `fills --hours ...` 使用 `userFillsByTime`,仅暴露近期滚动窗口 — 不支持完整历史归档。
|
||||
- `historicalOrders` 仅返回近期订单,不支持完整导出。
|
||||
- `review` 命令基于启发式分析。仅凭成交记录无法还原交易意图、下单质量或真实滑点。
|
||||
- `export` 命令输出标准化数据集,而非回测引擎。仍需自行构建滑点/成交模型。
|
||||
- 现货别名如 `@107` 是有效标识符,即使 UI 显示的是更友好的名称。
|
||||
- `l2` 是某一时刻的快照,不是时间序列。
|
||||
|
||||
---
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/hyperliquid/scripts/hyperliquid_client.py \
|
||||
markets --limit 5
|
||||
```
|
||||
|
||||
应输出按 24 小时名义成交量排名的 Hyperliquid 永续合约市场前五名。
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
---
|
||||
title: "Solana"
|
||||
sidebar_label: "Solana"
|
||||
description: "使用 USD 定价查询 Solana 区块链数据——钱包余额、带价值的代币投资组合、交易详情、NFT、巨鲸检测及实时网络状态..."
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Solana
|
||||
|
||||
使用 USD 定价查询 Solana 区块链数据——钱包余额、带价值的代币投资组合、交易详情、NFT、巨鲸检测及实时网络状态。使用 Solana RPC + CoinGecko,无需 API 密钥。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/blockchain/solana` 安装 |
|
||||
| 路径 | `optional-skills/blockchain/solana` |
|
||||
| 版本 | `0.2.0` |
|
||||
| 作者 | Deniz Alagoz (gizdusum),由 Hermes Agent 增强 |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `Solana`, `Blockchain`, `Crypto`, `Web3`, `RPC`, `DeFi`, `NFT` |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Solana 区块链 Skill
|
||||
|
||||
通过 CoinGecko 查询附带 USD 定价的 Solana 链上数据。
|
||||
8 个命令:钱包投资组合、代币信息、交易记录、活动记录、NFT、
|
||||
巨鲸检测、网络状态及价格查询。
|
||||
|
||||
无需 API 密钥。仅使用 Python 标准库(urllib、json、argparse)。
|
||||
|
||||
---
|
||||
|
||||
## 使用场景
|
||||
|
||||
- 用户查询 Solana 钱包余额、代币持仓或投资组合价值
|
||||
- 用户想通过签名查看某笔具体交易
|
||||
- 用户想获取 SPL 代币元数据、价格、供应量或持仓大户
|
||||
- 用户想查看某地址的近期交易历史
|
||||
- 用户想查看某钱包持有的 NFT
|
||||
- 用户想查找大额 SOL 转账(巨鲸检测)
|
||||
- 用户想了解 Solana 网络健康状态、TPS、epoch 或 SOL 价格
|
||||
- 用户询问"BONK/JUP/SOL 的价格是多少?"
|
||||
|
||||
---
|
||||
|
||||
## 前置条件
|
||||
|
||||
辅助脚本仅使用 Python 标准库(urllib、json、argparse),无需外部包。
|
||||
|
||||
价格数据来自 CoinGecko 免费 API(无需密钥,速率限制约为每分钟 10-30 次请求)。如需更快查询,请使用 `--no-prices` 标志。
|
||||
|
||||
---
|
||||
|
||||
## 快速参考
|
||||
|
||||
RPC 端点(默认):https://api.mainnet-beta.solana.com
|
||||
覆盖方式:export SOLANA_RPC_URL=https://your-private-rpc.com
|
||||
|
||||
辅助脚本路径:~/.hermes/skills/blockchain/solana/scripts/solana_client.py
|
||||
|
||||
```
|
||||
python3 solana_client.py wallet <address> [--limit N] [--all] [--no-prices]
|
||||
python3 solana_client.py tx <signature>
|
||||
python3 solana_client.py token <mint_address>
|
||||
python3 solana_client.py activity <address> [--limit N]
|
||||
python3 solana_client.py nft <address>
|
||||
python3 solana_client.py whales [--min-sol N]
|
||||
python3 solana_client.py stats
|
||||
python3 solana_client.py price <mint_or_symbol>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 操作步骤
|
||||
|
||||
### 0. 环境检查
|
||||
|
||||
```bash
|
||||
python3 --version
|
||||
|
||||
# 可选:设置私有 RPC 以获得更好的速率限制
|
||||
export SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
|
||||
|
||||
# 确认连通性
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py stats
|
||||
```
|
||||
|
||||
### 1. 钱包投资组合
|
||||
|
||||
获取 SOL 余额、带 USD 价值的 SPL 代币持仓、NFT 数量及投资组合总值。代币按价值排序,过滤粉尘(dust),已知代币按名称标注(BONK、JUP、USDC 等)。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
wallet 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
|
||||
```
|
||||
|
||||
标志说明:
|
||||
- `--limit N` — 显示前 N 个代币(默认:20)
|
||||
- `--all` — 显示所有代币,不过滤粉尘,不限数量
|
||||
- `--no-prices` — 跳过 CoinGecko 价格查询(更快,仅 RPC)
|
||||
|
||||
输出内容:SOL 余额 + USD 价值、按价值排序的代币列表及价格、粉尘数量、NFT 摘要、USD 投资组合总值。
|
||||
|
||||
### 2. 交易详情
|
||||
|
||||
通过 base58 签名查看完整交易信息,显示 SOL 和 USD 的余额变化。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
tx 5j7s8K...your_signature_here
|
||||
```
|
||||
|
||||
输出内容:slot、时间戳、手续费、状态、余额变化(SOL + USD)、程序调用。
|
||||
|
||||
### 3. 代币信息
|
||||
|
||||
获取 SPL 代币元数据、当前价格、市值、供应量、精度、铸造/冻结权限及前 5 大持仓地址。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
token DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
|
||||
```
|
||||
|
||||
输出内容:名称、符号、精度、供应量、价格、市值、前 5 大持仓地址及占比。
|
||||
|
||||
### 4. 近期活动
|
||||
|
||||
列出某地址的近期交易(默认:最近 10 条,最多:25 条)。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
activity 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM --limit 25
|
||||
```
|
||||
|
||||
### 5. NFT 投资组合
|
||||
|
||||
列出某钱包持有的 NFT(启发式判断:amount=1 且 decimals=0 的 SPL 代币)。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
nft 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
|
||||
```
|
||||
|
||||
注意:此启发式方法无法检测压缩 NFT(cNFT)。
|
||||
|
||||
### 6. 巨鲸检测器
|
||||
|
||||
扫描最新区块中的大额 SOL 转账及其 USD 价值。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py \
|
||||
whales --min-sol 500
|
||||
```
|
||||
|
||||
注意:仅扫描最新区块——为时间点快照,非历史数据。
|
||||
|
||||
### 7. 网络状态
|
||||
|
||||
实时 Solana 网络健康状态:当前 slot、epoch、TPS、供应量、验证者版本、SOL 价格及市值。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py stats
|
||||
```
|
||||
|
||||
### 8. 价格查询
|
||||
|
||||
通过铸造地址或已知符号快速查询任意代币价格。
|
||||
|
||||
```bash
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py price BONK
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py price JUP
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py price SOL
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py price DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
|
||||
```
|
||||
|
||||
已知符号:SOL、USDC、USDT、BONK、JUP、WETH、JTO、mSOL、stSOL、
|
||||
PYTH、HNT、RNDR、WEN、W、TNSR、DRIFT、bSOL、JLP、WIF、MEW、BOME、PENGU。
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
- **CoinGecko 速率限制** — 免费套餐约每分钟 10-30 次请求。价格查询每个代币消耗 1 次请求。持有大量代币的钱包可能无法获取所有代币价格。如需提速,请使用 `--no-prices`。
|
||||
- **公共 RPC 速率限制** — Solana 主网公共 RPC 对请求有限制。生产环境请将 SOLANA_RPC_URL 设置为私有端点(Helius、QuickNode、Triton)。
|
||||
- **NFT 检测为启发式** — amount=1 且 decimals=0。压缩 NFT(cNFT)和 Token-2022 NFT 不会出现。
|
||||
- **巨鲸检测器仅扫描最新区块** — 非历史数据,结果因查询时刻而异。
|
||||
- **交易历史** — 公共 RPC 保留约 2 天的数据,较旧的交易可能不可用。
|
||||
- **代币名称** — 约 25 个知名代币按名称标注,其他代币显示缩写铸造地址。如需完整信息,请使用 `token` 命令。
|
||||
- **429 重试** — RPC 和 CoinGecko 调用在遇到速率限制错误时均会以指数退避方式最多重试 2 次。
|
||||
|
||||
---
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
# 应输出当前 Solana slot、TPS 及 SOL 价格
|
||||
python3 ~/.hermes/skills/blockchain/solana/scripts/solana_client.py stats
|
||||
```
|
||||
Reference in New Issue
Block a user