@four-meme/four-meme-ai 1.0.2 → 1.0.4
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/CLAUDE.md +2 -2
- package/README.md +1 -1
- package/bin/fourmeme.cjs +5 -1
- package/package.json +4 -1
- package/skills/four-meme-integration/SKILL.md +18 -7
- package/skills/four-meme-integration/references/create-token-scripts.md +1 -1
- package/skills/four-meme-integration/references/execute-trade.md +1 -1
- package/skills/four-meme-integration/scripts/8004-register.ts +2 -2
- package/skills/four-meme-integration/scripts/create-token-api.ts +3 -3
- package/skills/four-meme-integration/scripts/create-token-chain.ts +3 -3
- package/skills/four-meme-integration/scripts/execute-buy.ts +3 -3
- package/skills/four-meme-integration/scripts/execute-sell.ts +3 -3
- package/skills/four-meme-integration/scripts/send-token.ts +3 -3
package/CLAUDE.md
CHANGED
|
@@ -45,7 +45,7 @@ The SKILL defines a **User Agreement & Security Notice** (bilingual: English + T
|
|
|
45
45
|
3. **MUST NOT** run any operation that uses a private key or writes on-chain (e.g. `create-api`, `create-chain`, `buy`, `sell`, `send`, `8004-register`) until the user has explicitly agreed or confirmed to continue.
|
|
46
46
|
4. May run read‑only commands (e.g. `config`, `token-info`, `quote-buy`, `8004-balance`) while or after presenting the notice.
|
|
47
47
|
|
|
48
|
-
Never ask the user to paste a private key into chat. All private keys must come from environment / config (e.g. `PRIVATE_KEY
|
|
48
|
+
Never ask the user to paste a private key into chat. All private keys must come from environment / config (e.g. `PRIVATE_KEY`) as described in `SKILL.md`.
|
|
49
49
|
|
|
50
50
|
## Conventions (aligned with SKILL.md)
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@ Never ask the user to paste a private key into chat. All private keys must come
|
|
|
59
59
|
- For tax-type tokens, follow `tokenTaxInfo` constraints in `references/token-tax-info.md` and the interactive flow in `SKILL.md` (“Create token (full flow)”).
|
|
60
60
|
4. **RPC and private key (environment)**:
|
|
61
61
|
- When **using OpenClaw**: PRIVATE_KEY and BSC_RPC_URL are configured in OpenClaw (e.g. `skills.entries["four-meme-ai"].env` or apiKey); see SKILL.md.
|
|
62
|
-
- When **not using OpenClaw (standalone)**: set `PRIVATE_KEY`
|
|
62
|
+
- When **not using OpenClaw (standalone)**: set `PRIVATE_KEY` and optionally `BSC_RPC_URL` via the process environment—e.g. a `.env` file in the **directory where you run `fourmeme`** (the CLI loads it automatically via dotenv) or shell `export`. Do not ask the user to paste a private key in chat.
|
|
63
63
|
|
|
64
64
|
## CLI Usage (fourmeme)
|
|
65
65
|
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ export BSC_RPC_URL=https://bsc-dataseed.binance.org
|
|
|
51
51
|
npx fourmeme create-api ./logo.png MyToken MTK "Desc" AI
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
- **PRIVATE_KEY
|
|
54
|
+
- **PRIVATE_KEY**: Required for any command that signs or sends a transaction (create-api, create-chain, buy, sell, send, 8004-register). Hex string; `0x` prefix optional.
|
|
55
55
|
- **BSC_RPC_URL**: Optional. BSC RPC endpoint; if unset, scripts use a default public BSC RPC.
|
|
56
56
|
|
|
57
57
|
**Security**: Do not commit `.env` or share your private key. Add `.env` to `.gitignore` if you use a `.env` file.
|
package/bin/fourmeme.cjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* fourmeme CLI - dispatches to four-meme-integration scripts.
|
|
4
4
|
* Usage: fourmeme <command> [args...]
|
|
5
5
|
* Run "fourmeme --help" for commands.
|
|
6
|
+
* Loads .env from current working directory (where you run fourmeme) if present.
|
|
6
7
|
*/
|
|
7
8
|
const { spawnSync } = require('child_process');
|
|
8
9
|
const path = require('path');
|
|
9
10
|
|
|
11
|
+
// Load .env from cwd (e.g. your project dir) so PRIVATE_KEY, BSC_RPC_URL etc. work when running from a project
|
|
12
|
+
require('dotenv').config({ path: path.join(process.cwd(), '.env') });
|
|
13
|
+
|
|
10
14
|
const root = path.join(__dirname, '..');
|
|
11
15
|
const scriptsDir = path.join(root, 'skills', 'four-meme-integration', 'scripts');
|
|
12
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@four-meme/four-meme-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Four.meme AI skills for creating and trading meme tokens (BSC only)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
"skill",
|
|
43
43
|
"openclaw"
|
|
44
44
|
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"dotenv": "^16.0.0"
|
|
47
|
+
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@types/node": "^20.0.0",
|
|
47
50
|
"tsx": "^4.20.0",
|
|
@@ -13,13 +13,13 @@ description: |
|
|
|
13
13
|
- **Discover → detail → quote → execute**: use token-rankings / token-list / events to find tokens → token-get / token-info for details → quote-buy / quote-sell to estimate → buy / sell to execute (see "Agent workflow: buy/sell from rankings or events" below).
|
|
14
14
|
|
|
15
15
|
BSC only (Arbitrum/Base not supported). **Before use, the fourmeme CLI must be installed** (e.g. `npm install -g @four-meme/four-meme-ai@latest`). Create/chain need PRIVATE_KEY. TokenManager V1 not supported.
|
|
16
|
-
**OpenClaw**: PRIVATE_KEY
|
|
16
|
+
**OpenClaw**: Only **PRIVATE_KEY** is declared in registry metadata (`requires.env`) and is injected when this skill is **enabled**; **BSC_RPC_URL** is optional (set in global env or project `.env`). **Two steps required**: (1) Configure private key in the skill’s `apiKey` or `skills.entries["four-meme-ai"].env`; (2) **Enable this skill** so OpenClaw injects PRIVATE_KEY. See "PRIVATE_KEY and BSC_RPC_URL" and "Declared and optional environment variables" below.
|
|
17
17
|
allowed-tools:
|
|
18
18
|
- Bash(fourmeme *)
|
|
19
19
|
- Bash(npx fourmeme *)
|
|
20
20
|
license: MIT
|
|
21
21
|
metadata:
|
|
22
|
-
{"author":"Four.meme AI Skill","version":"1.0.0","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY"}}
|
|
22
|
+
{"author":"Four.meme AI Skill","version":"1.0.0","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY","optionalEnv":["BSC_RPC_URL"]}}
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
## [Agent must follow] User agreement and security notice on first use
|
|
@@ -172,14 +172,24 @@ This skill declares `requires.env: ["PRIVATE_KEY"]` and `primaryEnv: "PRIVATE_KE
|
|
|
172
172
|
|
|
173
173
|
**Required steps:**
|
|
174
174
|
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.
|
|
175
|
-
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
|
|
175
|
+
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.
|
|
176
176
|
|
|
177
177
|
**When not using OpenClaw (standalone)**
|
|
178
|
-
Set **PRIVATE_KEY**
|
|
178
|
+
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`:
|
|
179
179
|
|
|
180
|
-
- **.env file**:
|
|
180
|
+
- **.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`.
|
|
181
181
|
- **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> ...`.
|
|
182
182
|
|
|
183
|
+
### Declared and optional environment variables
|
|
184
|
+
|
|
185
|
+
- **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).
|
|
186
|
+
- **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.).
|
|
187
|
+
|
|
188
|
+
### Execution and install
|
|
189
|
+
|
|
190
|
+
- **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.
|
|
191
|
+
- **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.
|
|
192
|
+
|
|
183
193
|
| Need | Command | When |
|
|
184
194
|
|------|---------|------|
|
|
185
195
|
| Public config | `fourmeme config` | Get raisedToken / config (no auth) |
|
|
@@ -229,7 +239,7 @@ fourmeme config
|
|
|
229
239
|
```
|
|
230
240
|
|
|
231
241
|
**Step 2 – Create token (API)**
|
|
232
|
-
Requires `PRIVATE_KEY
|
|
242
|
+
Requires `PRIVATE_KEY`. Outputs `createArg` and `signature` (hex).
|
|
233
243
|
|
|
234
244
|
| Position | Argument | Description |
|
|
235
245
|
|----------|----------|-------------|
|
|
@@ -368,7 +378,7 @@ fourmeme send <toAddress> <amountWei> [tokenAddress]
|
|
|
368
378
|
| `amountWei` | Amount in wei (BNB or token smallest unit) |
|
|
369
379
|
| `tokenAddress` | Optional. Omit or use `BNB` / `0x0` for native BNB; otherwise ERC20 contract address |
|
|
370
380
|
|
|
371
|
-
- Env: `PRIVATE_KEY
|
|
381
|
+
- Env: `PRIVATE_KEY`. Optional: `BSC_RPC_URL`.
|
|
372
382
|
- Output: JSON with `txHash`, `to`, `amountWei`, `native` (whether BNB).
|
|
373
383
|
|
|
374
384
|
Examples:
|
|
@@ -448,3 +458,4 @@ See [references/tax-token-query.md](references/tax-token-query.md).
|
|
|
448
458
|
| [execute-trade.md](references/execute-trade.md) | Execute buy/sell CLI and contract usage |
|
|
449
459
|
| [event-listening.md](references/event-listening.md) | TokenManager2 event listening (V2) |
|
|
450
460
|
| [tax-token-query.md](references/tax-token-query.md) | TaxToken on-chain fee/tax query (tax-info) |
|
|
461
|
+
| **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, etc. |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Fetches `raisedToken` from `https://four.meme/meme-api/v1/public/config`. Use when building the create body manually.
|
|
7
7
|
|
|
8
8
|
2. **create-token-api.ts**
|
|
9
|
-
- Env: `PRIVATE_KEY
|
|
9
|
+
- Env: `PRIVATE_KEY`.
|
|
10
10
|
- Args: `imagePath`, `name`, `shortName`, `desc`, `label`.
|
|
11
11
|
- Optional env: `WEB_URL`, `TWITTER_URL`, `TELEGRAM_URL`, `PRE_SALE` (default `"0"`), `FEE_PLAN` (default `"false"`).
|
|
12
12
|
- Performs: nonce → login (signs `You are sign in Meme {nonce}`) → upload image → GET public config → POST create.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Execute Buy / Sell (Four.meme BSC)
|
|
2
2
|
|
|
3
|
-
Executes buy/sell (sends on-chain transactions). Requires `PRIVATE_KEY
|
|
3
|
+
Executes buy/sell (sends on-chain transactions). Requires `PRIVATE_KEY`. Only **TokenManager2 (V2)** tokens are supported.
|
|
4
4
|
|
|
5
5
|
## Buy
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - imageUrl: optional (URL string)
|
|
10
10
|
* - description: optional
|
|
11
11
|
*
|
|
12
|
-
* Env: PRIVATE_KEY
|
|
12
|
+
* Env: PRIVATE_KEY. Optional: BSC_RPC_URL, 8004_NFT_ADDRESS.
|
|
13
13
|
* Default contract: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 (BSC).
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ function buildAgentURI(name: string, imageUrl: string, description: string): str
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
async function main() {
|
|
44
|
-
const privateKey = process.env.PRIVATE_KEY
|
|
44
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
45
45
|
if (!privateKey) {
|
|
46
46
|
console.error('Set PRIVATE_KEY');
|
|
47
47
|
process.exit(1);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Usage:
|
|
7
7
|
* npx tsx create-token-api.ts <imagePath> <name> <shortName> <desc> <label> [taxOptions.json]
|
|
8
8
|
*
|
|
9
|
-
* Env: PRIVATE_KEY
|
|
9
|
+
* Env: PRIVATE_KEY (wallet private key, no 0x prefix ok)
|
|
10
10
|
* Optional env: WEB_URL, TWITTER_URL, TELEGRAM_URL, PRE_SALE ("0"), FEE_PLAN ("false")
|
|
11
11
|
* Tax token: pass path to a JSON file with "tokenTaxInfo" as last arg, or set TAX_TOKEN=1 and
|
|
12
12
|
* TAX_FEE_RATE (1|3|5|10), TAX_BURN_RATE, TAX_DIVIDE_RATE, TAX_LIQUIDITY_RATE, TAX_RECIPIENT_RATE,
|
|
@@ -30,9 +30,9 @@ function toHex(value: string): string {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async function main() {
|
|
33
|
-
const privateKey = process.env.PRIVATE_KEY
|
|
33
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
34
34
|
if (!privateKey) {
|
|
35
|
-
console.error('Set PRIVATE_KEY
|
|
35
|
+
console.error('Set PRIVATE_KEY');
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
const pk = privateKey.startsWith('0x') ? (privateKey as `0x${string}`) : (`0x${privateKey}` as `0x${string}`);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* npx tsx create-token-chain.ts <createArgHex> <signatureHex>
|
|
8
8
|
* echo '{"createArg":"0x...","signature":"0x..."}' | npx tsx create-token-chain.ts --
|
|
9
9
|
*
|
|
10
|
-
* Env: PRIVATE_KEY
|
|
10
|
+
* Env: PRIVATE_KEY. Optional: BSC_RPC_URL.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { createWalletClient, http, parseAbi } from 'viem';
|
|
@@ -28,9 +28,9 @@ function toHex(s: string): `0x${string}` {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
async function main() {
|
|
31
|
-
const privateKey = process.env.PRIVATE_KEY
|
|
31
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
32
32
|
if (!privateKey) {
|
|
33
|
-
console.error('Set PRIVATE_KEY
|
|
33
|
+
console.error('Set PRIVATE_KEY');
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
36
36
|
const pk = privateKey.startsWith('0x') ? (privateKey as `0x${string}`) : (`0x${privateKey}` as `0x${string}`);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Usage:
|
|
5
5
|
* npx tsx execute-buy.ts <tokenAddress> amount <amountWei> <maxFundsWei> # buy fixed token amount
|
|
6
6
|
* npx tsx execute-buy.ts <tokenAddress> funds <fundsWei> <minAmountWei> # spend fixed quote (e.g. BNB)
|
|
7
|
-
* Env: PRIVATE_KEY
|
|
7
|
+
* Env: PRIVATE_KEY. Only V2 tokens (version 2 from getTokenInfo).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
@@ -98,9 +98,9 @@ const ERC20_ABI = [
|
|
|
98
98
|
const RPC_URL = process.env.BSC_RPC_URL || 'https://bsc-dataseed.binance.org';
|
|
99
99
|
|
|
100
100
|
async function main() {
|
|
101
|
-
const pk = process.env.PRIVATE_KEY
|
|
101
|
+
const pk = process.env.PRIVATE_KEY;
|
|
102
102
|
if (!pk) {
|
|
103
|
-
console.error('Set PRIVATE_KEY
|
|
103
|
+
console.error('Set PRIVATE_KEY');
|
|
104
104
|
process.exit(1);
|
|
105
105
|
}
|
|
106
106
|
const account = privateKeyToAccount(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Four.meme - execute sell on TokenManager2 (BSC only).
|
|
4
4
|
* Usage: npx tsx execute-sell.ts <tokenAddress> <amountWei> [minFundsWei]
|
|
5
|
-
* Env: PRIVATE_KEY
|
|
5
|
+
* Env: PRIVATE_KEY. Sends approve(tokenManager, amount) then sellToken(token, amount).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
@@ -78,9 +78,9 @@ const ERC20_ABI = [
|
|
|
78
78
|
const RPC_URL = process.env.BSC_RPC_URL || 'https://bsc-dataseed.binance.org';
|
|
79
79
|
|
|
80
80
|
async function main() {
|
|
81
|
-
const pk = process.env.PRIVATE_KEY
|
|
81
|
+
const pk = process.env.PRIVATE_KEY;
|
|
82
82
|
if (!pk) {
|
|
83
|
-
console.error('Set PRIVATE_KEY
|
|
83
|
+
console.error('Set PRIVATE_KEY');
|
|
84
84
|
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
const account = privateKeyToAccount(
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - amountWei: amount in wei (for BNB or token decimals)
|
|
9
9
|
* - tokenAddress: optional; omit or use "BNB" / "0x0" for native BNB; otherwise ERC20 token contract address
|
|
10
10
|
*
|
|
11
|
-
* Env: PRIVATE_KEY
|
|
11
|
+
* Env: PRIVATE_KEY. Optional: BSC_RPC_URL.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { createWalletClient, http, parseAbi } from 'viem';
|
|
@@ -26,9 +26,9 @@ function isAddress(s: string): boolean {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
async function main() {
|
|
29
|
-
const privateKey = process.env.PRIVATE_KEY
|
|
29
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
30
30
|
if (!privateKey) {
|
|
31
|
-
console.error('Set PRIVATE_KEY
|
|
31
|
+
console.error('Set PRIVATE_KEY');
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
const pk = privateKey.startsWith('0x') ? (privateKey as `0x${string}`) : (`0x${privateKey}` as `0x${string}`);
|