@four-meme/four-meme-ai 1.0.5 → 1.0.7

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 CHANGED
@@ -20,16 +20,33 @@ When the user needs to create or trade meme tokens on four.meme (BSC), use the *
20
20
  - **Tax token fee/tax info**: `fourmeme tax-info <tokenAddress>`. See `references/tax-token-query.md` and `token-tax-info.md`.
21
21
  - **Send BNB/ERC20**: `fourmeme send <toAddress> <amountWei> [tokenAddress]` to transfer from the trading wallet.
22
22
  - **EIP‑8004 identity NFT**: `fourmeme 8004-register <name> [imageUrl] [description]` and `fourmeme 8004-balance <ownerAddress>`.
23
- - **CLI** (after `npm install`): use **`npx fourmeme <command> [args]`**. Run `npx fourmeme --help` for all commands, including:
24
- - Config: `npx fourmeme config`
25
- - Create (one-shot): `npx fourmeme create-instant --image=... --name=... --short-name=... --desc=... --label=...` (same args as create-api; optional `--pre-sale=0.001` in BNB)
26
- - Create (two steps): `npx fourmeme create-api ...` → `npx fourmeme create-chain ...`
27
- - Trade/info: `npx fourmeme token-info <tokenAddress>`, `npx fourmeme quote-buy`, `npx fourmeme quote-sell`
28
- - Execute trade: `npx fourmeme buy <token> amount|funds ...`, `npx fourmeme sell <token> <amountWei> [minFundsWei]` (needs PRIVATE_KEY)
29
- - Events: `npx fourmeme events <fromBlock> [toBlock]`
30
- - Tax: `npx fourmeme tax-info <tokenAddress>`
31
- - EIP‑8004: `npx fourmeme 8004-register ...`, `npx fourmeme 8004-balance ...`
32
- - Verify: `npx fourmeme verify`
23
+ - **CLI**: `npx fourmeme <command> [args]`. Run `npx fourmeme --help` for the full list. See **Commands and parameters** below.
24
+
25
+ ## Commands and parameters
26
+
27
+ | Command | Parameters | Description |
28
+ |--------|------------|-------------|
29
+ | `config` | *(none)* | Public config (raisedToken). No auth. |
30
+ | `create-api` | `--image=` `--name=` `--short-name=` `--desc=` `--label=` `[--web-url=]` `[--twitter-url=]` `[--telegram-url=]` `[--pre-sale=<BNB>]` `[--fee-plan=false]` `[--tax-options=<path>]` or `[--tax-token --tax-fee-rate=5 ...]` | Create token API only. Label: `Meme|AI|Defi|Games|Infra|De-Sci|Social|Depin|Charity|Others`. Env: PRIVATE_KEY. |
31
+ | `create-chain` | `<createArgHex>` `<signatureHex>` `[--value=<wei>]` or `--` (stdin JSON) | Submit createToken on BSC. Env: PRIVATE_KEY. |
32
+ | `create-instant` | `--image=` `--name=` `--short-name=` `--desc=` `--label=` `[--web-url=]` `[--twitter-url=]` `[--telegram-url=]` `[--pre-sale=<BNB>]` `[--fee-plan=false]` `[--value=<wei>]` `[--tax-options=<path>]` or `[--tax-token --tax-fee-rate=5 ...]` | One-shot create (API + chain). Same options as create-api plus `--value=` override. Env: PRIVATE_KEY. |
33
+ | `token-info` | `<tokenAddress>` | On-chain token info (Helper3). |
34
+ | `token-list` | `[--orderBy=Hot]` `[--pageIndex=1]` `[--pageSize=30]` `[--tokenName=]` `[--symbol=]` `[--labels=]` `[--listedPancake=false]` | REST token list. |
35
+ | `token-get` | `<tokenAddress>` | REST token detail + trading info. |
36
+ | `token-rankings` | `<orderBy>` `[--barType=HOUR24]` | Rankings. orderBy: `Time|ProgressDesc|TradingDesc|Hot|Graduated`. |
37
+ | `quote-buy` | `<tokenAddress>` `<amountWei>` `[fundsWei]` | Estimate buy (no tx). Use 0 for amount or funds. |
38
+ | `quote-sell` | `<tokenAddress>` `<amountWei>` | Estimate sell (no tx). |
39
+ | `buy` | `<token>` `amount` `<amountWei>` `<maxFundsWei>` | Buy fixed amount. Env: PRIVATE_KEY. |
40
+ | `buy` | `<token>` `funds` `<fundsWei>` `<minAmountWei>` | Buy with fixed quote. Env: PRIVATE_KEY. |
41
+ | `sell` | `<tokenAddress>` `<amountWei>` `[minFundsWei]` | Execute sell. Env: PRIVATE_KEY. |
42
+ | `send` | `<toAddress>` `<amountWei>` `[tokenAddress]` | Send BNB or ERC20. Omit tokenAddress for BNB. Env: PRIVATE_KEY. |
43
+ | `8004-register` | `<name>` `[imageUrl]` `[description]` | EIP-8004 register NFT. Env: PRIVATE_KEY. |
44
+ | `8004-balance` | `<ownerAddress>` | EIP-8004 query balance. |
45
+ | `events` | `<fromBlock>` `[toBlock]` | TokenManager2 events (BSC). |
46
+ | `tax-info` | `<tokenAddress>` | TaxToken fee/tax config. |
47
+ | `verify` | *(none)* | Config + events (last 50 blocks). Read-only. |
48
+
49
+ Create token optional (omit if empty): `--web-url=`, `--twitter-url=`, `--telegram-url=`. Presale: `--pre-sale=<BNB>` in ether (e.g. `0.001`). Tax: `--tax-options=<path>` or `--tax-token --tax-fee-rate=5 --tax-burn-rate=0 --tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0 --tax-recipient-address= --tax-min-sharing=100000` (burn+divide+liquidity+recipient=100).
33
50
 
34
51
  ## Install (project)
35
52
 
package/bin/fourmeme.cjs CHANGED
@@ -50,47 +50,87 @@ function printHelp() {
50
50
 
51
51
  Usage: npx fourmeme <command> [args...]
52
52
 
53
- (In project dir, use npx fourmeme; npm install does not add fourmeme to PATH.)
54
-
55
- Commands:
56
- config Get public config (raisedToken). No auth.
57
- create-api --image= --name= --short-name= --desc= --label= [options]
58
- Create token API flow. Env: PRIVATE_KEY.
59
- create-chain <createArgHex> <signatureHex>
60
- Submit createToken tx on BSC. Or: fourmeme create-chain -- (stdin JSON)
61
- create-instant --image= --name= --short-name= --desc= --label= [options]
62
- One-shot: create-api + create-chain (same args as create-api).
53
+ Commands and parameters:
54
+
55
+ config
56
+ (no args) Get public config (raisedToken). No auth.
57
+
58
+ create-api
59
+ Required: --image=<path> --name=<name> --short-name=<symbol> --desc=<text> --label=<label>
60
+ Optional: --web-url= --twitter-url= --telegram-url= (omit if empty)
61
+ --pre-sale=<BNB> (ether units, e.g. 0.001)
62
+ --fee-plan=false
63
+ --tax-options=<path> OR --tax-token --tax-fee-rate=5 --tax-burn-rate=0
64
+ --tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0
65
+ --tax-recipient-address= --tax-min-sharing=100000
66
+ Label: Meme|AI|Defi|Games|Infra|De-Sci|Social|Depin|Charity|Others
67
+ Env: PRIVATE_KEY.
68
+
69
+ create-chain
70
+ <createArgHex> <signatureHex> [--value=<wei>]
71
+ Or: fourmeme create-chain -- (read createArg, signature, creationFeeWei from stdin JSON)
72
+ Env: PRIVATE_KEY, optional CREATION_FEE_WEI.
73
+
74
+ create-instant
75
+ Required: --image=<path> --name=<name> --short-name=<symbol> --desc=<text> --label=<label>
76
+ Optional: --web-url= --twitter-url= --telegram-url= (omit if empty)
77
+ --pre-sale=<BNB> (ether units, e.g. 0.001)
78
+ --fee-plan=false
79
+ --value=<wei> (override computed creation fee; default from API)
80
+ --tax-options=<path> OR --tax-token --tax-fee-rate=5 --tax-burn-rate=0
81
+ --tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0
82
+ --tax-recipient-address= --tax-min-sharing=100000
83
+ Label: Meme|AI|Defi|Games|Infra|De-Sci|Social|Depin|Charity|Others
84
+ One-shot: API + submit createToken. Env: PRIVATE_KEY.
85
+
63
86
  token-info <tokenAddress>
64
- Get token info from Helper3 (BSC, on-chain).
65
- token-list [--orderBy=Hot] [--pageIndex=1] [--pageSize=30] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=false]
66
- Token list (REST API, filter/query).
87
+ On-chain token info (Helper3). No auth.
88
+
89
+ token-list
90
+ [--orderBy=Hot] [--pageIndex=1] [--pageSize=30] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=false]
91
+ REST token list. No auth.
92
+
67
93
  token-get <tokenAddress>
68
- Token detail + trading info (REST API get/v2).
94
+ REST token detail + trading info. No auth.
95
+
69
96
  token-rankings <orderBy> [--barType=HOUR24]
