@gangfun/cli 0.16.3 → 0.16.5
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 +7 -6
- package/README.zh-CN.md +6 -5
- package/package.json +1 -1
- package/src/bond.js +9 -2
- package/src/discover.js +89 -21
- package/src/index.js +17 -12
package/README.md
CHANGED
|
@@ -41,8 +41,9 @@ npx skills add gangfun/gang-launchpad/skill
|
|
|
41
41
|
## Commands
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
+
gang version # this CLI's version (also -v, --version), no wallet needed
|
|
44
45
|
gang preflight
|
|
45
|
-
gang hot [--limit 10] [--track all|v2|soft] [--include-graduated] # 24h USD volume
|
|
46
|
+
gang hot [--limit 10] [--track all|v3|fair|v2|soft] [--include-graduated] # 24h USD volume
|
|
46
47
|
gang new [--limit 10] [--max-age 2h]
|
|
47
48
|
gang near-grad [--min-pct 50] [--limit 10]
|
|
48
49
|
gang watch [<addr>] [--interval 10] [--events a,b] [--max-events N] [--timeout 30m] [--webhook URL]
|
|
@@ -130,9 +131,9 @@ Buy / sell / create: **preview → you confirm → execute**. `requestId` expire
|
|
|
130
131
|
|
|
131
132
|
### Discovery (0.3.0+)
|
|
132
133
|
|
|
133
|
-
`hot` / `new` / `near-grad` / `watch` read the gang.fun indexer (`GANG_API`) and cover
|
|
134
|
-
`quote` (the unit to pass to `--amount`), `progressPct`, `remaining`/`remainingUsd`, `volume24hUsd`, `holders`, `ageMin` and a `next` command
|
|
135
|
-
Graduated tokens are hidden unless `--include-graduated` is passed.
|
|
134
|
+
`hot` / `new` / `near-grad` / `watch` read the gang.fun indexer (`GANG_API`) and cover every track: GangLaunchpad `v3` / `fair`
|
|
135
|
+
(打新) and the older `v2` / `soft` (0.16.5+; before, V2 and Soft only). Each row has `track`, `quote` (the unit to pass to `--amount`), `progressPct`, `remaining`/`remainingUsd`, `volume24hUsd`, `holders`, `ageMin` and a `next` command
|
|
136
|
+
(`gang buy` on V3 and graduated tokens, `gang mint` on a 打新 sale, `gang quote` on a V2 / Soft curve). Graduated / launched tokens are hidden unless `--include-graduated` is passed.
|
|
136
137
|
|
|
137
138
|
`gang watch` polls and prints NDJSON. The minimum interval is 3s with `<addr>` and 10s for the whole market. With `<addr>` it emits `trade` / `progress` (25/50/75/90%) / `graduated`.
|
|
138
139
|
Without it, it emits `new_token` / `near_grad` (crosses `--min-pct`) / `graduated`. `--max-events 1` blocks until the next event and
|
|
@@ -207,7 +208,7 @@ gang agents --window 30d --sort follow
|
|
|
207
208
|
`--slippage`. `--use-quote` / `--pay-bnb` pick what a buy pays with, `--to-bnb` sells for BNB. A taxed sell needs about
|
|
208
209
|
700k gas (it also sells one chunk of the held tax): let the wallet estimate, or give at least 750k.
|
|
209
210
|
The router is checked first (a GangRouter with pool trades, never Pancake or an old router); `--from` works only on
|
|
210
|
-
these pool trades (and on V3 / 打新 tokens). Details: `references/
|
|
211
|
+
these pool trades (and on V3 / 打新 tokens). Details: `skill/references/pool.md`.
|
|
211
212
|
|
|
212
213
|
## Env
|
|
213
214
|
|
|
@@ -227,4 +228,4 @@ gang agents --window 30d --sort follow
|
|
|
227
228
|
|
|
228
229
|
## Version
|
|
229
230
|
|
|
230
|
-
`0.16.
|
|
231
|
+
`0.16.5` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
|
package/README.zh-CN.md
CHANGED
|
@@ -31,8 +31,9 @@ Skill:`npx skills add gangfun/gang-launchpad/skill`
|
|
|
31
31
|
## 命令
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
+
gang version # CLI 版本(也可用 -v、--version),不需要钱包
|
|
34
35
|
gang preflight
|
|
35
|
-
gang hot [--limit 10] [--track all|v2|soft] [--include-graduated] # 按 24h USD 成交量
|
|
36
|
+
gang hot [--limit 10] [--track all|v3|fair|v2|soft] [--include-graduated] # 按 24h USD 成交量
|
|
36
37
|
gang new [--limit 10] [--max-age 2h]
|
|
37
38
|
gang near-grad [--min-pct 50] [--limit 10]
|
|
38
39
|
gang watch [<addr>] [--interval 10] [--events a,b] [--max-events N] [--timeout 30m] [--webhook URL]
|
|
@@ -115,8 +116,8 @@ x.com / twitter.com 链接(主页、帖子、社区),统一存成 `https:/
|
|
|
115
116
|
|
|
116
117
|
### 发现(0.3.0+)
|
|
117
118
|
|
|
118
|
-
`hot` / `new` / `near-grad` / `watch` 读 gang.fun indexer(`GANG_API
|
|
119
|
-
`progressPct`、`remaining`/`remainingUsd`、`volume24hUsd`、`holders`、`ageMin` 和 `next`
|
|
119
|
+
`hot` / `new` / `near-grad` / `watch` 读 gang.fun indexer(`GANG_API`),覆盖所有盘:GangLaunchpad 的 `v3` / `fair`(打新)和旧的 `v2` / `soft`(0.16.5 起;之前只有 V2 与 Soft)。每行带 `track`、`quote`(`--amount` 的单位)、
|
|
120
|
+
`progressPct`、`remaining`/`remainingUsd`、`volume24hUsd`、`holders`、`ageMin` 和 `next` 命令(V3 与已毕业的币是 `gang buy`,打新是 `gang mint`,V2 / Soft 内盘是 `gang quote`);已毕业 / 已开盘默认隐藏(`--include-graduated` 显示)。
|
|
120
121
|
|
|
121
122
|
`gang watch` 轮询并输出 NDJSON(最短间隔:单币 3s,全市场 10s):带 `<addr>` 推 `trade` / `progress`(25/50/75/90%)/ `graduated`;不带则推 `new_token` / `near_grad`(越过 `--min-pct`)/ `graduated`。
|
|
122
123
|
`--max-events 1` = 阻塞到下一个事件;`--webhook` 把每个事件 POST 出去。详见 [skill/references/discover.md](https://github.com/gangfun/gang-launchpad/blob/main/skill/references/discover.md)。
|
|
@@ -180,7 +181,7 @@ gang agents --window 30d --sort follow
|
|
|
180
181
|
- 毕业前不可转账;毕业(或打新发射)后走 PancakeSwap:`gang buy` / `gang sell`
|
|
181
182
|
经 GangRouter 在外盘成交。先只授权本次用量,再发 `poolBuy` / `poolBuyBNB` / `poolSell` / `poolSellForBNB`;最少到手:买入按
|
|
182
183
|
`getAmountsOut` 扣买入税,卖出按税 handler 的 `previewSellNextBlock`,再扣 `--slippage`。`--use-quote` / `--pay-bnb` 选买入用什么付,
|
|
183
|
-
`--to-bnb` 卖成 BNB。带税的卖出约需 70 万 gas(会顺带换一块税):让钱包自动估算,或者至少给 75 万。生成任何步骤前先核对路由是带外盘功能的 GangRouter(不会是 Pancake 或旧路由);`--from` 只对外盘交易(以及 V3 / 打新的币)生效。详见 `references/
|
|
184
|
+
`--to-bnb` 卖成 BNB。带税的卖出约需 70 万 gas(会顺带换一块税):让钱包自动估算,或者至少给 75 万。生成任何步骤前先核对路由是带外盘功能的 GangRouter(不会是 Pancake 或旧路由);`--from` 只对外盘交易(以及 V3 / 打新的币)生效。详见 `skill/references/pool.md`。
|
|
184
185
|
|
|
185
186
|
## 环境变量
|
|
186
187
|
|
|
@@ -200,4 +201,4 @@ gang agents --window 30d --sort follow
|
|
|
200
201
|
|
|
201
202
|
## 版本
|
|
202
203
|
|
|
203
|
-
`0.16.
|
|
204
|
+
`0.16.5` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"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.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/bond.js
CHANGED
|
@@ -415,13 +415,20 @@ export async function runBond(sub, { opt, flag, out, fail, summarize }) {
|
|
|
415
415
|
// not ready: the call only records / waits. If a chunk has become buyable by the time it lands, the max minimum
|
|
416
416
|
// makes it revert (Slippage) instead of buying unchecked: re-run for a priced preview
|
|
417
417
|
const toDead = ready && !m.live
|
|
418
|
-
|
|
418
|
+
// the minimum comes from the chunk simulated with no minimum: previewBurn prices the whole quoteIn, so a quote that
|
|
419
|
+
// taxes transfers into the pair (fewer tokens bought) would fail every minimum taken from it
|
|
420
|
+
let expect = tokensOut
|
|
421
|
+
if (ready && !toDead) {
|
|
422
|
+
const dry = await simulate(ctx, me(), 'burnChunk', [token, 0n])
|
|
423
|
+
if (dry.result) expect = dry.result[1]
|
|
424
|
+
}
|
|
425
|
+
const minOut = toDead ? 0n : ready ? (expect * BigInt(Math.round((100 - slippage) * 100))) / BPS : MAX_UINT
|
|
419
426
|
const sim = await simulate(ctx, me(), 'burnChunk', [token, minOut])
|
|
420
427
|
if (sim.failed) return out({ success: false, step: 'burn', ...sim.failed })
|
|
421
428
|
return out(send('burnChunk', [token, minOut], {
|
|
422
429
|
step: 'burn', burnLeft: view.burnLeft, quote: view.quote,
|
|
423
430
|
...(toDead ? { quoteToDead: qf(quoteIn), note: 'slashed before the pair and still no pair 30 days after the post: the rest goes to 0xdead as quote' }
|
|
424
|
-
: ready ? { chunkQuoteIn: qf(quoteIn), expectBurnTokens: tokens(
|
|
431
|
+
: ready ? { chunkQuoteIn: qf(quoteIn), expectBurnTokens: tokens(expect), minBurnTokens: tokens(minOut), slippagePct: slippage }
|
|
425
432
|
: { note: 'no chunk this time: the call records the price observation (first call after a slash) or waits for the 10-minute average / a price no more than 2% above it. It is cheap; the platform keeper also calls it every 5 minutes (one chunk per 4 minutes at most). If a chunk becomes buyable before it lands, it reverts (Slippage) rather than buy without a minimum: re-run then' }),
|
|
426
433
|
}))
|
|
427
434
|
}
|
package/src/discover.js
CHANGED
|
@@ -56,11 +56,55 @@ export function parseDuration(raw, name) {
|
|
|
56
56
|
return Math.round(Number(m[1]) * { '': 1, s: 1, m: 60, h: 3600, d: 86400 }[m[2].toLowerCase()])
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const WBNB = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'
|
|
60
|
+
// BSC USDT / USDC: $1 when no V2 row prices them
|
|
61
|
+
const STABLES = ['0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d']
|
|
62
|
+
const TRACKS = ['all', 'v3', 'fair', 'v2', 'soft']
|
|
63
|
+
// detail route per track (V2 / Soft details both live under /tokens) and trades route
|
|
64
|
+
const DETAIL = { v2: '/tokens', soft: '/tokens', v3: '/v3/tokens', fair: '/fair/sales' }
|
|
65
|
+
const TRADES = { v2: '/stocks/tokens', soft: '/tokens', v3: '/v3/tokens', fair: '/fair/sales' }
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* GangLaunchpad rows: `v3` = V3 curves (/v3/tokens), `fair` = 打新 sales (/fair/sales; `graduated` = launched).
|
|
69
|
+
* List rows carry raw wei and no USD; details (/…/<addr>) carry human amounts and USD like the V2 rows.
|
|
70
|
+
* `quoteUsdOf(quoteAddress)` prices a list row's quote (from the V2 / Soft rows), null when unknown.
|
|
71
|
+
*/
|
|
72
|
+
function gangRow(r, quoteUsdOf) {
|
|
73
|
+
const fair = r.track === 'fair'
|
|
74
|
+
const dec = r.quoteDecimals ?? 18
|
|
75
|
+
const w = (v) => num(v) / 10 ** dec
|
|
76
|
+
const detail = r.raisedQuote != null
|
|
77
|
+
const graduated = !!r.graduated || r.status === 'launched'
|
|
78
|
+
const raised = detail ? num(r.raisedQuote) : fair ? w(r.sharePrice) * num(r.sold) : w(r.realQuote)
|
|
79
|
+
const target = detail ? num(r.gradAmtQuote) : fair ? w(r.raiseQuote) : w(r.gradAmt)
|
|
80
|
+
const remaining = graduated ? 0 : detail ? num(r.graduationRemainingQuote) : Math.max(0, target - raised)
|
|
81
|
+
const quoteUsd = num(r.quoteUsd) || quoteUsdOf(r.quoteAddress) || null
|
|
82
|
+
const inUsd = (field, quoteField) => (r[field] != null ? usd(num(r[field])) : quoteUsd ? usd(num(r[quoteField]) * quoteUsd) : null)
|
|
83
|
+
return {
|
|
84
|
+
address: r.address, symbol: r.symbol, name: r.name, track: r.track,
|
|
85
|
+
quote: r.quoteSymbol || '?', quoteAddress: r.quoteAddress || null,
|
|
86
|
+
// 打新: the 1% pool tax after launch; V3: its own buy / sell tax, pool only
|
|
87
|
+
taxed: fair || num(r.buyTaxBps) > 0 || num(r.sellTaxBps) > 0,
|
|
88
|
+
graduated, pair: r.pair || null,
|
|
89
|
+
progressPct: num(r.progressPct), raised, graduationTarget: target, remaining,
|
|
90
|
+
remainingUsd: quoteUsd ? usd(remaining * quoteUsd) : null,
|
|
91
|
+
priceUsd: r.priceUsd ?? (quoteUsd ? num(r.priceQuote) * quoteUsd : null), fdvUsd: inUsd('fdvUsd', 'fdvQuote'),
|
|
92
|
+
volume24hUsd: inUsd('volume24hUsd', 'volume24hQuote'), trades24h: num(r.trades24h), trades: num(r.trades),
|
|
93
|
+
holders: r.holders != null ? num(r.holders) : fair ? num(r.participants) : null,
|
|
94
|
+
...(fair && { sharePrice: w(r.sharePrice), sharesLeft: num(r.sharesLeft), minWalletsLeft: num(r.minWalletsLeft) }),
|
|
95
|
+
createdAt: r.createdAt, ageMin: r.createdAt ? Math.floor((now() - r.createdAt) / 60) : null,
|
|
96
|
+
lastTradeAt: r.lastTradeAt || r.lastActivityAt || null, creatorHandle: r.creatorHandle || null, logoUrl: r.logoUrl || null,
|
|
97
|
+
website: r.website && !websiteError(r.website) ? r.website : null,
|
|
98
|
+
twitter: r.twitter && !twitterError(r.twitter) ? r.twitter : null,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
59
102
|
/**
|
|
60
|
-
* One shape for
|
|
61
|
-
* `soft` = legacy BNB curve (/tokens, 20 BNB graduation). Amounts are human units of `quote`.
|
|
103
|
+
* One shape for every API track: GangLaunchpad `v3` / `fair` (gangRow), `v2` = quote-ERC20 curves (/stocks/tokens,
|
|
104
|
+
* LaunchpadV2 family), `soft` = legacy BNB curve (/tokens, 20 BNB graduation). Amounts are human units of `quote`.
|
|
62
105
|
*/
|
|
63
|
-
export function normalize(r) {
|
|
106
|
+
export function normalize(r, quoteUsdOf = () => null) {
|
|
107
|
+
if (r.track === 'v3' || r.track === 'fair') return gangRow(r, quoteUsdOf)
|
|
64
108
|
const v2 = r.track === 'stocks'
|
|
65
109
|
const quote = v2 ? (r.quoteSymbol || '?') : 'BNB'
|
|
66
110
|
const raised = v2 ? num(r.raisedQuote) : num(r.raisedBnb)
|
|
@@ -97,24 +141,45 @@ async function pages(path, stop) {
|
|
|
97
141
|
return { rows, truncated: true }
|
|
98
142
|
}
|
|
99
143
|
|
|
100
|
-
/** All indexed tokens, normalized and de-duplicated. track: all | v2 | soft */
|
|
144
|
+
/** All indexed tokens, normalized and de-duplicated. track: all | v3 | fair | v2 | soft */
|
|
101
145
|
export async function fetchMarket(track = 'all', stop) {
|
|
102
|
-
if (!
|
|
146
|
+
if (!TRACKS.includes(track)) throw new Error(`--track must be ${TRACKS.join(', ')} (got ${track})`)
|
|
103
147
|
const none = { rows: [], truncated: false }
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
148
|
+
const want = (t) => track === 'all' || track === t
|
|
149
|
+
// the GangLaunchpad list rows have no USD: the V2 / Soft rows price their quotes. A track not listed is read for that
|
|
150
|
+
// only, one page and best effort: no truncation, and a failure just leaves the USD fields null
|
|
151
|
+
const priced = want('v3') || want('fair')
|
|
152
|
+
const prices = (path) => get(`${path}${path.includes('?') ? '&' : '?'}limit=200`, stop).then((p) => ({ rows: p?.items || [] }), () => none)
|
|
153
|
+
const [v3, fair, v2, soft] = await Promise.all([
|
|
154
|
+
want('v3') ? pages('/v3/tokens?status=all', stop) : none,
|
|
155
|
+
want('fair') ? pages('/fair/sales?status=all', stop) : none,
|
|
156
|
+
want('v2') ? pages('/stocks/tokens', stop) : priced ? prices('/stocks/tokens') : none,
|
|
157
|
+
want('soft') ? pages('/tokens?sort=new', stop) : priced ? prices('/tokens?sort=new') : none,
|
|
107
158
|
])
|
|
159
|
+
const usdOf = new Map()
|
|
160
|
+
for (const r of v2.rows) if (num(r.quoteUsd) > 0 && r.quoteAddress) usdOf.set(r.quoteAddress.toLowerCase(), num(r.quoteUsd))
|
|
161
|
+
const bnbUsd = soft.rows.find((r) => num(r.bnbUsd) > 0)?.bnbUsd
|
|
162
|
+
if (!usdOf.has(WBNB) && bnbUsd) usdOf.set(WBNB, num(bnbUsd))
|
|
163
|
+
for (const a of STABLES) if (!usdOf.has(a)) usdOf.set(a, 1)
|
|
164
|
+
const quoteUsdOf = (a) => (a ? usdOf.get(a.toLowerCase()) ?? null : null)
|
|
108
165
|
const seen = new Map()
|
|
109
|
-
|
|
110
|
-
|
|
166
|
+
const rows = [...v3.rows, ...fair.rows, ...(want('v2') ? v2.rows : []), ...(want('soft') ? soft.rows : [])]
|
|
167
|
+
for (const r of rows) {
|
|
168
|
+
const t = normalize(r, quoteUsdOf)
|
|
111
169
|
if (!seen.has(t.address)) seen.set(t.address, t)
|
|
112
170
|
}
|
|
113
|
-
return { tokens: [...seen.values()], truncated: v2.
|
|
171
|
+
return { tokens: [...seen.values()], truncated: [v3, fair, v2, soft].some((p) => p.truncated) }
|
|
114
172
|
}
|
|
115
173
|
|
|
116
|
-
|
|
117
|
-
const
|
|
174
|
+
/** The command that acts on a token next: quote / preview a buy (no tx is sent before `gang execute`). */
|
|
175
|
+
const hint = (t) => {
|
|
176
|
+
const amount = `--amount <amount in ${t.quote}>`
|
|
177
|
+
if (t.graduated) return `gang buy --token ${t.address} ${amount}` // the PancakeSwap pool, through GangRouter
|
|
178
|
+
if (t.track === 'fair') return `gang mint --token ${t.address} --shares <n>`
|
|
179
|
+
if (t.track === 'v3') return `gang buy --token ${t.address} ${amount}`
|
|
180
|
+
return `gang quote --token ${t.address} ${amount}`
|
|
181
|
+
}
|
|
182
|
+
const withHint = (t) => ({ ...t, next: hint(t) })
|
|
118
183
|
|
|
119
184
|
/** hot = 24h USD volume on the curve; new = newest first; near-grad = closest to graduation. */
|
|
120
185
|
export function rank(tokens, sort, { limit = 10, minPct = 50, maxAgeSec = null, includeGraduated = false } = {}) {
|
|
@@ -122,7 +187,7 @@ export function rank(tokens, sort, { limit = 10, minPct = 50, maxAgeSec = null,
|
|
|
122
187
|
if (sort === 'hot') {
|
|
123
188
|
// graduated rows carry DEX volume with trades24h = 0, so volume alone also qualifies
|
|
124
189
|
list = list.filter((t) => t.trades24h > 0 || t.volume24hUsd > 0)
|
|
125
|
-
.sort((a, b) => (b.volume24hUsd - a.volume24hUsd) || (b.trades24h - a.trades24h))
|
|
190
|
+
.sort((a, b) => ((b.volume24hUsd ?? 0) - (a.volume24hUsd ?? 0)) || (b.trades24h - a.trades24h))
|
|
126
191
|
} else if (sort === 'new') {
|
|
127
192
|
const t0 = now()
|
|
128
193
|
if (maxAgeSec != null) list = list.filter((t) => t0 - t.createdAt <= maxAgeSec)
|
|
@@ -134,16 +199,19 @@ export function rank(tokens, sort, { limit = 10, minPct = 50, maxAgeSec = null,
|
|
|
134
199
|
return list.slice(0, limit).map(withHint)
|
|
135
200
|
}
|
|
136
201
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
202
|
+
/** One token's detail. `track` known (later polls): its own route; else each route in turn. */
|
|
203
|
+
async function tokenDetail(addr, stop, track) {
|
|
204
|
+
const a = addr.toLowerCase()
|
|
205
|
+
for (const base of track ? [DETAIL[track]] : ['/tokens', '/v3/tokens', '/fair/sales']) {
|
|
206
|
+
const r = await get(`${base}/${a}`, stop)
|
|
207
|
+
if (r) return normalize(r)
|
|
208
|
+
}
|
|
209
|
+
throw new Error(`token not indexed by ${API}: ${addr}. On-chain view: \`gang info --token ${addr}\``)
|
|
141
210
|
}
|
|
142
211
|
|
|
143
212
|
/** One page of trades, newest first. */
|
|
144
213
|
async function tradePage(t, offset = 0, stop) {
|
|
145
|
-
const
|
|
146
|
-
const page = await get(`${base}/${t.address}/trades?limit=${TRADE_PAGE}&offset=${offset}`, stop)
|
|
214
|
+
const page = await get(`${TRADES[t.track]}/${t.address}/trades?limit=${TRADE_PAGE}&offset=${offset}`, stop)
|
|
147
215
|
const items = (page?.items || []).map((x) => ({
|
|
148
216
|
side: x.side, trader: x.trader, traderHandle: x.traderHandle || null,
|
|
149
217
|
amount: num(x.quoteIn ?? x.bnb), quote: t.quote, tokens: num(x.tokens),
|
|
@@ -212,7 +280,7 @@ export async function watch({ token, intervalSec = 10, minPct = 50, track = 'all
|
|
|
212
280
|
await sleep(intervalSec)
|
|
213
281
|
if (shouldStop()) return
|
|
214
282
|
try {
|
|
215
|
-
const cur = await tokenDetail(token, stop)
|
|
283
|
+
const cur = await tokenDetail(token, stop, t.track)
|
|
216
284
|
const { fresh, gap } = await freshTrades(cur, seen, stop)
|
|
217
285
|
// advance state only after both reads succeed, so a failed tick can't swallow a prev → cur transition
|
|
218
286
|
const prev = t
|
package/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { normalizeWebsite, normalizeTwitter } from './links.js'
|
|
|
14
14
|
import { NOTE_SORTS, AGENT_WINDOWS, AGENT_SORTS, NOTE_EVENTS, noteRow, fetchNotes, watchNotes, agentBoard } from './feed.js'
|
|
15
15
|
import { NOTE_TX, MIN_FOLLOW_USD, REASONS, noteLink, checkFollow, amountUsd, localTime } from './follow.js'
|
|
16
16
|
import { rememberPreview, previewFor } from './previews.js'
|
|
17
|
-
import { UA, checkUpdate } from './version.js'
|
|
17
|
+
import { UA, VERSION, checkUpdate } from './version.js'
|
|
18
18
|
import { runFair, FAIR_EVENT_ABIS } from './fair.js'
|
|
19
19
|
import { runV3, v3Ctx, V3_EVENT_ABIS } from './v3.js'
|
|
20
20
|
import { runBond } from './bond.js'
|
|
@@ -204,14 +204,15 @@ kind's trade. Results of V3 / 打新 tokens carry kind: "v3" | "fair". --testnet
|
|
|
204
204
|
only); --calldata prints the raw tx instead of a baw preview; --from <addr> reads / builds for that wallet (V2 / Soft:
|
|
205
205
|
graduated tokens only).
|
|
206
206
|
|
|
207
|
+
gang version this CLI's version (also --version, -v); no wallet needed
|
|
207
208
|
gang preflight check sign-in, Developer Mode, tradeAllTokens, Agent ID
|
|
208
209
|
gang list [--kind v3|fair [--status …]]
|
|
209
210
|
V2 / Soft / U / S tokens; --kind v3 (--status curve|graduated|all) / --kind fair
|
|
210
211
|
(--status minting|launched|all): GangLaunchpad tokens from gang.fun
|
|
211
|
-
gang hot [--limit 10] [--track all|v2|soft] [--include-graduated]
|
|
212
|
-
|
|
213
|
-
gang new [--limit 10] [--max-age 2h] [--track …] newest
|
|
214
|
-
gang near-grad [--min-pct 50] [--limit 10] [--track …] closest to graduation
|
|
212
|
+
gang hot [--limit 10] [--track all|v3|fair|v2|soft] [--include-graduated]
|
|
213
|
+
tokens not yet graduated / launched, ranked by 24h USD volume
|
|
214
|
+
gang new [--limit 10] [--max-age 2h] [--track …] newest first
|
|
215
|
+
gang near-grad [--min-pct 50] [--limit 10] [--track …] closest to graduation (打新: to filling)
|
|
215
216
|
gang watch [<addr>] [--interval 10] [--min-pct 50] [--events a,b] [--max-events N] [--timeout 30m] [--webhook URL]
|
|
216
217
|
NDJSON stream (min interval: 3s token, 10s market). <addr>: trade / progress / graduated.
|
|
217
218
|
no addr: new_token / near_grad / graduated across the market
|
|
@@ -860,7 +861,7 @@ function create() {
|
|
|
860
861
|
}
|
|
861
862
|
|
|
862
863
|
// commands whose JSON result carries `update`; `watch` streams NDJSON and help is plain text
|
|
863
|
-
const UPDATE_CHECKED = new Set(['preflight', 'list', 'hot', 'new', 'near-grad', 'notes', 'agents', 'token', 'info', 'status', 'quote',
|
|
864
|
+
const UPDATE_CHECKED = new Set(['version', '--version', '-v', 'preflight', 'list', 'hot', 'new', 'near-grad', 'notes', 'agents', 'token', 'info', 'status', 'quote',
|
|
864
865
|
'buy', 'follow', 'sell', 'claim', 'mint', 'withdraw', 'release', 'upload-logo', 'create', 'execute', 'tx', 'fair', 'v3', 'bond',
|
|
865
866
|
'buyback'])
|
|
866
867
|
// gang tx decodes these beside the V2 / Soft / U / S pads' events (GangLaunchpad: both kinds; the tax router; the vaults)
|
|
@@ -896,6 +897,10 @@ async function main() {
|
|
|
896
897
|
return runBond(args[1], { opt, flag, out, fail, summarize: summarizePreview })
|
|
897
898
|
case 'buyback':
|
|
898
899
|
return runBuyback(args[1], { opt, flag, out, fail, summarize: summarizePreview })
|
|
900
|
+
case 'version':
|
|
901
|
+
case '--version':
|
|
902
|
+
case '-v':
|
|
903
|
+
return out({ success: true, version: VERSION })
|
|
899
904
|
case 'preflight': {
|
|
900
905
|
const issues = []
|
|
901
906
|
const status = bawStatus()
|
|
@@ -909,7 +914,7 @@ async function main() {
|
|
|
909
914
|
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.' })
|
|
910
915
|
}
|
|
911
916
|
return out({
|
|
912
|
-
success: issues.length === 0, status, address: me,
|
|
917
|
+
success: issues.length === 0, cliVersion: VERSION, status, address: me,
|
|
913
918
|
// `launchpad` = createPad: kept for readers of the old field (it used to be the V2 create target)
|
|
914
919
|
launchpad: padNets('v3').mainnet.pad, createPad: padNets('v3').mainnet.pad, isAgent: agent,
|
|
915
920
|
devMode: settings?.devMode?.enabled ?? null, tradeAllTokens: settings?.tradeAllTokens ?? null, issues,
|
|
@@ -938,16 +943,16 @@ async function main() {
|
|
|
938
943
|
const market = await fetchMarket(track)
|
|
939
944
|
const tokens = rank(market.tokens, cmd, { limit, minPct, maxAgeSec, includeGraduated })
|
|
940
945
|
const empty = {
|
|
941
|
-
hot: includeGraduated ? 'No token traded in the last 24h.' : 'No
|
|
942
|
-
new: maxAgeSec != null ? `No
|
|
943
|
-
'near-grad': `No
|
|
946
|
+
hot: includeGraduated ? 'No token traded in the last 24h.' : 'No token before graduation traded in the last 24h.',
|
|
947
|
+
new: maxAgeSec != null ? `No token created in the last ${opt('max-age')}.` : 'No tokens before graduation.',
|
|
948
|
+
'near-grad': `No token at ≥${minPct}% of graduation; lower --min-pct to see the closest ones.`,
|
|
944
949
|
}[cmd]
|
|
945
950
|
return out({
|
|
946
951
|
success: true, source: API, sort: cmd, track, count: tokens.length,
|
|
947
952
|
...(cmd === 'near-grad' ? { minPct } : {}), ...(maxAgeSec != null ? { maxAgeSec } : {}),
|
|
948
953
|
...(market.truncated ? { truncated: true } : {}),
|
|
949
954
|
tokens,
|
|
950
|
-
note: tokens.length ? 'Amounts are in each token\'s `quote` unit
|
|
955
|
+
note: tokens.length ? 'Amounts are in each token\'s `quote` unit, the unit of `next`\'s --amount. Data, not advice.' : empty,
|
|
951
956
|
})
|
|
952
957
|
}
|
|
953
958
|
case 'notes': {
|
|
@@ -974,7 +979,7 @@ async function main() {
|
|
|
974
979
|
...(agents && { agents }), ...(minHit != null && { minHit }), ...(own && { ownLeftOut: own }),
|
|
975
980
|
notes,
|
|
976
981
|
note: notes.length
|
|
977
|
-
? 'Data, not advice. To follow one: `gang follow <tx> --
|
|
982
|
+
? 'Data, not advice. To follow one: `gang follow <tx> --amount <amount>` → show the preview → the user confirms → `gang execute`.'
|
|
978
983
|
: (all ? 'No notes.' : empty),
|
|
979
984
|
})
|
|
980
985
|
}
|