Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/x402/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Documentation must reflect code changes immediately. Follow these dependency map
<Tabs>
<TabItem value="TRON" label="TRON">

- **Network Identifier**: Must follow the `tron:<network>` format (supports `mainnet`, `nile`, `shasta`).
- **Network Identifier**: Must follow the `tron:<hex_chain_id>` CAIP-2 format. Use exported constants from `@bankofai/x402-tron` (`TRON_MAINNET`, `TRON_NILE`, `TRON_SHASTA`) instead of hard-coding names.
- **Signature Standard**: TRON signatures must reference the **TIP-712** standard (do not confuse with EIP-712).
- **Address Format**: Token addresses must use Base58 encoding (must start with `T`).
- **Node Access**: Must connect to TronGrid endpoints.
Expand Down
4 changes: 2 additions & 2 deletions docs/x402/api-catalog/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ For a paid POST endpoint, or to pin the payment chain, token, and scheme, pass t
```bash
x402-cli pay 'https://x402-gateway.bankofai.io/providers/<fqn>/<path>' \
--method POST \
--network tron:mainnet \
--network tron:0x2b6653dc \
--token USDT \
--scheme exact \
--max-amount 0.000001 \
Expand All @@ -73,7 +73,7 @@ x402-cli pay 'https://x402-gateway.bankofai.io/providers/<fqn>/<path>' \
| Flag | Purpose |
|---|---|
| `--method` | HTTP method (defaults to `GET`) |
| `--network` | CAIP-2 payment chain, e.g. `tron:mainnet`, `eip155:56` |
| `--network` | CAIP-2 payment chain, e.g. `tron:0x2b6653dc`, `eip155:56` |
| `--token` | Settlement token, e.g. `USDT` |
| `--scheme` | x402 payment scheme declared by the route, e.g. `exact` |
| `--max-amount` | Spend ceiling in USD; the call aborts if the quote exceeds it |
Expand Down
14 changes: 7 additions & 7 deletions docs/x402/api-catalog/list-your-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@ An example based on the **SunPump** service (copied verbatim from `providers/sun
"title": "SunPump",
"mainTitle": "One-call agent token launch, paid via x402",
"subtitle": "Create a meme or agent token from structured metadata.",
"description": "## What it does\n\nSunPump Agent Token Launch API lets agents, scripts, and applications pay with x402 and submit token launch metadata to SunPump. The gateway forwards the caller's JSON payload to the SunPump launch endpoint after payment settlement.\n\n## Best for\n\n- Agent workflows that need to create a meme or agent token from structured metadata.\n- Operator tools that want one paid API call for token creation.\n- Mainnet payment flows across TRON and BSC while using the same SunPump launch request shape.\n\n## Request shape\n\nPOST a JSON body with `name`, `symbol`, `description`, `imageBase64`, `twitterUrl`, `telegramUrl`, `websiteUrl`, and `tweetUsername`. Keep `name` within 1-20 characters and use a unique symbol. `imageBase64` may include a base64-encoded token image; if it is empty or omitted, SunPump generates an image automatically.\n\n## Code usage\n\nUse `x402-cli pay` against the route for the mainnet payment chain you want. TRON Mainnet example:\n\n```bash\nx402-cli pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --method POST \\\n --network tron:mainnet \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001 \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nBSC Mainnet uses `sunpump-token-launch-bsc` with `eip155:56` and the same JSON body.",
"description": "## What it does\n\nSunPump Agent Token Launch API lets agents, scripts, and applications pay with x402 and submit token launch metadata to SunPump. The gateway forwards the caller's JSON payload to the SunPump launch endpoint after payment settlement.\n\n## Best for\n\n- Agent workflows that need to create a meme or agent token from structured metadata.\n- Operator tools that want one paid API call for token creation.\n- Mainnet payment flows across TRON and BSC while using the same SunPump launch request shape.\n\n## Request shape\n\nPOST a JSON body with `name`, `symbol`, `description`, `imageBase64`, `twitterUrl`, `telegramUrl`, `websiteUrl`, and `tweetUsername`. Keep `name` within 1-20 characters and use a unique symbol. `imageBase64` may include a base64-encoded token image; if it is empty or omitted, SunPump generates an image automatically.\n\n## Code usage\n\nUse `x402-cli pay` against the route for the mainnet payment chain you want. TRON Mainnet example:\n\n```bash\nx402-cli pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --method POST \\\n --network tron:0x2b6653dc \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001 \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nBSC Mainnet uses `sunpump-token-launch-bsc` with `eip155:56` and the same JSON body.",
"useCase": "Use this provider when an app, agent, or CLI workflow needs to launch a SunPump token after a successful x402 payment. Choose the route matching the intended mainnet payment chain: TRON Mainnet or BSC Mainnet.",
"i18n": {
"zh-CN": {
"title": "SunPump",
"subtitle": "用结构化元数据一次付费发币(meme/Agent 代币)。",
"description": "## 能做什么\n\nSunPump Agent 发币 API 允许 Agent、脚本和应用先完成 x402 支付,再把发币元数据提交给 SunPump。Gateway 在支付结算后把调用方的 JSON 请求体转发到 SunPump 发币接口。\n\n## 适合场景\n\n- 需要基于结构化元数据创建 meme token 或 agent token 的 Agent 工作流。\n- 希望用一次付费 API 调用完成发币的运营工具。\n- 在 TRON 和 BSC 主网上使用同一套 SunPump 发币请求格式验证支付流程。\n\n## 请求格式\n\nPOST JSON 请求体包含 `name`、`symbol`、`description`、`imageBase64`、`twitterUrl`、`telegramUrl`、`websiteUrl` 和 `tweetUsername`。`name` 需要保持在 1-20 个字符内,并使用唯一 symbol。`imageBase64` 可以传入 base64 编码的 token 图片;如果为空或不传,SunPump 会自动生成图片。\n\n## 代码用法\n\n使用 `x402-cli pay` 调用目标主网支付链对应的路由。TRON 主网示例:\n\n```bash\nx402-cli pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --method POST \\\n --network tron:mainnet \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001 \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nBSC 主网使用 `sunpump-token-launch-bsc` 和 `eip155:56`,请求体相同。",
"description": "## 能做什么\n\nSunPump Agent 发币 API 允许 Agent、脚本和应用先完成 x402 支付,再把发币元数据提交给 SunPump。Gateway 在支付结算后把调用方的 JSON 请求体转发到 SunPump 发币接口。\n\n## 适合场景\n\n- 需要基于结构化元数据创建 meme token 或 agent token 的 Agent 工作流。\n- 希望用一次付费 API 调用完成发币的运营工具。\n- 在 TRON 和 BSC 主网上使用同一套 SunPump 发币请求格式验证支付流程。\n\n## 请求格式\n\nPOST JSON 请求体包含 `name`、`symbol`、`description`、`imageBase64`、`twitterUrl`、`telegramUrl`、`websiteUrl` 和 `tweetUsername`。`name` 需要保持在 1-20 个字符内,并使用唯一 symbol。`imageBase64` 可以传入 base64 编码的 token 图片;如果为空或不传,SunPump 会自动生成图片。\n\n## 代码用法\n\n使用 `x402-cli pay` 调用目标主网支付链对应的路由。TRON 主网示例:\n\n```bash\nx402-cli pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --method POST \\\n --network tron:0x2b6653dc \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001 \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nBSC 主网使用 `sunpump-token-launch-bsc` 和 `eip155:56`,请求体相同。",
"useCase": "适合应用、Agent 或 CLI 流程在 x402 支付成功后调用 SunPump 发币接口。根据主网支付链选择 TRON 主网或 BSC 主网路由。",
"mainTitle": "一次付费完成 Agent 代币发行(x402)"
}
},
"logo": "https://sunpump.meme/favicon.ico",
"category": "finance",
"chains": [
"tron:mainnet",
"tron:0x2b6653dc",
"eip155:56"
],
"isFirstParty": true,
Expand All @@ -110,7 +110,7 @@ An example based on the **SunPump** service (copied verbatim from `providers/sun
"url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch",
"x402Routes": [
{
"network": "tron:mainnet",
"network": "tron:0x2b6653dc",
"provider": "sunpump-token-launch-tron",
"scheme": "exact",
"url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch"
Expand Down Expand Up @@ -166,7 +166,7 @@ Use it when an agent, backend workflow, or CLI script has already validated the
- FQN: `sunpump-token-launch`
- Service URL: `https://sunpump.meme`
- Category: `finance`
- Chains: `tron:mainnet`, `eip155:56`
- Chains: `tron:0x2b6653dc`, `eip155:56`
- TRON Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron`
- BSC Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc`

Expand All @@ -179,7 +179,7 @@ TRON Mainnet:
```bash
x402-cli pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \
--method POST \
--network tron:mainnet \
--network tron:0x2b6653dc \
--token USDT \
--scheme exact \
--max-amount 0.000001 \
Expand Down Expand Up @@ -233,7 +233,7 @@ CI enforces the following rules — go through them before submitting:
- `version` must be `1`.
- `fqn` is lowercase letters/digits/hyphens and must match the directory name.
- `category` must be one of the allowed values (see [reference](./reference.md#allowed-categories)).
- `chains` needs at least one entry, using CAIP-2 style chain IDs — mainnets or testnets (e.g. `tron:mainnet`, `tron:nile`, `eip155:56`, `eip155:97`).
- `chains` needs at least one entry, using CAIP-2 style chain IDs — mainnets or testnets (e.g. `tron:0x2b6653dc`, `tron:0xcd8690dc`, `eip155:56`, `eip155:97`).
- `isFirstParty`, `isFeatured` (booleans) and `featuredTags` (string array, may be empty `[]`) are **required** — missing any of them fails validation.
- For every endpoint: `method` must be uppercase, `path` must start with `/`, and `maxPriceUsd` must not be less than `minPriceUsd`.
- _(Optional)_ An endpoint that settles across multiple chains can add `x402Routes` — one entry per network (`network`, `provider`, `scheme`, `url`). See the [reference](./reference.md#x402routes--multi-network-routing).
Expand Down
10 changes: 5 additions & 5 deletions docs/x402/api-catalog/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ An endpoint may serve the same capability across several chains, each settling t

| Field | Type | Description |
|---|---|---|
| `network` | string | CAIP-2 chain ID this route settles on (e.g. `tron:mainnet`, `eip155:56`) |
| `network` | string | CAIP-2 chain ID this route settles on (e.g. `tron:0x2b6653dc`, `eip155:56`) |
| `provider` | string | The gateway provider `fqn` that handles this network |
| `scheme` | string | x402 payment scheme for this route, e.g. `exact` — each route declares its own |
| `url` | string | Full gateway URL for this network's route |
Expand All @@ -72,7 +72,7 @@ For example, a token-launch endpoint might expose one route per supported chain
```bash
x402-cli pay 'https://x402-gateway.bankofai.io/providers/<provider>/<path>' \
--method POST \
--network tron:mainnet \
--network tron:0x2b6653dc \
--token USDT \
--scheme exact \
--max-amount 0.000001 \
Expand Down Expand Up @@ -111,9 +111,9 @@ security shopping storage translation

| Chain | ID |
|---|---|
| TRON mainnet | `tron:mainnet` |
| TRON Nile testnet | `tron:nile` |
| TRON Shasta testnet | `tron:shasta` |
| TRON mainnet | `tron:0x2b6653dc` |
| TRON Nile testnet | `tron:0xcd8690dc` |
| TRON Shasta testnet | `tron:0x94a9059e` |
| BNB Chain (BSC) | `eip155:56` |
| BNB Smart Chain testnet | `eip155:97` |

Expand Down
8 changes: 4 additions & 4 deletions docs/x402/core-concepts/http-402.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ When the server returns a `402 Payment Required` response, the decoded `PAYMENT-
"accepts": [
{
"scheme": "exact",
"network": "tron:nile",
"network": "tron:0xcd8690dc",
"amount": "100",
"asset": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
"payTo": "<SELLER_TRON_ADDRESS>",
Expand Down Expand Up @@ -128,8 +128,8 @@ When the server returns a `402 Payment Required` response, the decoded `PAYMENT-
| `error` | Human-readable error message |
| `resource` | Information about the requested resource |
| `accepts` | Array of accepted payment options |
| `scheme` | Payment scheme (`exact`, `upto`, `batch-settlement`, `auth-capture`, or `exact_gasfree`) |
| `network` | Network identifier (`tron:nile`, `tron:mainnet`, `eip155:56`, `eip155:97`) |
| `scheme` | Payment scheme (`exact`, `upto`, `batch-settlement`, or `exact_gasfree`) |
| `network` | Network identifier (`tron:0xcd8690dc`, `tron:0x2b6653dc`, `eip155:56`, `eip155:97`) |
| `amount` | Payment amount in the smallest unit (e.g., 100 = 0.0001 USDT) |
| `asset` | TRC-20/BEP-20 token contract address |
| `payTo` | Seller's wallet address |
Expand All @@ -149,7 +149,7 @@ The client responds via the `PAYMENT-SIGNATURE` header with a signed payload:
"x402Version": 2,
"accepted": {
"scheme": "exact",
"network": "tron:nile",
"network": "tron:0xcd8690dc",
"asset": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
"amount": "100",
"payTo": "<SELLER_TRON_ADDRESS>",
Expand Down
40 changes: 18 additions & 22 deletions docs/x402/core-concepts/network-and-token-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import TabItem from '@theme/TabItem';

## TRON Network Identifiers

x402 adopts a standardized network identifier format: `tron:<network_name>`.
The `<network_name>` can be `mainnet`, `shasta`, or `nile`.
x402 adopts the CAIP-2 network identifier format `tron:<hex_chain_id>`.
Use the exported constants from `@bankofai/x402-tron` (`TRON_MAINNET`, `TRON_NILE`, `TRON_SHASTA`) in application code instead of copying opaque hex strings.

### Identifier Reference

| Network Name | Network | Description |
| :----------- | :------------- | :------------------------------ |
| **TRON Mainnet** | `tron:mainnet` | TRON Mainnet (Production) |
| **TRON Shasta** | `tron:shasta` | TRON Shasta Testnet |
| **TRON Nile** | `tron:nile` | TRON Nile Testnet |
| Network Name | CAIP-2 ID | SDK Constant | Description |
| :----------- | :-------- | :----------- | :---------- |
| **TRON Mainnet** | `tron:0x2b6653dc` | `TRON_MAINNET` | TRON Mainnet (Production) |
| **TRON Shasta** | `tron:0x94a9059e` | `TRON_SHASTA` | TRON Shasta Testnet |
| **TRON Nile** | `tron:0xcd8690dc` | `TRON_NILE` | TRON Nile Testnet |

---

Expand Down Expand Up @@ -57,10 +57,10 @@ By default, **USDT** and **USDD** are used as primary settlement currencies.

| Symbol | Network | Contract Address |
| :------ | :------------- | :--------------- |
| **USDT** | `tron:mainnet` | `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` |
| **USDT** | `tron:nile` | `TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf` |
| **USDD** | `tron:mainnet` | `TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz` |
| **USDD** | `tron:nile` | `TGjgvdTWWrybVLaVeFqSyVqJQWjxqRYbaK` |
| **USDT** | `tron:0x2b6653dc` | `TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t` |
| **USDT** | `tron:0xcd8690dc` | `TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf` |
| **USDD** | `tron:0x2b6653dc` | `TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz` |
| **USDD** | `tron:0xcd8690dc` | `TGjgvdTWWrybVLaVeFqSyVqJQWjxqRYbaK` |
| **USDT** | `eip155:56` | `0x55d398326f99059fF775485246999027B3197955` |
| **USDC** | `eip155:56` | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` |
| **EPS** | `eip155:56` | `0xA7f552078dcC247C2684336020c03648500C6d9F` |
Expand Down Expand Up @@ -95,7 +95,7 @@ x402 uses typed data signing for all payment-related signatures.

When configuring an `HTTP 402` payment request on the server side, you must explicitly define:

1. **Network** – The unique network identifier (e.g., `tron:nile`)
1. **Network** – The unique network identifier (e.g., `tron:0xcd8690dc`)
2. **Asset** – The TRC-20/BEP-20 token **contract address**
3. **Amount** – The integer value in the token’s **smallest unit (raw amount)**

Expand All @@ -108,7 +108,7 @@ When configuring an `HTTP 402` payment request on the server side, you must expl

## Payment Schemes

x402 supports five payment schemes. Each is implemented as a client + server + facilitator trio per chain family.
x402 supports four payment schemes. Each is implemented as a client + server + facilitator trio per chain family.

### `exact` Scheme

Expand All @@ -127,13 +127,9 @@ Usage-based billing. The client signs a Permit2 authorization for up to a **maxi

A payment-channel scheme for high-frequency micro-payments (e.g. AI agent per-token billing). The payer **deposits once** on-chain, then pays many requests with off-chain **vouchers**; the facilitator **claims** a batch and **settles** to `payTo` in a single tx — so N requests cost ~one deposit's worth of gas. Includes a **refund** path for the unused balance. Available on EVM and TRON.

### `auth-capture` Scheme

Escrow-style authorization capture (EVM only). Funds are authorized into an escrow contract and released per business logic.

### `exact_gasfree` Scheme

TRON-specific. Allows buyers to pay with USDT/USDD **without holding TRX for gas fees**. The payer signs a TIP-712 GasFree permit and a relayer pays the on-chain energy via the official GasFree Proxy — no TRX for the payer, no one-time `approve`. Funds come from the payer's GasFree custodial wallet (not the main wallet). Available on `tron:mainnet` and `tron:nile`.
TRON-specific. Allows buyers to pay with USDT/USDD **without holding TRX for gas fees**. The payer signs a TIP-712 GasFree permit and a relayer pays the on-chain energy via the official GasFree Proxy — no TRX for the payer, no one-time `approve`. Funds come from the payer's GasFree custodial wallet (not the main wallet). Available on `tron:0x2b6653dc` and `tron:0xcd8690dc`.

#### GasFree Account Management (via x402-payment skill)

Expand Down Expand Up @@ -190,10 +186,10 @@ You may deploy your own Facilitator to gain full control over payment verificati

| Core Component | TRON/BSC Implementation |
| :------------- | :---------------------- |
| **Networks** | `tron:mainnet`, `tron:shasta`, `tron:nile`, `eip155:56`, `eip155:97` |
| **Networks** | `tron:0x2b6653dc`, `tron:0x94a9059e`, `tron:0xcd8690dc`, `eip155:56`, `eip155:97` |
| **Token Standard** | TRC-20 (built-in USDT & USDD support), BEP-20 |
| **Signing Mechanism** | TIP-712 / EIP-712 typed data signing |
| **Payment Schemes** | `exact`, `upto`, `batch-settlement`, `auth-capture` (EVM), `exact_gasfree` (TRON) |
| **Payment Schemes** | `exact`, `upto`, `batch-settlement`, `exact_gasfree` (TRON) |

---

Expand All @@ -202,9 +198,9 @@ You may deploy your own Facilitator to gain full control over payment verificati
On the **client / facilitator** side, register a custom TRC-20 token via the TRON token registry (`@bankofai/x402-tron`):

```typescript
import { registerToken } from "@bankofai/x402-tron";
import { registerToken, TRON_NILE } from "@bankofai/x402-tron";

registerToken("tron:nile", {
registerToken(TRON_NILE, {
address: "<YOUR_TOKEN_CONTRACT_ADDRESS>",
decimals: 6,
name: "My Token",
Expand Down
Loading
Loading