Nad.fun Token Creation Flow
Prerequisite: monad-development Skill
Before proceeding, check if the monad-development skill is installed. If it is not available, install it using ClawHub:
CODEBLOCK0
Find and install the monad-development skill from the results. This skill is required for wallet management and on-chain actions in Step 3 and Step 4.
Help the user create a token on Nad.fun by following the 4-step sequential process below. Each step depends on the output of the previous step.
API Base URL
Production: INLINECODE2
Contract Addresses
CODEBLOCK1
Step 1: Upload Image
POST INLINECODE3
- - Content-Type:
image/png, image/jpeg, image/webp, or INLINECODE7 - Body: Raw binary image data (max 5MB)
- Returns:
image_uri (CDN URL) and is_nsfw (boolean)
CODEBLOCK2
Error Codes
| Status | Description |
|---|
| 400 | Invalid image format or missing image |
| 413 |
Image exceeds 5MB limit |
| 500 | NSFW check failed or upload failed |
Step 2: Upload Metadata
POST INLINECODE10
- - Content-Type: INLINECODE11
- Requires:
image_uri from Step 1
Request Body
Required fields:
| Field | Type | Constraints |
|---|
| INLINECODE13 | string | Must be from INLINECODE14 |
| INLINECODE15 |
string | 1-32 characters |
|
symbol | string | 1-10 characters, alphanumeric only (
/^[a-zA-Z0-9]+$/) |
Optional fields:
| Field | Type | Constraints |
|---|
| INLINECODE18 | string or null | Max 500 characters |
| INLINECODE19 |
string or null | Must start with
https:// |
|
twitter | string or null | Must contain
x.com and start with
https:// |
|
telegram | string or null | Must contain
t.me and start with
https:// |
CODEBLOCK3
Error Codes
| Status | Description |
|---|
| 400 | NSFW status unknown, invalid data, or validation failed |
| 500 |
Upload to storage or database failed |
Step 3: Mine Salt
POST INLINECODE27
- - Content-Type: INLINECODE28
- Requires:
metadata_uri from Step 2 - Produces a vanity token address ending in INLINECODE30
Request Body
| Field | Type | Description |
|---|
| INLINECODE31 | string | Creator's wallet address (EVM format) |
| INLINECODE32 |
string | Token name (must match metadata) |
|
symbol | string | Token symbol (must match metadata) |
|
metadata_uri | string | Metadata URI from Step 2 |
CODEBLOCK4
- - Returns:
salt (bytes32 hex) and address (token address with 7777 suffix)
Error Codes
| Status | Description |
|---|
| 400 | Invalid parameters |
| 408 |
Timeout - max iterations reached |
| 500 | Internal server error |
Step 4: Create Token On-Chain
Call BondingCurveRouter.create() with the data from previous steps.
TokenCreationParams
CODEBLOCK5
CODEBLOCK6
Option A: Create Without Initial Buy
Send only the deploy fee as msg.value.
CODEBLOCK7
Option B: Create With Initial Buy
Send deployFee + amountIn as msg.value. Use Lens.getInitialBuyAmountOut(amountIn) for amountOut.
CODEBLOCK8
Wallet for On-Chain Actions
For Step 3 (salt mining) and Step 4 (on-chain deployment), use the wallet from the monad-development skill. That skill handles all wallet configuration, private key management, and RPC setup. Use the signer and wallet address it provides when calling the salt API (creator field) and when sending the BondingCurveRouter.create() transaction.
Important Rules
- 1. Sequential process - Each step depends on the previous step's output.
- NSFW validation - Images are auto-checked in Step 1; the flag carries into metadata.
- URL validation - All URLs must use HTTPS. Twitter must use
x.com, Telegram must use t.me. - Image domain restriction - Only
https://storage.nadapp.net/ image URIs are accepted in metadata. - Salt mining - May timeout if the vanity address pattern can't be found within iteration limits.
- actionId - Always use
1 (graduate to Capricorn V3).
When Generating Code
- - Use
ethers v6 syntax by default unless the user specifies otherwise. - Always handle errors for each API call before proceeding to the next step.
- The
salt from Step 3 and metadata_uri from Step 2 are both needed for Step 4. - For initial buy, always query
Lens.getInitialBuyAmountOut() to get the correct amountOut.
Nad.fun 代币创建流程
前置条件:monad-development 技能
在继续之前,请检查是否已安装 monad-development 技能。如果未安装,请使用 ClawHub 进行安装:
bash
clawhub search monad
从搜索结果中找到并安装 monad-development 技能。该技能用于第3步和第4步中的钱包管理和链上操作。
按照以下4步顺序流程帮助用户在 Nad.fun 上创建代币。每一步都依赖于上一步的输出。
API 基础 URL
生产环境: https://api.nadapp.net
合约地址
BondingCurveRouter = 0x6F6B8F1a20703309951a5127c45B49b1CD981A22
Lens = 0x7e78A8DE94f21804F7a17F4E8BF9EC2c872187ea
第1步:上传图片
POST /agent/token/image
- - Content-Type: image/png、image/jpeg、image/webp 或 image/svg+xml
- 请求体: 原始二进制图片数据(最大5MB)
- 返回: imageuri(CDN URL)和 isnsfw(布尔值)
js
const imageResponse = await fetch(https://api.nadapp.net/agent/token/image, {
method: POST,
headers: { Content-Type: imageFile.type },
body: imageFile,
});
const { imageuri, isnsfw } = await imageResponse.json();
错误码
图片超过5MB限制 |
| 500 | NSFW 检查失败或上传失败 |
第2步:上传元数据
POST /agent/token/metadata
- - Content-Type: application/json
- 需要: 第1步中的 image_uri
请求体
必填字段:
| 字段 | 类型 | 约束条件 |
|---|
| image_uri | 字符串 | 必须来自 https://storage.nadapp.net/ |
| name |
字符串 | 1-32个字符 |
| symbol | 字符串 | 1-10个字符,仅限字母数字(/^[a-zA-Z0-9]+$/) |
可选字段:
| 字段 | 类型 | 约束条件 |
|---|
| description | 字符串或 null | 最多500个字符 |
| website |
字符串或 null | 必须以 https:// 开头 |
| twitter | 字符串或 null | 必须包含 x.com 并以 https:// 开头 |
| telegram | 字符串或 null | 必须包含 t.me 并以 https:// 开头 |
js
const metadataResponse = await fetch(https://api.nadapp.net/agent/token/metadata, {
method: POST,
headers: { Content-Type: application/json },
body: JSON.stringify({
image_uri,
name: My Token,
symbol: MTK,
description: An awesome token for the Nad.fun,
website: https://mytoken.com,
twitter: https://x.com/mytoken,
telegram: https://t.me/mytoken,
}),
});
const { metadata_uri } = await metadataResponse.json();
错误码
| 状态码 | 描述 |
|---|
| 400 | NSFW 状态未知、数据无效或验证失败 |
| 500 |
上传到存储或数据库失败 |
第3步:挖掘盐值
POST /agent/salt
- - Content-Type: application/json
- 需要: 第2步中的 metadata_uri
- 生成以 7777 结尾的虚荣代币地址
请求体
| 字段 | 类型 | 描述 |
|---|
| creator | 字符串 | 创建者的钱包地址(EVM 格式) |
| name |
字符串 | 代币名称(必须与元数据匹配) |
| symbol | 字符串 | 代币符号(必须与元数据匹配) |
| metadata_uri | 字符串 | 第2步中的元数据 URI |
js
const saltResponse = await fetch(https://api.nadapp.net/agent/salt, {
method: POST,
headers: { Content-Type: application/json },
body: JSON.stringify({
creator: walletAddress,
name: My Token,
symbol: MTK,
metadata_uri: metadataUri,
}),
});
const { salt, address } = await saltResponse.json();
- - 返回: salt(bytes32 十六进制)和 address(以 7777 结尾的代币地址)
错误码
超时 - 达到最大迭代次数 |
| 500 | 内部服务器错误 |
第4步:链上创建代币
使用前几步的数据调用 BondingCurveRouter.create()。
TokenCreationParams
solidity
struct TokenCreationParams {
string name;
string symbol;
string tokenURI; // 第2步中的 metadata_uri
uint256 amountOut; // 0 表示不进行初始购买,或使用 Lens.getInitialBuyAmountOut(amountIn)
bytes32 salt; // 第3步中的 salt
uint8 actionId; // 始终为 1(升级到 Capricorn V3)
}
solidity
function create(TokenCreationParams calldata params) external payable returns (address token, address pool);
选项 A:不进行初始购买创建
仅发送部署费用作为 msg.value。
js
const curve = new ethers.Contract(BONDINGCURVEADDRESS, BONDINGCURVEABI, signer);
const [deployFee,,] = await curve.feeConfig();
const params = {
name, symbol,
tokenURI: metadata_uri,
amountOut: 0,
salt,
actionId: 1,
};
const tx = await router.create(params, { value: deployFee });
await tx.wait();
选项 B:进行初始购买创建
发送 deployFee + amountIn 作为 msg.value。使用 Lens.getInitialBuyAmountOut(amountIn) 获取 amountOut。
js
const lens = new ethers.Contract(LENSADDRESS, LENSABI, signer);
const expectedAmountOut = await lens.getInitialBuyAmountOut(amountIn);
const [deployFee,,] = await curve.feeConfig();
const params = {
name, symbol,
tokenURI: metadata_uri,
amountOut: expectedAmountOut,
salt,
actionId: 1,
};
const tx = await router.create(params, { value: deployFee + amountIn });
await tx.wait();
链上操作的钱包
对于第3步(盐值挖掘)和第4步(链上部署),请使用 monad-development 技能中的钱包。该技能处理所有钱包配置、私钥管理和 RPC 设置。在调用盐值 API(creator 字段)和发送 BondingCurveRouter.create() 交易时,使用它提供的签名者和钱包地址。
重要规则
- 1. 顺序流程 - 每一步都依赖于上一步的输出。
- NSFW 验证 - 第1步中自动检查图片;该标志会传递到元数据中。
- URL 验证 - 所有 URL 必须使用 HTTPS。Twitter 必须使用 x.com,Telegram 必须使用 t.me。
- 图片域名限制 - 元数据中仅接受 https://storage.nadapp.net/ 的图片 URI。
- 盐值挖掘 - 如果在迭代限制内找不到虚荣地址模式,可能会超时。
- actionId - 始终使用 1(升级到 Capricorn V3)。
生成代码时
- - 默认使用 ethers v6 语法,除非用户另有指定。
- 在进行下一步之前,始终处理每个 API 调用的错误。
- 第4步需要第3步的 salt 和第2步的 metadata_uri。
- 对于初始购买,始终查询 Lens.getInitialBuyAmountOut() 以获取正确的 amountOut。