@hot-fun/hot-fun-ai 1.0.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/.env.example ADDED
@@ -0,0 +1,5 @@
1
+ # Solana wallet private key (base58 string or JSON array of bytes) — required
2
+ PRIVATE_KEY=
3
+
4
+ # Solana RPC endpoint — required
5
+ SOLANA_RPC_URL=
package/CLAUDE.md ADDED
@@ -0,0 +1,63 @@
1
+ # hot-fun-ai – Agent Guidelines (Claude / Claude Code)
2
+
3
+ ## Overview
4
+
5
+ This repo provides the **hot-fun-integration** skill for AI agents: create meme tokens on **hot.fun (Solana)** using the hot.fun API and on-chain Solana programs.
6
+
7
+ The authoritative specification for this skill is `skills/hot-fun-integration/SKILL.md`. Claude/Claude Code should treat that file as the main contract for behavior, safety, and command usage.
8
+
9
+ ## When to Use This Skill
10
+
11
+ Use this repo when the user explicitly or implicitly asks to:
12
+
13
+ - **Create** a meme token on hot.fun on Solana (API flow + on-chain transaction).
14
+
15
+ If the user's request does not involve hot.fun or Solana token creation, you should not use this skill.
16
+
17
+ ## Repo Layout
18
+
19
+ ```
20
+ hot-fun-ai/
21
+ ├── skills/
22
+ │ └── hot-fun-integration/
23
+ │ ├── SKILL.md # Main skill instructions (Cursor / OpenClaw)
24
+ │ ├── references/ # API reference docs
25
+ │ └── scripts/ # create-token (full flow)
26
+ ├── bin/
27
+ │ └── hotfun.cjs # CLI dispatcher (hotfun ...)
28
+ ├── package.json
29
+ ├── README.md
30
+ └── CLAUDE.md # This file (Claude-facing guidelines)
31
+ ```
32
+
33
+ ## Safety and Private Key Handling
34
+
35
+ The SKILL defines a **User Agreement & Security Notice** (bilingual: English + Traditional Chinese). Claude MUST:
36
+
37
+ 1. On first use of this skill in a conversation, present the User Agreement and Security Notice in the user's language (use the 繁體中文 block when the user writes in Traditional Chinese; otherwise use English).
38
+ 2. Make clear that **continuing to use this plugin/skill implies acceptance of the User Agreement**.
39
+ 3. **MUST NOT** run any operation that uses a private key or writes on-chain (e.g. `create-token`) until the user has explicitly agreed or confirmed to continue.
40
+
41
+ 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`.
42
+
43
+ ## Conventions (aligned with SKILL.md)
44
+
45
+ 1. **Chain**: Solana only.
46
+ 2. **Create token**: Single command `hotfun create-token <name> <symbol> <uri>` handles the full flow: call API to get base58 transaction → sign with private key → send to Solana RPC. User provides token image/metadata URI directly (no image upload needed).
47
+ 3. **RPC and private key (environment)**:
48
+ - When **using OpenClaw**: PRIVATE_KEY and SOLANA_RPC_URL are configured in OpenClaw (e.g. `skills.entries["hot-fun-ai"].env` or apiKey); see SKILL.md.
49
+ - When **not using OpenClaw (standalone)**: set `PRIVATE_KEY` and optionally `SOLANA_RPC_URL` via the process environment — e.g. a `.env` file in the **directory where you run `hotfun`** (the CLI loads it automatically via dotenv) or shell `export`. Do not ask the user to paste a private key in chat.
50
+
51
+ ## CLI Usage (hotfun)
52
+
53
+ From the project root after `npm install`, use:
54
+
55
+ ```bash
56
+ npx hotfun <command> [args...]
57
+ ```
58
+
59
+ Key commands (full list and parameters in `SKILL.md`):
60
+
61
+ - `hotfun create-token <name> <symbol> <uri>` – Create token on hot.fun (API → sign → send to Solana).
62
+
63
+ Always prefer these CLI commands rather than calling scripts directly, unless `SKILL.md` suggests otherwise.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lol-dev-99
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # hot-fun-ai
2
+
3
+ Hot.fun AI skills for creating meme tokens on **Solana**. Lets agents integrate with [hot.fun](https://hot.fun) for token creation.
4
+
5
+ ## Skills
6
+
7
+ | Skill | Description |
8
+ |-------|-------------|
9
+ | `hot-fun-integration` | Create meme tokens on **Solana** via hot.fun API + on-chain transaction. |
10
+
11
+ Safety, user agreement, and detailed agent behavior requirements are defined in [`skills/hot-fun-integration/SKILL.md`](skills/hot-fun-integration/SKILL.md) (bilingual User Agreement & Security Notice). Claude-specific guidance lives in [`CLAUDE.md`](CLAUDE.md).
12
+
13
+ ## Usage (Agent)
14
+
15
+ When the user needs to create meme tokens on hot.fun (Solana), use the **hot-fun-integration** skill:
16
+
17
+ - **Create token**: `hotfun create-token <name> <symbol> <uri>` — calls the hot.fun API to get a transaction, signs it with the wallet private key, and sends it to Solana RPC. See `SKILL.md` and `references/api-create-token.md` for full details.
18
+ - **CLI** (after `npm install`): use **`npx hotfun <command> [args...]`**. Run `npx hotfun --help` for all commands.
19
+
20
+ ## Install (project)
21
+
22
+ ```bash
23
+ cd hot-fun-ai
24
+ npm install
25
+ ```
26
+
27
+ ## Environment variables (without OpenClaw)
28
+
29
+ When you **do not** use OpenClaw, the CLI reads `PRIVATE_KEY` and `SOLANA_RPC_URL` from the process environment. Set them in one of these ways:
30
+
31
+ **Option 1: `.env` file in the working directory**
32
+
33
+ Create a file named `.env` in the directory where you run `hotfun`:
34
+
35
+ ```bash
36
+ # .env (do not commit this file)
37
+ PRIVATE_KEY=your_solana_private_key_base58_or_json_array
38
+ SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
39
+ ```
40
+
41
+ The CLI automatically loads `.env` from the current working directory.
42
+
43
+ **Option 2: export in the shell**
44
+
45
+ ```bash
46
+ export PRIVATE_KEY=your_solana_private_key
47
+ export SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
48
+ npx hotfun create-token MyToken MTK "https://example.com/metadata.json"
49
+ ```
50
+
51
+ - **PRIVATE_KEY**: Required for any command that signs or sends a transaction. Base58 string or JSON array of bytes.
52
+ - **SOLANA_RPC_URL**: Optional. Solana RPC endpoint; if unset, scripts use `https://api.mainnet-beta.solana.com`.
53
+
54
+ **Security**: Do not commit `.env` or share your private key. Add `.env` to `.gitignore` if you use a `.env` file.
55
+
56
+ ## Install as OpenClaw plugin
57
+
58
+ This repo is an [OpenClaw](https://docs.openclaw.ai)-compatible plugin:
59
+
60
+ ```bash
61
+ openclaw plugins install /path/to/hot-fun-ai
62
+ ```
63
+
64
+ Then in `~/.openclaw/openclaw.json` set:
65
+
66
+ ```json5
67
+ {
68
+ skills: {
69
+ entries: {
70
+ "hot-fun-ai": {
71
+ enabled: true,
72
+ env: {
73
+ PRIVATE_KEY: "your_solana_private_key",
74
+ SOLANA_RPC_URL: "https://api.mainnet-beta.solana.com"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ See [skills/hot-fun-integration/SKILL.md](skills/hot-fun-integration/SKILL.md) for full details.
83
+
84
+ ## Docs
85
+
86
+ - Skill instructions (agent behavior, safety, flows): `skills/hot-fun-integration/SKILL.md`
87
+ - Claude/Claude Code guidelines: `CLAUDE.md`
88
+ - References: `skills/hot-fun-integration/references/` (API docs)
89
+
90
+ ## License
91
+
92
+ MIT
package/bin/hotfun.cjs ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * hotfun CLI - dispatches to hot-fun-integration scripts.
4
+ * Usage: hotfun <command> [args...]
5
+ * Run "hotfun --help" for commands.
6
+ * Loads .env from current working directory (where you run hotfun) if present.
7
+ */
8
+ const { spawnSync } = require('child_process');
9
+ const path = require('path');
10
+
11
+ // Load .env from cwd (e.g. your project dir) so PRIVATE_KEY, SOLANA_RPC_URL etc. work when running from a project
12
+ require('dotenv').config({ path: path.join(process.cwd(), '.env') });
13
+
14
+ const root = path.join(__dirname, '..');
15
+ const scriptsDir = path.join(root, 'skills', 'hot-fun-integration', 'scripts');
16
+
17
+ const commands = {
18
+ 'create-token': 'create-token.ts',
19
+ };
20
+
21
+ function run(scriptName, args = []) {
22
+ const scriptPath = path.join(scriptsDir, scriptName);
23
+ const result = spawnSync('npx', ['tsx', scriptPath, ...args], {
24
+ stdio: 'inherit',
25
+ shell: true,
26
+ cwd: root,
27
+ });
28
+ process.exit(result.status ?? 1);
29
+ }
30
+
31
+ function printHelp() {
32
+ console.log(`hotfun - Hot.fun CLI (Solana)
33
+
34
+ Usage: npx hotfun <command> [args...]
35
+
36
+ Commands:
37
+ create-token <name> <symbol> <uri>
38
+ Create token on hot.fun (API → sign → send). Env: PRIVATE_KEY.
39
+
40
+ Env: PRIVATE_KEY, SOLANA_RPC_URL (optional), ROYALTY_PARTY (optional). See SKILL.md for full docs.
41
+ `);
42
+ }
43
+
44
+ const argv = process.argv.slice(2);
45
+ const cmd = argv[0];
46
+
47
+ if (!cmd || cmd === '--help' || cmd === '-h' || cmd === 'help') {
48
+ printHelp();
49
+ process.exit(0);
50
+ }
51
+
52
+ const script = commands[cmd];
53
+ if (!script) {
54
+ console.error(`Unknown command: ${cmd}`);
55
+ printHelp();
56
+ process.exit(1);
57
+ }
58
+
59
+ run(script, argv.slice(1));
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "hot-fun-ai",
3
+ "name": "Hot.fun AI",
4
+ "description": "Create meme tokens on hot.fun (Solana). CLI hotfun + skill.",
5
+ "skills": ["skills/hot-fun-integration"],
6
+ "configSchema": {
7
+ "type": "object",
8
+ "additionalProperties": false,
9
+ "description": "No plugin-level config; use skills.entries[\"hot-fun-ai\"].env for PRIVATE_KEY."
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@hot-fun/hot-fun-ai",
3
+ "version": "1.0.0",
4
+ "description": "Hot.fun AI skills for creating meme tokens on Solana",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "bin/",
9
+ "skills/",
10
+ "plugin.ts",
11
+ "openclaw.plugin.json",
12
+ "CLAUDE.md",
13
+ ".env.example"
14
+ ],
15
+ "bin": {
16
+ "hotfun": "./bin/hotfun.cjs"
17
+ },
18
+ "openclaw": {
19
+ "extensions": [
20
+ "./plugin.ts"
21
+ ]
22
+ },
23
+ "scripts": {
24
+ "hotfun": "node bin/hotfun.cjs",
25
+ "build": "tsc",
26
+ "create-token": "tsx skills/hot-fun-integration/scripts/create-token.ts"
27
+ },
28
+ "keywords": [
29
+ "hot.fun",
30
+ "meme",
31
+ "token",
32
+ "solana",
33
+ "agent",
34
+ "skill",
35
+ "openclaw"
36
+ ],
37
+ "dependencies": {
38
+ "@solana/web3.js": "^1.95.0",
39
+ "bs58": "^6.0.0",
40
+ "dotenv": "^16.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^20.0.0",
44
+ "tsx": "^4.20.0",
45
+ "typescript": "^5.0.0"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
+ }
package/plugin.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * OpenClaw plugin entry for hot-fun-ai.
3
+ * Skills are declared in openclaw.plugin.json; env (PRIVATE_KEY, SOLANA_RPC_URL) is configured per-skill in skills.entries.
4
+ */
5
+ export default function (_api: unknown) {
6
+ // No runtime registration needed; skills are loaded from manifest.
7
+ }
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: hot-fun-ai
3
+ description: |
4
+ CLI tool to create meme tokens on hot.fun (Solana). Returns structured JSON for token creation flow.
5
+
6
+ allowed-tools:
7
+ - Bash(hotfun *)
8
+ - Bash(npx hotfun *)
9
+ license: MIT
10
+ metadata:
11
+ {"author":"Hot.fun AI Skill","version":"1.0.0","openclaw":{"requires":{"env":["PRIVATE_KEY"]},"primaryEnv":"PRIVATE_KEY","optionalEnv":["SOLANA_RPC_URL","ROYALTY_PARTY"]}}
12
+ ---
13
+
14
+ ## [Agent must follow] User agreement and security notice on first use
15
+
16
+ When responding to any user request about hotfun 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.
17
+ Until the user has explicitly agreed or confirmed to continue, **do not** run `create-token` (any operation that uses the private key or writes to the chain).
18
+
19
+ **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.
20
+
21
+ ---
22
+
23
+ ### User Agreement & Security Notice (繁體中文)
24
+
25
+ **用戶協議**
26
+
27
+ **前情提示**:使用本插件及本 skill 所涉功能(包括但不限於代幣創建等)前,請您閱讀以下協議。**若您選擇繼續使用本插件及本 skill 功能,即表示您已閱讀、理解並同意本協議。**
28
+
29
+ **本插件性質與責任限制**:本插件僅提供純本地的命令列互動能力(私鑰透過環境變數或本地設定使用),**不會收集、上傳或儲存您的私鑰**。因任何原因(包括但不限於插件被竄改、環境遭入侵、誤操作、第三方插件等)導致的私鑰洩露或資產損失,**本插件及提供方不承擔責任**。
30
+
31
+ **安全警示**
32
+
33
+ 使用本插件進行代幣創建等操作時,請務必注意:
34
+
35
+ - **保護私鑰**:切勿在聊天對話中輸入、貼上或洩露私鑰;不要將私鑰分享給任何人或任何第三方。
36
+ - **交易錢包僅存小額資金**:用於執行操作的錢包(即提供 PRIVATE_KEY 的錢包)建議只存放少量資金,以降低因洩露或誤操作導致的損失。
37
+ - **及時轉出資金**:完成操作後,請及時將交易錢包中的資產轉移到您自己控制的、更安全的錢包或冷錢包中。
38
+ - **謹慎安裝 Agent/插件**:下載或安裝任何 Agent、瀏覽器插件或第三方工具時,請確認來源可信,避免惡意插件竊取私鑰或助記詞。
39
+
40
+ ---
41
+
42
+ ### User Agreement & Security Notice (English)
43
+
44
+ **User Agreement**
45
+
46
+ **Notice**: Before using this plugin and this skill (including but not limited to token creation), please read the following. **By choosing to continue using this plugin and this skill, you have read, understood, and agreed to this agreement.**
47
+
48
+ **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).
49
+
50
+ **Security Notice**
51
+
52
+ When using this plugin for token creation, please:
53
+
54
+ - **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.
55
+ - **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.
56
+ - **Move funds out promptly**: After operations, move assets from the trading wallet to a wallet or cold storage you control.
57
+ - **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.
58
+
59
+ ---
60
+
61
+ ## hotfun capability overview
62
+
63
+ After you agree to the above and confirm to continue, this skill can help you with the following (all via the `hotfun` CLI on Solana):
64
+
65
+ | Category | Capability | Description |
66
+ |----------|-------------|-------------|
67
+ | **Create** | Create token | Call API → sign transaction → send to Solana RPC. |
68
+
69
+ ## hotfun CLI
70
+
71
+ Solana only; all commands output JSON. Run `hotfun --help` for usage.
72
+
73
+ ## Installation (required before use)
74
+
75
+ **You must install the hotfun CLI before using this skill.** Recommended (global):
76
+
77
+ ```bash
78
+ npm install -g @hot-fun/hot-fun-ai@latest
79
+ ```
80
+
81
+ After installation, run commands with `hotfun <command> [args]`. If you use a local install instead, use `npx hotfun <command> [args]` from the project root.
82
+
83
+ ## Create token flow
84
+
85
+ ### 1. Ask user for required information (must be done first)
86
+
87
+ Before calling `create-token`, the Agent **must** ask the user for and confirm:
88
+
89
+ | Info | Required | Description |
90
+ |------|----------|-------------|
91
+ | **Token name** (name) | Yes | Full token name |
92
+ | **Token symbol** (symbol) | Yes | e.g. MTK, DOGE |
93
+ | **URI** (uri) | Yes | Token metadata / image URL (e.g. IPFS link) |
94
+
95
+ Optional env: `ROYALTY_PARTY` (royalty recipient address; defaults to system program = no royalty).
96
+
97
+ ### 2. Technical flow (done by create-token)
98
+
99
+ After collecting the above, execute:
100
+
101
+ ```bash
102
+ hotfun create-token <name> <symbol> <uri>
103
+ ```
104
+
105
+ Under the hood, the single command handles the full flow:
106
+
107
+ 1. **Call API** — POST to `https://gate.game.com/v3/hotfun/create_pool_with_config` with payer (from PRIVATE_KEY), name, symbol, uri. API returns a base58-encoded Solana transaction.
108
+ 2. **Sign** — Deserialize the transaction and sign it with the wallet private key.
109
+ 3. **Send** — Send the signed transaction to Solana RPC and confirm.
110
+
111
+ Output JSON includes: `txHash`, `wallet`, `baseMint` (new token address), `dbcConfig`, `dbcPool`, `name`, `symbol`, `uri`.
112
+
113
+ Full API and parameters: [references/api-create-token.md](references/api-create-token.md).
114
+
115
+ ## CLI commands
116
+
117
+ | Need | Command | When |
118
+ |------|---------|------|
119
+ | **Create token** | `hotfun create-token <name> <symbol> <uri>` | API → sign → send to Solana. Env: PRIVATE_KEY. |
120
+
121
+ Chain: **Solana only**.
122
+
123
+ ## PRIVATE_KEY and SOLANA_RPC_URL
124
+
125
+ **When using OpenClaw**
126
+ 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).
127
+
128
+ **Required steps:**
129
+ 1. **Configure private key**: In the Skill management page, set the hot-fun-ai skill's **apiKey** (corresponds to `primaryEnv: "PRIVATE_KEY"`), or set `PRIVATE_KEY` under `skills.entries["hot-fun-ai"].env` in `~/.openclaw/openclaw.json`. Optionally set **SOLANA_RPC_URL** in global env if needed.
130
+ 2. **Enable this skill**: In the agent or session, ensure the **hot-fun-ai** skill is **enabled**. Only when the skill is enabled will OpenClaw inject **PRIVATE_KEY** into the process; otherwise create commands will fail with missing key.
131
+
132
+ **When not using OpenClaw (standalone)**
133
+ Set **PRIVATE_KEY** and optionally **SOLANA_RPC_URL** via the process environment:
134
+
135
+ - **.env file**: Put a `.env` file in **the directory where you run the `hotfun` command** (i.e. your project / working directory). The CLI automatically loads `.env` from that current working directory. Use lines like `PRIVATE_KEY=...` and `SOLANA_RPC_URL=...`. Do not commit `.env`; add it to `.gitignore`.
136
+ - **Shell export**: `export PRIVATE_KEY=your_base58_key` and optionally `export SOLANA_RPC_URL=https://api.mainnet-beta.solana.com`, then run `npx hotfun <command> ...`.
137
+
138
+ ### Declared and optional environment variables
139
+
140
+ - **PRIVATE_KEY** (required for write operations): Solana wallet private key in base58 or JSON array format.
141
+ - **SOLANA_RPC_URL** (optional): Solana RPC endpoint; if unset, scripts use `https://api.mainnet-beta.solana.com`.
142
+ - **ROYALTY_PARTY** (optional): Royalty recipient Solana address; defaults to `11111111111111111111111111111111` (system program = no royalty).
143
+
144
+ ### Execution and install
145
+
146
+ - **Invocation**: The agent must run commands only via the **hotfun** CLI: `hotfun <command> [args]` or `npx hotfun <command> [args]` (allowed-tools). Do not invoke scripts or `npx tsx` directly; the CLI entry (`bin/hotfun.cjs`) dispatches to the correct script and loads `.env` from the current working directory.
147
+ - **Install**: `npm install -g @hot-fun/hot-fun-ai@latest`. Runtime: Node.js. Dependencies (including dotenv, @solana/web3.js, tsx) are declared in the package's `package.json`; global install installs them. No separate install spec beyond the npm package.
@@ -0,0 +1,80 @@
1
+ # Hot.fun Create Token API Reference
2
+
3
+ ## Flow
4
+
5
+ The `hotfun create-token` command handles the full flow in a single invocation:
6
+
7
+ 1. **Call API** — POST to the hot.fun API with token parameters; receive a base58-encoded Solana transaction.
8
+ 2. **Sign** — Deserialize the transaction and sign it with the wallet private key.
9
+ 3. **Send** — Send the signed transaction to Solana RPC and confirm.
10
+
11
+ ## API Endpoint
12
+
13
+ | Method | Endpoint |
14
+ |--------|----------|
15
+ | POST | `https://gate.game.com/v3/hotfun/create_pool_with_config` |
16
+
17
+ ### Request
18
+
19
+ **Content-Type**: `application/x-www-form-urlencoded`
20
+
21
+ | Parameter | Required | Description |
22
+ |-----------|----------|-------------|
23
+ | `payer` | Yes | Solana wallet public key (derived from PRIVATE_KEY) |
24
+ | `royalty_party` | Yes | Royalty recipient address. Default: `11111111111111111111111111111111` (system program = no royalty) |
25
+ | `name` | Yes | Token name |
26
+ | `symbol` | Yes | Token symbol |
27
+ | `uri` | Yes | Token metadata / image URI (e.g. IPFS link) |
28
+
29
+ **Required headers**:
30
+ ```
31
+ Origin: https://hot.fun
32
+ Referer: https://hot.fun/
33
+ ```
34
+
35
+ ### Response
36
+
37
+ ```json
38
+ {
39
+ "data": {
40
+ "transaction": "<base58-encoded Solana transaction>",
41
+ "signature": "",
42
+ "dbc_config": "<pubkey>",
43
+ "dbc_pool": "<pubkey>",
44
+ "base_mint": "<pubkey>"
45
+ },
46
+ "common": {
47
+ "timestamp": 1772694804,
48
+ "app_name": "hotfunv3",
49
+ "chain_asset_config": [...],
50
+ "config": { "check_chinese_symbol_duplicate": false }
51
+ }
52
+ }
53
+ ```
54
+
55
+ **Key fields in `data`**:
56
+
57
+ | Field | Description |
58
+ |-------|-------------|
59
+ | `transaction` | Base58-encoded Solana transaction to sign and send |
60
+ | `base_mint` | The new token's mint address |
61
+ | `dbc_config` | DBC config account |
62
+ | `dbc_pool` | DBC pool account |
63
+
64
+ ### Example
65
+
66
+ ```bash
67
+ curl 'https://gate.game.com/v3/hotfun/create_pool_with_config' \
68
+ -H 'Content-Type: application/x-www-form-urlencoded' \
69
+ -H 'Origin: https://hot.fun' \
70
+ -H 'Referer: https://hot.fun/' \
71
+ --data-raw 'payer=<WALLET_PUBKEY>&royalty_party=11111111111111111111111111111111&name=MyToken&symbol=MTK&uri=https%3A%2F%2Fexample.com%2Fmetadata.json'
72
+ ```
73
+
74
+ ## Sign and Send
75
+
76
+ 1. Decode the base58 `transaction` string to bytes.
77
+ 2. Deserialize as a `VersionedTransaction`.
78
+ 3. Sign with the wallet `Keypair`.
79
+ 4. Send via `connection.sendRawTransaction()`.
80
+ 5. Confirm via `connection.confirmTransaction()`.
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Hot.fun - create token: full flow (API → sign → send).
4
+ *
5
+ * 1. Call hot.fun API to get a base58-encoded Solana transaction
6
+ * 2. Sign the transaction with the wallet private key
7
+ * 3. Send the signed transaction to Solana RPC
8
+ *
9
+ * Usage:
10
+ * npx hotfun create-token <name> <symbol> <uri>
11
+ *
12
+ * Env: PRIVATE_KEY (Solana wallet private key, base58 or JSON array)
13
+ * Optional env: SOLANA_RPC_URL, ROYALTY_PARTY
14
+ */
15
+
16
+ import {
17
+ Connection,
18
+ Keypair,
19
+ VersionedTransaction,
20
+ } from '@solana/web3.js';
21
+ import bs58 from 'bs58';
22
+
23
+ const API_URL = 'https://gate.game.com/v3/hotfun/create_pool_with_config';
24
+ const DEFAULT_ROYALTY_PARTY = '11111111111111111111111111111111';
25
+
26
+ function loadKeypair(privateKey: string): Keypair {
27
+ try {
28
+ if (privateKey.startsWith('[')) {
29
+ const arr = JSON.parse(privateKey);
30
+ return Keypair.fromSecretKey(new Uint8Array(arr));
31
+ }
32
+ return Keypair.fromSecretKey(bs58.decode(privateKey));
33
+ } catch {
34
+ throw new Error('Invalid PRIVATE_KEY format. Use base58 string or JSON array of bytes.');
35
+ }
36
+ }
37
+
38
+ async function main() {
39
+ const name = process.argv[2];
40
+ const symbol = process.argv[3];
41
+ const uri = process.argv[4];
42
+
43
+ if (!name || !symbol || !uri) {
44
+ console.error('Usage: npx hotfun create-token <name> <symbol> <uri>');
45
+ console.error('Example: npx hotfun create-token MyToken MTK "https://example.com/metadata.json"');
46
+ process.exit(1);
47
+ }
48
+
49
+ const privateKey = process.env.PRIVATE_KEY;
50
+ if (!privateKey) {
51
+ console.error('Set PRIVATE_KEY (Solana wallet private key, base58 or JSON array)');
52
+ process.exit(1);
53
+ }
54
+
55
+ const keypair = loadKeypair(privateKey);
56
+ const payer = keypair.publicKey.toBase58();
57
+ const royaltyParty = process.env.ROYALTY_PARTY || DEFAULT_ROYALTY_PARTY;
58
+ const rpcUrl = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
59
+ const connection = new Connection(rpcUrl, 'confirmed');
60
+
61
+ // ── Step 1: Call API to get transaction ────────────────────────────────
62
+ console.error(`Creating token "${name}" (${symbol}) ...`);
63
+ console.error(` payer: ${payer}`);
64
+ console.error(` uri: ${uri}`);
65
+
66
+ const body = new URLSearchParams({
67
+ payer,
68
+ royalty_party: royaltyParty,
69
+ name,
70
+ symbol,
71
+ uri,
72
+ });
73
+
74
+ const res = await fetch(API_URL, {
75
+ method: 'POST',
76
+ headers: {
77
+ 'Content-Type': 'application/x-www-form-urlencoded',
78
+ 'Origin': 'https://hot.fun',
79
+ 'Referer': 'https://hot.fun/',
80
+ },
81
+ body: body.toString(),
82
+ });
83
+
84
+ if (!res.ok) {
85
+ throw new Error(`API request failed: ${res.status} ${res.statusText}`);
86
+ }
87
+
88
+ const json = await res.json() as {
89
+ data: {
90
+ transaction: string;
91
+ signature: string;
92
+ dbc_config: string;
93
+ dbc_pool: string;
94
+ base_mint: string;
95
+ };
96
+ common: Record<string, unknown>;
97
+ };
98
+
99
+ const { transaction: txBase58, dbc_config, dbc_pool, base_mint } = json.data;
100
+
101
+ if (!txBase58) {
102
+ throw new Error('API returned empty transaction. Response: ' + JSON.stringify(json));
103
+ }
104
+
105
+ console.error(` base_mint: ${base_mint}`);
106
+ console.error(` dbc_config: ${dbc_config}`);
107
+ console.error(` dbc_pool: ${dbc_pool}`);
108
+
109
+ // ── Step 2: Deserialize and sign transaction ──────────────────────────
110
+ const txBytes = bs58.decode(txBase58);
111
+ const tx = VersionedTransaction.deserialize(txBytes);
112
+ tx.sign([keypair]);
113
+
114
+ // ── Step 3: Send to Solana RPC ────────────────────────────────────────
115
+ console.error('Sending transaction ...');
116
+ const txHash = await connection.sendRawTransaction(tx.serialize(), {
117
+ skipPreflight: false,
118
+ maxRetries: 3,
119
+ });
120
+
121
+ console.error('Confirming ...');
122
+ const confirmation = await connection.confirmTransaction(txHash, 'confirmed');
123
+
124
+ if (confirmation.value.err) {
125
+ throw new Error(`Transaction failed: ${JSON.stringify(confirmation.value.err)}`);
126
+ }
127
+
128
+ // ── Output ────────────────────────────────────────────────────────────
129
+ const out = {
130
+ txHash,
131
+ wallet: payer,
132
+ baseMint: base_mint,
133
+ dbcConfig: dbc_config,
134
+ dbcPool: dbc_pool,
135
+ name,
136
+ symbol,
137
+ uri,
138
+ };
139
+ console.log(JSON.stringify(out, null, 2));
140
+ }
141
+
142
+ main().catch((e) => {
143
+ console.error(e.message || e);
144
+ process.exit(1);
145
+ });