70
- Rankings: orderBy=Time|ProgressDesc|TradingDesc|Hot|Graduated. barType only for TradingDesc.
71
- quote-buy <token> <amountWei> [fundsWei]
72
- Estimate buy (no tx). Use 0 for amount or funds.
73
- quote-sell <token> <amountWei>
74
- Estimate sell (no tx).
75
- buy <token> amount <amountWei> <maxFundsWei>
76
- Execute buy: fixed token amount. Env: PRIVATE_KEY.
77
- buy <token> funds <fundsWei> <minAmountWei>
78
- Execute buy: spend fixed quote (e.g. BNB). Env: PRIVATE_KEY.
79
- sell <token> <amountWei> [minFundsWei]
80
- Execute sell. Env: PRIVATE_KEY.
97
+ orderBy: Time|ProgressDesc|TradingDesc|Hot|Graduated. barType for TradingDesc. No auth.
98
+
99
+ quote-buy <tokenAddress> <amountWei> [fundsWei]
100
+ Estimate buy. Use 0 for amount or funds. No tx.
101
+
102
+ quote-sell <tokenAddress> <amountWei>
103
+ Estimate sell. No tx.
104
+
105
+ buy <tokenAddress> amount <amountWei> <maxFundsWei>
106
+ Buy fixed token amount. Env: PRIVATE_KEY.
107
+
108
+ buy <tokenAddress> funds <fundsWei> <minAmountWei>
109
+ Spend fixed quote (e.g. BNB). Env: PRIVATE_KEY.
110
+
111
+ sell <tokenAddress> <amountWei> [minFundsWei]
112
+ Execute sell. Env: PRIVATE_KEY.
113
+
81
114
  send <toAddress> <amountWei> [tokenAddress]
82
- Send BNB or ERC20 to address. Omit tokenAddress for BNB. Env: PRIVATE_KEY.
115
+ Send BNB or ERC20. Omit tokenAddress for BNB. Env: PRIVATE_KEY.
116
+
83
117
  8004-register <name> [imageUrl] [description]
84
- EIP-8004: register identity NFT. Env: PRIVATE_KEY.
118
+ EIP-8004 register identity NFT. Env: PRIVATE_KEY.
119
+
85
120
  8004-balance <ownerAddress>
86
- EIP-8004: query NFT balance of address (read-only).
121
+ EIP-8004 query NFT balance. Read-only.
122
+
87
123
  events <fromBlock> [toBlock]
88
- TokenManager2 events (BSC). Default toBlock: latest.
124
+ TokenManager2 events (BSC). toBlock default: latest.
125
+
89
126
  tax-info <tokenAddress>
90
- TaxToken fee/tax config (BSC, creatorType 5 only).
91
- verify Run config + events for last 50 blocks (read-only check).
127
+ TaxToken fee/tax config (creatorType 5). Read-only.
128
+
129
+ verify
130
+ (no args) Config + events last 50 blocks. Read-only.
92
131
 
