用途
该技能用于通过 uxc 与精选 OpenAPI Schema 运行 Moralis EVM 数据操作,提供一个以读取为先的钱包智能查询界面。
主要能力
覆盖范围包括:
- 原生余额查询:
get:/{address}/balance - 钱包代币余额:
get:/wallets/{address}/tokens - 钱包历史:
get:/wallets/{address}/history - 钱包 swaps:
get:/wallets/{address}/swaps - 钱包净值:
get:/wallets/{address}/net-worth - ERC-20 元数据查询:
get:/erc20/metadata - ERC-20 代币价格查询:
get:/erc20/{address}/price
不覆盖:写入或交易提交流程;Solana、Streams 或 NFT 专属接口;完整 Moralis API。
前置条件
- uxc 已安装并可在 PATH 中使用。
- 可访问
https://deep-index.moralis.io/api/v2.2。 - 可访问精选 OpenAPI schema:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/moralis-openapi-skill/references/moralis-evm.openapi.json。 - 拥有 Moralis API key。
认证配置
Moralis 使用 X-API-Key 请求头认证。配置一个 API key 凭据并绑定到 deep-index.moralis.io/api/v2.2:
uxc auth credential set moralis \
--auth-type api_key \
--api-key-header X-API-Key \
--secret-env MORALIS_API_KEY
uxc auth binding add \
--id moralis \
--host deep-index.moralis.io \
--path-prefix /api/v2.2 \
--scheme https \
--credential moralis \
--priority 100
认证异常时可验证当前映射:
uxc auth binding match https://deep-index.moralis.io/api/v2.2
使用方式
默认使用固定链接命令:
command -v moralis-openapi-cli
若缺失则创建:
uxc link moralis-openapi-cli https://deep-index.moralis.io/api/v2.2 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/moralis-openapi-skill/references/moralis-evm.openapi.json
moralis-openapi-cli -h
先查看操作 schema:
moralis-openapi-cli get:/{address}/balance -h
moralis-openapi-cli get:/wallets/{address}/tokens -h
moralis-openapi-cli get:/erc20/{address}/price -h
优先执行范围较窄的读取,再进行较广的钱包扫描:
moralis-openapi-cli get:/{address}/balance address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 chain=eth
moralis-openapi-cli get:/erc20/{address}/price address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 chain=eth
moralis-openapi-cli get:/wallets/{address}/net-worth address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 chain=eth
使用 key/value 参数执行:
moralis-openapi-cli get:/wallets/{address}/tokens address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 chain=eth
moralis-openapi-cli get:/wallets/{address}/history address=0xd8da6bf26964af9d7eed9e03e53415d37aa96045 chain=eth limit=20
moralis-openapi-cli <operation> ... 等价于 uxc https://deep-index.moralis.io/api/v2.2 --schema-url <moralis_openapi_schema> <operation> ...。
适用场景
适合在自动化流程或代理中执行 Moralis EVM 钱包与 ERC-20 代币的只读查询,例如获取某地址余额、代币持仓、交易历史、swap 记录、净值和代币价格。
限制与注意事项
- 本 v1 技能为只读,不应暗示支持签名或交易广播。
- 自动化应保持在 JSON 输出信封上,不要使用
--text。 - 优先解析稳定字段:
ok、kind、protocol、data、error。 - Moralis 支持多链,始终显式传入
chain,不要默认以太坊。 - 钱包历史和 swaps 在大范围下可能开销较高,建议从小 limit 和窄时间窗口开始。