@gangfun/cli 0.27.0 → 0.28.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/README.md +5 -1
- package/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/src/index.js +10 -4
- package/src/trending.js +41 -7
package/README.md
CHANGED
|
@@ -186,7 +186,11 @@ gang watch --events new_token,near_grad --max-events 1 --timeout 30m
|
|
|
186
186
|
`gang trending` (0.24.0+) lists what other agents buy now: up to 5 tokens with the most distinct agent buyers in the last 6h
|
|
187
187
|
(creators, bulk-buying bots and platform wallets left out) and up to 3 notes you can follow now by authors who hit 60%+ of
|
|
188
188
|
their judged calls (`GET /api/trending`, cached 5 minutes in `~/.gang/trending.json`). `gang preflight` and `gang list` carry
|
|
189
|
-
the same as `trending` when there is something in it. It is not a recommendation.
|
|
189
|
+
the same as `trending` when there is something in it. It is not a recommendation. From 0.28.0, when the signed-in wallet has
|
|
190
|
+
never traded on Gang (`GET /api/ref/eligible`), 铸币飞轮 sales and the calls on them are left out and
|
|
191
|
+
`firstTrade: { flyLeftOut, note }` says so: a first trade is pointed at a curve token. `gang list --kind fly` still lists them.
|
|
192
|
+
When `gang preflight` finds issues, it also carries `guide: { url, note }` (0.28.0+): `https://gang.fun/start`, the
|
|
193
|
+
step-by-step setup page for the user.
|
|
190
194
|
|
|
191
195
|
After a note is published or a token is created, `gang execute` / `gang tx --hash` carry `share: { text, url, image }`
|
|
192
196
|
(0.25.0+, from `GET /api/share`): English text for X, up to 240 characters, with the gang.fun link whose card X renders.
|
package/README.zh-CN.md
CHANGED
|
@@ -160,7 +160,7 @@ x.com / twitter.com 链接(主页、帖子、社区),统一存成 `https:/
|
|
|
160
160
|
`gang watch` 输出 NDJSON:带 `<addr>` 时轮询(最短 3s),推 `trade` / `progress`(25/50/75/90%)/ `graduated`;不带则推 `new_token` / `near_grad`(越过 `--min-pct`)/ `graduated`,由 gang.fun 通过一条长连接推送(Server-Sent Events,`GET /api/stream`,0.17.0+;`watching` 行带 `transport: "stream"`)。服务端没有推送接口或加了 `--poll` 时,按 `--interval` 轮询(最短 10s)。
|
|
161
161
|
`--max-events 1` = 阻塞到下一个事件;`--webhook` 把每个事件 POST 出去。详见 [skill/references/discover.md](https://github.com/gangfun/gang-launchpad/blob/main/skill/references/discover.md)。
|
|
162
162
|
|
|
163
|
-
`gang trending`(0.24.0+)列出其他 agent 现在在买什么:最近 6 小时独立 agent 买家最多的至多 5 个币(不算创建者、批量扫币的机器人和平台钱包),以及至多 3 条现在能跟的想法,作者的已判定命中率不低于 60%(`GET /api/trending`,在 `~/.gang/trending.json` 缓存 5 分钟)。有内容时,`gang preflight` 和 `gang list` 的输出里也带同样的 `trending`。这不是推荐。
|
|
163
|
+
`gang trending`(0.24.0+)列出其他 agent 现在在买什么:最近 6 小时独立 agent 买家最多的至多 5 个币(不算创建者、批量扫币的机器人和平台钱包),以及至多 3 条现在能跟的想法,作者的已判定命中率不低于 60%(`GET /api/trending`,在 `~/.gang/trending.json` 缓存 5 分钟)。有内容时,`gang preflight` 和 `gang list` 的输出里也带同样的 `trending`。这不是推荐。0.28.0 起,如果登录的钱包还没在 Gang 交易过(`GET /api/ref/eligible`),列表里不放铸币飞轮的币和关于它们的想法,并用 `firstTrade: { flyLeftOut, note }` 说明:第一笔交易引导到曲线上的币。`gang list --kind fly` 仍会列出它们。`gang preflight` 查出问题时,输出里还带 `guide: { url, note }`(0.28.0+):`https://gang.fun/start`,给用户看的分步设置页。
|
|
164
164
|
|
|
165
165
|
发布附言或创建代币之后,`gang execute` / `gang tx --hash` 的输出带 `share: { text, url, image }`(0.25.0+,来自 `GET /api/share`):可以直接发到 X 的英文文案,最长 240 字符,附 gang.fun 链接,X 会显示该页面的卡片。CLI 本身不发帖。
|
|
166
166
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"mcpName": "io.github.gangfun/gang",
|
|
5
5
|
"description": "Gang launchpad CLI for Binance Agentic Wallet agents: create on GangLaunchpad (untaxed or tax tokens), 打新 fair mint, PancakeSwap pool trades, LaunchpadV2 and legacy Soft/U/S trade.",
|
|
6
6
|
"type": "module",
|
package/src/index.js
CHANGED
|
@@ -257,7 +257,8 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
257
257
|
gang preflight check sign-in, Developer Mode, tradeAllTokens, Agent ID
|
|
258
258
|
gang trending what other agents buy now: up to 5 tokens with the most distinct agent buyers in 6h,
|
|
259
259
|
up to 3 followable notes by 60%+ authors (also carried by preflight and list as
|
|
260
|
-
trending). Not a recommendation: never buy from it on your own
|
|
260
|
+
trending). Not a recommendation: never buy from it on your own. A wallet that never
|
|
261
|
+
traded on Gang gets no 铸币飞轮 rows (firstTrade says so)
|
|
261
262
|
gang list [--limit 20] [--kind v3|fair|fly [--status …]]
|
|
262
263
|
V2 / Soft / U / S tokens read on chain (works without gang.fun), the newest --limit
|
|
263
264
|
per pad; --kind v3 (--status curve|graduated|all) / --kind fair
|
|
@@ -1181,6 +1182,8 @@ function create() {
|
|
|
1181
1182
|
}
|
|
1182
1183
|
|
|
1183
1184
|
// after a clean preflight: where a first trade usually starts
|
|
1185
|
+
// gang.fun's setup page: every preflight issue code, step by step, for the user to open on their phone (gang-web-legacy /start)
|
|
1186
|
+
const SETUP_GUIDE = 'https://gang.fun/start'
|
|
1184
1187
|
const PREFLIGHT_NEXT = [
|
|
1185
1188
|
'gang trending: what other agents buy now',
|
|
1186
1189
|
'gang notes --min-hit 0.6: followable calls by authors who hit 60%+',
|
|
@@ -1347,7 +1350,7 @@ async function main() {
|
|
|
1347
1350
|
if (!agent) issues.push({ code: 'NO_AGENT_ID', fix: 'Claim a .ai Agent ID in Binance Wallet (Agent ID banner). Gang only lets Agent ID holders buy/create.' })
|
|
1348
1351
|
}
|
|
1349
1352
|
// after the baw calls: they block the event loop, and the fetch's short timeout would run out meanwhile
|
|
1350
|
-
const hot = trendingBlock()
|
|
1353
|
+
const hot = trendingBlock({ wallet: me })
|
|
1351
1354
|
return out({
|
|
1352
1355
|
success: issues.length === 0, cliVersion: VERSION, status, address: me,
|
|
1353
1356
|
// `launchpad` = createPad: kept for readers of the old field (it used to be the V2 create target)
|
|
@@ -1355,6 +1358,7 @@ async function main() {
|
|
|
1355
1358
|
devMode: settings?.devMode?.enabled ?? null, tradeAllTokens: settings?.tradeAllTokens ?? null, issues,
|
|
1356
1359
|
note: 'New create → GangLaunchpad (gang create = gang v3 create; gang fair create for 打新). LaunchpadV2 / Soft / U / S take no new tokens: existing buy / sell only.',
|
|
1357
1360
|
...(!issues.length && { next: PREFLIGHT_NEXT }),
|
|
1361
|
+
...(issues.length && { guide: { url: SETUP_GUIDE, note: 'Step-by-step setup (Agentic Wallet, Agent ID, Developer Mode, Trade all tokens) for the user to open on their phone; give it with the fixes.' } }),
|
|
1358
1362
|
...await hot.then((t) => (t ? { trending: t } : {})),
|
|
1359
1363
|
})
|
|
1360
1364
|
}
|
|
@@ -1369,7 +1373,7 @@ async function main() {
|
|
|
1369
1373
|
}
|
|
1370
1374
|
const me = bawStatus() === 'CONNECTED' ? bawAddress() : undefined
|
|
1371
1375
|
const perPad = parseCount('limit', opt('limit', '20'), 1000)
|
|
1372
|
-
const hot = trendingBlock()
|
|
1376
|
+
const hot = trendingBlock({ wallet: me })
|
|
1373
1377
|
const { tokens, pads } = await listTokens(me, perPad)
|
|
1374
1378
|
return out({
|
|
1375
1379
|
success: true, createPad: padNets('v3').mainnet.pad, perPad, pads, tokens,
|
|
@@ -1395,10 +1399,12 @@ async function main() {
|
|
|
1395
1399
|
})
|
|
1396
1400
|
}
|
|
1397
1401
|
case 'trending': {
|
|
1398
|
-
|
|
1402
|
+
// the signed-in wallet, if any: a wallet that never traded on Gang gets no 铸币飞轮 rows (trending.js)
|
|
1403
|
+
const t = await trending({ wallet: myAddress() })
|
|
1399
1404
|
if (!t) fail(`gang.fun has no trending list right now (${API}/trending); try gang hot or gang notes --min-hit 0.6`, { retry: true })
|
|
1400
1405
|
return out({
|
|
1401
1406
|
success: true, at: t.at ? localTime(t.at) : null, tokens: t.tokens, calls: t.calls, note: TRENDING_NOTE,
|
|
1407
|
+
...(t.firstTrade && { firstTrade: t.firstTrade }),
|
|
1402
1408
|
...(!t.tokens.length && !t.calls.length && { empty: 'Nothing qualifies right now: no token with enough distinct agent buyers in 6h, no followable note by a 60%+ author.' }),
|
|
1403
1409
|
})
|
|
1404
1410
|
}
|
package/src/trending.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* `gang trending` prints it; `gang preflight` and `gang list` carry it as `trending`. Cached 5 minutes in
|
|
6
6
|
* ~/.gang/trending.json with a short timeout, so it never slows a command down much, and it's simply left out when gang.fun
|
|
7
7
|
* doesn't answer.
|
|
8
|
+
* For a wallet that has never traded on Gang (GET /api/ref/eligible), 铸币飞轮 sales and the calls on them are left out:
|
|
9
|
+
* a first trade is pointed at a curve token instead.
|
|
8
10
|
*/
|
|
9
11
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
|
|
10
12
|
import { homedir } from 'node:os'
|
|
@@ -18,6 +20,7 @@ const TTL_MS = 5 * 60_000
|
|
|
18
20
|
const TIMEOUT_MS = 3_000
|
|
19
21
|
const ADDR = /^0x[0-9a-fA-F]{40}$/
|
|
20
22
|
export const TRENDING_NOTE = 'What other agents are buying now, not a recommendation. Mention it only when it helps the user; never buy from it on your own.'
|
|
23
|
+
export const FIRST_TRADE_NOTE = 'This wallet has not traded on Gang yet, so 铸币飞轮 (Mint Flywheel) sales are left out here: a first trade is simpler on a curve token. gang list --kind fly still lists them.'
|
|
21
24
|
|
|
22
25
|
function readCache() {
|
|
23
26
|
try {
|
|
@@ -41,8 +44,29 @@ const tokenRow = (t) => ({
|
|
|
41
44
|
volume24hUsd: t.volume24hUsd ?? null, link: `https://gang.fun/token/${t.address}`, next: `gang info --token ${t.address}`,
|
|
42
45
|
})
|
|
43
46
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Whether `wallet` has never traded on Gang: true / false from gang.fun (GET /api/ref/eligible, which `--ref` also asks),
|
|
49
|
+
* null when there is no wallet or no answer (then nothing is left out). Not cached: a wallet stops being new on its first trade.
|
|
50
|
+
*/
|
|
51
|
+
export async function firstTrade(wallet) {
|
|
52
|
+
if (!ADDR.test(wallet ?? '')) return null
|
|
53
|
+
try {
|
|
54
|
+
const r = await fetch(`${API}/ref/eligible?${new URLSearchParams({ wallet })}`, { headers: { accept: 'application/json', 'user-agent': UA }, signal: AbortSignal.timeout(TIMEOUT_MS) })
|
|
55
|
+
if (!r.ok) return null
|
|
56
|
+
const b = await r.json()
|
|
57
|
+
return b?.eligible === true ? true : b?.reason === 'already_traded' ? false : null
|
|
58
|
+
} catch { return null }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const isFly = (track) => String(track ?? '').toLowerCase() === 'fly'
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* → { at, tokens, calls } (rendered rows), or null when gang.fun has no answer. A miss is cached too, so a down server costs
|
|
65
|
+
* one timeout per 5 minutes. wallet: the signed-in wallet; when it has never traded on Gang, 铸币飞轮 rows are dropped and
|
|
66
|
+
* `firstTrade: { flyLeftOut, note }` says so (only when something was dropped).
|
|
67
|
+
*/
|
|
68
|
+
export async function trending({ wallet = null } = {}) {
|
|
69
|
+
const fresh = firstTrade(wallet)
|
|
46
70
|
const c = readCache()
|
|
47
71
|
let body = c ? c.body : undefined
|
|
48
72
|
if (body === undefined) {
|
|
@@ -53,16 +77,26 @@ export async function trending() {
|
|
|
53
77
|
writeCache(body)
|
|
54
78
|
}
|
|
55
79
|
if (!body || !Array.isArray(body.tokens) || !Array.isArray(body.calls)) return null
|
|
80
|
+
let tokens = body.tokens.filter((t) => ADDR.test(t?.address ?? ''))
|
|
81
|
+
let calls = body.calls.filter((n) => n?.tx)
|
|
82
|
+
let left = 0
|
|
83
|
+
if (await fresh) {
|
|
84
|
+
const before = tokens.length + calls.length
|
|
85
|
+
tokens = tokens.filter((t) => !isFly(t.track))
|
|
86
|
+
calls = calls.filter((n) => !isFly(n.token?.track))
|
|
87
|
+
left = before - tokens.length - calls.length
|
|
88
|
+
}
|
|
56
89
|
return {
|
|
57
90
|
at: body.at ?? null,
|
|
58
|
-
tokens:
|
|
59
|
-
calls:
|
|
91
|
+
tokens: tokens.slice(0, 5).map(tokenRow),
|
|
92
|
+
calls: calls.slice(0, 3).map(noteRow),
|
|
93
|
+
...(left && { firstTrade: { flyLeftOut: left, note: FIRST_TRADE_NOTE } }),
|
|
60
94
|
}
|
|
61
95
|
}
|
|
62
96
|
|
|
63
97
|
/** The `trending` block other commands carry: only when there's something in it. */
|
|
64
|
-
export async function trendingBlock() {
|
|
65
|
-
const t = await trending()
|
|
98
|
+
export async function trendingBlock(opts) {
|
|
99
|
+
const t = await trending(opts)
|
|
66
100
|
if (!t || (!t.tokens.length && !t.calls.length)) return null
|
|
67
|
-
return { tokens: t.tokens, calls: t.calls, more: 'gang trending', note: TRENDING_NOTE }
|
|
101
|
+
return { tokens: t.tokens, calls: t.calls, more: 'gang trending', note: TRENDING_NOTE, ...(t.firstTrade && { firstTrade: t.firstTrade }) }
|
|
68
102
|
}
|