skillpp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.md +58 -0
- package/LICENSE +21 -0
- package/README.md +307 -0
- package/README.zh-CN.md +307 -0
- package/SKILL.md +490 -0
- package/adapters/binance-ai.md +22 -0
- package/adapters/claude.md +21 -0
- package/adapters/gemini.md +26 -0
- package/adapters/gpt.md +28 -0
- package/adapters/kimi.md +26 -0
- package/adapters/mimo.md +22 -0
- package/adapters/openclaw.md +29 -0
- package/assets/skillpp-banner.png +0 -0
- package/package.json +59 -0
- package/pipelines.md +310 -0
- package/prompts/newbie-mode.md +48 -0
- package/prompts/router-prompt.md +32 -0
- package/prompts/universal-system-prompt.md +41 -0
- package/registry.md +209 -0
- package/rules.md +323 -0
- package/schemas/audit.schema.json +67 -0
- package/schemas/checkpoint.schema.json +86 -0
- package/schemas/handoff.schema.json +82 -0
- package/schemas/token.schema.json +36 -0
- package/scripts/compatibility-check.mjs +130 -0
- package/scripts/selftest.mjs +384 -0
- package/scripts/skillpp.mjs +448 -0
- package/scripts/validate-skillpp.mjs +140 -0
- package/skillpp.manifest.json +714 -0
- package/skills/audit-plus/SKILL.md +612 -0
- package/skills/binance/binance/CHANGELOG.md +112 -0
- package/skills/binance/binance/LICENSE.md +9 -0
- package/skills/binance/binance/SKILL.md +69 -0
- package/skills/binance/binance/references/algo.md +21 -0
- package/skills/binance/binance/references/alpha.md +9 -0
- package/skills/binance/binance/references/auth.md +32 -0
- package/skills/binance/binance/references/c2c.md +5 -0
- package/skills/binance/binance/references/convert.md +19 -0
- package/skills/binance/binance/references/copy-trading.md +6 -0
- package/skills/binance/binance/references/crypto-loan.md +27 -0
- package/skills/binance/binance/references/derivatives-options-streams.md +25 -0
- package/skills/binance/binance/references/derivatives-options.md +85 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro.md +34 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin.md +146 -0
- package/skills/binance/binance/references/dual-investment.md +15 -0
- package/skills/binance/binance/references/fiat.md +9 -0
- package/skills/binance/binance/references/futures-coin-streams.md +29 -0
- package/skills/binance/binance/references/futures-coin.md +109 -0
- package/skills/binance/binance/references/futures-usds-streams.md +35 -0
- package/skills/binance/binance/references/futures-usds.md +144 -0
- package/skills/binance/binance/references/gift-card.md +10 -0
- package/skills/binance/binance/references/margin-trading-streams.md +6 -0
- package/skills/binance/binance/references/margin-trading.md +101 -0
- package/skills/binance/binance/references/mining.md +17 -0
- package/skills/binance/binance/references/pay.md +5 -0
- package/skills/binance/binance/references/rebate.md +5 -0
- package/skills/binance/binance/references/simple-earn.md +56 -0
- package/skills/binance/binance/references/spot-streams.md +25 -0
- package/skills/binance/binance/references/spot.md +114 -0
- package/skills/binance/binance/references/staking.md +59 -0
- package/skills/binance/binance/references/sub-account.md +67 -0
- package/skills/binance/binance/references/vip-loan.md +27 -0
- package/skills/binance/binance/references/wallet.md +75 -0
- package/skills/binance/fiat/CHANGELOG.md +11 -0
- package/skills/binance/fiat/LICENSE.md +9 -0
- package/skills/binance/fiat/SKILL.md +169 -0
- package/skills/binance/fiat/references/authentication.md +126 -0
- package/skills/binance/fiat/references/sapi-endpoints.md +217 -0
- package/skills/binance/onchain-pay/.local.md.example +10 -0
- package/skills/binance/onchain-pay/CHANGELOG.md +20 -0
- package/skills/binance/onchain-pay/LICENSE.md +9 -0
- package/skills/binance/onchain-pay/SKILL.md +466 -0
- package/skills/binance/onchain-pay/references/authentication.md +92 -0
- package/skills/binance/onchain-pay/scripts/sign_and_call.sh +52 -0
- package/skills/binance/p2p/CHANGELOG.md +33 -0
- package/skills/binance/p2p/LICENSE.md +9 -0
- package/skills/binance/p2p/SKILL.md +1082 -0
- package/skills/binance/p2p/references/agent-sapi-api.md +795 -0
- package/skills/binance/p2p/references/authentication.md +100 -0
- package/skills/binance/payment/SKILL.md +824 -0
- package/skills/binance/payment/common.py +560 -0
- package/skills/binance/payment/payment_skill.py +86 -0
- package/skills/binance/payment/receive.py +109 -0
- package/skills/binance/payment/references/setup-guide.md +77 -0
- package/skills/binance/payment/requirements.txt +4 -0
- package/skills/binance/payment/send.py +952 -0
- package/skills/binance/payment/send_extension/__init__.py +43 -0
- package/skills/binance/payment/send_extension/base.py +48 -0
- package/skills/binance/payment/send_extension/c2c.py +193 -0
- package/skills/binance/payment/send_extension/pix.py +316 -0
- package/skills/binance/square-post/README.md +62 -0
- package/skills/binance/square-post/SKILL.md +171 -0
- package/skills/binance/square-post/scripts/lib.mjs +175 -0
- package/skills/binance/square-post/scripts/post-image.mjs +80 -0
- package/skills/binance/square-post/scripts/post-text.mjs +41 -0
- package/skills/binance/square-post/scripts/post-video.mjs +110 -0
- package/skills/binance/square-post/scripts/save-key.mjs +34 -0
- package/skills/binance-web3/binance-agentic-wallet/SKILL.md +150 -0
- package/skills/binance-web3/binance-agentic-wallet/references/authentication.md +136 -0
- package/skills/binance-web3/binance-agentic-wallet/references/limit-order.md +204 -0
- package/skills/binance-web3/binance-agentic-wallet/references/market-order.md +179 -0
- package/skills/binance-web3/binance-agentic-wallet/references/prediction.md +489 -0
- package/skills/binance-web3/binance-agentic-wallet/references/preflight.md +66 -0
- package/skills/binance-web3/binance-agentic-wallet/references/security.md +47 -0
- package/skills/binance-web3/binance-agentic-wallet/references/send.md +53 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-setting.md +86 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-view.md +312 -0
- package/skills/binance-web3/binance-agentic-wallet/references/x402-payment.md +259 -0
- package/skills/binance-web3/binance-tokenized-securities-info/SKILL.md +613 -0
- package/skills/binance-web3/crypto-market-rank/SKILL.md +91 -0
- package/skills/binance-web3/crypto-market-rank/references/cli.md +219 -0
- package/skills/binance-web3/crypto-market-rank/scripts/cli.mjs +149 -0
- package/skills/binance-web3/meme-rush/SKILL.md +72 -0
- package/skills/binance-web3/meme-rush/references/cli.md +158 -0
- package/skills/binance-web3/meme-rush/scripts/cli.mjs +101 -0
- package/skills/binance-web3/query-address-info/SKILL.md +61 -0
- package/skills/binance-web3/query-address-info/references/cli.md +56 -0
- package/skills/binance-web3/query-address-info/scripts/cli.mjs +132 -0
- package/skills/binance-web3/query-token-audit/SKILL.md +162 -0
- package/skills/binance-web3/query-token-info/SKILL.md +83 -0
- package/skills/binance-web3/query-token-info/references/cli.md +135 -0
- package/skills/binance-web3/query-token-info/scripts/cli.mjs +112 -0
- package/skills/binance-web3/trading-signal/SKILL.md +66 -0
- package/skills/binance-web3/trading-signal/references/cli.md +90 -0
- package/skills/binance-web3/trading-signal/scripts/cli.mjs +92 -0
- package/skills/four-meme/four-guard/API-Contract-TaxToken.md +277 -0
- package/skills/four-meme/four-guard/API-CreateToken.02-02-2026.md +285 -0
- package/skills/four-meme/four-guard/API-Documents.03-03-2026.md +789 -0
- package/skills/four-meme/four-guard/AgentIdentifier.abi +585 -0
- package/skills/four-meme/four-guard/README.md +21 -0
- package/skills/four-meme/four-guard/SKILL.md +31 -0
- package/skills/four-meme/four-guard/TaxToken.abi +969 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.js_ +81 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.sol +69 -0
- package/skills/four-meme/four-guard/TokenManager.lite.abi +836 -0
- package/skills/four-meme/four-guard/TokenManager2.lite.abi +2325 -0
- package/skills/four-meme/four-guard/TokenManagerHelper3.abi +999 -0
- package/skills/four-meme/four-guard/go.mod +36 -0
- package/skills/four-meme/four-guard/go.sum +127 -0
- package/skills/four-meme/four-guard/main.go +183 -0
- package/skills/four-meme/four-meme-ai/SKILL.md +31 -0
- package/skills/four-meme/four-meme-ai/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-ai/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-ai/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-ai/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-ai/references/errors.md +29 -0
- package/skills/four-meme/four-meme-ai/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-ai/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-ai/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-ai/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-ai/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-ai/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-ai/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-ai/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-ai/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-ai/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-ai/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-ai/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-ai/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-ai/scripts/verify-events.ts +47 -0
- package/skills/four-meme/four-meme-integration/SKILL.md +374 -0
- package/skills/four-meme/four-meme-integration/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-integration/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-integration/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-integration/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-integration/references/errors.md +29 -0
- package/skills/four-meme/four-meme-integration/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-integration/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-integration/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-integration/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-integration/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-integration/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-integration/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-integration/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-integration/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-integration/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-integration/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-integration/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-integration/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-integration/scripts/verify-events.ts +47 -0
- package/skills/skillpp/contract-profiler/SKILL.md +118 -0
- package/skills/skillpp/newbie-tutor/SKILL.md +85 -0
- package/skills/skillpp/opportunity-board/SKILL.md +87 -0
- package/skills/skillpp/risk-fusion/SKILL.md +146 -0
- package/skills/skillpp/scam-pattern-lab/SKILL.md +115 -0
- package/skills/skillpp/wallet-doctor/SKILL.md +119 -0
- package/skills/skillpp/watchtower/SKILL.md +72 -0
- package/tests/compatibility/v0.1.0.json +117 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: query-token-info
|
|
3
|
+
description: |
|
|
4
|
+
Per-token details for a specific token identified by keyword, symbol, or contract address:
|
|
5
|
+
(1) search — find tokens by keyword/symbol/contract;
|
|
6
|
+
(2) meta — static info: name, symbol, logo, social links, creator, official website;
|
|
7
|
+
(3) dynamic — real-time market data: price, 24h change, volume, holder count, liquidity;
|
|
8
|
+
(4) kline — OHLCV candlestick data for technical analysis.
|
|
9
|
+
Use for: "price of $X", "search for token Y", "kline chart for $Z", "who created $W",
|
|
10
|
+
"social links for $V", "holder count of $U", "candlestick data", "find the contract address of a token".
|
|
11
|
+
metadata:
|
|
12
|
+
author: binance-web3-team
|
|
13
|
+
version: "2.0"
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Query Token Info Skill
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
Four read-only token endpoints fronted by one CLI. The agent picks a subcommand and passes
|
|
21
|
+
a JSON blob; with this skill user can:
|
|
22
|
+
|
|
23
|
+
Search Tokens: Find tokens by name, symbol, or contract address across chains.
|
|
24
|
+
Token Research: Get token metadata, social links, and creator info.
|
|
25
|
+
Market Analysis: Real-time price, volume, holder distribution, and liquidity data.
|
|
26
|
+
Chart Analysis: K-Line candlestick data for technical analysis.
|
|
27
|
+
|
|
28
|
+
## When to Use This Skill
|
|
29
|
+
|
|
30
|
+
| User intent | Command |
|
|
31
|
+
|-------------|---------|
|
|
32
|
+
| Search a token by keyword, symbol, or contract address | `search` |
|
|
33
|
+
| Get static metadata (name, symbol, logo, social links, creator) | `meta` |
|
|
34
|
+
| Get real-time market data (price, volume, holders, liquidity) | `dynamic` |
|
|
35
|
+
| Get candlestick chart / OHLCV data | `kline` |
|
|
36
|
+
|
|
37
|
+
## Supported Chains
|
|
38
|
+
|
|
39
|
+
| Chain | `chainId` |
|
|
40
|
+
|-------|-----------|
|
|
41
|
+
| Ethereum | `1` |
|
|
42
|
+
| BSC | `56` |
|
|
43
|
+
| Base | `8453` |
|
|
44
|
+
| Solana | `CT_501` |
|
|
45
|
+
|
|
46
|
+
All four commands (`search`, `meta`, `dynamic`, `kline`) use the same `chainId` values.
|
|
47
|
+
|
|
48
|
+
## How to Call APIs
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node skill-dir/scripts/cli.mjs <command> '<json_params>'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
node skill-dir/scripts/cli.mjs search '{"keyword":"keyword","chainIds":"56"}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Commands
|
|
61
|
+
|
|
62
|
+
| Command | Purpose | Required args | Example |
|
|
63
|
+
|---------|---------|---------------|---------|
|
|
64
|
+
| `search` | Search tokens by keyword | `keyword` (optional: `chainIds`, `orderBy`) | `node skill-dir/scripts/cli.mjs search '{"keyword":"keyword","chainIds":"1,56,8453,CT_501"}'` |
|
|
65
|
+
| `meta` | Static token metadata | `chainId`, `contractAddress` | `node skill-dir/scripts/cli.mjs meta '{"chainId":"56","contractAddress":"0x..."}'` |
|
|
66
|
+
| `dynamic` | Real-time market data | `chainId`, `contractAddress` | `node skill-dir/scripts/cli.mjs dynamic '{"chainId":"56","contractAddress":"0x..."}'` |
|
|
67
|
+
| `kline` | Candlestick data | `chainId`, `contractAddress`, `interval` (optional: `limit`, `from`, `to`, `pm`) | `node skill-dir/scripts/cli.mjs kline '{"chainId":"56","contractAddress":"0x...","interval":"1min","limit":500}'` |
|
|
68
|
+
|
|
69
|
+
## Rules
|
|
70
|
+
|
|
71
|
+
- **Icon URL**: `icon` fields are relative paths. Prepend `https://bin.bnbstatic.com` for a usable URL.
|
|
72
|
+
- **Numbers as strings**: All numeric market fields (`price`, `volume24h`, `marketCap`, etc.) are
|
|
73
|
+
returned as strings. Convert before arithmetic.
|
|
74
|
+
- **Kline is a 2D array**, not JSON objects. Each candle: `[open, high, low, close, volume, timestamp_ms, count]`.
|
|
75
|
+
- **Kline time window**: `limit` takes priority over `from` when both are provided. Use `to`
|
|
76
|
+
with `limit` to fetch the N most recent candles ending at `to`. `pm` selects price (`p`,
|
|
77
|
+
default) or market-cap (`m`) series.
|
|
78
|
+
- **Intervals** supported by `kline`: `1s`, `1min`, `3min`, `5min`, `15min`, `30min`, `1h`, `2h`,
|
|
79
|
+
`4h`, `6h`, `8h`, `12h`, `1d`, `3d`, `1w`, `1m`.
|
|
80
|
+
|
|
81
|
+
## Full CLI Reference
|
|
82
|
+
|
|
83
|
+
See [`references/cli.md`](references/cli.md) for per-subcommand invocations, parameter tables, return-field tables, and real response samples.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# query-token-info — CLI Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for every command in `scripts/cli.mjs`.
|
|
4
|
+
|
|
5
|
+
**Invocation pattern:** `node <skill-dir>/scripts/cli.mjs <command> '<json_params>'`
|
|
6
|
+
**Exit codes:** `0` success · `1` usage/upstream error · `3` network failure
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## `search` — Search tokens by keyword
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node <skill-dir>/scripts/cli.mjs search '{"keyword":"<keyword>","chainIds":"56"}'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Parameters
|
|
17
|
+
|
|
18
|
+
| Param | Type | Required | Description |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| `keyword` | string | **yes** | Name / symbol / contract address |
|
|
21
|
+
| `chainIds` | string | no | Comma-separated chainIds (e.g. `"56"`, `"1,56,8453,CT_501"`); default: all |
|
|
22
|
+
| `orderBy` | string | no | Sort key, e.g. `volume24h` |
|
|
23
|
+
|
|
24
|
+
### Return fields (under `.data[]`)
|
|
25
|
+
|
|
26
|
+
| Field | Type | Description |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `chainId` | string | Chain identifier (e.g. `"56"` = BSC) |
|
|
29
|
+
| `contractAddress` | string | Token contract address |
|
|
30
|
+
| `tokenId` | string | Binance-internal token ID (stable across address changes) |
|
|
31
|
+
| `name`, `symbol` | string | Token display names |
|
|
32
|
+
| `icon` | string | Logo path — prefix with `https://bin.bnbstatic.com` |
|
|
33
|
+
| `price`, `percentChange24h` | string | Latest USD price and 24h change (%) |
|
|
34
|
+
| `volume24h`, `marketCap`, `liquidity` | string | All USD; string-encoded decimals |
|
|
35
|
+
| `tagsInfo` | object | Risk / recognition tags, categorized (e.g. `"Sensitive Events": [...]`, `"Community Recognition Level": [...]`) |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## `meta` — Static token metadata
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
node <skill-dir>/scripts/cli.mjs meta '{"chainId":"56","contractAddress":"0x..."}'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Parameters
|
|
46
|
+
|
|
47
|
+
| Param | Type | Required | Description |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| `chainId` | string | **yes** | Chain identifier |
|
|
50
|
+
| `contractAddress` | string | **yes** | Token contract address (case-insensitive) |
|
|
51
|
+
|
|
52
|
+
### Return fields (under `.data`)
|
|
53
|
+
|
|
54
|
+
| Field | Type | Description |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `tokenId` | string | Binance-internal stable ID |
|
|
57
|
+
| `name`, `symbol`, `decimals` | — | Display name, ticker, precision |
|
|
58
|
+
| `chainName`, `chainIconUrl` | string | Chain display info |
|
|
59
|
+
| `links` | array of `{label, link}` | Website / whitepaper / social links |
|
|
60
|
+
| `aiNarrativeFlag` | number | `1` = AI has narrative summary available |
|
|
61
|
+
| `nativeAddressFlag` | boolean | `true` = native chain coin (not an ERC-20) |
|
|
62
|
+
|
|
63
|
+
`links[]` entries are `{label, link}` — labels include `"website"`, `"whitepaper"`, social platforms.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## `dynamic` — Real-time market data
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
node <skill-dir>/scripts/cli.mjs dynamic '{"chainId":"56","contractAddress":"0x..."}'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Parameters
|
|
74
|
+
|
|
75
|
+
| Param | Type | Required | Description |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `chainId` | string | **yes** | Chain identifier |
|
|
78
|
+
| `contractAddress` | string | **yes** | Token contract address |
|
|
79
|
+
|
|
80
|
+
### Return fields (under `.data`)
|
|
81
|
+
|
|
82
|
+
Price + volume/buy/sell breakdowns across multiple windows (5m, 1h, 4h, 24h), separated by on-chain vs Binance-routed:
|
|
83
|
+
|
|
84
|
+
| Field pattern | Meaning |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `price`, `nativeTokenPrice` | Current USD price and chain-native price |
|
|
87
|
+
| `volume{5m,1h,4h,24h}` | Total trading volume in window (USD) |
|
|
88
|
+
| `volume{window}{Buy,Sell}` | Direction breakdown |
|
|
89
|
+
| `volume{window}Binance` | Binance-routed subset |
|
|
90
|
+
| `volume{window}Net{Buy,Binance}` | Net flow = Buy − Sell |
|
|
91
|
+
| `holders` | Holder count (if available) |
|
|
92
|
+
| `liquidity` | Current liquidity in USD |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## `kline` — Candlestick OHLCV
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
node <skill-dir>/scripts/cli.mjs kline '{"chainId":"56","contractAddress":"0x...","interval":"1h","limit":24}'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Parameters
|
|
103
|
+
|
|
104
|
+
| Param | Type | Required | Description |
|
|
105
|
+
|---|---|---|---|
|
|
106
|
+
| `chainId` | string | **yes** | Chain identifier — `1` (Ethereum) / `56` (BSC) / `8453` (Base) / `CT_501` (Solana) |
|
|
107
|
+
| `contractAddress` | string | **yes** | Token contract address |
|
|
108
|
+
| `interval` | string | **yes** | Candle size: `1s` / `1min` / `3min` / `5min` / `15min` / `30min` / `1h` / `2h` / `4h` / `6h` / `8h` / `12h` / `1d` / `3d` / `1w` / `1m` |
|
|
109
|
+
| `limit` | number | no | Optional. Max 500 per request. Has higher priority than `from` when both provided. |
|
|
110
|
+
| `from` | number | no | Optional. Start timestamp in **milliseconds**. |
|
|
111
|
+
| `to` | number | no | Optional. End timestamp in **milliseconds**. |
|
|
112
|
+
| `pm` | string | no | Optional. Price mode — `p` (price, default) or `m` (marketcap). |
|
|
113
|
+
|
|
114
|
+
### Return shape (under `.data[]`)
|
|
115
|
+
|
|
116
|
+
Each row is a 2D array (7 numbers):
|
|
117
|
+
|
|
118
|
+
| Index | Field |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `[0]` | open price (USD) |
|
|
121
|
+
| `[1]` | high price |
|
|
122
|
+
| `[2]` | low price |
|
|
123
|
+
| `[3]` | close price |
|
|
124
|
+
| `[4]` | volume |
|
|
125
|
+
| `[5]` | timestamp (ms since epoch, start of candle) |
|
|
126
|
+
| `[6]` | trade count |
|
|
127
|
+
|
|
128
|
+
Envelope is `{ data, status: {error_code, error_message} }` — no `code` field (unlike other commands).
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Errors
|
|
133
|
+
|
|
134
|
+
Exit codes: `0` ok · `1` upstream/usage (stderr: reason; stdout: body with business `code`) · `3` network.
|
|
135
|
+
Business `code`: `000000` ok · `100004` rate-limited · `100002` bad param · `000400` token not found / unsupported chain.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
// query-token-info CLI - self-contained, zero-dep, Node >= 22
|
|
4
|
+
// Usage: node cli.mjs <command> '<json_params>'
|
|
5
|
+
//
|
|
6
|
+
// Commands:
|
|
7
|
+
// search token search by keyword
|
|
8
|
+
// meta static token metadata
|
|
9
|
+
// dynamic real-time market data (price, volume, holders)
|
|
10
|
+
// kline candlestick data
|
|
11
|
+
//
|
|
12
|
+
// All 4 commands use the SAME parameter shape: { chainId, contractAddress, ... }.
|
|
13
|
+
// Internally, kline hits a different host and uses different upstream field names
|
|
14
|
+
// (platform/address) - this CLI handles the translation so the LLM caller sees
|
|
15
|
+
// one consistent interface.
|
|
16
|
+
|
|
17
|
+
// ---- inline HTTP helper (self-contained, zero dependency) ----
|
|
18
|
+
const TIMEOUT_MS = 10_000;
|
|
19
|
+
const UA = { 'Accept-Encoding': 'identity', 'User-Agent': 'binance-web3/2.0 (Skill)' };
|
|
20
|
+
|
|
21
|
+
// ---- chainId -> upstream kline platform name ----
|
|
22
|
+
// Single source of truth for chain identity. Used only by kline (other commands
|
|
23
|
+
// pass chainId through as-is to the Binance Web3 API which accepts chainId directly).
|
|
24
|
+
const CHAIN_ID_TO_PLATFORM = {
|
|
25
|
+
'1': 'ethereum',
|
|
26
|
+
'56': 'bsc',
|
|
27
|
+
'8453': 'base',
|
|
28
|
+
'CT_501': 'solana',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const qs = (p) => Object.entries(p)
|
|
32
|
+
.filter(([, v]) => v != null)
|
|
33
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
34
|
+
.join('&');
|
|
35
|
+
|
|
36
|
+
async function call({ url, method = 'GET', body, headers = {} }) {
|
|
37
|
+
const ctrl = new AbortController();
|
|
38
|
+
const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
|
|
39
|
+
const opts = { method, headers: { ...UA, ...headers }, signal: ctrl.signal };
|
|
40
|
+
if (method === 'POST') { opts.headers['content-type'] = 'application/json'; opts.body = JSON.stringify(body || {}); }
|
|
41
|
+
let res;
|
|
42
|
+
try { res = await fetch(url, opts); }
|
|
43
|
+
catch { clearTimeout(timer); throw Object.assign(new Error('Network request failed'), { exitCode: 3 }); }
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
const data = await res.json();
|
|
46
|
+
if (res.status >= 400) throw Object.assign(new Error(`HTTP ${res.status}`), { exitCode: 1, body: data });
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ---- commands: (params) => { url, method?, body?, headers? } ----
|
|
51
|
+
const COMMANDS = {
|
|
52
|
+
search: (p) => ({
|
|
53
|
+
url: `https://web3.binance.com/bapi/defi/v5/public/wallet-direct/buw/wallet/market/token/search/ai?${qs(p)}`,
|
|
54
|
+
}),
|
|
55
|
+
meta: (p) => ({
|
|
56
|
+
url: `https://web3.binance.com/bapi/defi/v1/public/wallet-direct/buw/wallet/dex/market/token/meta/info/ai?${qs(p)}`,
|
|
57
|
+
}),
|
|
58
|
+
dynamic: (p) => ({
|
|
59
|
+
url: `https://web3.binance.com/bapi/defi/v4/public/wallet-direct/buw/wallet/market/token/dynamic/info/ai?${qs(p)}`,
|
|
60
|
+
}),
|
|
61
|
+
kline: (p) => {
|
|
62
|
+
// Translate unified interface -> upstream kline field names.
|
|
63
|
+
// { chainId, contractAddress, interval, ... } -> { platform, address, interval, ... }
|
|
64
|
+
const { chainId, contractAddress, ...rest } = p;
|
|
65
|
+
const platform = chainId == null ? undefined : CHAIN_ID_TO_PLATFORM[chainId];
|
|
66
|
+
if (chainId != null && platform === undefined) {
|
|
67
|
+
const supported = Object.keys(CHAIN_ID_TO_PLATFORM).map((k) => `"${k}"`).join(', ');
|
|
68
|
+
throw Object.assign(
|
|
69
|
+
new Error(`kline: unsupported chainId "${chainId}". Supported: ${supported}`),
|
|
70
|
+
{ exitCode: 1 },
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const upstream = { ...rest };
|
|
74
|
+
if (platform !== undefined) upstream.platform = platform;
|
|
75
|
+
if (contractAddress !== undefined) upstream.address = contractAddress;
|
|
76
|
+
return {
|
|
77
|
+
url: `https://dquery.sintral.io/u-kline/v1/k-line/candles?${qs(upstream)}`,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// ---- exports (for unit testing; direct execution still works - see dispatch below) ----
|
|
83
|
+
export { COMMANDS, call, qs, UA, TIMEOUT_MS, CHAIN_ID_TO_PLATFORM };
|
|
84
|
+
|
|
85
|
+
// ---- CLI dispatch (only runs when executed directly, not when imported) ----
|
|
86
|
+
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
87
|
+
const [cmd, paramsStr] = process.argv.slice(2);
|
|
88
|
+
|
|
89
|
+
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
90
|
+
console.log("Usage: node cli.mjs <command> '<json_params>'\n\nCommands:");
|
|
91
|
+
for (const name of Object.keys(COMMANDS)) console.log(` ${name}`);
|
|
92
|
+
process.exit(0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const builder = COMMANDS[cmd];
|
|
96
|
+
if (!builder) { console.error(`Unknown command: ${cmd}\nRun with --help to see available commands.`); process.exit(1); }
|
|
97
|
+
|
|
98
|
+
let params = {};
|
|
99
|
+
if (paramsStr) {
|
|
100
|
+
try { params = JSON.parse(paramsStr); }
|
|
101
|
+
catch { console.error('Invalid JSON params'); process.exit(1); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const result = await call(builder(params));
|
|
106
|
+
console.log(JSON.stringify(result, null, 2));
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.error(err.message);
|
|
109
|
+
if (err.body) console.log(JSON.stringify(err.body, null, 2));
|
|
110
|
+
process.exit(err.exitCode || 1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trading-signal
|
|
3
|
+
description: |
|
|
4
|
+
Per-trade smart-money signals — each result is a discrete buy or sell event from a tracked smart-money wallet,
|
|
5
|
+
with trigger price, current price, max gain since trigger, and exit rate. BSC and Solana only.
|
|
6
|
+
Use for: "smart money buy signal on $X", "any whale just bought $Y", "alpha signals in the last hour",
|
|
7
|
+
"copy-trade-worthy signals", "trigger price and max gain on these trades", "on-chain trading signals from smart money".
|
|
8
|
+
metadata:
|
|
9
|
+
author: binance-web3-team
|
|
10
|
+
version: "2.0"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Trading Signal Skill
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
This skill retrieves on-chain Smart Money trading signals to help users track professional investors:
|
|
18
|
+
|
|
19
|
+
Get smart money buy/sell signals
|
|
20
|
+
Compare signal trigger price with current price
|
|
21
|
+
Analyze max gain and exit rate of signals
|
|
22
|
+
Get token tags (e.g., Pumpfun, DEX Paid)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## When to Use This Skill
|
|
26
|
+
|
|
27
|
+
| User intent | Command |
|
|
28
|
+
|-------------|---------|
|
|
29
|
+
| Get on-chain smart-money buy/sell signals with gain + exit-rate data | `smart-money` |
|
|
30
|
+
|
|
31
|
+
## Supported Chains
|
|
32
|
+
|
|
33
|
+
| Chain | chainId |
|
|
34
|
+
|-------|---------|
|
|
35
|
+
| BSC | `56` |
|
|
36
|
+
| Solana | `CT_501` |
|
|
37
|
+
|
|
38
|
+
## How to Call APIs
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
node <skill-dir>/scripts/cli.mjs smart-money '{"chainId":"CT_501","page":1,"pageSize":50}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
| Command | Purpose | Required args | Example |
|
|
47
|
+
|---------|---------|---------------|---------|
|
|
48
|
+
| `smart-money` | Smart-money buy/sell signals with trigger price, max gain, exit rate | `chainId` | `node <skill-dir>/scripts/cli.mjs smart-money '{"chainId":"56","page":1,"pageSize":50}'` |
|
|
49
|
+
|
|
50
|
+
Optional args: `page` (default 1), `pageSize` (**max 100**), `smartSignalType` (filter; empty string = all).
|
|
51
|
+
|
|
52
|
+
## Rules
|
|
53
|
+
|
|
54
|
+
- **`pageSize` cap is 100** — larger values are silently clamped upstream.
|
|
55
|
+
- **`status` enum** (map to user-friendly language when summarizing):
|
|
56
|
+
- `active` — signal still valid
|
|
57
|
+
- `timeout` — exceeded observation window (may still be informative, but stale)
|
|
58
|
+
- `completed` — reached target / stop loss
|
|
59
|
+
Prefer `active` signals when surfacing actionable opportunities.
|
|
60
|
+
- **Quality indicators**: higher `smartMoneyCount` (more distinct smart-money addresses) implies higher signal reliability; high `exitRate` (%) suggests smart money has already exited, so the opportunity may have passed.
|
|
61
|
+
- **`direction`** is `buy` or `sell` — always include this when summarizing a signal.
|
|
62
|
+
- **Icon URL prefix**: `logoUrl` is a relative path; prepend `https://bin.bnbstatic.com`. `chainLogoUrl` is already a full URL. Timestamps are ms; `maxGain` is a % string — convert before arithmetic.
|
|
63
|
+
|
|
64
|
+
## Full CLI Reference
|
|
65
|
+
|
|
66
|
+
See [`references/cli.md`](references/cli.md) for per-subcommand invocations, parameter tables, signal / tag / performance field tables, and real response samples.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# trading-signal — CLI Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for every command in `scripts/cli.mjs`.
|
|
4
|
+
|
|
5
|
+
**Invocation pattern:** `node <skill-dir>/scripts/cli.mjs <command> '<json_params>'`
|
|
6
|
+
**Exit codes:** `0` success · `1` usage/upstream error · `3` network failure
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## `smart-money` — On-chain Smart Money trading signals
|
|
11
|
+
|
|
12
|
+
> ⚠️ Only `"56"` (BSC) and `"CT_501"` (Solana) are supported. `pageSize` max is `100`. Signals with `status: "timeout"` are stale — prefer `"valid"` / `"active"` signals.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
node <skill-dir>/scripts/cli.mjs smart-money '{"chainId":"CT_501","page":1,"pageSize":20}'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Parameters
|
|
19
|
+
|
|
20
|
+
| Param | Type | Required | Default | Description |
|
|
21
|
+
|---|---|---|---|---|
|
|
22
|
+
| `chainId` | string | **yes** | — | `"56"` (BSC) · `"CT_501"` (Solana) |
|
|
23
|
+
| `page` | number | no | `1` | Page number (1-indexed) |
|
|
24
|
+
| `pageSize` | number | no | — | Items per page, max `100` |
|
|
25
|
+
| `smartSignalType` | string | no | — | Filter by signal type (e.g. `"SMART_MONEY"`); omit for all |
|
|
26
|
+
|
|
27
|
+
### Return fields (under `.data[]`)
|
|
28
|
+
|
|
29
|
+
**Token identity**
|
|
30
|
+
|
|
31
|
+
| Field | Type | Description |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `signalId` | number | Unique signal ID |
|
|
34
|
+
| `ticker` | string | Token symbol |
|
|
35
|
+
| `chainId` | string | Chain identifier |
|
|
36
|
+
| `contractAddress` | string | Token contract address |
|
|
37
|
+
| `logoUrl` | string | Logo path — prefix with `https://bin.bnbstatic.com` |
|
|
38
|
+
| `chainLogoUrl` | string | Full URL of the chain icon |
|
|
39
|
+
| `tokenDecimals` | number | Token decimals |
|
|
40
|
+
|
|
41
|
+
**Tags & flags**
|
|
42
|
+
|
|
43
|
+
| Field | Type | Description |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `isAlpha` | boolean | Marked as Alpha token |
|
|
46
|
+
| `launchPlatform` | string | Launch platform (e.g. `"Pumpfun"`, `"Moonshot"`) |
|
|
47
|
+
| `tokenTag` | object | Categorized tags. Known categories: `"Social Events"`, `"Launch Platform"`, `"Sensitive Events"`, `"Wash Trading Behavior"` |
|
|
48
|
+
|
|
49
|
+
**Signal data**
|
|
50
|
+
|
|
51
|
+
| Field | Type | Description |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `smartSignalType` | string | e.g. `"SMART_MONEY"` |
|
|
54
|
+
| `direction` | string | `"buy"` or `"sell"` |
|
|
55
|
+
| `smartMoneyCount` | number | Smart money addresses triggering the signal (higher = stronger) |
|
|
56
|
+
| `signalCount` | number | Historical signal count for this token |
|
|
57
|
+
| `signalTriggerTime` | number | Signal trigger timestamp (ms) |
|
|
58
|
+
| `timeFrame` | number | Observation window (ms) |
|
|
59
|
+
|
|
60
|
+
**Price & performance**
|
|
61
|
+
|
|
62
|
+
| Field | Type | Description |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `alertPrice`, `alertMarketCap` | string | Price / market cap at trigger (USD) |
|
|
65
|
+
| `currentPrice`, `currentMarketCap` | string | Latest price / market cap (USD) |
|
|
66
|
+
| `highestPrice`, `highestPriceTime` | string, number | Peak after signal + timestamp (ms) |
|
|
67
|
+
| `totalTokenValue` | string | Aggregate trade value at signal (USD) |
|
|
68
|
+
| `maxGain` | string | Max % gain since trigger — **decimal fraction** (e.g. `"0.25"` = 25%); multiply by 100 when displaying as a percentage |
|
|
69
|
+
| `exitRate` | number | % of smart money already exited (high = stale) |
|
|
70
|
+
| `status` | string | Signal status. Values: `active` (monitoring), `valid` (fresh/open), `timeout` (expired), `completed` (closed). |
|
|
71
|
+
|
|
72
|
+
**Sample `tokenTag` shape** (categorized; each category holds `[{tagName}]`):
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
"tokenTag": {
|
|
76
|
+
"Social Events": [{"tagName": "DEX Paid"}],
|
|
77
|
+
"Launch Platform": [{"tagName": "Pumpfun"}],
|
|
78
|
+
"Sensitive Events": [{"tagName": "Smart Money Add Holdings"}],
|
|
79
|
+
"Wash Trading Behavior": [{"tagName": "Insider Wash Trading"}]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Signal quality:** `smartMoneyCount ≥ 5` = stronger conviction · `exitRate ≥ 70` = already exiting, treat with caution · `status:"timeout"` = no longer actionable.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Errors
|
|
88
|
+
|
|
89
|
+
Exit codes: `0` ok · `1` upstream/usage (stderr: reason; stdout: body with business `code`) · `3` network.
|
|
90
|
+
Business `code`: `000000` ok · `100004` rate-limited · `100002` bad param (check `chainId`/`pageSize`) · `000400` unsupported chain.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
// trading-signal CLI - self-contained, zero-dep, Node >= 22
|
|
4
|
+
// Usage: node cli.mjs <command> '<json_params>'
|
|
5
|
+
//
|
|
6
|
+
// Commands:
|
|
7
|
+
// smart-money POST on-chain Smart Money trading signals (BSC + Solana)
|
|
8
|
+
|
|
9
|
+
// ---- inline HTTP helper (self-contained, zero dependency) ----
|
|
10
|
+
const TIMEOUT_MS = 10_000;
|
|
11
|
+
const UA = { 'Accept-Encoding': 'identity', 'User-Agent': 'binance-web3/2.0 (Skill)' };
|
|
12
|
+
|
|
13
|
+
const qs = (p) => Object.entries(p)
|
|
14
|
+
.filter(([, v]) => v != null)
|
|
15
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
16
|
+
.join('&');
|
|
17
|
+
|
|
18
|
+
async function call({ url, method = 'GET', body, headers = {} }) {
|
|
19
|
+
const ctrl = new AbortController();
|
|
20
|
+
const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
|
|
21
|
+
const opts = { method, headers: { ...UA, ...headers }, signal: ctrl.signal };
|
|
22
|
+
if (method === 'POST') { opts.headers['content-type'] = 'application/json'; opts.body = JSON.stringify(body || {}); }
|
|
23
|
+
let res;
|
|
24
|
+
try { res = await fetch(url, opts); }
|
|
25
|
+
catch { clearTimeout(timer); throw Object.assign(new Error('Network request failed'), { exitCode: 3 }); }
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
const data = await res.json();
|
|
28
|
+
if (res.status >= 400) throw Object.assign(new Error(`HTTP ${res.status}`), { exitCode: 1, body: data });
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ---- per-command supported chains (client-side fail-fast) ----
|
|
33
|
+
const CHAINS = {
|
|
34
|
+
'smart-money': new Set(['56', 'CT_501']),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function validateChainId(cmd, chainId) {
|
|
38
|
+
const allowed = CHAINS[cmd];
|
|
39
|
+
if (!allowed) return;
|
|
40
|
+
const id = String(chainId ?? '');
|
|
41
|
+
if (!allowed.has(id)) {
|
|
42
|
+
const supported = [...allowed].map((c) => `"${c}"`).join(', ');
|
|
43
|
+
throw Object.assign(
|
|
44
|
+
new Error(`${cmd}: unsupported chainId "${chainId}". Supported: ${supported}`),
|
|
45
|
+
{ exitCode: 1 },
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ---- commands: (params) => { url, method?, body?, headers? } ----
|
|
51
|
+
const COMMANDS = {
|
|
52
|
+
'smart-money': (p) => {
|
|
53
|
+
validateChainId('smart-money', p.chainId);
|
|
54
|
+
return {
|
|
55
|
+
url: 'https://web3.binance.com/bapi/defi/v1/public/wallet-direct/buw/wallet/web/signal/smart-money/ai',
|
|
56
|
+
method: 'POST',
|
|
57
|
+
body: p,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ---- exports (for unit testing; direct execution still works - see dispatch below) ----
|
|
63
|
+
export { COMMANDS, call, qs, UA, TIMEOUT_MS, CHAINS, validateChainId };
|
|
64
|
+
|
|
65
|
+
// ---- CLI dispatch (only runs when executed directly, not when imported) ----
|
|
66
|
+
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
67
|
+
const [cmd, paramsStr] = process.argv.slice(2);
|
|
68
|
+
|
|
69
|
+
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
70
|
+
console.log("Usage: node cli.mjs <command> '<json_params>'\n\nCommands:");
|
|
71
|
+
for (const name of Object.keys(COMMANDS)) console.log(` ${name}`);
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const builder = COMMANDS[cmd];
|
|
76
|
+
if (!builder) { console.error(`Unknown command: ${cmd}\nRun with --help to see available commands.`); process.exit(1); }
|
|
77
|
+
|
|
78
|
+
let params = {};
|
|
79
|
+
if (paramsStr) {
|
|
80
|
+
try { params = JSON.parse(paramsStr); }
|
|
81
|
+
catch { console.error('Invalid JSON params'); process.exit(1); }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const result = await call(builder(params));
|
|
86
|
+
console.log(JSON.stringify(result, null, 2));
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error(err.message);
|
|
89
|
+
if (err.body) console.log(JSON.stringify(err.body, null, 2));
|
|
90
|
+
process.exit(err.exitCode || 1);
|
|
91
|
+
}
|
|
92
|
+
}
|