@gangfun/cli 0.17.7 → 0.18.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 +19 -6
- package/README.zh-CN.md +18 -5
- package/package.json +1 -1
- package/src/baw.js +30 -5
- package/src/discover.js +21 -11
- package/src/fly.js +932 -0
- package/src/index.js +127 -29
- package/src/mcp.js +9 -8
- package/src/pool.js +15 -7
- package/src/portfolio.js +30 -5
- package/src/steps.js +22 -5
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
|
|
|
6
6
|
|
|
7
7
|
**One command per action (0.12.0+):** `gang buy` / `sell` / `info` / `status` / `claim` / `mint` / `withdraw` / `release` work on every token: the CLI reads the token's kind and runs the V3, 打新 or V2 / Soft code. `gang v3 …` / `gang fair …` stay as aliases.
|
|
8
8
|
|
|
9
|
+
**持续打新 / continuous mint (0.18.0+):** `gang create --fly` starts a sale on GangFlywheelPad (its own pad, kind 3): shares with a quota per wallet (invites add quota), a pool at the mint price once it fills, and minting that goes on after launch. The unified commands detect these tokens (`kind: "fly"`); `gang fly …` is the alias. BSC testnet (set 2) for now: the mainnet pad (`0x631e66560F4FAE4e486B65349edE48189E48B029`) opens after testing, and `create --fly` on mainnet says so until then. Rules: `skill/references/fly.md`.
|
|
10
|
+
|
|
9
11
|
**V3 tax tokens and 打新 (0.9.0+):** on GangLaunchpad, live on BSC mainnet since 2026-10-27 (pad `0x15CFD2dc8278Fb87a1783ef42111618E20874365`, GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`, both built in); `--testnet` uses BSC testnet set 10.
|
|
10
12
|
|
|
11
13
|
## Install
|
|
@@ -43,7 +45,7 @@ npx skills add gangfun/gang-launchpad/skill
|
|
|
43
45
|
```bash
|
|
44
46
|
gang version # this CLI's version (also -v, --version), no wallet needed
|
|
45
47
|
gang preflight
|
|
46
|
-
gang hot [--limit 10] [--track all|v3|fair|v2|soft] [--include-graduated] # 24h USD volume
|
|
48
|
+
gang hot [--limit 10] [--track all|v3|fair|fly|v2|soft] [--include-graduated] # 24h USD volume
|
|
47
49
|
gang new [--limit 10] [--max-age 2h]
|
|
48
50
|
gang near-grad [--min-pct 50] [--limit 10]
|
|
49
51
|
gang watch [<addr>] [--interval 10] [--events a,b] [--max-events N] [--timeout 30m] [--webhook URL] [--poll]
|
|
@@ -52,7 +54,7 @@ gang watch --notes [--agent a,b] [--min-hit 0.6] [--interval 30] [--events note,
|
|
|
52
54
|
gang agents [--window 1d|7d|30d|all] [--sort score|hitRate|count|follow|followUsd] [--limit 10] # who to follow
|
|
53
55
|
# One command per action, whatever pad the token is on (0.12.0+): the CLI reads GangLaunchpad's kindOf (V3 curve / 打新
|
|
54
56
|
# sale; otherwise the V2 / Soft / U / S pads) and runs that kind's trade. --testnet = BSC testnet set 10 (GangLaunchpad only)
|
|
55
|
-
gang list [--limit 20] [--kind v3|fair [--status …]] # V2 / Soft / U / S on chain, newest 20 per pad; --kind: from gang.fun
|
|
57
|
+
gang list [--limit 20] [--kind v3|fair|fly [--status …]] # V2 / Soft / U / S on chain, newest 20 per pad; --kind v3|fair: from gang.fun, fly: the pad
|
|
56
58
|
gang info --token <addr> # one token, any pad (gang token is the older name)
|
|
57
59
|
gang status --token <addr> # my position: balance; V3 dividend / 打新 reward, sellable; poolSellAll
|
|
58
60
|
gang portfolio [--from <addr>] # every holding: balance, value, cost / unrealized, claimable, USD; bonds
|
|
@@ -65,7 +67,7 @@ gang sell --token <addr> (--amount <tokens> | --all) [--slippage 1] [--to-bnb] [
|
|
|
65
67
|
gang mint --token <addr> --shares <n> [--note …] # 打新 before it fills: + the sale's mint fee (1–3%, the platform's)
|
|
66
68
|
gang withdraw --token <addr> (--shares <n> | --all) [--note …] # 打新: sell back at the mint price before it fills
|
|
67
69
|
gang claim --token <addr> # V3: my dividend (in the quote token); 打新: the holder reward
|
|
68
|
-
gang release --token <addr> # V3: push a tax payment that failed earlier
|
|
70
|
+
gang release --token <addr> # V3: push a tax payment that failed earlier; 持续打新: an owed dev cut / tax share
|
|
69
71
|
gang follow <note tx> --amount <n> [--slippage 1] [--note …] # buy the token a note is about, as a follow of it
|
|
70
72
|
gang upload-logo (--file ./avatar.png | --url <image URL>) # → ipfs://<cid> (view at https://cdn.gang.fun/ipfs/<cid>)
|
|
71
73
|
# create: GangLaunchpad. A V3 token (own buy / sell tax 1–5%, pool only, paid to the creator itself or a whitelisted
|
|
@@ -73,8 +75,18 @@ gang upload-logo (--file ./avatar.png | --url <image URL>) # → ipfs://<cid>
|
|
|
73
75
|
gang create --name <n> --symbol <s> [--buy-tax 2 --sell-tax 2 [--dividend 0] [--recipient 0x…]] [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
74
76
|
gang create --fair --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1] [--shares 1] [--logo …] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
75
77
|
# --cap 0.25–1% of supply per wallet (1% → at least 50 wallets), --hold 60–90% (the hold line)
|
|
78
|
+
# 持续打新 (continuous mint, GangFlywheelPad; BSC testnet until the mainnet pad opens). --preset j (default: the J template) or
|
|
79
|
+
# steady; every setting can be overridden: --raise 3-50 --quota 5-100 --invite-bonus 0-3 --max-per-tx 1-10 --hold 60-90
|
|
80
|
+
# --mint-fee 1-3 --exit-fee 1-2 --dev-cut 0-10 --buy-pct 0-50 --sell-tax 1-2 --launch-delay 0-300 --window 300-1800
|
|
81
|
+
# --cap-mul 1-2 --post-mint|--no-post-mint --tier flat|standard|linear [--step-pct --step-shares --max-mul] --supply-cap 10-500
|
|
82
|
+
gang create --fly --name <n> --symbol <s> [--preset j|steady] [settings…] [--dev-shares 1] [--logo …] [--testnet]
|
|
83
|
+
gang mint --token <addr> --shares <n> [--ref <inviter>] [--slippage 2] # before launch: the sale price; after: mintPost (pool price or above)
|
|
84
|
+
gang fly open-early --token <addr> # creator, ≥ 30% sold
|
|
85
|
+
gang fly launch --token <addr> # anyone, after launchAt
|
|
86
|
+
gang fly invite --token <addr> [--who <addr>] # https://gang.fun/token/<addr>?ref=<who>, invites, bonus, quota left
|
|
76
87
|
gang v3 income --recipient 0x… # a recipient's income per token (gang.fun)
|
|
77
|
-
# aliases: gang v3 <list|info|status|create|buy|sell|claim|release|tx>, gang fair <list|info|status|create|mint|withdraw|buy|sell|claim|tx
|
|
88
|
+
# aliases: gang v3 <list|info|status|create|buy|sell|claim|release|tx>, gang fair <list|info|status|create|mint|withdraw|buy|sell|claim|tx>,
|
|
89
|
+
# gang fly <list|info|status|create|mint|withdraw|open-early|launch|invite|buy|sell|claim|release|claim-dev|tx>
|
|
78
90
|
# run the same code (their results carry useInstead)
|
|
79
91
|
# Creator bond (押金承诺, GangBond): from create on, the creator bonds quote that it keeps ≥ X tokens; T = graduation / launch + --days
|
|
80
92
|
gang bond post --token <addr> --hold <tokens|N%> --days <7-90> (--amount <quote> | --cover 100) [--use-wbnb] # creator, from create on (--cover once on the pair); WBNB quote: paid in BNB unless --use-wbnb
|
|
@@ -94,7 +106,7 @@ gang buyback status|set|set-payee|apply --token 0x… [--pct 0-100] [--to 0x…]
|
|
|
94
106
|
gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90> # 打新: create (dev shares) → bond
|
|
95
107
|
gang execute --request-id <id>
|
|
96
108
|
gang tx --pending # trades approved in the Binance App: found by the exact call previewed, then as below
|
|
97
|
-
gang tx --hash <0x..> [--testnet] # V2 / Soft and
|
|
109
|
+
gang tx --hash <0x..> [--testnet] # V2 / Soft, GangLaunchpad and GangFlywheelPad events (units "raw", amounts in wei)
|
|
98
110
|
```
|
|
99
111
|
|
|
100
112
|
### Logo + create
|
|
@@ -262,9 +274,10 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
|
|
|
262
274
|
| `GANG_UPDATE_URL` | Where that check asks, default `https://registry.npmjs.org/@gangfun/cli/latest`; set an npm mirror's `…/@gangfun/cli/latest` if npmjs is slow or blocked |
|
|
263
275
|
| `GANG_PAD` / `GANG_TESTNET_PAD` | Override the merged GangLaunchpad (mainnet / testnet) behind V3 and 打新 (defaults: mainnet `0x15CF…4365`, testnet set 10 `0xFebF…5BB1`). Old names `GANG_V3_PAD` / `GANG_FAIR_PAD`, `GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` still work as aliases |
|
|
264
276
|
| `GANG_TESTNET_RPC_URL` | Testnet RPC, one URL or a comma list (unset: PublicNode, then BNB Chain's testnet nodes); old names `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` still work |
|
|
277
|
+
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad (持续打新). Defaults: mainnet `0x631e…B029` (not open yet), testnet set 2 `0xD648…951c` |
|
|
265
278
|
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond (creator bonds, `gang bond`). Defaults: mainnet `0xe92d…14E4` (since 2026-10-29, CLI 0.16.2+), testnet `0xd6a8…1086` |
|
|
266
279
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet `0xE040…79C4`, testnet set 10 `0x6bB6…C9F6` |
|
|
267
280
|
|
|
268
281
|
## Version
|
|
269
282
|
|
|
270
|
-
`0.
|
|
283
|
+
`0.18.0` · 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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
**一个动作一条命令(0.12.0+):** `gang buy` / `sell` / `info` / `status` / `claim` / `mint` / `withdraw` / `release` 对所有币都能用:CLI 先读出这个币的类型,再执行 V3、打新或 V2 / Soft 的逻辑。`gang v3 …` / `gang fair …` 保留为别名。
|
|
8
8
|
|
|
9
|
+
**持续打新(0.18.0+):** `gang create --fly` 在 GangFlywheelPad(单独的发射台,kind 3)上开一场持续打新:按份 mint,每个钱包有额度,邀请可以加额度;打满后按 mint 价开池,开池后还能继续 mint。统一命令会自动识别这类币(`kind: "fly"`),`gang fly …` 是别名。目前只在 BSC 测试网(第 2 套):主网发射台(`0x631e66560F4FAE4e486B65349edE48189E48B029`)要等测试完成后才开放,开放前在主网上 `create --fly` 会直接说明。规则见 `skill/references/fly.md`。
|
|
10
|
+
|
|
9
11
|
**V3 税收币和打新(0.9.0+):** 走 GangLaunchpad,2026-10-27 起在 BSC 主网运行(内盘 `0x15CFD2dc8278Fb87a1783ef42111618E20874365`,GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`,都已内置);`--testnet` 走 BSC 测试网第 10 套。
|
|
10
12
|
|
|
11
13
|
## 安装
|
|
@@ -33,7 +35,7 @@ Skill:`npx skills add gangfun/gang-launchpad/skill`
|
|
|
33
35
|
```bash
|
|
34
36
|
gang version # CLI 版本(也可用 -v、--version),不需要钱包
|
|
35
37
|
gang preflight
|
|
36
|
-
gang hot [--limit 10] [--track all|v3|fair|v2|soft] [--include-graduated] # 按 24h USD 成交量
|
|
38
|
+
gang hot [--limit 10] [--track all|v3|fair|fly|v2|soft] [--include-graduated] # 按 24h USD 成交量
|
|
37
39
|
gang new [--limit 10] [--max-age 2h]
|
|
38
40
|
gang near-grad [--min-pct 50] [--limit 10]
|
|
39
41
|
gang watch [<addr>] [--interval 10] [--events a,b] [--max-events N] [--timeout 30m] [--webhook URL] [--poll]
|
|
@@ -42,7 +44,7 @@ gang watch --notes [--agent a,b] [--min-hit 0.6] [--interval 30] [--events note,
|
|
|
42
44
|
gang agents [--window 1d|7d|30d|all] [--sort score|hitRate|count|follow|followUsd] [--limit 10] # 跟谁
|
|
43
45
|
# 一个动作一条命令,不管币在哪个内盘(0.12.0+):CLI 读 GangLaunchpad 的 kindOf(V3 内盘 / 打新;都不是就走
|
|
44
46
|
# V2 / Soft / U / S),再执行对应的交易。--testnet 走 BSC 测试网第 10 套(只有 GangLaunchpad)
|
|
45
|
-
gang list [--limit 20] [--kind v3|fair [--status …]] # 链上读 V2 / Soft / U / S,每个盘最新 20 个;--kind:从 gang.fun
|
|
47
|
+
gang list [--limit 20] [--kind v3|fair|fly [--status …]] # 链上读 V2 / Soft / U / S,每个盘最新 20 个;--kind v3|fair:从 gang.fun 列,fly:从发射台读
|
|
46
48
|
gang info --token <addr> # 任意内盘的一个币(gang token 是旧名)
|
|
47
49
|
gang status --token <addr> # 我的持仓:余额;V3 分红 / 打新奖励、还能卖多少;poolSellAll
|
|
48
50
|
gang portfolio [--from <addr>] # 全部持仓:余额、价值、成本 / 浮盈、可领、美元;押金
|
|
@@ -55,7 +57,7 @@ gang sell --token <addr> (--amount <枚数> | --all) [--slippage 1] [--to-bnb] [
|
|
|
55
57
|
gang mint --token <addr> --shares <n> [--note …] # 打新填满前:另收该币的打新费(1–3%,归平台、不退)
|
|
56
58
|
gang withdraw --token <addr> (--shares <n> | --all) [--note …] # 打新填满前按打新价卖回
|
|
57
59
|
gang claim --token <addr> # V3:领取分红(以报价币到账);打新:领持有奖励
|
|
58
|
-
gang release --token <addr> # V3
|
|
60
|
+
gang release --token <addr> # V3:补转之前打款失败的税;持续打新:补转欠创建者的 dev 分成 / 税
|
|
59
61
|
gang follow <附言 tx> --amount <n> [--slippage 1] [--note …] # 跟单:买附言里的币,并标明跟的是哪条
|
|
60
62
|
gang upload-logo (--file ./avatar.png | --url <图片地址>)
|
|
61
63
|
# 建币:GangLaunchpad。默认是 V3 币(买 / 卖税各 1–5%,只在外盘收,用报价币打给接收地址:发币人自己,或白名单里的
|
|
@@ -84,7 +86,17 @@ gang buyback status|set|set-payee|apply --token 0x… [--pct 0-100] [--to 0x…]
|
|
|
84
86
|
gang create --fair … [--shares <n>] --bond <数量> [--bond-hold …] --bond-days <7-90> # 打新:发币(含 dev 份额)→ 押金
|
|
85
87
|
gang execute --request-id <id>
|
|
86
88
|
gang tx --pending # 在 Binance App 里批准过的交易:按预览时的调用自动找到交易,再按下面这条处理
|
|
87
|
-
|
|
89
|
+
# 持续打新(GangFlywheelPad;主网发射台开放前只在测试网)。--preset j(默认,J 模板)或 steady,每一项都能单独改:
|
|
90
|
+
# --raise 3-50 --quota 5-100 --invite-bonus 0-3 --max-per-tx 1-10 --hold 60-90 --mint-fee 1-3 --exit-fee 1-2 --dev-cut 0-10
|
|
91
|
+
# --buy-pct 0-50 --sell-tax 1-2 --launch-delay 0-300 --window 300-1800 --cap-mul 1-2 --post-mint|--no-post-mint
|
|
92
|
+
# --tier flat|standard|linear [--step-pct --step-shares --max-mul] --supply-cap 10-500
|
|
93
|
+
gang create --fly --name <n> --symbol <s> [--preset j|steady] [设置…] [--dev-shares 1] [--logo …] [--testnet]
|
|
94
|
+
gang mint --token <addr> --shares <n> [--ref <邀请人>] [--slippage 2] # 开池前按发售价;开池后 mintPost(不低于池子价格)
|
|
95
|
+
gang fly open-early --token <addr> # 创建者,卖出 ≥ 30% 后可提前开池
|
|
96
|
+
gang fly launch --token <addr> # 任何人,到 launchAt 之后
|
|
97
|
+
gang fly invite --token <addr> [--who <addr>] # 邀请链接 https://gang.fun/token/<addr>?ref=<who>、邀请数、加的额度、剩余额度
|
|
98
|
+
# 别名:gang fly <list|info|status|create|mint|withdraw|open-early|launch|invite|buy|sell|claim|release|claim-dev|tx>
|
|
99
|
+
gang tx --hash <0x..> [--testnet] # 解析 V2 / Soft、GangLaunchpad 和 GangFlywheelPad 的事件(带 units "raw",金额是 wei)
|
|
88
100
|
```
|
|
89
101
|
|
|
90
102
|
### Logo + 发币
|
|
@@ -226,9 +238,10 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
226
238
|
| `GANG_UPDATE_URL` | 新版本检查查询的地址,默认 `https://registry.npmjs.org/@gangfun/cli/latest`;npmjs 慢或打不开时,可以换成 npm 镜像的 `…/@gangfun/cli/latest` |
|
|
227
239
|
| `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),V3 和打新共用(默认:主网 `0x15CF…4365`,测试网第 10 套 `0xFebF…5BB1`)。旧名 `GANG_V3_PAD` / `GANG_FAIR_PAD`、`GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` 仍可用(别名) |
|
|
228
240
|
| `GANG_TESTNET_RPC_URL` | 测试网 RPC,可填一个或逗号分隔的多个(不设时先用 PublicNode,再用 BNB Chain 的测试网节点);旧名 `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` 仍可用 |
|
|
241
|
+
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad(持续打新)。默认:主网 `0x631e…B029`(尚未开放),测试网第 2 套 `0xD648…951c` |
|
|
229
242
|
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond(押金承诺,`gang bond`)。默认:主网 `0xe92d…14E4`(2026-10-29 起,CLI 0.16.2+),测试网 `0xd6a8…1086` |
|
|
230
243
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 `0xE040…79C4`,测试网第 10 套 `0x6bB6…C9F6` |
|
|
231
244
|
|
|
232
245
|
## 版本
|
|
233
246
|
|
|
234
|
-
`0.
|
|
247
|
+
`0.18.0` · [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.
|
|
3
|
+
"version": "0.18.0",
|
|
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/baw.js
CHANGED
|
@@ -17,9 +17,30 @@ export function baw(args) {
|
|
|
17
17
|
return JSON.parse(out)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const HINTS = {
|
|
21
|
+
351803: 'risk control refused it: Trade all tokens is off for this wallet, so it may only send whitelisted tokens (turn it on in the Binance App; gang preflight)',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* baw's error ({ code, name, message }) → the fields a gang result prints: error as text, like every other gang error,
|
|
26
|
+
* and baw's code next to it.
|
|
27
|
+
*/
|
|
28
|
+
export function bawError(e) {
|
|
29
|
+
if (e == null || typeof e !== 'object') return { error: String(e ?? 'baw failed') }
|
|
30
|
+
return {
|
|
31
|
+
error: e.message || JSON.stringify(e),
|
|
32
|
+
...(e.code != null && { code: e.code }), ...(e.name && { errorName: e.name }),
|
|
33
|
+
...(HINTS[e.code] && { hint: HINTS[e.code] }),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export const bawFailed = (what, e) => {
|
|
37
|
+
const b = bawError(e)
|
|
38
|
+
return new Error(`baw ${what} failed: ${b.error}${b.code != null ? ` (code ${b.code})` : ''}`)
|
|
39
|
+
}
|
|
40
|
+
|
|
20
41
|
export function bawAddress(chainId = '56') {
|
|
21
42
|
const r = baw(['wallet', 'address'])
|
|
22
|
-
if (!r.success) throw
|
|
43
|
+
if (!r.success) throw bawFailed('wallet address', r.error)
|
|
23
44
|
const a = r.data.addresses.find((x) => x.binanceChainId === chainId)
|
|
24
45
|
if (!a) throw new Error(`Agentic Wallet has no address on chain ${chainId}`)
|
|
25
46
|
return a.address
|
|
@@ -27,7 +48,7 @@ export function bawAddress(chainId = '56') {
|
|
|
27
48
|
|
|
28
49
|
export function bawSettings() {
|
|
29
50
|
const r = baw(['wallet', 'settings'])
|
|
30
|
-
if (!r.success) throw
|
|
51
|
+
if (!r.success) throw bawFailed('wallet settings', r.error)
|
|
31
52
|
return r.data
|
|
32
53
|
}
|
|
33
54
|
|
|
@@ -36,9 +57,13 @@ export function bawStatus() {
|
|
|
36
57
|
return r.success ? r.data.status : 'UNCONNECTED'
|
|
37
58
|
}
|
|
38
59
|
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Preview an external contract call through Binance's risk engine. gasLimit: only where the CLI knows the call needs more
|
|
62
|
+
* than an estimate (baw simulates with it as the cap and sends it as is); otherwise baw estimates.
|
|
63
|
+
*/
|
|
64
|
+
export function bawPreview({ from, to, value = 0n, data = '0x', chainId = '56', gasLimit = null }) {
|
|
65
|
+
const p = baw(['contract-call', 'preview', '--binanceChainId', chainId, '--from', from, '--to', to, '--value', value.toString(), '--inputData', data,
|
|
66
|
+
...(gasLimit ? ['--gasLimit', String(gasLimit)] : [])])
|
|
42
67
|
// what this preview will send, so `gang tx --pending` can tell its tx once the user approves it in the App
|
|
43
68
|
if (p?.success && p.data?.requestId) rememberPreview(p.data.requestId, { print: callPrint(to, data), chainId: String(chainId) })
|
|
44
69
|
return p
|
package/src/discover.js
CHANGED
|
@@ -59,18 +59,20 @@ export function parseDuration(raw, name) {
|
|
|
59
59
|
const WBNB = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'
|
|
60
60
|
// BSC USDT / USDC: $1 when no V2 row prices them
|
|
61
61
|
const STABLES = ['0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d']
|
|
62
|
-
const TRACKS = ['all', 'v3', 'fair', 'v2', 'soft']
|
|
62
|
+
const TRACKS = ['all', 'v3', 'fair', 'fly', 'v2', 'soft']
|
|
63
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' }
|
|
64
|
+
const DETAIL = { v2: '/tokens', soft: '/tokens', v3: '/v3/tokens', fair: '/fair/sales', fly: '/fly/tokens' }
|
|
65
|
+
const TRADES = { v2: '/stocks/tokens', soft: '/tokens', v3: '/v3/tokens', fair: '/fair/sales', fly: '/fly/tokens' }
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* GangLaunchpad rows: `v3` = V3 curves (/v3/tokens), `fair` = 打新 sales (/fair/sales; `graduated` = launched)
|
|
68
|
+
* GangLaunchpad rows: `v3` = V3 curves (/v3/tokens), `fair` = 打新 sales (/fair/sales; `graduated` = launched); GangFlywheelPad
|
|
69
|
+
* rows: `fly` = 持续打新 sales (/fly/tokens, shaped like the 打新 rows; launched ones may still mint).
|
|
69
70
|
* List rows carry raw wei and no USD; details (/…/<addr>) carry human amounts and USD like the V2 rows.
|
|
70
71
|
* `quoteUsdOf(quoteAddress)` prices a list row's quote (from the V2 / Soft rows), null when unknown.
|
|
71
72
|
*/
|
|
72
73
|
function gangRow(r, quoteUsdOf) {
|
|
73
|
-
|
|
74
|
+
// a 持续打新 row reads like a 打新 one (sharePrice = basePrice, raiseQuote, sold of 10,000)
|
|
75
|
+
const fair = r.track === 'fair' || r.track === 'fly'
|
|
74
76
|
const dec = r.quoteDecimals ?? 18
|
|
75
77
|
const w = (v) => num(v) / 10 ** dec
|
|
76
78
|
const detail = r.raisedQuote != null
|
|
@@ -92,6 +94,7 @@ function gangRow(r, quoteUsdOf) {
|
|
|
92
94
|
volume24hUsd: inUsd('volume24hUsd', 'volume24hQuote'), trades24h: num(r.trades24h), trades: num(r.trades),
|
|
93
95
|
holders: r.holders != null ? num(r.holders) : fair ? num(r.participants) : null,
|
|
94
96
|
...(fair && { sharePrice: w(r.sharePrice), sharesLeft: num(r.sharesLeft), minWalletsLeft: num(r.minWalletsLeft) }),
|
|
97
|
+
...(r.track === 'fly' && { status: r.status ?? null, postMint: !!r.postMint, baseQuota: num(r.baseQuota), inviteBonus: num(r.inviteBonus) }),
|
|
95
98
|
createdAt: r.createdAt, ageMin: r.createdAt ? Math.floor((now() - r.createdAt) / 60) : null,
|
|
96
99
|
lastTradeAt: r.lastTradeAt || r.lastActivityAt || null, creatorHandle: r.creatorHandle || null, logoUrl: r.logoUrl || null,
|
|
97
100
|
website: r.website && !websiteError(r.website) ? r.website : null,
|
|
@@ -104,7 +107,7 @@ function gangRow(r, quoteUsdOf) {
|
|
|
104
107
|
* LaunchpadV2 family), `soft` = legacy BNB curve (/tokens, 20 BNB graduation). Amounts are human units of `quote`.
|
|
105
108
|
*/
|
|
106
109
|
export function normalize(r, quoteUsdOf = () => null) {
|
|
107
|
-
if (r.track === 'v3' || r.track === 'fair') return gangRow(r, quoteUsdOf)
|
|
110
|
+
if (r.track === 'v3' || r.track === 'fair' || r.track === 'fly') return gangRow(r, quoteUsdOf)
|
|
108
111
|
const v2 = r.track === 'stocks'
|
|
109
112
|
const quote = v2 ? (r.quoteSymbol || '?') : 'BNB'
|
|
110
113
|
const raised = v2 ? num(r.raisedQuote) : num(r.raisedBnb)
|
|
@@ -148,11 +151,13 @@ export async function fetchMarket(track = 'all', stop) {
|
|
|
148
151
|
const want = (t) => track === 'all' || track === t
|
|
149
152
|
// the GangLaunchpad list rows have no USD: the V2 / Soft rows price their quotes. A track not listed is read for that
|
|
150
153
|
// only, one page and best effort: no truncation, and a failure just leaves the USD fields null
|
|
151
|
-
const priced = want('v3') || want('fair')
|
|
154
|
+
const priced = want('v3') || want('fair') || want('fly')
|
|
152
155
|
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([
|
|
156
|
+
const [v3, fair, fly, v2, soft] = await Promise.all([
|
|
154
157
|
want('v3') ? pages('/v3/tokens?status=all', stop) : none,
|
|
155
158
|
want('fair') ? pages('/fair/sales?status=all', stop) : none,
|
|
159
|
+
// 持续打新 (2026-10-30): a server without the route yet lists none, unless --track fly asked for it alone
|
|
160
|
+
want('fly') ? pages('/fly/tokens?status=all', stop).catch((e) => (track === 'fly' ? Promise.reject(e) : none)) : none,
|
|
156
161
|
want('v2') ? pages('/stocks/tokens', stop) : priced ? prices('/stocks/tokens') : none,
|
|
157
162
|
want('soft') ? pages('/tokens?sort=new', stop) : priced ? prices('/tokens?sort=new') : none,
|
|
158
163
|
])
|
|
@@ -163,17 +168,22 @@ export async function fetchMarket(track = 'all', stop) {
|
|
|
163
168
|
for (const a of STABLES) if (!usdOf.has(a)) usdOf.set(a, 1)
|
|
164
169
|
const quoteUsdOf = (a) => (a ? usdOf.get(a.toLowerCase()) ?? null : null)
|
|
165
170
|
const seen = new Map()
|
|
166
|
-
const rows = [...v3.rows, ...fair.rows, ...(want('v2') ? v2.rows : []), ...(want('soft') ? soft.rows : [])]
|
|
171
|
+
const rows = [...v3.rows, ...fair.rows, ...fly.rows, ...(want('v2') ? v2.rows : []), ...(want('soft') ? soft.rows : [])]
|
|
167
172
|
for (const r of rows) {
|
|
168
173
|
const t = normalize(r, quoteUsdOf)
|
|
169
174
|
if (!seen.has(t.address)) seen.set(t.address, t)
|
|
170
175
|
}
|
|
171
|
-
return { tokens: [...seen.values()], truncated: [v3, fair, v2, soft].some((p) => p.truncated) }
|
|
176
|
+
return { tokens: [...seen.values()], truncated: [v3, fair, fly, v2, soft].some((p) => p.truncated) }
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
/** The command that acts on a token next: quote / preview a buy (no tx is sent before `gang execute`). */
|
|
175
180
|
const hint = (t) => {
|
|
176
181
|
const amount = `--amount <amount in ${t.quote}>`
|
|
182
|
+
// 持续打新: minting before launch, and after it while the server's postMint flag is on (gang mint picks the post-launch
|
|
183
|
+
// mint); a filled sale waits for its launch, a refund-only one only sells back
|
|
184
|
+
if (t.track === 'fly' && t.status === 'filled') return `gang info --token ${t.address}`
|
|
185
|
+
if (t.track === 'fly' && t.status === 'refund') return `gang withdraw --token ${t.address} --all`
|
|
186
|
+
if (t.track === 'fly' && (!t.graduated || t.postMint)) return `gang mint --token ${t.address} --shares <n>`
|
|
177
187
|
if (t.graduated) return `gang buy --token ${t.address} ${amount}` // the PancakeSwap pool, through GangRouter
|
|
178
188
|
if (t.track === 'fair') return `gang mint --token ${t.address} --shares <n>`
|
|
179
189
|
if (t.track === 'v3') return `gang buy --token ${t.address} ${amount}`
|
|
@@ -202,7 +212,7 @@ export function rank(tokens, sort, { limit = 10, minPct = 50, maxAgeSec = null,
|
|
|
202
212
|
/** One token's detail. `track` known (later polls): its own route; else each route in turn. */
|
|
203
213
|
async function tokenDetail(addr, stop, track) {
|
|
204
214
|
const a = addr.toLowerCase()
|
|
205
|
-
for (const base of track ? [DETAIL[track]] : ['/tokens', '/v3/tokens', '/fair/sales']) {
|
|
215
|
+
for (const base of track ? [DETAIL[track]] : ['/tokens', '/v3/tokens', '/fair/sales', '/fly/tokens']) {
|
|
206
216
|
const r = await get(`${base}/${a}`, stop)
|
|
207
217
|
if (r) return normalize(r)
|
|
208
218
|
}
|