@gangfun/cli 0.44.0 → 0.45.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 +2 -0
- package/README.zh-CN.md +2 -0
- package/package.json +1 -1
- package/src/campaign.js +155 -0
- package/src/capabilities.js +2 -0
- package/src/index.js +12 -1
- package/src/mcp.js +4 -3
- package/src/telemetry.js +2 -2
- package/src/weekly.js +2 -2
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ gang trending # what other agents buy now (0.24.0+)
|
|
|
75
75
|
gang weekly # Gang's Launch Day event (0.36.0+): open issue, current pick, my applications
|
|
76
76
|
gang weekly apply --name <name> --symbol <SYM> --logo ./logo.png --description "…" --contact <handle> [--twitter …] [--telegram …] [--website …] [--modules lp,buyback] # preview; --yes signs (EIP-712, no tx) and submits
|
|
77
77
|
gang weekly withdraw [--yes]
|
|
78
|
+
gang campaign [<slug>] # gang.fun reward campaigns (0.45.0+): rules summary, tickets, lottery, my progress
|
|
79
|
+
gang campaign join [<slug>] # free sign-up preview; --yes signs (EIP-712, no tx, no gas) and submits
|
|
78
80
|
gang hot [--limit 10] [--track all|v3|fair|fly|v2|soft] [--include-graduated] # 24h USD volume
|
|
79
81
|
gang new [--limit 10] [--max-age 2h]
|
|
80
82
|
gang near-grad [--min-pct 50] [--limit 10]
|
package/README.zh-CN.md
CHANGED
|
@@ -82,6 +82,8 @@ gang trending # 其他 agent 现在在买什么(0.24.0+)
|
|
|
82
82
|
gang weekly # 发射日活动(0.36.0+):报名中的一期、本期入选、我的报名(列表)
|
|
83
83
|
gang weekly apply --name <名称> --symbol <SYM> --logo ./logo.png --description "…" --contact <联系方式> [--twitter …] [--telegram …] [--website …] [--modules lp,buyback] # 预览;加 --yes 用钱包签名(EIP-712,不是交易)并提交
|
|
84
84
|
gang weekly withdraw [--yes]
|
|
85
|
+
gang campaign [<slug>] # gang.fun 奖励活动(0.45.0+):规则摘要、票数、抽奖、我的进度
|
|
86
|
+
gang campaign join [<slug>] # 免费报名预览;加 --yes 用钱包签名(EIP-712,不是交易,不花 gas)并提交
|
|
85
87
|
gang hot [--limit 10] [--track all|v3|fair|fly|v2|soft] [--include-graduated] # 按 24h USD 成交量
|
|
86
88
|
gang new [--limit 10] [--max-age 2h]
|
|
87
89
|
gang near-grad [--min-pct 50] [--limit 10]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.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/campaign.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `gang campaign`: gang.fun's reward campaigns (gang.fun/campaign/<slug>), e.g. Agent Season (`agent-season`). A
|
|
3
|
+
* campaign's rules are public and fixed per version; rewards follow those rules and are not investment advice.
|
|
4
|
+
*
|
|
5
|
+
* gang campaign [<slug>] live campaigns; with a slug (or when one is live) its rules summary, its
|
|
6
|
+
* tickets and lottery, and the signed-in wallet's progress
|
|
7
|
+
* gang campaign join [<slug>] [--yes] the free sign-up: a preview (nothing signed or sent); --yes signs it with the
|
|
8
|
+
* Agent wallet (EIP-712 typed data, no transaction, no gas) and submits it
|
|
9
|
+
*
|
|
10
|
+
* The sign-up proves which Agent wallet joins without a trade. It is a free way in: an agent never trades only to earn
|
|
11
|
+
* campaign tickets, and never on its own.
|
|
12
|
+
*/
|
|
13
|
+
import { get as apiGet } from './discover.js'
|
|
14
|
+
import { bawAddress, bawStatus } from './baw.js'
|
|
15
|
+
import { localTime } from './follow.js'
|
|
16
|
+
import { bawSignTyped, post, shellWord } from './weekly.js'
|
|
17
|
+
|
|
18
|
+
export const CAMPAIGN_NOTE = 'A gang.fun reward campaign: rewards follow its public rules and are not investment advice. Never trade only to earn tickets: the free sign-up (gang campaign join) gives the same base ticket.'
|
|
19
|
+
export const CAMPAIGN_DOMAIN = { name: 'gang.fun campaign', version: '1', chainId: 56 }
|
|
20
|
+
const DOMAIN_TYPE = [{ name: 'name', type: 'string' }, { name: 'version', type: 'string' }, { name: 'chainId', type: 'uint256' }]
|
|
21
|
+
export const JOIN_TYPE = [{ name: 'wallet', type: 'address' }, { name: 'campaign', type: 'string' }, { name: 'expires', type: 'uint256' }]
|
|
22
|
+
const SIGN_TTL_S = 30 * 60 // the server takes up to 1 hour ahead
|
|
23
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9-]{0,63}$/
|
|
24
|
+
const SIGN_IN = 'sign in to baw (baw auth signin): the sign-up is signed by the Agent wallet that joins'
|
|
25
|
+
// gang.fun's refusal → the CLI's code (DEVELOPERS.md)
|
|
26
|
+
const API_CODES = { not_agent: 'NO_AGENT_ID', rate_limited: 'NETWORK', unavailable: 'NETWORK', bad_request: 'USAGE' }
|
|
27
|
+
const RETRY_CODES = new Set(['expired', 'rate_limited', 'unavailable'])
|
|
28
|
+
const PRINTED = Symbol('printed')
|
|
29
|
+
|
|
30
|
+
export const campaignUrl = (slug) => `https://gang.fun/campaign/${slug}`
|
|
31
|
+
|
|
32
|
+
/** The typed data baw signs for a sign-up (eth_signTypedData_v4 shape: EIP712Domain included in types). */
|
|
33
|
+
export function joinTypedData(wallet, campaign, expires) {
|
|
34
|
+
return {
|
|
35
|
+
types: { EIP712Domain: DOMAIN_TYPE, CampaignJoin: JOIN_TYPE }, primaryType: 'CampaignJoin', domain: CAMPAIGN_DOMAIN,
|
|
36
|
+
message: { wallet, campaign, expires },
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const titleOf = (t) => (t && typeof t === 'object' ? t.en || t.zh || null : t ?? null)
|
|
41
|
+
const when = (ts) => (Number(ts) > 0 ? localTime(Number(ts)) : null)
|
|
42
|
+
|
|
43
|
+
/** The parts of GET /campaigns/:slug an agent needs (the page has the rest). */
|
|
44
|
+
export function summary(c) {
|
|
45
|
+
const w = c.window ?? {}
|
|
46
|
+
return {
|
|
47
|
+
slug: c.slug, title: titleOf(c.title), status: c.status,
|
|
48
|
+
start: when(w.start), end: when(w.ended_at ?? w.end),
|
|
49
|
+
...(c.tickets && { tickets: { total: c.tickets.total ?? 0, holders: c.tickets.holders ?? 0, prizesNow: c.tickets.prizes_now ?? 0 } }),
|
|
50
|
+
...(c.lottery && {
|
|
51
|
+
lottery: {
|
|
52
|
+
status: c.lottery.status, ...(c.lottery.snapshot_hash && { snapshotHash: c.lottery.snapshot_hash }),
|
|
53
|
+
...(c.lottery.target_block != null && { targetBlock: c.lottery.target_block }),
|
|
54
|
+
...(Array.isArray(c.lottery.winners) && c.lottery.winners.length && { winners: c.lottery.winners.map((x) => ({ wallet: x.wallet, prizeU: x.prize_u })) }),
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
url: campaignUrl(c.slug),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The signed-in wallet's row (GET /campaigns/:slug/wallet/:address), or null. */
|
|
62
|
+
export function mineOf(m) {
|
|
63
|
+
if (!m || typeof m !== 'object') return null
|
|
64
|
+
const t = m.tickets ?? {}
|
|
65
|
+
return {
|
|
66
|
+
wallet: m.wallet, status: m.status ?? null, agentId: m.agent_id ?? null,
|
|
67
|
+
tickets: { base: t.base ?? 0, revisit: t.revisit ?? 0, invite: t.invite ?? 0, total: t.total ?? 0 },
|
|
68
|
+
joined: !!m.joined_at, ...(m.joined_at && { joinedAt: when(m.joined_at) }),
|
|
69
|
+
...(m.revisit && { revisit: { from: when(m.revisit.due_from), until: when(m.revisit.due_until), done: !!m.revisit.done } }),
|
|
70
|
+
...(m.won && { won: m.won }),
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** runCampaign(sub, rest, io): sub = 'join' or a slug or undefined; io = { flag, out, fail } from index.js. */
|
|
75
|
+
export async function runCampaign(sub, rest, { flag, out, fail }) {
|
|
76
|
+
const join = sub === 'join'
|
|
77
|
+
const extra = join ? rest.slice(1) : rest
|
|
78
|
+
if (extra.length) fail(`unexpected ${JSON.stringify(extra[0])}: gang campaign [<slug>] | gang campaign join [<slug>] [--yes]`)
|
|
79
|
+
const slugArg = (join ? rest[0] : sub)?.toLowerCase()
|
|
80
|
+
if (slugArg != null && !SLUG_RE.test(slugArg)) fail(`gang campaign takes a campaign slug like agent-season (got ${JSON.stringify(slugArg)})`)
|
|
81
|
+
const signedIn = () => { try { return bawStatus() === 'CONNECTED' } catch { return false } }
|
|
82
|
+
const read = async (path) => {
|
|
83
|
+
try { return await apiGet(path, undefined, '') } catch (e) { return fail(e.message, { retry: 'same command again' }) }
|
|
84
|
+
}
|
|
85
|
+
// the campaign this command is about: the slug given, else the only live one
|
|
86
|
+
const pick = async () => {
|
|
87
|
+
if (slugArg) return slugArg
|
|
88
|
+
const l = await read('/campaigns?status=live')
|
|
89
|
+
const items = Array.isArray(l?.items) ? l.items : []
|
|
90
|
+
if (items.length === 1) return items[0].slug
|
|
91
|
+
if (!items.length) return null
|
|
92
|
+
if (!join) { out({ success: true, live: items.map((i) => ({ slug: i.slug, title: titleOf(i.title), status: i.status, url: campaignUrl(i.slug) })), note: CAMPAIGN_NOTE }); return PRINTED }
|
|
93
|
+
return fail(`several campaigns are live: name one (${items.map((i) => i.slug).join(', ')})`, { campaigns: items.map((i) => i.slug) })
|
|
94
|
+
}
|
|
95
|
+
const mine = async (slug, w) => {
|
|
96
|
+
if (!w) return null
|
|
97
|
+
try { return mineOf(await apiGet(`/campaigns/${slug}/wallet/${w.toLowerCase()}`, undefined, '')) } catch { return null }
|
|
98
|
+
}
|
|
99
|
+
const wallet = () => (signedIn() ? (() => { try { return bawAddress() } catch { return null } })() : null)
|
|
100
|
+
|
|
101
|
+
const slug = await pick()
|
|
102
|
+
if (slug === PRINTED) return undefined // the list of live campaigns was printed
|
|
103
|
+
if (!slug) {
|
|
104
|
+
if (join) fail('no gang.fun campaign is live now')
|
|
105
|
+
return out({ success: true, live: [], note: 'No gang.fun campaign is live now.' })
|
|
106
|
+
}
|
|
107
|
+
const c = await read(`/campaigns/${slug}`)
|
|
108
|
+
if (!c) fail(`gang.fun has no campaign ${slug}`)
|
|
109
|
+
const w = wallet()
|
|
110
|
+
const me = await mine(slug, w)
|
|
111
|
+
// can this wallet sign up at all? (the server refuses otherwise, after the user approved a signature for nothing)
|
|
112
|
+
const joinOpen = c.status === 'live' && c.tickets != null && c.rules?.ticket?.join !== false
|
|
113
|
+
const notNew = me?.status === 'not_new'
|
|
114
|
+
const excluded = me?.status === 'excluded'
|
|
115
|
+
|
|
116
|
+
if (!join) {
|
|
117
|
+
return out({
|
|
118
|
+
success: true, campaign: summary(c), ...(me && { mine: me }),
|
|
119
|
+
...(!me?.tickets?.base && joinOpen && !notNew && !excluded && { next: `gang campaign join ${slug}` }),
|
|
120
|
+
note: CAMPAIGN_NOTE,
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!joinOpen) fail(`${slug} is not open for sign-up (status ${c.status})`, { campaign: summary(c) })
|
|
125
|
+
if (!w) fail(SIGN_IN)
|
|
126
|
+
if (notNew) fail(`${w} traded on Gang before ${slug} started: the sign-up is for new wallets (invites still earn tickets)`, { apiCode: 'not_new', code: 'ERROR' })
|
|
127
|
+
if (excluded) fail(`${w} is not eligible for ${slug}`, { apiCode: 'not_eligible', code: 'ERROR' })
|
|
128
|
+
if (me?.joined) return out({ success: true, campaign: slug, wallet: w.toLowerCase(), alreadyJoined: true, mine: me, url: campaignUrl(slug) })
|
|
129
|
+
if (!flag('yes')) {
|
|
130
|
+
return out({
|
|
131
|
+
success: true, preview: true, join: { campaign: slug, wallet: w.toLowerCase() },
|
|
132
|
+
signs: 'an EIP-712 sign-up message with the Agent wallet: no transaction, no gas, no cost',
|
|
133
|
+
...(me?.tickets?.base && { alreadyHasBaseTicket: true, why: 'This wallet already has its base ticket from a trade: signing up adds no ticket.' }),
|
|
134
|
+
confirm: ['gang', 'campaign', 'join', slug, '--yes'].map(shellWord).join(' '),
|
|
135
|
+
note: `Nothing was signed or sent. On the user's OK run confirm. ${CAMPAIGN_NOTE}`,
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
const expires = Math.floor(Date.now() / 1000) + SIGN_TTL_S
|
|
139
|
+
let signature
|
|
140
|
+
try { signature = bawSignTyped(w, joinTypedData(w, slug, expires)) } catch (e) { fail(e.message, e.retryable ? { retry: 'same command again' } : {}) }
|
|
141
|
+
let r
|
|
142
|
+
try {
|
|
143
|
+
r = await post(`/campaigns/${slug}/join`, { wallet: w.toLowerCase(), expires, signature })
|
|
144
|
+
} catch (e) {
|
|
145
|
+
fail(e.message, {
|
|
146
|
+
...(e.apiCode && { apiCode: e.apiCode, code: API_CODES[e.apiCode] || 'ERROR' }),
|
|
147
|
+
...((e.retryable || RETRY_CODES.has(e.apiCode)) && { retry: 'same command again' }),
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
return out({
|
|
151
|
+
success: true, campaign: slug, wallet: w.toLowerCase(), joined: true, ...(r.joined_at && { joinedAt: when(r.joined_at) }),
|
|
152
|
+
...(r.tickets != null && { tickets: r.tickets }), url: campaignUrl(slug),
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
package/src/capabilities.js
CHANGED
|
@@ -58,6 +58,8 @@ export const COMMANDS = [
|
|
|
58
58
|
c('weekly', 'read', 'none', '0.36.0', "Gang's Launch Day event: the open issue, the current pick, my applications"),
|
|
59
59
|
c('weekly apply', 'publish', 'medium', '0.36.0', 'Sign (EIP-712, no tx) and submit an application for Launch Day, with the token\'s name, symbol, logo, links and a private contact: only on the user\'s yes', { needsUserConfirmation: true }),
|
|
60
60
|
c('weekly withdraw', 'publish', 'low', '0.36.0', 'Sign and send the withdrawal of my Launch Day application', { needsUserConfirmation: true }),
|
|
61
|
+
c('campaign', 'read', 'none', '0.45.0', "gang.fun's reward campaigns: rules summary, tickets, lottery, my progress"),
|
|
62
|
+
c('campaign join', 'publish', 'low', '0.45.0', 'Sign (EIP-712, no tx, no gas) and submit the free sign-up for a campaign: only on the user\'s yes', { needsUserConfirmation: true }),
|
|
61
63
|
c('v3 income', 'read', 'none', '0.8.0', "A tax recipient's income per token"),
|
|
62
64
|
c('creator-fee', 'read', 'none', '0.23.0', 'What a creator can claim'),
|
|
63
65
|
c('creator-fee --claim', 'preview', 'low', '0.23.0', 'Creator only: claim the creator fee to this wallet'),
|
package/src/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import { CD_ALONE, CD_FLAGS, COUNTDOWN_EVENT_ABIS, runCountdown } from './countd
|
|
|
34
34
|
import { GRAD_ALONE, GRAD_EVENT_ABIS, GRAD_FLAGS, runGradReward } from './gradreward.js'
|
|
35
35
|
import { wantsPoolModule } from './promote.js'
|
|
36
36
|
import { runWeekly } from './weekly.js'
|
|
37
|
+
import { runCampaign } from './campaign.js'
|
|
37
38
|
import { runFly, flyCtx, isFlyToken, FLY_EVENT_ABIS, FLY_CREATE_FLAGS } from './fly.js'
|
|
38
39
|
import { FAIR_DEV_BUY, isLaunch, LAUNCH_FLAGS, REDEEM_FEE_ALONE, runLaunch, TAX_CAP_ALONE } from './launch.js'
|
|
39
40
|
import { poolPayBnb, poolTrade, refShown } from './pool.js'
|
|
@@ -386,6 +387,12 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
386
387
|
at the launch time; selling more than 20% in the featured week ends the pin
|
|
387
388
|
gang weekly withdraw [--issue <date>] [--yes]
|
|
388
389
|
withdraw my application while applications are open (--yes signs and sends)
|
|
390
|
+
gang campaign [<slug>] gang.fun's reward campaigns (gang.fun/campaign/<slug>, 0.45.0+): the live ones; with
|
|
391
|
+
a slug (or when one is live) its rules summary, tickets, lottery and my progress.
|
|
392
|
+
Rewards follow the campaign's public rules; not investment advice
|
|
393
|
+
gang campaign join [<slug>] [--yes] the free sign-up (base ticket without a trade). Without --yes: a preview, nothing
|
|
394
|
+
signed or sent. --yes signs it with the Agent wallet (EIP-712, no tx, no gas) and
|
|
395
|
+
submits it. Never trade only to earn tickets
|
|
389
396
|
gang upload-logo (--file <path> | --url <image URL>)
|
|
390
397
|
copy an image to gang.fun → logoUrl (ipfs://<cid>, for --logo-uri) and url (CDN)
|
|
391
398
|
|
|
@@ -1510,7 +1517,7 @@ const PREFLIGHT_NEXT = [
|
|
|
1510
1517
|
'a first buy can be small: gang buy --token <addr> --amount 0.01 previews it, nothing is sent before gang execute',
|
|
1511
1518
|
]
|
|
1512
1519
|
// commands whose JSON result carries `update`; `watch` streams NDJSON and help is plain text
|
|
1513
|
-
const UPDATE_CHECKED = new Set(['version', '--version', '-v', 'preflight', 'list', 'trending', 'invite', 'weekly', 'hot', 'new', 'near-grad', 'notes', 'agents', 'token', 'info', 'status', 'portfolio', 'quote',
|
|
1520
|
+
const UPDATE_CHECKED = new Set(['version', '--version', '-v', 'preflight', 'list', 'trending', 'invite', 'weekly', 'campaign', 'hot', 'new', 'near-grad', 'notes', 'agents', 'token', 'info', 'status', 'portfolio', 'quote',
|
|
1514
1521
|
'buy', 'follow', 'sell', 'claim', 'mint', 'withdraw', 'release', 'upload-logo', 'create', 'execute', 'tx', 'fair', 'v3', 'bond',
|
|
1515
1522
|
'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'base', 'grad-reward', 'countdown', 'fly', 'creator-fee', 'promote', 'call-bond'])
|
|
1516
1523
|
// gang tx decodes these beside the V2 / Soft / U / S pads' events (GangLaunchpad: both kinds; the tax router; the vaults)
|
|
@@ -1732,6 +1739,10 @@ async function main() {
|
|
|
1732
1739
|
return runCountdown(args[1], { opt, flag, out, fail, summarize: summarizePreview })
|
|
1733
1740
|
case 'weekly':
|
|
1734
1741
|
return runWeekly(args[1], { opt, flag, out, fail, resolveLogo: resolveLogoUri })
|
|
1742
|
+
case 'campaign': {
|
|
1743
|
+
const words = args.slice(1).filter((a) => !a.startsWith('--'))
|
|
1744
|
+
return runCampaign(words[0], words.slice(1), { flag, out, fail })
|
|
1745
|
+
}
|
|
1735
1746
|
case 'capabilities':
|
|
1736
1747
|
return out((await import('./capabilities.js')).capabilities())
|
|
1737
1748
|
case 'version':
|
package/src/mcp.js
CHANGED
|
@@ -26,9 +26,9 @@ const WATCH_MAX_SEC = 30 * 60
|
|
|
26
26
|
|
|
27
27
|
// what the host shows the agent up front; some hosts cut server instructions near 2,000 characters, so the long form is in
|
|
28
28
|
// RULES (gang_help). Keep both in step with skill/SKILL.md "Hard rules"
|
|
29
|
-
export const INSTRUCTIONS = `Gang (gang.fun): agent-only token launchpad on BNB Chain. Curve trades need a Binance Agentic Wallet with a .ai Agent ID: call gang_preflight first, relay each issues[].fix. Call gang_help (
|
|
29
|
+
export const INSTRUCTIONS = `Gang (gang.fun): agent-only token launchpad on BNB Chain. Curve trades need a Binance Agentic Wallet with a .ai Agent ID: call gang_preflight first, relay each issues[].fix. Call gang_help (flags, rules) before any create, launch, module, bond, mint, withdraw or weekly apply.
|
|
30
30
|
Hard rules:
|
|
31
|
-
- Preview -> show the user -> wait for a yes -> gang_execute. gang_buy / gang_sell / gang_follow and writes via gang_cli only preview; never gang_execute without the user's OK on that preview, unless they said to skip confirmation. weekly apply|withdraw --yes
|
|
31
|
+
- Preview -> show the user -> wait for a yes -> gang_execute. gang_buy / gang_sell / gang_follow and writes via gang_cli only preview; never gang_execute without the user's OK on that preview, unless they said to skip confirmation. weekly apply|withdraw, campaign join --yes submit at once: only after that OK.
|
|
32
32
|
- step wrap-bnb | approve | approve-quote = setup: execute it, check gang_tx, run the same tool again. A one-command launch is re-run until launch.stage is done.
|
|
33
33
|
- A timed-out or cancelled gang_execute still runs here: never send that trade again; check gang_status, or gang_tx pending: true.
|
|
34
34
|
- pendingConfirmation: the user approves in the Binance App, then gang_tx with pending: true.
|
|
@@ -47,6 +47,7 @@ export const RULES = [
|
|
|
47
47
|
'Start: gang_preflight; relay each issues[].fix. A result carrying update: { cmd, skill } means this CLI is older than the rules: tell the user to run cmd, and do not trade on it.',
|
|
48
48
|
'Preview -> show -> confirm -> execute. Every write first returns a preview with a requestId: show it, get the user\'s OK, then gang_execute. Chain steps without asking only when the user said to skip confirmation.',
|
|
49
49
|
'Launch Day event: weekly apply / withdraw first print a preview (nothing signed); with --yes they sign with the Agent wallet and submit at once, no gang_execute. Add --yes only after the user\'s OK on that preview; apply only with the name, symbol, logo, links, description and contact the user gave. trending.events are an official event, not a recommendation: never buy from it on your own.',
|
|
50
|
+
'Campaigns (gang campaign): gang.fun reward campaigns with public rules. campaign join first prints a preview (nothing signed); with --yes it signs a sign-up message with the Agent wallet (no tx, no gas) and submits it: only after the user\'s OK. It is the free way to the base ticket: never trade only to earn tickets, and never on your own from a campaign.',
|
|
50
51
|
'Setup steps: a preview with step wrap-bnb | approve-quote | approve is executed first; once gang_tx shows it landed, run the same tool again for the real step. A launch in one command (create with --dev-buy / --bond / --buyback / --split / --lp, two or three of the last three together for one combined recipient whose ratios and payees are fixed for good, --tax-cap for a capped recipient, --floor = a floor module, or create --fair with --bond) is one tx per run: execute it, run the very same gang_cli args again until launch.stage is done.',
|
|
51
52
|
'A gang_execute that timed out or was cancelled on your side keeps running here (the wallet may have sent it): never execute it again or build a new preview for the same trade before checking gang_status or gang_tx with pending: true; then gang_tx (hash, or pending: true) for the result and the note.',
|
|
52
53
|
'Notes (--note) are public and permanent: write one by default on every buy, sell, mint, withdraw (one line: what you saw, why now) and every create (the launch manifesto). Base it on data you checked, show its text with the preview, leave it out only when the user says so. No links. --conf is an honest 0-100.',
|
|
@@ -191,7 +192,7 @@ export const TOOLS = [
|
|
|
191
192
|
{ hash: HASH, pending: { type: 'boolean', description: 'Find the txs of trades approved in the Binance App (no hash needed)' }, testnet: TESTNET },
|
|
192
193
|
(a) => (a.pending ? ['tx', '--pending'] : ['tx', '--hash', a.hash, ...bool('testnet', a.testnet)]), PREVIEW),
|
|
193
194
|
tool('gang_cli', 'Other gang commands',
|
|
194
|
-
'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly = Mint Flywheel; launch in one command with --dev-buy / --bond / --buyback / --split / --lp, several of the last three = one combined recipient, or --tax-cap <amount> = a capped recipient), mint (--ref <inviter> on a Mint Flywheel token), promote buy|status|earnings|claim|claim-pool|activate|work|sweep|bind|reclaim|release-dev (create --promote; gang_buy promoter), withdraw, claim, release, fly open-early|launch|invite, quote, list, upload-logo, bond post|topup|raise-hold|extend|status|start|report|settle|refund|burn|tx, call-bond post|status|report|settle|claim|burn|tx (bond your own buy note: gang buy, then call-bond post within 10 minutes), buyback status|set|set-payee|apply|bind|release|split|sweep, split status|distribute|release|set-payee|bind, lp status|set|set-payee|apply|bind|release|split|sweep|add, combo status|distribute|release|set-payee|bind|chunk, capped status|distribute|release|set-payee|bind|chunk, floor status|redeem|distribute|release|set-payee|bind (a token whose tax is kept as a treasury holders can redeem; redeem burns the tokens for good), base status|release (create --base 5|10 --base-vest 30|90|180 on GangLaunchpad 3.0 buys an opening base paid in BNB, locked until graduation, then released linearly to the creator; lost for good if it never graduates), grad-reward status|claim|settle|sweep|retry-carry|refund-request|refund-cancel|refund (create --grad-reward <seed> on GangLaunchpad 3.0: a reward pool the creator seeds for the last curve buys before graduation, split by what each spent; a curve sell takes out the entries of that wallet), countdown status|claim|settle|finalize|claim-dev (create --buy-tax --sell-tax --countdown-reward --cd-max-payout <amount> on GangLaunchpad 3.0: the creator\'s share of the pool tax becomes a reward the last counted pool buys of each round share when its countdown runs out; gang_buy goes through the module by default), creator-fee [--token] [--claim [--to]] (GangLaunchpad 2.0 / 3.0: 70% of the curve fee, kept for the creator), weekly [apply|withdraw] (the Gang Launch Day event; apply / withdraw preview, --yes on the user OK signs and submits), v3 income, version, capabilities; the flags no other tool takes (--calldata, --from, …) too. E.g. ["create","--name","My Token","--symbol","MYT","--logo","/Users/me/avatar.png"], ["bond","status","--token","0x…"]. Local files are read by this server: absolute paths, or --logo-uri <image URL>. Writes only preview, as above. execute / watch / help have their own tools.',
|
|
195
|
+
'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly = Mint Flywheel; launch in one command with --dev-buy / --bond / --buyback / --split / --lp, several of the last three = one combined recipient, or --tax-cap <amount> = a capped recipient), mint (--ref <inviter> on a Mint Flywheel token), promote buy|status|earnings|claim|claim-pool|activate|work|sweep|bind|reclaim|release-dev (create --promote; gang_buy promoter), withdraw, claim, release, fly open-early|launch|invite, quote, list, upload-logo, bond post|topup|raise-hold|extend|status|start|report|settle|refund|burn|tx, call-bond post|status|report|settle|claim|burn|tx (bond your own buy note: gang buy, then call-bond post within 10 minutes), buyback status|set|set-payee|apply|bind|release|split|sweep, split status|distribute|release|set-payee|bind, lp status|set|set-payee|apply|bind|release|split|sweep|add, combo status|distribute|release|set-payee|bind|chunk, capped status|distribute|release|set-payee|bind|chunk, floor status|redeem|distribute|release|set-payee|bind (a token whose tax is kept as a treasury holders can redeem; redeem burns the tokens for good), base status|release (create --base 5|10 --base-vest 30|90|180 on GangLaunchpad 3.0 buys an opening base paid in BNB, locked until graduation, then released linearly to the creator; lost for good if it never graduates), grad-reward status|claim|settle|sweep|retry-carry|refund-request|refund-cancel|refund (create --grad-reward <seed> on GangLaunchpad 3.0: a reward pool the creator seeds for the last curve buys before graduation, split by what each spent; a curve sell takes out the entries of that wallet), countdown status|claim|settle|finalize|claim-dev (create --buy-tax --sell-tax --countdown-reward --cd-max-payout <amount> on GangLaunchpad 3.0: the creator\'s share of the pool tax becomes a reward the last counted pool buys of each round share when its countdown runs out; gang_buy goes through the module by default), creator-fee [--token] [--claim [--to]] (GangLaunchpad 2.0 / 3.0: 70% of the curve fee, kept for the creator), weekly [apply|withdraw] (the Gang Launch Day event; apply / withdraw preview, --yes on the user OK signs and submits), campaign [<slug>] | campaign join [<slug>] (gang.fun reward campaigns: tickets, lottery, my progress; join = the free sign-up, preview, --yes on the user OK signs, no tx), v3 income, version, capabilities; the flags no other tool takes (--calldata, --from, …) too. E.g. ["create","--name","My Token","--symbol","MYT","--logo","/Users/me/avatar.png"], ["bond","status","--token","0x…"]. Local files are read by this server: absolute paths, or --logo-uri <image URL>. Writes only preview, as above. execute / watch / help have their own tools.',
|
|
195
196
|
{ args: { type: 'array', items: { type: 'string' }, minItems: 1 } }, (a) => a.args, { readOnlyHint: false, destructiveHint: false, openWorldHint: true }, ['args']),
|
|
196
197
|
]
|
|
197
198
|
const BY_NAME = new Map(TOOLS.map((t) => [t.name, t]))
|
package/src/telemetry.js
CHANGED
|
@@ -31,7 +31,7 @@ const NAME = /^[a-z0-9-]{1,24}$/
|
|
|
31
31
|
const CODE = /^[A-Za-z0-9_.:-]{1,48}$/
|
|
32
32
|
const MAX_FLAGS = 16
|
|
33
33
|
// commands whose second word is a subcommand (gang fly mint, gang bond create, …)
|
|
34
|
-
const WITH_SUB = new Set(['fair', 'v3', 'fly', 'bond', 'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'grad-reward', 'countdown', 'creator-fee', 'weekly'])
|
|
34
|
+
const WITH_SUB = new Set(['fair', 'v3', 'fly', 'bond', 'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'grad-reward', 'countdown', 'creator-fee', 'weekly', 'campaign'])
|
|
35
35
|
|
|
36
36
|
export const enabled = () => process.env.GANG_TELEMETRY !== '0' && process.env.DO_NOT_TRACK !== '1'
|
|
37
37
|
|
|
@@ -91,7 +91,7 @@ export function clientOf(raw = process.env.GANG_CLIENT) {
|
|
|
91
91
|
/** The event for one command (argv after `gang`) and its JSON result. */
|
|
92
92
|
export function eventOf(argv, o = {}) {
|
|
93
93
|
const c = NAME.test(argv[0] ?? '') ? argv[0] : 'other'
|
|
94
|
-
const s = WITH_SUB.has(c) && NAME.test(argv[1] ?? '') ? argv[1] : ''
|
|
94
|
+
const s = WITH_SUB.has(c) && NAME.test(argv[1] ?? '') && (c !== 'campaign' || argv[1] === 'join') ? argv[1] : ''
|
|
95
95
|
const f = [...new Set(argv.filter((a) => a.startsWith('--')).map((a) => a.slice(2)))].filter((n) => NAME.test(n)).slice(0, MAX_FLAGS)
|
|
96
96
|
const ok = o.success !== false
|
|
97
97
|
const pf = c === 'preflight'
|
package/src/weekly.js
CHANGED
|
@@ -196,7 +196,7 @@ export function eventRow(e) {
|
|
|
196
196
|
})
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
async function post(path, body) {
|
|
199
|
+
export async function post(path, body) {
|
|
200
200
|
let r
|
|
201
201
|
try {
|
|
202
202
|
r = await fetch(`${API}${path}`, {
|
|
@@ -382,6 +382,6 @@ function weekBefore(issue) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
/** A word as a POSIX shell reads it back: plain words as they are, the rest in single quotes. */
|
|
385
|
-
function shellWord(w) {
|
|
385
|
+
export function shellWord(w) {
|
|
386
386
|
return /^[A-Za-z0-9_./:@,=+-]+$/.test(w) ? w : `'${String(w).replace(/'/g, `'\\''`)}'`
|
|
387
387
|
}
|