93
- Env: PRIVATE_KEY, BSC_RPC_URL. See SKILL.md for full docs.
132
+ Env: PRIVATE_KEY (required for create-api, create-chain, create-instant, buy, sell, send, 8004-register).
133
+ BSC_RPC_URL, CREATION_FEE_WEI optional. See SKILL.md.
94
134
  `);
95
135
  }
96
136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@four-meme/four-meme-ai",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Four.meme AI skills for creating and trading meme tokens (BSC only)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,13 +43,14 @@
43
43
  "openclaw"
44
44
  ],
45
45
  "dependencies": {
46
- "dotenv": "^16.0.0"
46
+ "@four-meme/four-meme-ai": "^1.0.5",
47
+ "dotenv": "^16.0.0",
48
+ "tsx": "^4.20.0",
49
+ "viem": "^2.0.0"
47
50
  },
48
51
  "devDependencies": {
49
52
  "@types/node": "^20.0.0",
50
- "tsx": "^4.20.0",
51
- "typescript": "^5.0.0",
52
- "viem": "^2.0.0"
53
+ "typescript": "^5.0.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
@@ -1,454 +1,371 @@
1
- ---
2
- name: four-meme-ai
3
- description: |
4
- CLI tool for creating and trading meme tokens on Four.Meme (BSC), with structured JSON outputs for config, token details, pricing quotes, on-chain events, and TaxToken fee configuration.
5
-
6
-
7
-
8
- allowed-tools:
9
- - Bash(fourmeme *)
10
- - Bash(npx fourmeme *)
11
- license: MIT
12
- metadata:
13
- {"author":"Four.meme AI Skill","version":"1.0.4","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY","optionalEnv":["BSC_RPC_URL"]}}
14
- ---
15
-
16
- ## [Agent must follow] User agreement and security notice on first use
17
-
18
- When responding to any user request about fourmeme or this skill, **you must first** present the content below in this order: **User Agreement, then Security Notice**, and state clearly that by choosing to continue, the user agrees to the User Agreement.
19
- Until the user has explicitly agreed or confirmed to continue, **do not** run `create-api`, `create-chain`, `buy`, `sell`, `send`, or `8004-register` (any operation that uses the private key or writes to the chain). Read-only commands (e.g. `config`, `token-info`, `quote-buy`, `8004-balance`) may be run while or after presenting the notice.
20
-
21
- **Language selection**: Present the User Agreement and Security Notice **in the user’s language**. If the user is writing in **Traditional Chinese (繁體中文)**, use the **繁體中文** block below; otherwise use the **English** block.
22
-
23
- ---
24
-
25
- ### User Agreement & Security Notice (繁體中文)
26
-
27
- **用戶協議**
28
-
29
- **前情提示**:使用本插件及本 skill 所涉功能(包括但不限於代幣創建、買賣、轉帳、8004 註冊等)前,請您閱讀以下協議。**若您選擇繼續使用本插件及本 skill 功能,即表示您已閱讀、理解並同意本協議。**
30
-
31
- **本插件性質與責任限制**:本插件僅提供純本地的命令列互動能力(私鑰透過環境變數或本地設定使用),**不會收集、上傳或儲存您的私鑰**。因任何原因(包括但不限於插件被竄改、環境遭入侵、誤操作、第三方插件等)導致的私鑰洩露或資產損失,**本插件及提供方不承擔責任**。
32
-
33
- **安全警示**
34
-
35
- 使用本插件進行代幣創建、買賣、轉帳等操作時,請務必注意:
36
-
37
- - **保護私鑰**:切勿在聊天對話中輸入、貼上或洩露私鑰;不要將私鑰分享給任何人或任何第三方。
38
- - **交易錢包僅存小額資金**:用於執行操作的錢包(即提供 PRIVATE_KEY 的錢包)建議只存放少量資金,以降低因洩露或誤操作導致的損失。
39
- - **及時轉出資金**:完成交易後,請及時將交易錢包中的資產轉移到您自己控制的、更安全的錢包或冷錢包中。
40
- - **謹慎安裝 Agent/插件**:下載或安裝任何 Agent、瀏覽器插件或第三方工具時,請確認來源可信,避免惡意插件竊取私鑰或助記詞。
41
-
42
- ---
43
-
44
- ### User Agreement & Security Notice (English)
45
-
46
- **User Agreement**
47
-
48
- **Notice**: Before using this plugin and this skill (including but not limited to token creation, buy/sell, transfers, 8004 registration), please read the following. **By choosing to continue using this plugin and this skill, you have read, understood, and agreed to this agreement.**
49
-
50
- **Plugin nature and limitation of liability**: This plugin provides local-only CLI interaction (private key is used via environment or local config). It **does not collect, upload, or store your private key**. The plugin and its providers **are not liable** for private key disclosure or asset loss due to any cause (including but not limited to tampered plugin, compromised environment, user error, or third-party plugins).
51
-
52
- **Security Notice**
53
-
54
- When using this plugin for token creation, trading, or transfers, please:
55
-
56
- - **Protect your private key**: Do not type, paste, or expose your private key in chat; do not share it with anyone or any third party.
57
- - **Keep only small amounts in the trading wallet**: The wallet used for operations (the one whose PRIVATE_KEY you provide) should hold only a small amount of funds to limit loss from disclosure or mistakes.
58
- - **Move funds out promptly**: After trading, move assets from the trading wallet to a wallet or cold storage you control.
59
- - **Install agents/plugins carefully**: When installing any agent, browser extension, or third-party tool, verify the source to avoid malware that could steal your private key or seed phrase.
60
-
61
- ---
62
-
63
- ## fourmeme capability overview
64
-
65
- After you agree to the above and confirm to continue, this skill can help you with the following (all via the `fourmeme` CLI on BSC):
66
-
67
- | Category | Capability | Description |
68
- |----------|-------------|-------------|
69
- | **Create** | Create token | Upload image + name/symbol/description/label; optional tax-token params; API returns signature then on-chain create. |
70
- | **Query** | Public config | Get raisedToken and other public config (no auth). |
71
- | **Query** | Token info (on-chain) | By address: version, tokenManager, price, offers (Helper3). |
72
- | **Query** | Token list / detail / rankings | REST: filtered paginated list, single-token detail and trading info, hot/24h volume/newest/graduated rankings. |
73
- | **Trading** | Buy/sell quotes | Estimate cost or proceeds for buy or sell (no transaction sent). |
74
- | **Trading** | Execute buy | Buy a given token by amount or by quote spent (requires PRIVATE_KEY). |
75
- | **Trading** | Execute sell | Sell a given token amount; optional minimum quote received (requires PRIVATE_KEY). |
76
- | **Other** | Event listening | Fetch TokenCreate, TokenPurchase, TokenSale, LiquidityAdded on-chain. |
77
- | **Other** | Tax token fees | Query on-chain fee and burn/dividend/liquidity config for a token. |
78
- | **Other** | Send | Send BNB or ERC20 to a given address (requires PRIVATE_KEY). |
79
- | **Other** | EIP-8004 | Register 8004 identity NFT; query balance by address. |
80
-
81
- See the **CLI (fourmeme)** table and sections below for commands and arguments.
82
-
83
- ---
84
-
85
- # fourmeme CLI
86
-
87
- BSC only; all commands output JSON. Run `fourmeme --help` for usage.
88
-
89
- ## Installation (required before use)
90
-
91
- **You must install the fourmeme CLI before using this skill.** Recommended (global):
92
-
93
- ```bash
94
- npm install -g @four-meme/four-meme-ai@latest
95
- ```
96
-
97
- After installation, run commands with `fourmeme <command> [args]`. If you use a local install instead, use `npx fourmeme <command> [args]` from the project root.
98
-
99
- This skill provides: token creation (API + chain), buy/sell quotes and execution, token info/list/rankings, event listening, Tax token fee queries, send, and EIP-8004 identity NFT register and balance. Contract addresses and version notes: [references/contract-addresses.md](references/contract-addresses.md). **TokenManager V1 is not supported in this skill.**
100
-
101
- ## Create token flow
102
-
103
- ### 1. Ask user for required information (must be done first)
104
-
105
- Before calling `create-api`, the Agent **must** ask the user for and confirm:
106
-
107
- | Info | Required | Description |
108
- |------|----------|-------------|
109
- | **Image path** (imagePath) | Yes | Local logo path; jpeg/png/gif/bmp/webp |
110
- | **Token name** (name) | Yes | Full token name |
111
- | **Token symbol** (shortName) | Yes | e.g. MTK, DOGE |
112
- | **Description** (desc) | Yes | Token description text |
113
- | **Label** (label) | Yes | One of: Meme \| AI \| Defi \| Games \| Infra \| De-Sci \| Social \| Depin \| Charity \| Others |
114
- | **Tax token?** | No | If yes, then ask for tokenTaxInfo (feeRate, four rates, recipientAddress, minSharing); see "Create token (full flow)" below |
115
-
116
- Optional: WEB_URL, TWITTER_URL, TELEGRAM_URL, PRE_SALE, FEE_PLAN (AntiSniperFeeMode), etc.; may be provided by user or left at defaults.
117
-
118
- ### 2. Technical flow (done by create-api / create-chain)
119
-
120
- After collecting the above, execute in this order (handled by scripts or CLI):
121
-
122
- 1. **Get nonce** `POST /private/user/nonce/generate` with body accountAddress, verifyType, networkCode (BSC).
123
- 2. **Login** Sign `You are sign in Meme {nonce}` with wallet; `POST /private/user/login/dex` to get access_token.
124
- 3. **Upload image** `POST /private/token/upload` with access_token in header and image as body; get imgUrl.
125
- 4. **Create (API)** GET `/public/config` for raisedToken (do not modify); `POST /private/token/create` with name, shortName, desc, imgUrl, label, raisedToken, etc.; get createArg, signature.
126
- 5. **Create (chain)** Call `TokenManager2.createToken(createArg, sign)` on BSC to complete on-chain creation.
127
-
128
- Commands: first `fourmeme create-api --image= --name= --short-name= --desc= --label= [options]`, then `fourmeme create-chain <createArgHex> <signatureHex>`. Or one-shot: `fourmeme create-instant --image= ...`. Full API and parameters: [references/api-create-token.md](references/api-create-token.md); script flow and examples: [references/create-token-scripts.md](references/create-token-scripts.md); Tax token params: [references/token-tax-info.md](references/token-tax-info.md).
129
-
130
- ## Agent workflow: buy/sell from rankings or events
131
-
132
- This skill supports a flow to discover tokens, get details, quote, and execute. The following is an example workflow, not a trading recommendation: discover → detail → quote → execute.
133
-
134
- 1. **Discover** (one or more of):
135
- - **Rankings**: `fourmeme token-rankings <orderBy>` (orderBy = Hot, TradingDesc, Time, ProgressDesc, Graduated); use token addresses from the response.
136
- - **List**: `fourmeme token-list [--orderBy=] [--labels=] ...` to filter and get addresses.
137
- - **On-chain events**: `fourmeme events <fromBlock> [toBlock]`; parse token addresses from TokenCreate/TokenPurchase, etc., for “newly created” or “recent trades” strategies.
138
- 2. **Get details**: For each candidate, call `fourmeme token-get <address>` (REST detail and trading info) or `fourmeme token-info <address>` (on-chain version, tokenManager, price, offers) to filter or display.
139
- 3. **Quote**: `fourmeme quote-buy <token> <amountWei> [fundsWei]` / `fourmeme quote-sell <token> <amountWei>` for estimated cost or proceeds.
140
- 4. **Execute**: `fourmeme buy ...` / `fourmeme sell ...` (requires PRIVATE_KEY). **Before executing, the Agent must confirm user intent** (e.g. user said “buy 0.05 BNB each for top 5 by 24h volume” or “auto-buy 0.01 BNB for new tokens”) and obtain explicit confirmation before first automated execution to avoid unauthorized use of funds.
141
-
142
- When the user asks to “buy/sell based on rankings or activity”, the Agent should clarify: which ranking (hot, 24h volume, newest, graduated, etc.), amount per token, and whether to quote only or also execute; then run the appropriate commands.
143
-
144
- ## Trading (Buy / Sell)
145
-
146
- - **Version** Use TokenManagerHelper3 `getTokenInfo(token)`. If `version === 1` use V1 TokenManager; if `version === 2` use TokenManager2 (and check for X Mode / TaxToken / AntiSniperFeeMode if needed).
147
- - **Quote (pre-calc)** – TokenManagerHelper3:
148
- - Buy: `tryBuy(token, amount, funds)` use `amount > 0` for “buy X tokens”, or `funds > 0` for “spend X quote”.
149
- - Sell: `trySell(token, amount)`.
150
- - **Execute** Use the `tokenManager` address from `getTokenInfo` and call the corresponding contract:
151
- - V1: `purchaseToken` / `purchaseTokenAMAP`, `saleToken`.
152
- - V2: `buyToken` / `buyTokenAMAP`, `sellToken`. For sell, user must `ERC20.approve(tokenManager, amount)` first.
153
- - X Mode tokens: use TokenManager2 `buyToken(bytes args, uint256 time, bytes signature)` with encoded `BuyTokenParams`.
154
-
155
- ## CLI (fourmeme)
156
-
157
- Run `fourmeme --help` for usage. After **global install** (`npm install -g @four-meme/four-meme-ai@latest`), use **`fourmeme <command> [args]`**. With a local install only, use **`npx fourmeme <command> [args]`** from the project root.
158
-
159
- ### PRIVATE_KEY and BSC_RPC_URL
160
-
161
- **When using OpenClaw**
162
- This skill declares `requires.env: ["PRIVATE_KEY"]` and `primaryEnv: "PRIVATE_KEY"` in metadata; OpenClaw injects them only when an agent runs with **this skill enabled** (other skills cannot access them).
163
-
164
- **Required steps:**
165
- 1. **Configure private key**: In the Skill management page, set the four-meme-ai skill’s **apiKey** (corresponds to `primaryEnv: "PRIVATE_KEY"`), or set `PRIVATE_KEY` under `skills.entries["four-meme-ai"].env` in `~/.openclaw/openclaw.json`. Optionally set **BSC_RPC_URL** in global env if needed.
166
- 2. **Enable this skill**: In the agent or session, ensure the **four-meme-ai** skill is **enabled**. Only when the skill is enabled will OpenClaw inject **PRIVATE_KEY** into the process; otherwise create/buy/sell/send/8004-register will fail with missing key. **BSC_RPC_URL** is optional (metadata: `optionalEnv`); if not set, scripts use a default BSC RPC.
167
-
168
- **When not using OpenClaw (standalone)**
169
- Set **PRIVATE_KEY** and optionally **BSC_RPC_URL** via the process environment so they are available when running `npx fourmeme` or `node bin/fourmeme.cjs`:
170
-
171
- - **.env file**: Put a `.env` file in **the directory where you run the `fourmeme` command** (i.e. your project / working directory). Example: if you run `fourmeme quote-buy ...` from `/path/to/my-project`, place `.env` at `/path/to/my-project/.env`. The CLI automatically loads `.env` from that current working directory. Use lines like `PRIVATE_KEY=...` and `BSC_RPC_URL=...`. Do not commit `.env`; add it to `.gitignore`.
172
- - **Shell export**: `export PRIVATE_KEY=your_hex_key` and `export BSC_RPC_URL=https://bsc-dataseed.binance.org` (or another BSC RPC), then run `npx fourmeme <command> ...`.
173
-
174
- ### Declared and optional environment variables
175
-
176
- - **Declared in registry metadata** (injected by OpenClaw when skill is enabled): **PRIVATE_KEY** (required for write operations). Optional in metadata: **BSC_RPC_URL** (scripts fall back to default BSC RPC if unset).
177
- - **Not in metadata; optional, may be set in env or project `.env`**: **BSC_RPC_URL**, **CREATION_FEE_WEI** (extra BNB on create), **TAX_TOKEN**, **TAX_FEE_RATE**, **TAX_BURN_RATE**, **TAX_DIVIDE_RATE**, **TAX_LIQUIDITY_RATE**, **TAX_RECIPIENT_RATE**, **TAX_RECIPIENT_ADDRESS**, **TAX_MIN_SHARING**, **WEB_URL**, **TWITTER_URL**, **TELEGRAM_URL**, **PRE_SALE**, **FEE_PLAN**, **8004_NFT_ADDRESS** / **EIP8004_NFT_ADDRESS**. Only **PRIVATE_KEY** is required for signing; others have defaults or are used only for specific commands (see Create token flow, EIP-8004, etc.).
178
-
179
- ### Execution and install
180
-
181
- - **Invocation**: The agent must run commands only via the **fourmeme** CLI: `fourmeme <command> [args]` or `npx fourmeme <command> [args]` (allowed-tools). Do not invoke scripts or `npx tsx` directly; the CLI entry (`bin/fourmeme.cjs`) dispatches to the correct script and loads `.env` from the current working directory.
182
- - **Install**: `npm install -g @four-meme/four-meme-ai@latest`. Runtime: Node.js. Dependencies (including dotenv, viem, tsx) are declared in the package’s `package.json`; global install installs them. No separate install spec beyond the npm package.
183
-
184
- | Need | Command | When |
185
- |------|---------|------|
186
- | Public config | `fourmeme config` | Get raisedToken / config (no auth) |
187
- | Token info (on-chain) | `fourmeme token-info <tokenAddress>` | Version, tokenManager, price, offers (BSC Helper3) |
188
- | Token list (REST) | `fourmeme token-list [--orderBy=] [--pageIndex=] [--pageSize=] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=]` | Filtered, paginated token list |
189
- | Token detail (REST) | `fourmeme token-get <tokenAddress>` | Token detail and trading info (get/v2) |
190
- | Token rankings (REST) | `fourmeme token-rankings <orderBy> [--barType=HOUR24]` | Time / ProgressDesc / TradingDesc / Hot / Graduated; barType for TradingDesc |
191
- | Buy quote | `fourmeme quote-buy <token> <amountWei> [fundsWei]` | Estimate only; no transaction |
192
- | Sell quote | `fourmeme quote-sell <token> <amountWei>` | Estimate only; no transaction |
193
- | **Execute buy** | `fourmeme buy <token> amount <amountWei> <maxFundsWei>` | Buy fixed amount (needs PRIVATE_KEY) |
194
- | **Execute buy** | `fourmeme buy <token> funds <fundsWei> <minAmountWei>` | Spend fixed quote (e.g. BNB) (needs PRIVATE_KEY) |
195
- | **Execute sell** | `fourmeme sell <token> <amountWei> [minFundsWei]` | Sell (needs PRIVATE_KEY) |
196
- | **Send** | `fourmeme send <toAddress> <amountWei> [tokenAddress]` | Send BNB or ERC20 to address (needs PRIVATE_KEY) |
197
- | **EIP-8004 register** | `fourmeme 8004-register <name> [imageUrl] [description]` | Register 8004 identity NFT (needs PRIVATE_KEY) |
198
- | **EIP-8004 query** | `fourmeme 8004-balance <ownerAddress>` | Query 8004 NFT balance (read-only) |
199
- | Events | `fourmeme events <fromBlock> [toBlock]` | TokenCreate / Purchase / Sale / LiquidityAdded |
200
- | Tax token info | `fourmeme tax-info <tokenAddress>` | Fee/tax config for TaxToken |
201
- | Read-only check | `fourmeme verify` | Run config + events (last 50 blocks) |
202
-
203
- Chain: **BSC only** (Arbitrum/Base not supported).
204
-
205
- ### Create token (full flow)
206
-
207
- **Agent interaction: ask about tax token and parameters before creating**
208
-
209
- When the user asks to create a token, the Agent must ask in this order:
210
-
211
- 1. **Tax token or not?**
212
- Ask: “Do you want to create a tax (Tax) token? If not, it will be a normal token.”
213
- - If **no**: use `fourmeme create-api --image= --name= --short-name= --desc= --label=` (no --tax-options, no --tax-token).
214
- - If **yes**: continue to step 2.
215
-
216
- 2. **Tax parameters** (only when user chose tax token)
217
- Ask for (and explain constraints; see “tokenTaxInfo parameters” table below):
218
- - **feeRate**: Fee rate (%). **Only 1, 3, 5, or 10.**
219
- - **burnRate**, **divideRate**, **liquidityRate**, **recipientRate**: Four percentages; **sum must be 100**.
220
- - If **recipientRate > 0**: ask **recipientAddress**.
221
- - **minSharing**: Minimum token balance to participate in dividends (in ether units, e.g. 100000, 1000000).
222
-
223
- Then either:
224
- - **Option A**: Write `{ "tokenTaxInfo": { ... } }` to a JSON file and call `fourmeme create-api --image= ... --tax-options=<path>`.
225
- - **Option B**: Run `fourmeme create-api --image= ... --tax-token --tax-fee-rate=5 ...` (and other --tax-* as needed).
226
-
227
- **Step 1 – Config (optional)**
228
- ```bash
229
- fourmeme config
230
- ```
231
-
232
- **Step 2 – Create token (API)**
233
- Requires `PRIVATE_KEY`. Outputs `createArg` and `signature` (hex).
234
-
235
- | Position | Argument | Description |
236
- |----------|----------|-------------|
237
- | 1 | `imagePath` | Local image path (jpeg/png/gif/bmp/webp) |
238
- | 2 | `name` | Token full name |
239
- | 3 | `shortName` | Token symbol (e.g. MTK) |
240
- | 4 | `desc` | Description text |
241
- | 5 | `label` | Category label (see list below) |
242
- | 6 | `[taxOptions.json]` | Optional; path to JSON containing `tokenTaxInfo` for tax token |
243
-
244
- **Label** (exactly one): `Meme` \| `AI` \| `Defi` \| `Games` \| `Infra` \| `De-Sci` \| `Social` \| `Depin` \| `Charity` \| `Others`.
245
-
246
- **Optional env vars** (defaults if omitted): `WEB_URL`, `TWITTER_URL`, `TELEGRAM_URL`; `PRE_SALE` (default `"0"`); `FEE_PLAN` (`"true"` = AntiSniperFeeMode, default `"false"`).
247
-
248
- ```bash
249
- fourmeme create-api --image=<path> --name= --short-name= --desc= --label= [--tax-options=path]
250
- # Example: fourmeme create-api --image=./logo.png --name=MyToken --short-name=MTK --desc="Description" --label=AI
251
- # Tax: fourmeme create-api --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax token" --label=Meme --tax-options=tax.json
252
- ```
253
-
254
- **Tax token**
255
- - **Option 1**: Last argument = path to JSON file with `{ "tokenTaxInfo": { ... } }`; fields see “tokenTaxInfo parameters” below.
256
- - **Option 2**: Env vars: `TAX_TOKEN=1`, `TAX_FEE_RATE` (1|3|5|10), `TAX_BURN_RATE` / `TAX_DIVIDE_RATE` / `TAX_LIQUIDITY_RATE` / `TAX_RECIPIENT_RATE` (sum = 100), `TAX_RECIPIENT_ADDRESS`, `TAX_MIN_SHARING` (e.g. 100000). See [references/token-tax-info.md](references/token-tax-info.md).
257
-
258
- **tokenTaxInfo parameters** (required for tax token, via JSON or env):
259
-
260
- | Field | Type | Description | Constraint |
261
- |-------|------|-------------|------------|
262
- | `feeRate` | number | Trading fee rate (%) | **Only** `1`, `3`, `5`, `10` |
263
- | `burnRate` | number | Burn share (%) | Sum with next three = 100 |
264
- | `divideRate` | number | Dividend share (%) | Same |
265
- | `liquidityRate` | number | Liquidity share (%) | Same |
266
- | `recipientRate` | number | Recipient share (%) | 0 if unused |
267
- | `recipientAddress` | string | Recipient address | `""` if unused |
268
- | `minSharing` | number | Min balance for dividend (ether units) | d×10ⁿ, n≥5, 1≤d≤9; e.g. 100000, 1000000 |
269
-
270
- Example (5% fee, 20% burn, 30% dividend, 40% liquidity, 10% recipient):
271
-
272
- ```json
273
- {
274
- "tokenTaxInfo": {
275
- "feeRate": 5,
276
- "burnRate": 20,
277
- "divideRate": 30,
278
- "liquidityRate": 40,
279
- "recipientRate": 10,
280
- "recipientAddress": "0x1234567890123456789012345678901234567890",
281
- "minSharing": 100000
282
- }
283
- }
284
- ```
285
-
286
- **Step 3 Create token (chain)**
287
- ```bash
288
- fourmeme create-chain <createArgHex> <signatureHex>
289
- # Or pipe: fourmeme create-api ... | fourmeme create-chain --
290
- ```
291
-
292
- #### Full automated create flow
293
-
294
- To **create and submit on-chain in one go**, the Agent should:
295
-
296
- 1. **Run create-api** to get signature data (same as Step 2 above; JSON with `createArg` and `signature`):
297
- ```bash
298
- fourmeme create-api --image= --name= --short-name= --desc= --label= [--tax-options=path]
299
- ```
300
- Parse stdout JSON for `createArg` and `signature` (already hex strings).
301
-
302
- 2. **Run create-chain** with those two values:
303
- ```bash
304
- fourmeme create-chain <createArgHex> <signatureHex>
305
- ```
306
- This calls `TokenManager2.createToken(createArg, sign)` on BSC and outputs tx result / token address.
307
-
308
- 3. **Optional**: If the user said “create and go on-chain for me”, the Agent can run the two steps in sequence after collecting tax params, then summarize: success, `tokenAddress` / `requestId`, and main params (name, shortName, label, tax config).
309
-
310
- ### token-info
311
-
312
- ```bash
313
- fourmeme token-info <tokenAddress>
314
- ```
315
- On-chain query (Helper3); returns version, tokenManager, price, offers, etc.
316
-
317
- ### token-list / token-get / token-rankings (REST)
318
-
319
- Four.meme REST API; use `Accept: application/json`; no login or cookie.
320
-
321
- **Token list (filter / paginate)**
322
- ```bash
323
- fourmeme token-list [--orderBy=Hot] [--pageIndex=1] [--pageSize=30] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=false]
324
- ```
325
-
326
- **Token detail and trading info**
327
- ```bash
328
- fourmeme token-get <tokenAddress>
329
- ```
330
- API: GET `/private/token/get/v2?address=...`
331
-
332
- **Rankings**
333
- ```bash
334
- fourmeme token-rankings <orderBy> [--barType=HOUR24]
335
- ```
336
- orderBy: `Time` (newest) | `ProgressDesc` | `TradingDesc` (24h volume; barType HOUR24) | `Hot` | `Graduated`. Output JSON.
337
-
338
- ### quote-buy / quote-sell (estimate only; no transaction)
339
-
340
- ```bash
341
- fourmeme quote-buy <tokenAddress> <amountWei> [fundsWei]
342
- fourmeme quote-sell <tokenAddress> <amountWei>
343
- ```
344
- - amountWei: token amount (use 0 when buying by quote amount); fundsWei: quote to spend (omit or 0 when buying by token amount).
345
-
346
- ### buy / sell (execute; requires PRIVATE_KEY)
347
-
348
- **Buy** (one of):
349
- - By amount: `fourmeme buy <token> amount <amountWei> <maxFundsWei>` (spend at most maxFundsWei to buy amountWei tokens).
350
- - By funds: `fourmeme buy <token> funds <fundsWei> <minAmountWei>` (spend fundsWei quote, receive at least minAmountWei tokens).
351
-
352
- **Sell**: Script performs approve then sell.
353
- ```bash
354
- fourmeme sell <tokenAddress> <amountWei> [minFundsWei]
355
- ```
356
- - minFundsWei optional (slippage: minimum quote received). V2 tokens only.
357
-
358
- ### send (send BNB or ERC20 to an address)
359
-
360
- Send **native BNB** or **ERC20** from the current wallet (PRIVATE_KEY) to a given address (BSC).
361
-
362
- ```bash
363
- fourmeme send <toAddress> <amountWei> [tokenAddress]
364
- ```
365
-
366
- | Argument | Description |
367
- |----------|-------------|
368
- | `toAddress` | Recipient address (0x...) |
369
- | `amountWei` | Amount in wei (BNB or token smallest unit) |
370
- | `tokenAddress` | Optional. Omit or use `BNB` / `0x0` for native BNB; otherwise ERC20 contract address |
371
-
372
- - Env: `PRIVATE_KEY`. Optional: `BSC_RPC_URL`.
373
- - Output: JSON with `txHash`, `to`, `amountWei`, `native` (whether BNB).
374
-
375
- Examples:
376
- ```bash
377
- # Send 0.1 BNB (1e17 wei)
378
- fourmeme send 0x1234...abcd 100000000000000000
379
-
380
- # Send 1000 units of an ERC20 (18 decimals)
381
- fourmeme send 0x1234...abcd 1000000000000000000000 0xTokenContractAddress
382
- ```
383
-
384
- ### EIP-8004 identity NFT (register and query)
385
-
386
- EIP-8004 identity NFT: **register** (mint) and **query balance**. Default contract: `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` (BSC). Override with env `8004_NFT_ADDRESS` or `EIP8004_NFT_ADDRESS`.
387
-
388
- **Register**: Requires `PRIVATE_KEY`. User provides name (required), image URL (optional), description (optional). CLI builds EIP-8004 payload (type, name, description, image, active, supportedTrust), encodes as `data:application/json;base64,<base64>` for `agentURI`, and calls `register(string agentURI)`.
389
-
390
- ```bash
391
- fourmeme 8004-register <name> [imageUrl] [description]
392
- ```
393
-
394
- | Argument | Description |
395
- |----------|-------------|
396
- | `name` | Required. Identity name |
397
- | `imageUrl` | Optional. Avatar/image URL (must be publicly reachable) |
398
- | `description` | Optional. Description |
399
-
400
- - Output JSON: `txHash`, `agentId` (from event), `agentURI`.
401
-
402
- **Query**: Read-only; number of 8004 NFTs held by an address.
403
-
404
- ```bash
405
- fourmeme 8004-balance <ownerAddress>
406
- ```
407
-
408
- - Output JSON: `owner`, `balance`.
409
-
410
- Examples:
411
- ```bash
412
- fourmeme 8004-register "myagent" "https://example.com/logo.png" "My agent description"
413
- fourmeme 8004-balance 0x1234567890123456789012345678901234567890
414
- ```
415
-
416
- ### events (TokenManager2 V2 only)
417
-
418
- Fetch TokenCreate, TokenPurchase, TokenSale, LiquidityAdded on BSC.
419
-
420
- ```bash
421
- fourmeme events <fromBlock> [toBlock]
422
- ```
423
- Omit toBlock for latest. Real-time subscription: [references/event-listening.md](references/event-listening.md).
424
-
425
- ### tax-info (TaxToken fee/tax)
426
-
427
- Only for TaxToken (creatorType 5).
428
-
429
- ```bash
430
- fourmeme tax-info <tokenAddress>
431
- ```
432
- See [references/tax-token-query.md](references/tax-token-query.md).
433
-
434
- ## API and config reference
435
-
436
- - **Token detail (REST)**: `GET /private/token/get?address=<token>`, `GET /private/token/getById?id=<requestId>` (requestId from TokenCreate event). Response may include `data.aiCreator` (token created by Agent). List/rankings: [references/token-query-api.md](references/token-query-api.md).
437
- - **Agent Creator / Agent wallets**: On-chain — token template bit 85 for “created by agent”; AgentIdentifier contract (`isAgent(wallet)`) on BSC to identify agent wallets. See [references/agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) and [references/contract-addresses.md](references/contract-addresses.md).
438
- - **raisedToken**: `GET https://four.meme/meme-api/v1/public/config` for current raisedToken; use as-is in create body; do not modify its fields.
439
-
440
- ## References
441
-
442
- | Document | Description |
443
- |----------|-------------|
444
- | [contract-addresses.md](references/contract-addresses.md) | TokenManager / TokenManager2 / Helper3 addresses (BSC) |
445
- | [api-create-token.md](references/api-create-token.md) | Create token API (nonce / login / upload / create) |
446
- | [create-token-scripts.md](references/create-token-scripts.md) | Create token script flow and examples |
447
- | [token-tax-info.md](references/token-tax-info.md) | Tax token tokenTaxInfo parameters and constraints |
448
- | [token-query-api.md](references/token-query-api.md) | Token list / detail / rankings REST API |
449
- | [errors.md](references/errors.md) | buy/sell error codes; X Mode / TaxToken / AntiSniperFeeMode; Agent Creator |
450
- | [agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) | Token created by Agent Creator; AgentIdentifier contract and Agent wallets |
451
- | [execute-trade.md](references/execute-trade.md) | Execute buy/sell CLI and contract usage |
452
- | [event-listening.md](references/event-listening.md) | TokenManager2 event listening (V2) |
453
- | [tax-token-query.md](references/tax-token-query.md) | TaxToken on-chain fee/tax query (tax-info) |
454
- | **Official four.meme API and contracts (online)**: [Protocol Integration](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) | API documents, ABIs: TokenManager, TokenManager2, Helper3, TaxToken, AgentIdentifier, etc. |
1
+ ---
2
+ name: four-meme-ai
3
+ description: |
4
+ CLI tool for creating and trading meme tokens on Four.Meme (BSC), with structured JSON outputs for config, token details, pricing quotes, on-chain events, and TaxToken fee configuration.
5
+
6
+
7
+
8
+ allowed-tools:
9
+ - Bash(fourmeme *)
10
+ - Bash(npx fourmeme *)
11
+ license: MIT
12
+ metadata:
13
+ {"author":"Four.meme AI Skill","version":"1.0.4","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY","optionalEnv":["BSC_RPC_URL"]}}
14
+ ---
15
+
16
+ ## [Agent must follow] User agreement and security notice on first use
17
+
18
+ When responding to any user request about fourmeme or this skill, **you must first** present the content below in this order: **User Agreement, then Security Notice**, and state clearly that by choosing to continue, the user agrees to the User Agreement.
19
+ Until the user has explicitly agreed or confirmed to continue, **do not** run `create-api`, `create-chain`, `buy`, `sell`, `send`, or `8004-register` (any operation that uses the private key or writes to the chain). Read-only commands (e.g. `config`, `token-info`, `quote-buy`, `8004-balance`) may be run while or after presenting the notice.
20
+
21
+ **Language selection**: Present the User Agreement and Security Notice **in the user’s language**. If the user is writing in **Traditional Chinese (繁體中文)**, use the **繁體中文** block below; otherwise use the **English** block.
22
+
23
+ ---
24
+
25
+ ### User Agreement & Security Notice (繁體中文)
26
+
27
+ **用戶協議**
28
+
29
+ **前情提示**:使用本插件及本 skill 所涉功能(包括但不限於代幣創建、買賣、轉帳、8004 註冊等)前,請您閱讀以下協議。**若您選擇繼續使用本插件及本 skill 功能,即表示您已閱讀、理解並同意本協議。**
30
+
31
+ **本插件性質與責任限制**:本插件僅提供純本地的命令列互動能力(私鑰透過環境變數或本地設定使用),**不會收集、上傳或儲存您的私鑰**。因任何原因(包括但不限於插件被竄改、環境遭入侵、誤操作、第三方插件等)導致的私鑰洩露或資產損失,**本插件及提供方不承擔責任**。
32
+
33
+ **安全警示**
34
+
35
+ 使用本插件進行代幣創建、買賣、轉帳等操作時,請務必注意:
36
+
37
+ - **保護私鑰**:切勿在聊天對話中輸入、貼上或洩露私鑰;不要將私鑰分享給任何人或任何第三方。
38
+ - **交易錢包僅存小額資金**:用於執行操作的錢包(即提供 PRIVATE_KEY 的錢包)建議只存放少量資金,以降低因洩露或誤操作導致的損失。
39
+ - **及時轉出資金**:完成交易後,請及時將交易錢包中的資產轉移到您自己控制的、更安全的錢包或冷錢包中。
40
+ - **謹慎安裝 Agent/插件**:下載或安裝任何 Agent、瀏覽器插件或第三方工具時,請確認來源可信,避免惡意插件竊取私鑰或助記詞。
41
+
42
+ ---
43
+
44
+ ### User Agreement & Security Notice (English)
45
+
46
+ **User Agreement**
47
+
48
+ **Notice**: Before using this plugin and this skill (including but not limited to token creation, buy/sell, transfers, 8004 registration), please read the following. **By choosing to continue using this plugin and this skill, you have read, understood, and agreed to this agreement.**
49
+
50
+ **Plugin nature and limitation of liability**: This plugin provides local-only CLI interaction (private key is used via environment or local config). It **does not collect, upload, or store your private key**. The plugin and its providers **are not liable** for private key disclosure or asset loss due to any cause (including but not limited to tampered plugin, compromised environment, user error, or third-party plugins).
51
+
52
+ **Security Notice**
53
+
54
+ When using this plugin for token creation, trading, or transfers, please:
55
+
56
+ - **Protect your private key**: Do not type, paste, or expose your private key in chat; do not share it with anyone or any third party.
57
+ - **Keep only small amounts in the trading wallet**: The wallet used for operations (the one whose PRIVATE_KEY you provide) should hold only a small amount of funds to limit loss from disclosure or mistakes.
58
+ - **Move funds out promptly**: After trading, move assets from the trading wallet to a wallet or cold storage you control.
59
+ - **Install agents/plugins carefully**: When installing any agent, browser extension, or third-party tool, verify the source to avoid malware that could steal your private key or seed phrase.
60
+
61
+ ---
62
+
63
+ ## fourmeme capability overview
64
+
65
+ After you agree to the above and confirm to continue, this skill can help you with the following (all via the `fourmeme` CLI on BSC):
66
+
67
+ | Category | Capability | Description |
68
+ |----------|-------------|-------------|
69
+ | **Create** | Create token | Upload image + name/symbol/description/label; optional tax-token params; API returns signature then on-chain create. |
70
+ | **Query** | Public config | Get raisedToken and other public config (no auth). |
71
+ | **Query** | Token info (on-chain) | By address: version, tokenManager, price, offers (Helper3). |
72
+ | **Query** | Token list / detail / rankings | REST: filtered paginated list, single-token detail and trading info, hot/24h volume/newest/graduated rankings. |
73
+ | **Trading** | Buy/sell quotes | Estimate cost or proceeds for buy or sell (no transaction sent). |
74
+ | **Trading** | Execute buy | Buy a given token by amount or by quote spent (requires PRIVATE_KEY). |
75
+ | **Trading** | Execute sell | Sell a given token amount; optional minimum quote received (requires PRIVATE_KEY). |
76
+ | **Other** | Event listening | Fetch TokenCreate, TokenPurchase, TokenSale, LiquidityAdded on-chain. |
77
+ | **Other** | Tax token fees | Query on-chain fee and burn/dividend/liquidity config for a token. |
78
+ | **Other** | Send | Send BNB or ERC20 to a given address (requires PRIVATE_KEY). |
79
+ | **Other** | EIP-8004 | Register 8004 identity NFT; query balance by address. |
80
+
81
+ See the **CLI (fourmeme)** table and sections below for commands and arguments.
82
+
83
+ ---
84
+
85
+ # fourmeme CLI
86
+
87
+ BSC only; all commands output JSON.
88
+
89
+ ## CLI (fourmeme)
90
+
91
+ **Installation (required):** `npm install -g @four-meme/four-meme-ai@latest`. After install, run `fourmeme <command> [args]`; with local install only, use `npx fourmeme <command> [args]` from the project root. Run `fourmeme --help` for usage.
92
+
93
+ This skill provides: token creation (API + chain), buy/sell quotes and execution, token info/list/rankings, event listening, Tax token fee queries, send, and EIP-8004 identity NFT register and balance. Contract addresses: [references/contract-addresses.md](references/contract-addresses.md). **TokenManager V1 is not supported.**
94
+
95
+ ### PRIVATE_KEY and BSC_RPC_URL
96
+
97
+ **When using OpenClaw**
98
+ This skill declares `requires.env: ["PRIVATE_KEY"]` and `primaryEnv: "PRIVATE_KEY"` in metadata; OpenClaw injects them only when an agent runs with **this skill enabled** (other skills cannot access them).
99
+
100
+ **Required steps:**
101
+ 1. **Configure private key**: In the Skill management page, set the four-meme-ai skill’s **apiKey** (corresponds to `primaryEnv: "PRIVATE_KEY"`), or set `PRIVATE_KEY` under `skills.entries["four-meme-ai"].env` in `~/.openclaw/openclaw.json`. Optionally set **BSC_RPC_URL** in global env if needed.
102
+ 2. **Enable this skill**: In the agent or session, ensure the **four-meme-ai** skill is **enabled**. Only when the skill is enabled will OpenClaw inject **PRIVATE_KEY** into the process; otherwise create/buy/sell/send/8004-register will fail with missing key. **BSC_RPC_URL** is optional (metadata: `optionalEnv`); if not set, scripts use a default BSC RPC.
103
+
104
+ **When not using OpenClaw (standalone)**
105
+ Set **PRIVATE_KEY** and optionally **BSC_RPC_URL** via the process environment so they are available when running `npx fourmeme` or `node bin/fourmeme.cjs`:
106
+
107
+ - **.env file**: Put a `.env` file in **the directory where you run the `fourmeme` command** (i.e. your project / working directory). Example: if you run `fourmeme quote-buy ...` from `/path/to/my-project`, place `.env` at `/path/to/my-project/.env`. The CLI automatically loads `.env` from that current working directory. Use lines like `PRIVATE_KEY=...` and `BSC_RPC_URL=...`. Do not commit `.env`; add it to `.gitignore`.
108
+ - **Shell export**: `export PRIVATE_KEY=your_hex_key` and `export BSC_RPC_URL=https://bsc-dataseed.binance.org` (or another BSC RPC), then run `npx fourmeme <command> ...`.
109
+
110
+ ### Declared and optional environment variables
111
+
112
+ - **Declared in registry metadata** (injected by OpenClaw when skill is enabled): **PRIVATE_KEY** (required for write operations). Optional in metadata: **BSC_RPC_URL** (scripts fall back to default BSC RPC if unset).
113
+ - **Not in metadata; optional, may be set in env or project `.env`**: **BSC_RPC_URL**, **CREATION_FEE_WEI** (extra BNB on create), **WEB_URL**, **TWITTER_URL**, **TELEGRAM_URL**, **PRE_SALE**, **FEE_PLAN**, **8004_NFT_ADDRESS** / **EIP8004_NFT_ADDRESS**. Only **PRIVATE_KEY** is required for signing; others have defaults or are used only for specific commands (see Create token flow, EIP-8004, etc.). Tax token params use CLI only (`--tax-options=` or `--tax-token --tax-fee-rate=...`).
114
+
115
+ ### Execution and install
116
+
117
+ - **Invocation**: The agent must run commands only via the **fourmeme** CLI: `fourmeme <command> [args]` or `npx fourmeme <command> [args]` (allowed-tools). Do not invoke scripts or `npx tsx` directly; the CLI entry (`bin/fourmeme.cjs`) dispatches to the correct script and loads `.env` from the current working directory.
118
+
119
+ | Need | Command | When |
120
+ |------|---------|------|
121
+ | Public config | `fourmeme config` | Get raisedToken / config (no auth) |
122
+ | Token info (on-chain) | `fourmeme token-info <tokenAddress>` | Version, tokenManager, price, offers (BSC Helper3) |
123
+ | Token list (REST) | `fourmeme token-list [--orderBy=] [--pageIndex=] [--pageSize=] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=]` | Filtered, paginated token list |
124
+ | Token detail (REST) | `fourmeme token-get <tokenAddress>` | Token detail and trading info (get/v2) |
125
+ | Token rankings (REST) | `fourmeme token-rankings <orderBy> [--barType=HOUR24]` | Time / ProgressDesc / TradingDesc / Hot / Graduated; barType for TradingDesc |
126
+ | Buy quote | `fourmeme quote-buy <token> <amountWei> [fundsWei]` | Estimate only; no transaction |
127
+ | Sell quote | `fourmeme quote-sell <token> <amountWei>` | Estimate only; no transaction |
128
+ | **Execute buy** | `fourmeme buy <token> amount <amountWei> <maxFundsWei>` | Buy fixed amount (needs PRIVATE_KEY) |
129
+ | **Execute buy** | `fourmeme buy <token> funds <fundsWei> <minAmountWei>` | Spend fixed quote (e.g. BNB) (needs PRIVATE_KEY) |
130
+ | **Execute sell** | `fourmeme sell <token> <amountWei> [minFundsWei]` | Sell (needs PRIVATE_KEY) |
131
+ | **Send** | `fourmeme send <toAddress> <amountWei> [tokenAddress]` | Send BNB or ERC20 to address (needs PRIVATE_KEY) |
132
+ | **EIP-8004 register** | `fourmeme 8004-register <name> [imageUrl] [description]` | Register 8004 identity NFT (needs PRIVATE_KEY) |
133
+ | **EIP-8004 query** | `fourmeme 8004-balance <ownerAddress>` | Query 8004 NFT balance (read-only) |
134
+ | Events | `fourmeme events <fromBlock> [toBlock]` | TokenCreate / Purchase / Sale / LiquidityAdded |
135
+ | Tax token info | `fourmeme tax-info <tokenAddress>` | Fee/tax config for TaxToken |
136
+ | Read-only check | `fourmeme verify` | Run config + events (last 50 blocks) |
137
+
138
+ Chain: **BSC only** (Arbitrum/Base not supported).
139
+
140
+ ### Create token (full flow)
141
+
142
+ **1. Ask user for required information (must be done first)**
143
+
144
+ Before calling `create-instant`, the Agent **must** ask the user for and confirm:
145
+
146
+ | Info | Required | Description |
147
+ |------|----------|-------------|
148
+ | **Image path** (imagePath) | Yes | Local logo path; jpeg/png/gif/bmp/webp |
149
+ | **Token name** (name) | Yes | Full token name |
150
+ | **Token symbol** (shortName) | Yes | e.g. MTK, DOGE |
151
+ | **Description** (desc) | Yes | Token description text |
152
+ | **Label** (label) | Yes | One of: Meme \| AI \| Defi \| Games \| Infra \| De-Sci \| Social \| Depin \| Charity \| Others |
153
+ | **Tax token?** | No | If yes, ask for tokenTaxInfo (feeRate, four rates, recipientAddress, minSharing); see "tokenTaxInfo parameters" below |
154
+
155
+ Optional: `--web-url=`, `--twitter-url=`, `--telegram-url=`, `--pre-sale=` (BNB), `--fee-plan=`; may be provided or left at defaults.
156
+
157
+ **2. Technical flow (done by create-instant)**
158
+
159
+ After collecting the above, execute in this order (handled by scripts or CLI):
160
+
161
+ 1. **Get nonce** — `POST /private/user/nonce/generate` with body accountAddress, verifyType, networkCode (BSC).
162
+ 2. **Login** Sign `You are sign in Meme {nonce}` with wallet; `POST /private/user/login/dex` to get access_token.
163
+ 3. **Upload image** — `POST /private/token/upload` with access_token in header and image as body; get imgUrl.
164
+ 4. **Create** — `fourmeme create-instant --image= --name= --short-name= --desc= --label= [options]` runs API create and submits `TokenManager2.createToken` on BSC in one command.
165
+
166
+ > **Split flow (optional):** Step 4 GET `/public/config` for raisedToken; `POST /private/token/create` with name, shortName, desc, imgUrl, label, raisedToken, etc.; get createArg, signature. Step 5 Call `TokenManager2.createToken(createArg, sign)` on BSC. Use `fourmeme create-api` then `fourmeme create-chain` for this split flow.
167
+
168
+ **Commands:** `fourmeme create-instant --image= --name= --short-name= --desc= --label= [options]` (recommended). Or split: `fourmeme create-api ...` then `fourmeme create-chain <createArgHex> <signatureHex>`. Full params: `fourmeme --help`. References: [api-create-token.md](references/api-create-token.md), [create-token-scripts.md](references/create-token-scripts.md), [token-tax-info.md](references/token-tax-info.md).
169
+
170
+ **Tax token**
171
+ - **Option 1**: `--tax-options=<path>` path to JSON file with `{ "tokenTaxInfo": { ... } }`; fields see “tokenTaxInfo parameters” below.
172
+ - **Option 2**: CLI: `--tax-token --tax-fee-rate=5 --tax-burn-rate=0 --tax-divide-rate=0 --tax-liquidity-rate=100 --tax-recipient-rate=0 --tax-recipient-address= --tax-min-sharing=100000` (burn+divide+liquidity+recipient = 100). See [references/token-tax-info.md](references/token-tax-info.md).
173
+
174
+ **tokenTaxInfo parameters** (required for tax token, via JSON or CLI):
175
+
176
+ | Field | Type | Description | Constraint |
177
+ |-------|------|-------------|------------|
178
+ | `feeRate` | number | Trading fee rate (%) | **Only** `1`, `3`, `5`, `10` |
179
+ | `burnRate` | number | Burn share (%) | Sum with next three = 100 |
180
+ | `divideRate` | number | Dividend share (%) | Same |
181
+ | `liquidityRate` | number | Liquidity share (%) | Same |
182
+ | `recipientRate` | number | Recipient share (%) | 0 if unused |
183
+ | `recipientAddress` | string | Recipient address | `""` if unused |
184
+ | `minSharing` | number | Min balance for dividend (ether units) | d×10ⁿ, n≥5, 1≤d≤9; e.g. 100000, 1000000 |
185
+
186
+ Example (5% fee, 20% burn, 30% dividend, 40% liquidity, 10% recipient):
187
+
188
+ ```json
189
+ {
190
+ "tokenTaxInfo": {
191
+ "feeRate": 5,
192
+ "burnRate": 20,
193
+ "divideRate": 30,
194
+ "liquidityRate": 40,
195
+ "recipientRate": 10,
196
+ "recipientAddress": "0x1234567890123456789012345678901234567890",
197
+ "minSharing": 100000
198
+ }
199
+ }
200
+ ```
201
+
202
+ ### token-info
203
+
204
+ ```bash
205
+ fourmeme token-info <tokenAddress>
206
+ ```
207
+ On-chain query (Helper3); returns version, tokenManager, price, offers, etc.
208
+
209
+ ### token-list / token-get / token-rankings (REST)
210
+
211
+ Four.meme REST API; use `Accept: application/json`; no login or cookie.
212
+
213
+ **Token list (filter / paginate)**
214
+ ```bash
215
+ fourmeme token-list [--orderBy=Hot] [--pageIndex=1] [--pageSize=30] [--tokenName=] [--symbol=] [--labels=] [--listedPancake=false]
216
+ ```
217
+
218
+ **Token detail and trading info**
219
+ ```bash
220
+ fourmeme token-get <tokenAddress>
221
+ ```
222
+ API: GET `/private/token/get/v2?address=...`
223
+
224
+ **Rankings**
225
+ ```bash
226
+ fourmeme token-rankings <orderBy> [--barType=HOUR24]
227
+ ```
228
+ orderBy: `Time` (newest) | `ProgressDesc` | `TradingDesc` (24h volume; barType HOUR24) | `Hot` | `Graduated`. Output JSON.
229
+
230
+ ### quote-buy / quote-sell (estimate only; no transaction)
231
+
232
+ ```bash
233
+ fourmeme quote-buy <tokenAddress> <amountWei> [fundsWei]
234
+ fourmeme quote-sell <tokenAddress> <amountWei>
235
+ ```
236
+ - amountWei: token amount (use 0 when buying by quote amount); fundsWei: quote to spend (omit or 0 when buying by token amount).
237
+
238
+ ### buy / sell (execute; requires PRIVATE_KEY)
239
+
240
+ **Buy** (one of):
241
+ - By amount: `fourmeme buy <token> amount <amountWei> <maxFundsWei>` (spend at most maxFundsWei to buy amountWei tokens).
242
+ - By funds: `fourmeme buy <token> funds <fundsWei> <minAmountWei>` (spend fundsWei quote, receive at least minAmountWei tokens).
243
+
244
+ **Sell**: Script performs approve then sell.
245
+ ```bash
246
+ fourmeme sell <tokenAddress> <amountWei> [minFundsWei]
247
+ ```
248
+ - minFundsWei optional (slippage: minimum quote received). V2 tokens only.
249
+
250
+ ### send (send BNB or ERC20 to an address)
251
+
252
+ Send **native BNB** or **ERC20** from the current wallet (PRIVATE_KEY) to a given address (BSC).
253
+
254
+ ```bash
255
+ fourmeme send <toAddress> <amountWei> [tokenAddress]
256
+ ```
257
+
258
+ | Argument | Description |
259
+ |----------|-------------|
260
+ | `toAddress` | Recipient address (0x...) |
261
+ | `amountWei` | Amount in wei (BNB or token smallest unit) |
262
+ | `tokenAddress` | Optional. Omit or use `BNB` / `0x0` for native BNB; otherwise ERC20 contract address |
263
+
264
+ - Env: `PRIVATE_KEY`. Optional: `BSC_RPC_URL`.
265
+ - Output: JSON with `txHash`, `to`, `amountWei`, `native` (whether BNB).
266
+
267
+ Examples:
268
+ ```bash
269
+ # Send 0.1 BNB (1e17 wei)
270
+ fourmeme send 0x1234...abcd 100000000000000000
271
+
272
+ # Send 1000 units of an ERC20 (18 decimals)
273
+ fourmeme send 0x1234...abcd 1000000000000000000000 0xTokenContractAddress
274
+ ```
275
+
276
+ ### EIP-8004 identity NFT (register and query)
277
+
278
+ EIP-8004 identity NFT: **register** (mint) and **query balance**. Default contract: `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` (BSC). Override with env `8004_NFT_ADDRESS` or `EIP8004_NFT_ADDRESS`.
279
+
280
+ **Register**: Requires `PRIVATE_KEY`. User provides name (required), image URL (optional), description (optional). CLI builds EIP-8004 payload (type, name, description, image, active, supportedTrust), encodes as `data:application/json;base64,<base64>` for `agentURI`, and calls `register(string agentURI)`.
281
+
282
+ ```bash
283
+ fourmeme 8004-register <name> [imageUrl] [description]
284
+ ```
285
+
286
+ | Argument | Description |
287
+ |----------|-------------|
288
+ | `name` | Required. Identity name |
289
+ | `imageUrl` | Optional. Avatar/image URL (must be publicly reachable) |
290
+ | `description` | Optional. Description |
291
+
292
+ - Output JSON: `txHash`, `agentId` (from event), `agentURI`.
293
+
294
+ **Query**: Read-only; number of 8004 NFTs held by an address.
295
+
296
+ ```bash
297
+ fourmeme 8004-balance <ownerAddress>
298
+ ```
299
+
300
+ - Output JSON: `owner`, `balance`.
301
+
302
+ Examples:
303
+ ```bash
304
+ fourmeme 8004-register "myagent" "https://example.com/logo.png" "My agent description"
305
+ fourmeme 8004-balance 0x1234567890123456789012345678901234567890
306
+ ```
307
+
308
+ ### events (TokenManager2 V2 only)
309
+
310
+ Fetch TokenCreate, TokenPurchase, TokenSale, LiquidityAdded on BSC.
311
+
312
+ ```bash
313
+ fourmeme events <fromBlock> [toBlock]
314
+ ```
315
+ Omit toBlock for latest. Real-time subscription: [references/event-listening.md](references/event-listening.md).
316
+
317
+ ### tax-info (TaxToken fee/tax)
318
+
319
+ Only for TaxToken (creatorType 5).
320
+
321
+ ```bash
322
+ fourmeme tax-info <tokenAddress>
323
+ ```
324
+ See [references/tax-token-query.md](references/tax-token-query.md).
325
+
326
+ ## Agent workflow: buy/sell from rankings or events
327
+
328
+ This skill supports a flow to discover tokens, get details, quote, and execute. The following is an example workflow, not a trading recommendation: discover → detail → quote → execute.
329
+
330
+ 1. **Discover** (one or more of):
331
+ - **Rankings**: `fourmeme token-rankings <orderBy>` (orderBy = Hot, TradingDesc, Time, ProgressDesc, Graduated); use token addresses from the response.
332
+ - **List**: `fourmeme token-list [--orderBy=] [--labels=] ...` to filter and get addresses.
333
+ - **On-chain events**: `fourmeme events <fromBlock> [toBlock]`; parse token addresses from TokenCreate/TokenPurchase, etc., for "newly created" or "recent trades" strategies.
334
+ 2. **Get details**: For each candidate, call `fourmeme token-get <address>` (REST detail and trading info) or `fourmeme token-info <address>` (on-chain version, tokenManager, price, offers) to filter or display.
335
+ 3. **Quote**: `fourmeme quote-buy <token> <amountWei> [fundsWei]` / `fourmeme quote-sell <token> <amountWei>` for estimated cost or proceeds.
336
+ 4. **Execute**: `fourmeme buy ...` / `fourmeme sell ...` (requires PRIVATE_KEY). **Before executing, the Agent must confirm user intent** (e.g. user said "buy 0.05 BNB each for top 5 by 24h volume" or "auto-buy 0.01 BNB for new tokens") and obtain explicit confirmation before first automated execution to avoid unauthorized use of funds.
337
+
338
+ When the user asks to "buy/sell based on rankings or activity", the Agent should clarify: which ranking (hot, 24h volume, newest, graduated, etc.), amount per token, and whether to quote only or also execute; then run the appropriate commands.
339
+
340
+ ## Trading (Buy / Sell)
341
+
342
+ - **Version** – Use TokenManagerHelper3 `getTokenInfo(token)`. If `version === 1` use V1 TokenManager; if `version === 2` use TokenManager2 (and check for X Mode / TaxToken / AntiSniperFeeMode if needed).
343
+ - **Quote (pre-calc)** – TokenManagerHelper3:
344
+ - Buy: `tryBuy(token, amount, funds)` use `amount > 0` for "buy X tokens", or `funds > 0` for "spend X quote".
345
+ - Sell: `trySell(token, amount)`.
346
+ - **Execute** Use the `tokenManager` address from `getTokenInfo` and call the corresponding contract:
347
+ - V1: `purchaseToken` / `purchaseTokenAMAP`, `saleToken`.
348
+ - V2: `buyToken` / `buyTokenAMAP`, `sellToken`. For sell, user must `ERC20.approve(tokenManager, amount)` first.
349
+ - X Mode tokens: use TokenManager2 `buyToken(bytes args, uint256 time, bytes signature)` with encoded `BuyTokenParams`.
350
+
351
+ ## API and config reference
352
+
353
+ - **Token detail (REST)**: `GET /private/token/get?address=<token>`, `GET /private/token/getById?id=<requestId>` (requestId from TokenCreate event). Response may include `data.aiCreator` (token created by Agent). List/rankings: [references/token-query-api.md](references/token-query-api.md).
354
+ - **Agent Creator / Agent wallets**: On-chain — token template bit 85 for “created by agent”; AgentIdentifier contract (`isAgent(wallet)`) on BSC to identify agent wallets. See [references/agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) and [references/contract-addresses.md](references/contract-addresses.md).
355
+ - **raisedToken**: `GET https://four.meme/meme-api/v1/public/config` for current raisedToken; use as-is in create body; do not modify its fields.
356
+
357
+ ## References
358
+
359
+ | Document | Description |
360
+ |----------|-------------|
361
+ | [contract-addresses.md](references/contract-addresses.md) | TokenManager / TokenManager2 / Helper3 addresses (BSC) |
362
+ | [api-create-token.md](references/api-create-token.md) | Create token API (nonce / login / upload / create) |
363
+ | [create-token-scripts.md](references/create-token-scripts.md) | Create token script flow and examples |
364
+ | [token-tax-info.md](references/token-tax-info.md) | Tax token tokenTaxInfo parameters and constraints |
365
+ | [token-query-api.md](references/token-query-api.md) | Token list / detail / rankings REST API |
366
+ | [errors.md](references/errors.md) | buy/sell error codes; X Mode / TaxToken / AntiSniperFeeMode; Agent Creator |
367
+ | [agent-creator-and-wallets.md](references/agent-creator-and-wallets.md) | Token created by Agent Creator; AgentIdentifier contract and Agent wallets |
368
+ | [execute-trade.md](references/execute-trade.md) | Execute buy/sell CLI and contract usage |
369
+ | [event-listening.md](references/event-listening.md) | TokenManager2 event listening (V2) |
370
+ | [tax-token-query.md](references/tax-token-query.md) | TaxToken on-chain fee/tax query (tax-info) |
371
+ | **Official four.meme API and contracts (online)**: [Protocol Integration](https://four-meme.gitbook.io/four.meme/brand/protocol-integration) | API documents, ABIs: TokenManager, TokenManager2, Helper3, TaxToken, AgentIdentifier, etc. |
@@ -1,21 +1,34 @@
1
1
  # Create Token Scripts (Four.meme)
2
2
 
3
- ## One-shot (create-token-instant)
3
+ **Recommended:** Use `fourmeme create-instant` for one-shot token creation (API + on-chain in one command). Use the step-by-step flow only when you need to inspect or modify the API output before submitting on-chain.
4
+
5
+ ## One-shot (create-instant) — recommended
4
6
 
5
7
  **create-token-instant.ts** runs API create + on-chain submit in one command. Same args as create-token-api; on success submits createToken and outputs `txHash`.
6
8
 
9
+ - All options as `--key=value`; no positionals.
10
+ - **Required**: `--image=`, `--name=`, `--short-name=`, `--desc=`, `--label=`.
11
+ - **Optional**: `--web-url=`, `--twitter-url=`, `--telegram-url=` (only sent when non-empty); `--pre-sale=0` (**presale in ether units**, e.g. `0.001` for 0.001 BNB, not wei); `--fee-plan=false`, `--tax-options=<path>`; `--value=<wei>` (default to be auto calculated, override BNB value sent; otherwise API output `creationFeeWei` is used).
12
+ - **Tax token**: `--tax-options=tax.json` or `--tax-token` with `--tax-fee-rate=5` `--tax-burn-rate=0` `--tax-divide-rate=0` `--tax-liquidity-rate=100` `--tax-recipient-rate=0` `--tax-recipient-address=` `--tax-min-sharing=100000` (burn+divide+liquidity+recipient=100).
13
+ - **Label** (exactly one): `Meme` | `AI` | `Defi` | `Games` | `Infra` | `De-Sci` | `Social` | `Depin` | `Charity` | `Others`.
14
+ - **Env**: `PRIVATE_KEY`; RPC via `BSC_RPC_URL`.
15
+ - **Flow**: nonce → login → upload image → GET public config → POST create → submit `TokenManager2.createToken` on BSC.
16
+ - **Output**: JSON `{ "txHash" }`.
17
+
7
18
  ```bash
8
- # Same as create-token-api, all --key=value
9
- npx tsx .../create-token-instant.ts --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI
10
- # Or via CLI
19
+ # Via CLI (recommended)
11
20
  fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI
12
- ```
13
21
 
14
- Optional `--value=wei` overrides the value; otherwise API output `creationFeeWei` is used. Env: `PRIVATE_KEY`, optional `BSC_RPC_URL`.
22
+ # With presale (BNB, ether units)
23
+ fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI --pre-sale=0.001
24
+
25
+ # Tax token
26
+ fourmeme create-instant --image=./logo.png --name=TaxToken --short-name=TAX --desc="Tax" --label=Meme --tax-options=tax.json
27
+ ```
15
28
 
16
29
  ---
17
30
 
18
- ## Step-by-step flow
31
+ ## Step-by-step flow (create-api → create-chain)
19
32
 
20
33
  1. **get-public-config.ts** (optional)
21
34
  Fetches `raisedToken` from `https://four.meme/meme-api/v1/public/config`. Use when building the create body manually.
@@ -54,6 +67,13 @@ Optional `--value=wei` overrides the value; otherwise API output `creationFeeWei
54
67
  - `fee_rate` from TokenManager2 `_tradingFeeRate()` (basis points).
55
68
  - If the contract enforces a minimum fee per trade, use `max(computed trading_fee, minimum_fee)`.
56
69
 
70
+ ## Example (instant, recommended)
71
+
72
+ ```bash
73
+ export PRIVATE_KEY=your_hex_private_key
74
+ fourmeme create-instant --image=./logo.png --name=MyToken --short-name=MTK --desc="My desc" --label=AI
75
+ ```
76
+
57
77
  ## Example (piped)
58
78
 
59
79
  ```bash