diff --git a/changelog/index.md b/changelog/index.md index b0deabbc..de793d93 100644 --- a/changelog/index.md +++ b/changelog/index.md @@ -8,14 +8,54 @@ description: 'Product updates and announcements for BANK OF AI — all products, Product updates and announcements for BANK OF AI.
-
Nov 5, 2026
+
Nov 12, 2026
-### Docs 1.5.2: gateway sponsorship and delivery failure handling +### Wallet CLI 4.16.0 and TronWeb installation guidance -
DocsFix
+
Docsx402
+ +- Updated wallet-cli guides to the published 4.16.0 release with its exact TronWeb 6.5.1 dependency, GET body restrictions, and preview error details. The wallet-cli Skill keeps its separate CLI version pin. [Wallet CLI details](./x402/) +- Clarified the 8004 TypeScript SDK 1.2.1 TronWeb range (`^6.5.1`), its source lockfile (6.5.1), and fresh-install behavior (6.5.2), with application HTTP dependency override guidance. [Installation guide](/8004/Usage/Install/) + +
+
+ +
+
Nov 12, 2026
+
+ +### TRON MCP source v1.1.10 and v1.1.11: Mainnet RPC configuration and TronWeb 6.5.2 + +
DocsMCP
+ +- Updated TRON MCP docs through source v1.1.11: v1.1.10 introduced deployment-specific Mainnet RPC selection, restored the keyless default, and restricted TronGrid credential forwarding; v1.1.11 upgraded TronWeb to 6.5.2. npm `latest` remains 1.1.7. [Details](./mcp-server/) + +
+
+ +
+
Nov 11, 2026
+
+ +### TRON MCP source v1.1.9: deployment and input limits + +
DocsMCP
+ +- Updated TRON MCP docs for source v1.1.9: dependency fixes, Mainnet RPC fallback, HTTP/tool input limits, and Docker log permissions. npm `latest` remains 1.1.7, so the deployment guide distinguishes source and published behavior. [Details](./mcp-server/) + +
+
+ +
+
Nov 11, 2026
+
+ +### SDK 2.1.2 and Facilitator 2.3.1 + +
Docsx402
-- Documented x402 gateway sponsorship configuration, dedicated timeouts, and delivery failures after successful settlement; bumped the documentation version to 1.5.2. [Details](./x402/) +- Updated SDK installation and dependency guidance to 2.1.2, and Facilitator runtime and 1Password Connect deployment guidance to 2.3.1. [Details](./x402/)
@@ -24,11 +64,11 @@ Product updates and announcements for BANK OF AI.
Nov 4, 2026
-### x402 docs aligned with the latest SDK, facilitator, and gateway +### x402 docs aligned with the latest SDK and facilitator
Docsx402Fix
-- SDK 2.1.1 / official Core 2.29.0 and Zod 4 migration, facilitator 2.3.0 EVM nonce recovery and runtime requirements, and gateway 1.0.5 deployment and HTTP 400 responses for consumed Permit2 authorizations. [Details](./x402/) +- SDK 2.1.1 / official Core 2.29.0 and Zod 4 migration, facilitator 2.3.0 EVM nonce recovery and runtime requirements. [Details](./x402/)
@@ -54,7 +94,7 @@ Product updates and announcements for BANK OF AI.
Docsx402Fix
-- The 2.1.0 package set on official `@x402/core` 2.28.0 (with `@bankofai/x402-tron-extensions` for TRON resource sponsoring), decimal TRON IDs, the official facilitator's 10-per-minute anonymous limit on both `/verify` and `/settle`, Nile resource sponsoring, and the remaining API Catalog CI rules. [Details](./x402/) +- The 2.1.0 package set on official `@x402/core` 2.28.0 (with `@bankofai/x402-tron-extensions` for TRON resource sponsoring), decimal TRON IDs, the official facilitator's 10-per-minute anonymous limit on both `/verify` and `/settle`, and Nile resource sponsoring. [Details](./x402/) @@ -197,7 +237,7 @@ Product updates and announcements for BANK OF AI.
Docsx402Agent WalletSKILLS
-- A follow-up audit across the x402 SDK, CLI, Catalog, Gateway, Facilitator, Agent Wallet, and Skills repositories. The API Catalog samples were rebuilt from the real provider files — the previous ones omitted the now-required `assetTransferMethod` and would have failed validation if copied — and the invalid `subTitle` field was removed. Payload, retry-scope, and TRON-only capability claims were corrected; EVM approval gas sponsoring is now documented with its actual preconditions; `resolveWallet()` and `SignOptions` were added to the Agent Wallet SDK guide. [x402 details](./x402/) · [Agent Wallet details](./agent-wallet/) · [SKILLS details](./skills/) +- A follow-up audit across the x402 SDK, CLI, Facilitator, Agent Wallet, and Skills repositories. Payload, retry-scope, and TRON-only capability claims were corrected; EVM approval gas sponsoring is now documented with its actual preconditions; `resolveWallet()` and `SignOptions` were added to the Agent Wallet SDK guide. [x402 details](./x402/) · [Agent Wallet details](./agent-wallet/) · [SKILLS details](./skills/) @@ -210,7 +250,7 @@ Product updates and announcements for BANK OF AI.
Docsx402Agent WalletSKILLS
-- Updated the English and Simplified Chinese docs against the current x402 SDK, API Catalog, Gateway, CLI, Facilitator, Agent Wallet, and Skills repositories. Corrections include the Catalog `assetTransferMethod` contract, the client-only status of `auth-capture`, the Gateway authorization/settlement flow, Privy's `--network` exception, and the `x402-payment` skill's exact `x402-cli@1.0.1` requirement. Repository links, MDX syntax, and broken internal links were also repaired. [x402 details](./x402/) · [Agent Wallet details](./agent-wallet/) · [SKILLS details](./skills/) +- Updated the English and Simplified Chinese docs against the current x402 SDK, CLI, Facilitator, Agent Wallet, and Skills repositories. Corrections include the client-only status of `auth-capture`, Privy's `--network` exception, and the `x402-payment` skill's exact `x402-cli@1.0.1` requirement. Repository links, MDX syntax, and broken internal links were also repaired. [x402 details](./x402/) · [Agent Wallet details](./agent-wallet/) · [SKILLS details](./skills/) @@ -276,7 +316,7 @@ Product updates and announcements for BANK OF AI.
New Releasex402Docs
- **x402 SDK 1.1.0** — explicit payment flows (`upfront` / `escrow` on the wire as `extra.paymentFlow`, `authorization` by default), client spend controls on by default (`$1` per-payment cap, default-asset allowlist), payment-selection policies and lifecycle hooks, EVM smart-account support (ERC-7702, allowlisted ERC-6492), and a 90-second `HTTPFacilitatorClient` timeout. Upgrade all 11 packages together; Node.js 22+. [SDK Feature Matrix](../x402/sdk-features/) -- **Docs corrections** — removed the obsolete facilitator-fee material (`base_fee`, `extra.fee`, `/fee/quote`); the official service limits anonymous `/settle` calls to 1 request per IP per minute; GasFree is no longer described as auto-preferred — the CLI takes the first advertised requirement matching your filters, so pass `--scheme exact_gasfree` to force it; TRON Shasta is now documented as signed by the SDK/CLI but **not** settled by the official facilitator (use Nile or self-host); the CLI page now states its **pinned** dependencies — CLI 1.0.2 still bundles the `@bankofai/x402-*` SDK packages at 1.0.1 (`@bankofai/x402-gateway` at 1.0.2), so it does not yet carry the 1.1.0 client spend controls; and the Skills pages now install with `npx skills add … -g`. [x402 docs](../) +- **Docs corrections** — removed the obsolete facilitator-fee material (`base_fee`, `extra.fee`, `/fee/quote`); the official service limits anonymous `/settle` calls to 1 request per IP per minute; GasFree is no longer described as auto-preferred — the CLI takes the first advertised requirement matching your filters, so pass `--scheme exact_gasfree` to force it; TRON Shasta is now documented as signed by the SDK/CLI but **not** settled by the official facilitator (use Nile or self-host); the CLI page now states its **pinned** dependencies — CLI 1.0.2 still bundles the `@bankofai/x402-*` SDK packages at 1.0.1, so it does not yet carry the 1.1.0 client spend controls; and the Skills pages now install with `npx skills add … -g`. [x402 docs](../) @@ -298,11 +338,11 @@ Product updates and announcements for BANK OF AI.
Jul 30, 2026
-### x402 CLI v1.0.2 · Catalog — Base support +### x402 CLI v1.0.2 — Base support
New Releasex402Base
-- **Base is live in the CLI** — `eip155:8453` and `eip155:84532` both support USDC. The service catalog currently publishes Base Mainnet routes on `eip155:8453` only. Base settles under `exact` using EIP-3009 authorization instead of Permit2. +- **Base is live in the CLI** — `eip155:8453` and `eip155:84532` both support USDC. Base settles under `exact` using EIP-3009 authorization instead of Permit2. - **Agent Wallet is now the CLI's default payer** — `pay` signs with your active wallet, so no private key in an environment variable. With wallets configured but none active, the CLI stops before signing rather than choosing for you. [Details](./x402/) - Paid requests no longer follow HTTP redirects, keeping `PAYMENT-SIGNATURE` from reaching another origin. @@ -347,12 +387,11 @@ Product updates and announcements for BANK OF AI.
Jul 20, 2026
-### x402 CLI v1.0.1 · Catalog +### x402 CLI v1.0.1
New Releasex402TRON
- **x402 CLI v1.0.1** — TRON **GasFree** payments (`exact_gasfree`, no TRX needed), canonical CAIP-2 network IDs (legacy `tron:nile` rejected), and `settled` vs `delivered` reporting. Built on x402 SDK 1.0.1. [Details](./x402/) -- **x402 Catalog** — routes now support `exact_gasfree` on TRON; canonical CAIP-2 required; legacy `fee` / `feeConfig` fields dropped. [Details](./x402/)
@@ -379,7 +418,7 @@ Product updates and announcements for BANK OF AI.
New Releasex402CLI
-- **`v1.0.0` — first stable release** of `@bankofai/x402-cli`, a TypeScript command-line client for x402 payments: `pay` any x402-protected URL, `serve` a local paywall endpoint, `roundtrip` for end-to-end smoke tests, plus `gateway` and `catalog` for provider files and the service catalog. +- **`v1.0.0` — first stable release** of `@bankofai/x402-cli`, a TypeScript command-line client for x402 payments: `pay` any x402-protected URL, `serve` a local paywall endpoint, `roundtrip` for end-to-end smoke tests. - Built on the published `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 packages; `scheme=exact` with Permit2. - Networks: TRON (`tron:mainnet` / `tron:nile` / `tron:shasta`) and BSC (`eip155:56` / `eip155:97`). [Wallet CLI guide](/wallet-cli/quickstart/) @@ -393,7 +432,7 @@ Product updates and announcements for BANK OF AI.
UpdateNew Modelx402
-- **SKILLS** — added guidance for the **`exact_gasfree` scheme** on TRON, and moved the API catalog to a new endpoint. Re-install if you pinned an older version. [Details](./skills/) +- **SKILLS** — added guidance for the **`exact_gasfree` scheme** on TRON. Re-install if you pinned an older version. [Details](./skills/) - **LLM Service** — added the **GPT-5.6** family: `sol`, `terra`, and `luna`. [Details](./llm-service/) diff --git a/changelog/mcp-server.md b/changelog/mcp-server.md index d5661a92..8177b003 100644 --- a/changelog/mcp-server.md +++ b/changelog/mcp-server.md @@ -7,6 +7,38 @@ description: 'Release notes for MCP Server.' Release notes for MCP Server. +
+
Nov 12, 2026
+
+ +### TRON MCP source v1.1.10 and v1.1.11: Mainnet RPC configuration and TronWeb 6.5.2 + +
DocsMCP
+ +- Updated source deployment and upgrade commands to tag `v1.1.11`, which pins TronWeb 6.5.2. npm `latest` remains 1.1.7 as of this review; the source and published-package instructions remain separate. +- Documented `MCP_MAINNET_RPC_URL`, introduced in v1.1.10: a deployment-only override for all Mainnet RPC hosts, ahead of API-key selection, with HTTP/HTTPS URL validation and a restart required after changes. Nile and Shasta are unaffected. +- v1.1.10 also restored the keyless Mainnet default to `https://hptg.bankofai.io` and restricted TronGrid credential forwarding to official HTTPS TronGrid origins. `https://tg.ops.sunpump.xyz` is an explicit deployment override example. + +👉 [Local Deployment](/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment/) · [FAQ](/McpServer-Skills/MCP/TRONMCPServer/FAQ/) + +
+
+ +
+
Nov 11, 2026
+
+ +### TRON MCP source v1.1.9: deployment and input limits + +
DocsMCP
+ +- Source v1.1.9 uses TronWeb 6.5.1, MCP SDK 1.32.2, and patched Zod 4.6.7 while retaining Agent Wallet 2.4.0. npm `latest` remains 1.1.7; the source deployment now pins the reviewed tag and uses `npm ci`. +- Documented the keyless Mainnet fallback `https://tg.ops.sunpump.xyz`, the 1 MiB uncompressed HTTP JSON limit (413 / 415), and the combined 10,000-element/key tool-input limit. +- Updated Docker UID/GID 1000 log permissions and root-owned application files, source stdio client configuration, and source wallet-error / protocol-version guidance. + +
+
+
Oct 27, 2026
diff --git a/changelog/skills.md b/changelog/skills.md index 48548fb0..1d5c190b 100644 --- a/changelog/skills.md +++ b/changelog/skills.md @@ -171,12 +171,11 @@ Release notes for SKILLS.
Jul 10, 2026
-### GasFree guidance and a new catalog URL +### GasFree guidance
Updatex402
- Skills now document the **`exact_gasfree` payment scheme** on TRON — pay for an x402 service without keeping TRX around for energy. -- The **API catalog endpoint moved to a new URL**. Skills and the facilitator config were updated together; re-install if you pinned an older version.
diff --git a/changelog/x402.md b/changelog/x402.md index c16b73d1..0790b309 100644 --- a/changelog/x402.md +++ b/changelog/x402.md @@ -8,15 +8,32 @@ description: 'Release notes for the x402 payment protocol, SDK, and CLI.' Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
-
Nov 5, 2026
+
Nov 12, 2026
-### Docs 1.5.2: gateway sponsorship and delivery failure handling +### Wallet CLI 4.16.0 -
DocsFix
+
Docsx402
+ +- Updated current installation and Agent Wallet integration references from wallet-cli 4.15.1 to npm `latest` 4.16.0. The CLI pins TronWeb 6.5.1; the wallet-cli Skill still requires its own pinned CLI version. +- Clarified that an explicit payment cap rejects the first matching quote when it is too expensive, rather than searching later offers for a cheaper route. +- Documented that GET rejects `--body` and `--body-file` before any request, and stdin request bodies cannot share input with secret-input flags. Corrected the preview error description: an explicit payment limit can return `paymentStatus: "not_sent"` even under `--dry-run`, without signing or paying. -- Documented the TRON approval sponsorship endpoint flag, client/facilitator prerequisites, and ordinary, sponsored, and GasFree payment timeouts. -- Clarified upstream failures after settlement, `settled: true`, and `PAYMENT-RESPONSE` so HTTP error statuses do not prompt duplicate payments. +👉 [Quick start](/wallet-cli/quickstart/) · [Command reference](/wallet-cli/command-reference/) + +
+
+ +
+
Nov 11, 2026
+
+ +### SDK 2.1.2 and Facilitator 2.3.1 + +
Docsx402
+ +- Updated both TRON packages to 2.1.2 with TronWeb 6.5.1, retaining the exact official Core 2.29.0 peer. Clarified that application projects must configure their own HTTP dependency overrides. +- Updated Facilitator deployment requirements for 2.3.1: Node.js 24.22.2 in Docker/CI, refreshed security dependencies, and runtime credentials for 1Password Connect.
@@ -25,15 +42,14 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
Nov 4, 2026
-### Aligned with SDK 2.1.1, facilitator 2.3.0, and gateway 1.0.5 +### Aligned with SDK 2.1.1 and facilitator 2.3.0
DocsFix
- **SDK 2.1.1** — English and Chinese quickstarts, FAQ, and feature matrix now use TRON mechanism and resource extension 2.1.1 with official `@x402/*` 2.29.0. Documented native Zod 4.6.6+, the `error.issues` migration, and the 1,024-entry `accepts` limit; retained the migration history introduced in 2.1.0. - **Facilitator 2.3.0** — documented the official Core / EVM / extensions migration, explicit Agent Wallet 3.1.0-beta.1 pin, and Node.js 24/26 runtime requirements. Explained EVM nonce recovery using original signed transactions and its in-process limits, plus protocol rejection of incomplete TRON authorizations. -- **Gateway 1.0.5** — Docker deployment examples use v1.0.5 and no longer claim that the npm package is stuck at 1.0.2. Documented HTTP 400 `permit2_nonce_consumed` for consumed Permit2 authorizations, distinguishing ambiguous or network-mismatched settlements that still return 502. -👉 [SDK Features](/x402/sdk-features/) · [Facilitator](/x402/core-concepts/facilitator/) · [Gateway](/x402/core-concepts/gateway/) +👉 [SDK Features](/x402/sdk-features/) · [Facilitator](/x402/core-concepts/facilitator/)
@@ -65,15 +81,14 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/). - **SDK 2.1.0** — the SDK pages follow the 2.1.0 package set: `@bankofai/x402-tron` 2.1.0 and the new `@bankofai/x402-tron-extensions` 2.1.0 (upgrade the two together) on official `@x402/core` 2.28.0, with the official `@x402/*` HTTP/MCP integrations, `@x402/evm` and `@x402/extensions` 2.28.0. The quickstarts import from `@x402/core`, `@x402/fetch` and `@x402/express`, and construct `new x402ResourceServer(...)` in place of `createResourceServer` from `@bankofai/x402-core`, which is not used with the 2.1 mechanism. The local EVM package, `@bankofai/x402-extensions` and the `typescript/packages/legacy/` compatibility packages were removed in 2.1.0 (the root `legacy/` archive, including the retired Python SDK, already in 2.0.0). TRON resource sponsoring now needs an explicitly registered client extension, and the SDK requires Node.js 24.22.1+. The official `@x402/evm` ships no BSC default assets, so BSC routes must be priced with an explicit `{ asset, amount, extra }` object and BSC assets must be allowlisted on the client; among the networks these docs cover, the default assets are now USDT on TRON and USDC on Base / Base Sepolia. - **Pending settlement** — `settlement_pending` is documented as a non-terminal result to reconcile rather than resubmit. 2.1.0 adds the injectable `pendingSettlementStore` (the default `InMemoryTronPendingSettlementStore` covers one process only) and the `settlement_store_unavailable` and `settlement_execution_failed` codes, and extends `chain_read_failed` (already used by `exact` Permit2 reads) to `upto` preflight reads. `HTTPFacilitatorClient` now comes from official Core with a 90 s default timeout; the examples set 120 s. - **TRON-only examples** — the repository examples now cover TRON only, so the seller quickstart points BSC and Base sellers to the official facilitator or the upstream `@x402/evm` examples. The official facilitator v2.2.1 and v2.2.2 are security releases (Node.js and dependency updates; v2.2.2 also installs the patched system Brotli for CVE-2026-111497); its documented behavior is unchanged. -- **Decimal TRON IDs** — examples and tables use `tron:728126428` (mainnet), `tron:3448148188` (Nile) and `tron:2494104990` (Shasta). The x402 SDK still accepts the hex forms as input; wallet-cli's `--network` does not. The API Catalog is the exception: its schema still accepts only the hex form. +- **Decimal TRON IDs** — examples and tables use `tron:728126428` (mainnet), `tron:3448148188` (Nile) and `tron:2494104990` (Shasta). The x402 SDK still accepts the hex forms as input; wallet-cli's `--network` does not. - **Official facilitator limits** — anonymous callers get 10 requests per IP per minute and API Keys 1,000 per minute, counted separately for `/verify` and `/settle` (both are limited). Over the limit returns `429` with `Retry-After`. The docs previously said one `/settle` per minute. - **Resource sponsoring on Nile** — the official facilitator lists `trc20ApprovalResourceSponsoring` in `/supported` but enables it on Nile only, for Nile USDT, and requires an API Key (`sponsor_auth_required` / `sponsor_network_disabled` otherwise). `GET /sponsoring/ready` and the `/verify` / `/settle` error codes are now documented. - **Settlement records** — successful settlements are unique per (network, asset, payer, nonce) through a partial unique index. This corrects the Sep 9 note that the table had no unique constraint. -- **API Catalog** — local checks need Python 3.11+; the checklist adds the remaining CI rules (required `pay.md` strings, a TRON `exact` + `permit2` first route, no `--scheme exact_gasfree`, all four `status` keys) and notes that fixed-count tests must be updated in the same PR. The list commands read the local cache and download only when it is missing or lacks what was asked for, so run `update-catalog` to refresh a cache that may be stale. - **Wallet CLI reference** — now targets `@tron-walletcli/wallet-cli@4.15.1` and documents the default $1 per-payment cap for known stablecoins (`amount_exceeds_limit`), `--out` (required for binary responses), `--max-gasfree-fee-raw`, and that `--max-raw-amount` requires `--token` or `--asset`. The quick start warns that a first TRON `exact` payment in a token may broadcast a one-time `approve(Permit2, MaxUint256)`, and the result reference covers a response format error after settlement (`retryPayment: false`). It also notes that the wallet-cli Skill pins 4.14.0, so Skill users install that version instead. - **Protocol details** — a `402` carries its requirements in the Base64 `PAYMENT-REQUIRED` header with a `{}` body, and verification failures put the reason in that header's `error`; an insufficient Permit2 allowance on `exact` / `upto` returns `412 permit2_allowance_required`. EVM `exact` also supports the `upfront` payment flow. Permit2 payloads use `payload.permit2Authorization`. DHLU was removed from the token tables (no current code references it), BSC mainnet USDC is marked as explicit-asset only, the official facilitator's rate-limit counters are per instance, and the npm packages are Apache-2.0 (the repository LICENSE is MIT). -👉 [SDK Features](/x402/sdk-features/) · [Official Facilitator](/x402/core-concepts/OfficialFacilitator/) · [List Your Service](/x402/api-catalog/list-your-service/) +👉 [SDK Features](/x402/sdk-features/) · [Official Facilitator](/x402/core-concepts/OfficialFacilitator/) @@ -86,12 +101,11 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
DocsCLI
-- **New home for CLI docs** — the x402 command-line guides moved from the old x402 CLI pages to [Wallet CLI](/wallet-cli/) and use `@tron-walletcli/wallet-cli@4.14.0`. The standalone x402-cli pages were removed; the agent quick start and the API Catalog quick start now run on `wallet-cli x402`. -- **Deterministic examples** — the DIA `wallet-cli x402 pay` examples in the Wallet CLI and Catalog quick starts now pass `--method` and `--scheme` explicitly, so a route that offers both `exact` and `exact_gasfree` resolves predictably. +- **New home for CLI docs** — the x402 command-line guides moved from the old x402 CLI pages to [Wallet CLI](/wallet-cli/) and use `@tron-walletcli/wallet-cli@4.14.0`. The standalone x402-cli pages were removed; the agent quick start now runs on `wallet-cli x402`. +- **Deterministic examples** — the `wallet-cli x402 pay` examples in the Wallet CLI quick start now pass `--method` and `--scheme` explicitly, so a route that offers both `exact` and `exact_gasfree` resolves predictably. - **Install tip** — if `npm install -g` fails with a permission error, prefix it with `sudo` or drop `-g` and run `npx wallet-cli`. -- **API Catalog docs** — the listing guide now uses the real SunPump `catalog.json` and `pay.md`, and its checklist matches the catalog's CI: every `pay.md` needs a `wallet-cli x402 pay` example with `--network tron:728126428` and `--scheme exact`, every endpoint needs one Base Mainnet `exact` + `eip3009` route, and the PR must include the regenerated `dist/`. Gateway provider IDs are per chain (`…-tron`, `…-bsc`, `…-base`), and `serviceUrl` is the service's public website. -👉 [Wallet CLI quick start](/wallet-cli/quickstart/) · [Catalog quick start](/x402/api-catalog/get-started/) +👉 [Wallet CLI quick start](/wallet-cli/quickstart/) @@ -104,16 +118,13 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
DocsFix
-- **API Catalog examples rebuilt from the real provider** — the `catalog.json` and `pay.md` samples now match `providers/sunpump-token-launch/`: three chains and four routes, including TRON `exact_gasfree` and the Base `eip3009` route. The previous samples omitted `assetTransferMethod` and would have failed schema validation if copied. The submission checklist now states when the field is required, when it must be omitted, and that one network may carry several routes. - **Settlement record de-duplication** — the facilitator page claimed successful settlements were de-duplicated per authorization identity. They are not: `/settle` inserts one row per attempt, the table carries no unique constraint, and there is no upsert or pre-check. At most one success exists per identity only because on-chain replay protection allows a single settlement. The `/payments` feed's `limit` (default `50`, capped at `200`) and `offset` defaults are now documented, along with the `not_found` / `invalid_identity_query` / `missing_identity_or_auth` error codes. -- **Field corrections** — `subTitle` is not a valid provider field and has been removed (the schema rejects unknown keys; only `subtitle` exists), along with the `sub_title` derivation note that referenced it. Base Sepolia is flagged as schema-level only: the build ships no display metadata for it. - **Payload accuracy** — transfer authorization is carried in `payload.authorization` on the EIP-3009 path and `payload.permit2Authorization` on the Permit2 path. `extra` may carry `name`/`version` for permit2 assets that also implement EIP-2612 — the client's signal to sign a gasless permit instead of broadcasting `approve`. - **Scoped claims** — balance-aware payment selection and the cheapest-token strategy are TRON-only; `HTTPFacilitatorClient` retries rate limits on `getSupported()` only, while `verify()` and `settle()` surface a 429. TRON Shasta was added to the protocol network list. - **Payment record queries** — corrected the anonymous access description: the `tx_hash` and `network` + `nonce` lookups apply no seller filter without an API Key, so anyone holding an exact identifier can resolve the record. There is no unauthenticated listing endpoint, but these lookups are not rate-limited either (the official service's anonymous limit of 1 request per IP per minute covers `/settle` only) and settlement tx hashes are public on-chain data, so settlement metadata is effectively public rather than seller-private. The page now flags this as current implementation behaviour, not a recommended access-control policy. - **Facilitator** — removed a stale reference to facilitator fees. EVM ERC-20 approval gas sponsoring is now documented with its real conditions: the SDK does not register it automatically, a self-hosted facilitator must opt in, the official facilitator registers it for BSC and Base, and the resource server must declare the extension on the route. -- **CLI reference** — `/health` and `/.well-known/x402` accept any method, and the latter also returns `rawAmount` and `pay_url`; documented the `--providers-dir` and `--query` aliases, the default positional for `catalog build`, and the default output directory for `export-gateway`. -👉 [API Catalog Reference](/x402/api-catalog/reference/) · [List Your Service](/x402/api-catalog/list-your-service/) · [Wallet CLI guide](/wallet-cli/command-reference/) +👉 [Wallet CLI guide](/wallet-cli/command-reference/) @@ -126,12 +137,10 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
DocsFix
-- **API Catalog contract** — every `exact` route now correctly documents `assetTransferMethod` as required: `permit2` for TRON/BSC and `eip3009` for Base USDC; only `exact_gasfree` omits it. Catalog repository links now point at `BofAI/x402-catalog`; the older `x402-catelog` spelling only resolves through a GitHub rename redirect. - **Scheme matrix** — restored `auth-capture` as the fifth named scheme and marked its current scope accurately: the published SDK includes the EVM client, while server and facilitator implementations are not yet shipped. -- **Gateway flow** — clarified that the wallet signs a payment authorization and retries with `PAYMENT-SIGNATURE`; the facilitator then verifies and settles it on-chain. A `402` quote is not a gateway cryptographic signature. - **Documentation quality** — repaired invalid MDX placeholders and broken internal links; both locales pass the production build. -👉 [SDK Feature Matrix](/x402/sdk-features/) · [API Catalog Reference](/x402/api-catalog/reference/) · [Gateway](/x402/core-concepts/gateway/) +👉 [SDK Feature Matrix](/x402/sdk-features/) @@ -208,22 +217,6 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/). -
-
Jul 30, 2026
-
- -### x402 Catalog — Base routes - -
UpdateCatalogBase
- -- Published **Base Mainnet catalog routes** on `eip155:8453`, with payment guides and code examples. Base Sepolia remains available in the CLI but is not published in the service catalog. -- `assetTransferMethod` now accepts **`eip3009`** alongside `permit2` — Base USDC routes use `eip3009`. - -👉 [API Catalog reference](/x402/api-catalog/reference/) - -
-
-
Jul 29, 2026
@@ -259,23 +252,6 @@ Release notes for the x402 protocol, SDK, and [Wallet CLI guide](/wallet-cli/).
-
-
Jul 20, 2026
-
- -### x402 Catalog — GasFree routes & CAIP-2 - -
UpdateCatalog
- -- Catalog routes now support **`exact_gasfree`** on TRON, alongside `exact` + Permit2. -- Network IDs must be **canonical CAIP-2**; legacy TRON aliases like `tron:nile` are rejected by schema validation. -- With x402 SDK 1.0.1, GasFree cost is estimated client-side — routes must no longer publish the legacy `fee` / `feeConfig` fields. - -👉 [API Catalog reference](/x402/api-catalog/reference/) - -
-
-
Jul 15, 2026
@@ -289,7 +265,6 @@ First stable release of `@bankofai/x402-cli` — a TypeScript command-line clien - **`pay`** — pay any x402-protected URL: probe, read the `402` challenge, sign, and retry - **`serve`** — run a local x402 paywall endpoint that verifies and settles through a facilitator - **`roundtrip`** — start a temporary server, pay it, exit: the fastest end-to-end smoke test -- **`gateway`** / **`catalog`** — validate and scaffold provider files; search, cache, and export the provider catalog - Built on the published `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 packages; `scheme=exact` with Permit2 - Networks: TRON (`tron:mainnet` / `tron:nile` / `tron:shasta`) and BSC (`eip155:56` / `eip155:97`) diff --git a/devnotes/x402-stablecoin-payments-for-agents.md b/devnotes/x402-stablecoin-payments-for-agents.md index d61ca5d1..d829cc8d 100644 --- a/devnotes/x402-stablecoin-payments-for-agents.md +++ b/devnotes/x402-stablecoin-payments-for-agents.md @@ -40,7 +40,7 @@ Within the TRON ecosystem, [BANK OF AI](/BANK-OF-AI/Intro/) positions itself as ![BANK OF AI product matrix](/img/devnotes/bankofai-product-matrix-en.svg) -In this layering, x402 is the open payment protocol in the infrastructure and standards layer, sitting alongside 8004 which handles agent identity and reputation; MCP defines how agents and tools exchange context. The x402 Gateway, x402 Facilitator, x402 Recharge Server, Agent Wallet, Skills, and the various MCP Servers live in the middle layer, turning those protocols into directly callable capabilities. Each layer can be used on its own or combined as the scenario requires: x402 when you need to pay, 8004 when you need to verify identity or reputation, MCP when you need to connect to tools or on-chain services. +In this layering, x402 is the open payment protocol in the infrastructure and standards layer, sitting alongside 8004 which handles agent identity and reputation; MCP defines how agents and tools exchange context. The x402 Facilitator, x402 Recharge Server, Agent Wallet, Skills, and the various MCP Servers live in the middle layer, turning those protocols into directly callable capabilities. Each layer can be used on its own or combined as the scenario requires: x402 when you need to pay, 8004 when you need to verify identity or reputation, MCP when you need to connect to tools or on-chain services. ## 3. Architecture and payment flow diff --git a/docker/nginx/APKBUILD b/docker/nginx/APKBUILD index 9f577134..0127667d 100644 --- a/docker/nginx/APKBUILD +++ b/docker/nginx/APKBUILD @@ -1,5 +1,5 @@ pkgname=nginx -pkgver=1.31.8 +pkgver=1.31.9 pkgrel=0 pkgdesc="NGINX HTTP server for BofAI docs" url="https://nginx.org/" @@ -35,5 +35,5 @@ package() { } sha512sums=" -b05679bd30746f41b17343be570ed62b2bb0bc64e15d24d8af307db03d5227ab6b1da57bb4b640ad4d4c854a0c0233285d5ba294caa4ad199c49522883700fce nginx-1.31.8.tar.gz +282f12d4106b49f2e715defdea6855ecf32fe5957a8c61c19ed0ca73bad5ea737c47f73dd8c5fa2cfe67f441d2912cedc3649b5d00fce895537f54eb9f765210 nginx-1.31.9.tar.gz " diff --git a/docs/8004/Usage/Install.md b/docs/8004/Usage/Install.md index 6e6d3d21..3de03931 100644 --- a/docs/8004/Usage/Install.md +++ b/docs/8004/Usage/Install.md @@ -78,9 +78,11 @@ npm run build > **Note**: All dependencies are automatically installed when installing via npm or yarn. +As of 2026-11-12, TypeScript SDK **1.2.1** declares `tronweb: ^6.5.1`. Its source lockfile resolves **6.5.1**, while a fresh application install can resolve **6.5.2**. Inspect your application's lockfile rather than assuming it matches the SDK repository. For root-project HTTP dependency overrides covering both versions, see [TronWeb dependency security](/x402/sdk-features/#dependency-security). + ## Optional Dependencies For enhanced functionality: * **Subgraph**: Optional. TypeScript accepts `subgraphUrl` or `subgraphOverrides`; Python accepts `subgraphOverrides` only. -* **IPFS Providers**: Optional, and configured differently per language. Python has built-in providers — `ipfs="pinata"` (`pinataJwt`), `ipfs="filecoinPin"` (`filecoinPrivateKey`) or `ipfs="node"` (`ipfsNodeUrl`). TypeScript has no built-in provider: pass your own `ipfsUploader` callback, which `registerIPFS()` requires. \ No newline at end of file +* **IPFS Providers**: Optional, and configured differently per language. Python has built-in providers — `ipfs="pinata"` (`pinataJwt`), `ipfs="filecoinPin"` (`filecoinPrivateKey`) or `ipfs="node"` (`ipfsNodeUrl`). TypeScript has no built-in provider: pass your own `ipfsUploader` callback, which `registerIPFS()` requires. diff --git a/docs/Agent-Wallet/Developer/SDK-Guide.md b/docs/Agent-Wallet/Developer/SDK-Guide.md index 2511306c..dd62a09b 100644 --- a/docs/Agent-Wallet/Developer/SDK-Guide.md +++ b/docs/Agent-Wallet/Developer/SDK-Guide.md @@ -18,7 +18,7 @@ Agent-wallet 3.x is TypeScript only. The Python package `bankofai-agent-wallet` **Check Your Node.js Version** -Use Node.js `^22.23.4 || ^24.22.1 || >=26.12.1` — the October 2026 security releases. This is the `engines` range on the source `main` branch; the published npm `3.0.0` still declares `>=18.0.0`, but wallet-cli `4.15.1` itself declares the same range. On `main`, when the `wallet_cli` wallet type launches wallet-cli through a JavaScript entrypoint with the current Node (a locally installed package, or an `AGENT_WALLET_WALLET_CLI_PATH` pointing at a `.js` file), it checks the same range first; a `wallet-cli` executable found on `PATH` is not checked. (In the published `3.0.0`, that entrypoint check only requires Node.js 20+.) Check your current version: +Use Node.js `^22.23.4 || ^24.22.1 || >=26.12.1` — the October 2026 security releases. This is the `engines` range on the source `main` branch; the published npm `3.0.0` still declares `>=18.0.0`, but wallet-cli `4.16.0` itself declares the same range. On `main`, when the `wallet_cli` wallet type launches wallet-cli through a JavaScript entrypoint with the current Node (a locally installed package, or an `AGENT_WALLET_WALLET_CLI_PATH` pointing at a `.js` file), it checks the same range first; a `wallet-cli` executable found on `PATH` is not checked. (In the published `3.0.0`, that entrypoint check only requires Node.js 20+.) Check your current version: ```bash node -v diff --git a/docs/Agent-Wallet/QuickStart.md b/docs/Agent-Wallet/QuickStart.md index da19e12b..524a163d 100644 --- a/docs/Agent-Wallet/QuickStart.md +++ b/docs/Agent-Wallet/QuickStart.md @@ -29,7 +29,7 @@ Privy users: see [CLI Reference → Privy](./Developer/CLI-Reference.md#privy-wa ### 1.1 Prepare Your Environment: Install Node.js -Agent-wallet and wallet-cli (Path A) both require **Node.js 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+** — the October 2026 security releases (the published agent-wallet `3.0.0` still declares `>=18`; wallet-cli `4.15.1` and the next agent-wallet release declare this range). An up-to-date LTS install satisfies this. +Agent-wallet and wallet-cli (Path A) both require **Node.js 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+** — the October 2026 security releases (the published agent-wallet `3.0.0` still declares `>=18`; wallet-cli `4.16.0` and the next agent-wallet release declare this range). An up-to-date LTS install satisfies this. Open a terminal (Mac users press `Command + Space` and search for "Terminal"), then type: diff --git a/docs/BANK-OF-AI/QuickStart.md b/docs/BANK-OF-AI/QuickStart.md index 1be0f452..ea5bb64b 100644 --- a/docs/BANK-OF-AI/QuickStart.md +++ b/docs/BANK-OF-AI/QuickStart.md @@ -11,7 +11,6 @@ Choose an entry point for your task: | --- | --- | | Install capabilities for an agent | [Skills quick start](/McpServer-Skills/SKILLS/QuickStart/) | | Configure a wallet and pay with x402 | [wallet-cli quick start](/wallet-cli/quickstart/) | -| Find paid APIs | [API Catalog](/x402/api-catalog/get-started/) | | Recharge B.AI | [wallet-cli recharge guidance](/wallet-cli/command-reference/) | | DeFi workflows and data queries | [Skill catalog](/McpServer-Skills/SKILLS/BANKOFAISkill/) | diff --git a/docs/McpServer-Skills/MCP/TRONMCPServer/FAQ.md b/docs/McpServer-Skills/MCP/TRONMCPServer/FAQ.md index dee972ba..25890d13 100644 --- a/docs/McpServer-Skills/MCP/TRONMCPServer/FAQ.md +++ b/docs/McpServer-Skills/MCP/TRONMCPServer/FAQ.md @@ -14,7 +14,7 @@ This is the most common issue. Troubleshoot in the following order: 1. **Check Node.js version**. What is declared depends on how you run the server: - **`npx -y @bankofai/mcp-server-tron`** runs the npm package `1.1.7`, which declares Node.js `>=20`. - - **A source checkout** of `main` (tag `v1.1.8`) requires 22.23.4+ (22.x) or 24.22.1+ (24.x). Its `package.json` still says `1.1.7`, so the server reports version `1.1.7` there too. + - **Source v1.1.11** requires 22.23.4+ (22.x) or 24.22.1+ (24.x), and reports version `1.1.11`. The npm `latest` tag remains `1.1.7` as of 2026-11-12; use the source build for TronWeb 6.5.2, the Mainnet RPC override, and the dependency and input-limit fixes. Either way, we recommend the October 2026 security releases, 22.23.4+ or 24.22.1+: ```bash @@ -51,6 +51,10 @@ When using HTTP mode (`npx -y @bankofai/mcp-server-tron --http`, or `npm run sta 3. **Firewall blocking**. If you're accessing the local HTTP service from another machine, check whether the firewall allows inbound connections on that port. +### HTTP 413 / 415 or oversized tool arguments + +On source v1.1.11, **413** means the JSON body exceeds **1 MiB**; split the request. **415** means the body is compressed; send uncompressed JSON. The MCP SDK also rejects tool arguments exceeding a combined **10,000 array elements and object keys** before the tool handler runs. A large ABI or multicall batch can hit that limit; reduce the batch. These rejections occur before tool execution. + ### Write tools appear but return a wallet error {#write-tools-wallet-error} As of v1.1.7, write tools (transfers, staking, etc.) are always visible in the AI's tool list, but wallet availability is checked at execution time. If you call a write tool without a usable wallet, the tool returns an error such as `Error transferring TRX: `, where `` comes from Agent Wallet — see [Wallet error messages](#wallet-error-messages) below for what each one means. @@ -87,10 +91,10 @@ TRON MCP Server uses [Agent Wallet](../../../Agent-Wallet/Intro.md) for all wall | `Password required for local_secure wallets` | Wallets exist in the wallet directory, but no password resolved — neither `runtime_secrets.json` nor `AGENT_WALLET_PASSWORD`. | | `No active wallet set.` | A password resolved, but the wallet directory holds no wallets. In this case the private-key and mnemonic variables are ignored — create or import a wallet with Agent Wallet, or remove the password so the env-var path is used. | | `MAC mismatch — wrong password or corrupted file` | A password was found but does not match the keystore (see the next section). | -| `Wallet not configured.` | Agent Wallet could not even load its configuration — for example a malformed `runtime_secrets.json` or `wallets_config.json`. With agent-wallet 2.3.x (what a source checkout's `package-lock.json` installs), setting both a private key and a mnemonic also ends here, when the env-var path is reached (see below the table). | -| `Provide only one of AGENT_WALLET_PRIVATE_KEY or AGENT_WALLET_MNEMONIC` | A private key (`AGENT_WALLET_PRIVATE_KEY` or `TRON_PRIVATE_KEY`) and a mnemonic (`AGENT_WALLET_MNEMONIC` or `TRON_MNEMONIC`) are both set and the env-var path is reached, with agent-wallet 2.4.0 — what `npx -y @bankofai/mcp-server-tron` (npm `1.1.7`, dependency `^2.3.0`) installs today. The server passes the text through, e.g. `Error transferring TRX: Provide only one of …`, or `Error: Provide only one of …` from `get_wallet_address`. Unset one of the two. | +| `Wallet not configured.` | Agent Wallet could not even load its configuration — for example a malformed `runtime_secrets.json` or `wallets_config.json`. | +| `Provide only one of AGENT_WALLET_PRIVATE_KEY or AGENT_WALLET_MNEMONIC` | A private key (`AGENT_WALLET_PRIVATE_KEY` or `TRON_PRIVATE_KEY`) and a mnemonic (`AGENT_WALLET_MNEMONIC` or `TRON_MNEMONIC`) are both set and the env-var path is reached, with agent-wallet 2.4.0 — the version locked by source v1.1.11 and also resolved by npm 1.1.7 (`^2.3.0`). The server passes the text through, e.g. `Error transferring TRX: Provide only one of …`, or `Error: Provide only one of …` from `get_wallet_address`. Unset one of the two. | -Both agent-wallet versions read the private key from `AGENT_WALLET_PRIVATE_KEY` or its alias `TRON_PRIVATE_KEY`, and the mnemonic from `AGENT_WALLET_MNEMONIC` or its alias `TRON_MNEMONIC`. They read these env vars only on the env-var path — when no password resolves **and** the wallet directory holds no wallets. Otherwise the variables are silently ignored, and neither of the both-set errors above can occur. +Agent Wallet 2.4.0 reads the private key from `AGENT_WALLET_PRIVATE_KEY` or its alias `TRON_PRIVATE_KEY`, and the mnemonic from `AGENT_WALLET_MNEMONIC` or its alias `TRON_MNEMONIC`. It reads these env vars only on the env-var path — when no password resolves **and** the wallet directory holds no wallets. Otherwise the variables are silently ignored, and the both-set error above cannot occur. To resolve the first two: @@ -116,7 +120,9 @@ The API Key is configured but requests are still rate-limited — check the foll 2. **Is the Key still active?** Log into [trongrid.io](https://www.trongrid.io/) to confirm your API Key is active. -3. **The key is read from the environment, not from a request header.** The server reads `TRONGRID_API_KEY` from its own process environment and forwards it upstream as `TRON-PRO-API-KEY`; it does not inspect incoming request headers at all. A per-request API key against the hosted cloud service is therefore not possible — run a local or self-hosted instance with `TRONGRID_API_KEY` set if you need your own quota. +3. **The key is read from the environment, not from a request header.** The server reads `TRONGRID_API_KEY` from its own process environment; it does not inspect incoming request headers at all. Source v1.1.11 attaches the upstream `TRON-PRO-API-KEY` header only for official HTTPS TronGrid origins. A per-request API key against the hosted cloud service is therefore not possible — run a local or self-hosted instance with `TRONGRID_API_KEY` set if you need your own quota. + +4. **Check the Mainnet RPC override.** On source v1.1.11, `MCP_MAINNET_RPC_URL` takes precedence over the key. An override to another RPC origin receives no TronGrid credential. Unset the override to restore automatic selection, or configure the intended endpoint in the deployment environment; restart the server after changes. See [network configuration](./LocalPrivatizedDeployment.md#mainnet-rpc-override-source-v1111). --- @@ -183,7 +189,7 @@ If this keeps happening, remind the AI: "Please only use tools provided by TRON Several common causes and solutions: -- **No TronGrid API Key**: Without `TRONGRID_API_KEY`, Mainnet requests go to the BANK OF AI fallback endpoint `https://hptg.bankofai.io` on a source checkout from `v1.1.8`, and to `https://api.trongrid.io` without a key on npm `1.1.7` (what `npx` runs). Setting a free API Key sends them to `https://api.trongrid.io` under your own quota in both versions +- **No TronGrid API Key**: Without `TRONGRID_API_KEY` or a Mainnet RPC override, Mainnet requests go to `https://hptg.bankofai.io` on source v1.1.11, and to `https://api.trongrid.io` without a key on npm `1.1.7` (what `npx` runs). Setting a free API Key sends them to `https://api.trongrid.io` under your own quota; on source v1.1.11, `MCP_MAINNET_RPC_URL` must be unset for that automatic selection. - **Complex multi-tool workflows**: Some operations (like full wallet analysis) require multiple sequential calls — waiting is normal - **Use testnet for development**: Nile and Shasta testnets are usually faster - **Be more specific in prompts**: Reduce the AI's exploratory calls — tell it directly which tool to use and which network to query @@ -220,16 +226,17 @@ To clear the npx cache instead, delete `~/.npm/_npx` (and, if needed, run `npm c npx clear-npx-cache ``` -If you cloned from source: +For the source deployment, fetch tags and select the reviewed tag (currently `v1.1.11`), then rebuild with its lockfile: ```bash cd mcp-server-tron -git pull -npm install +git fetch --tags origin +git checkout v1.1.11 +npm ci npm run build ``` ### What MCP protocol version is supported? -The protocol version is negotiated by `@modelcontextprotocol/sdk`, which the server depends on as `^1.22.0`; a source checkout's `package-lock.json` pins 1.27.1. MCP protocol version **2025-11-25** requires SDK 1.24.1 or later — SDK 1.22.0–1.24.0 top out at 2025-06-18. Older protocol versions requested by the client are also accepted. +The protocol version is negotiated by `@modelcontextprotocol/sdk`. Source v1.1.11 depends on `^1.32.2` and locks **1.32.2**; npm 1.1.7 declares `^1.22.0`, so its resolved SDK depends on the installation lockfile. MCP protocol version **2025-11-25** requires SDK 1.24.1 or later — SDK 1.22.0–1.24.0 top out at 2025-06-18. Older protocol versions requested by the client are also accepted. diff --git a/docs/McpServer-Skills/MCP/TRONMCPServer/Intro.md b/docs/McpServer-Skills/MCP/TRONMCPServer/Intro.md index 738dc833..2ef335b4 100644 --- a/docs/McpServer-Skills/MCP/TRONMCPServer/Intro.md +++ b/docs/McpServer-Skills/MCP/TRONMCPServer/Intro.md @@ -1,5 +1,7 @@ # Introduction +> **Version status (2026-11-12):** the reviewed source tag is **v1.1.11**; npm `latest` remains **1.1.7**. v1.1.11 upgrades TronWeb to 6.5.2 and retains the deployment-specific Mainnet RPC override and TronGrid credential restrictions introduced in v1.1.10, plus the dependency fixes, bounded tool inputs, and HTTP and Docker limits from v1.1.9. Use the [source deployment instructions](/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment/#option-b-clone-from-source) for these updates. + ## What is TRON MCP Server? TRON MCP Server is a bridge that connects AI assistants with the TRON blockchain. Built on the [Model Context Protocol (MCP)](../Intro.md) standard, it lets you interact with the blockchain using natural language — checking balances, initiating transfers, calling smart contracts — without writing any code. diff --git a/docs/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md b/docs/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md index 134d731c..5828ce66 100644 --- a/docs/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md +++ b/docs/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md @@ -1,5 +1,9 @@ # Local Private Deployment +:::info Source and npm versions +As of **2026-11-12**, source tag **v1.1.11** and npm `latest` **1.1.7** differ. The Mainnet RPC override, dependency overrides, input limits, and Docker behavior described for v1.1.11 below apply to the source build. Use **Option B** for those updates; `npx ...@latest` still runs 1.1.7. +::: + ## What is Local Private Deployment? Local private deployment means running TRON MCP Server on your own machine, giving your AI assistant **full read and write access** to the TRON blockchain. @@ -29,7 +33,7 @@ Of course, all read-only query capabilities are also fully retained. | Requirement | Description | | :--- | :--- | -| **Node.js** | Recommended: 22.23.4+ (22.x) or 24.22.1+ (24.x), the October 2026 security releases ([download](https://nodejs.org/)). A source checkout of `main` (tag `v1.1.8`, Option B below) requires this range (its `package.json` still says `1.1.7`, so the server reports version `1.1.7`); the npm package `1.1.7` that `npx` runs (Option A) declares `>=20`. | +| **Node.js** | Source v1.1.11 requires **22.23.4+ (22.x) or 24.22.1+ (24.x)** ([download](https://nodejs.org/)); 20.x, 23.x, 25.x, and 26.x are outside its declared range. npm 1.1.7 declares `>=20`, but use the supported 22.x/24.x security baseline for either route. | | **TronGrid API Key** | Optional but recommended ([apply here](https://www.trongrid.io/)) | Verify your Node.js version: @@ -65,7 +69,7 @@ TRON MCP Server uses [Agent Wallet](../../../Agent-Wallet/Intro.md) for wallet m | Runtime Wallet Switching | Yes | | Recommended For | All use cases | -> TRON MCP Server depends on Agent Wallet **2.x** (`@bankofai/agent-wallet ^2.3.0`). The [Agent-Wallet documentation](../../../Agent-Wallet/Intro.md) describes 3.x, which this server does not use yet — follow the 2.x commands on this page. +> TRON MCP Server depends on Agent Wallet **2.x** (source v1.1.11: `@bankofai/agent-wallet ^2.4.0`, locked to 2.4.0; npm 1.1.7: `^2.3.0`). The [Agent-Wallet documentation](../../../Agent-Wallet/Intro.md) describes 3.x, which this server does not use yet — follow the 2.x commands on this page. First, install the Agent Wallet 2.x CLI: @@ -98,61 +102,70 @@ Without a saved or exported password, unlocking a `local_secure` wallet fails wh If you already have a private key you want to use, set it via the `AGENT_WALLET_PRIVATE_KEY` environment variable (Agent Wallet also accepts the alias `TRON_PRIVATE_KEY`, and a mnemonic via `AGENT_WALLET_MNEMONIC` or `TRON_MNEMONIC`). Note the precedence: the env-var path is only reached when no password resolves (neither `runtime_secrets.json` nor `AGENT_WALLET_PASSWORD`) **and** the wallet directory holds no wallets. If you already ran Path 1, saved a runtime password, or ran the Openclaw installer, the keystore path wins and these variables are silently ignored. -```bash -export AGENT_WALLET_PRIVATE_KEY=your_private_key_here -``` - -:::tip -To make this persist across terminal sessions, add it to your shell configuration file: +Enter the key locally with hidden terminal input so its value is not written into shell history: ```bash -echo 'export AGENT_WALLET_PRIVATE_KEY=your_private_key' >> ~/.zshrc # zsh (macOS default) -echo 'export AGENT_WALLET_PRIVATE_KEY=your_private_key' >> ~/.bashrc # bash (Linux default) -source ~/.zshrc # or source ~/.bashrc — takes effect immediately without restarting the terminal +printf 'Private key (hidden input): ' +read -r -s AGENT_WALLET_PRIVATE_KEY +printf '\n' +export AGENT_WALLET_PRIVATE_KEY ``` -Verify the environment variable is set: +:::tip +Verify only whether the variable is present; never print its value. For persistent storage, use the encrypted Agent Wallet setup in Path 1 instead of writing private keys into shell startup files. ```bash -echo $AGENT_WALLET_PRIVATE_KEY +node -e 'console.log(Boolean(process.env.AGENT_WALLET_PRIVATE_KEY))' ``` ::: - - --- ### Step 2: Configure Network (Optional) #### TronGrid API Key -On a source checkout from `v1.1.8`, the API Key also decides which Mainnet endpoint the server talks to. For frequent on-chain queries, it is recommended to configure a free TronGrid API Key: +On source v1.1.11, the API Key decides the default Mainnet endpoint when `MCP_MAINNET_RPC_URL` is unset. For frequent on-chain queries, it is recommended to configure a free TronGrid API Key: ```bash # Add to ~/.zshrc or ~/.bashrc export TRONGRID_API_KEY="" ``` -Register for free at [trongrid.io](https://www.trongrid.io/). How the variable affects each network (the only difference between versions is Mainnet without a key): +Register for free at [trongrid.io](https://www.trongrid.io/). Without a Mainnet RPC override, the defaults are: | Network | `TRONGRID_API_KEY` set | `TRONGRID_API_KEY` not set | | :--- | :--- | :--- | -| **Mainnet** | `https://api.trongrid.io`, with your key sent as `TRON-PRO-API-KEY` (your own quota) | Source checkout from `v1.1.8`: falls back to the BANK OF AI endpoint `https://hptg.bankofai.io`. npm `1.1.7` (what `npx` runs): `https://api.trongrid.io` without a key | +| **Mainnet** | `https://api.trongrid.io`, with your key sent as `TRON-PRO-API-KEY` (your own quota) | Source v1.1.11: falls back to `https://hptg.bankofai.io`. npm `1.1.7` (what `npx` runs): `https://api.trongrid.io` without a key | | **Nile** | `https://nile.trongrid.io` (key header also sent) | `https://nile.trongrid.io` | | **Shasta** | `https://api.shasta.trongrid.io` (key header also sent) | `https://api.shasta.trongrid.io` | The server works without a key, but keyless requests to TronGrid (Mainnet on npm `1.1.7`, and Nile / Shasta) share TronGrid's public rate limits, so high-frequency use can hit rate-limit errors. Set one if you want Mainnet traffic to go to TronGrid under your own quota. +#### Mainnet RPC Override (Source v1.1.11) + +Set `MCP_MAINNET_RPC_URL` in the server's deployment environment to override all three Mainnet RPC hosts: full node, solidity node, and event server. It takes precedence over `TRONGRID_API_KEY`, applies to `mainnet`, `tron`, and `trx`, and leaves Nile and Shasta unchanged. It cannot be set through MCP tool arguments. + +For example, a test deployment can explicitly use this Mainnet RPC: + +```bash +export MCP_MAINNET_RPC_URL="https://tg.ops.sunpump.xyz" +``` + +This still connects to Mainnet. Leave the variable unset in production to retain the default selection above. Only absolute HTTP/HTTPS URLs without credentials, query strings, or fragments are accepted; a base path is allowed. Restart the server after changing the setting because RPC clients are cached. For Docker, set it in `.env.docker` or pass `-e MCP_MAINNET_RPC_URL=https://tg.ops.sunpump.xyz` to `docker run`. + +Source v1.1.11 attaches `TRON-PRO-API-KEY` only when the configured RPC URL has an official HTTPS TronGrid origin (`https://api.trongrid.io`, `https://nile.trongrid.io`, or `https://api.shasta.trongrid.io`). Other RPC origins receive no TronGrid key, even if `TRONGRID_API_KEY` is set. + --- ### Step 3: Local Private Deployment -Multiple deployment options are available. For most users, Option A is sufficient. +Use Option B for the reviewed v1.1.11 source and its security updates. Option A runs the older published npm package. -#### Option A: Run directly with npx (Recommended) +#### Option A: Run the published package with npx -No need to clone the repository — run the latest version directly via `npx`. This is also the command used in the [Configuration Notes](#configuration-notes) below. +No clone is needed. This runs the published npm package (currently 1.1.7), rather than source v1.1.11. This is also the command used in the [Configuration Notes](#configuration-notes) below. ```bash npx -y @bankofai/mcp-server-tron @@ -160,15 +173,17 @@ npx -y @bankofai/mcp-server-tron #### Option B: Clone from Source -For developers who need to modify the source code or contribute: +Build the reviewed source tag with its lockfile and security overrides: ```bash -git clone https://github.com/BofAI/mcp-server-tron.git +git clone --branch v1.1.11 --depth 1 https://github.com/BofAI/mcp-server-tron.git cd mcp-server-tron -npm install +npm ci npm run build ``` +Source v1.1.11 pins **TronWeb 6.5.2**, uses MCP SDK **^1.32.2** and Zod **^4.6.7**, and keeps Agent Wallet on **2.x**. Its root overrides patch TronWeb's Axios and force Agent Wallet's parser onto the server's Zod 4; preserve `package-lock.json` and the overrides. The npm 1.1.7 package does not include these source-project overrides. + #### Option C: Run in HTTP Mode Start the server in HTTP mode, then connect your MCP client via the HTTP endpoint. From the published package, pass the `--http` flag — no clone needed: @@ -189,6 +204,8 @@ npm run start:http This will start a local stateless Streamable HTTP server (default: `http://localhost:3001/mcp`) that your MCP client can connect to. `GET` and `DELETE` on `/mcp` return `405` (SSE is not supported), and `GET /` returns server information. Each request is handled independently — no session state is maintained between requests. +In source v1.1.11, HTTP accepts **uncompressed JSON up to 1 MiB**. Compressed request bodies return **415**; oversized bodies return **413**. In both stdio and HTTP modes, tool arguments have a combined limit of **10,000 array elements and object keys**, checked before schema validation. These are source v1.1.11 limits, not guarantees for npm 1.1.7 or an unverified hosted deployment. + You can customize the port and host via environment variables: ```bash @@ -212,18 +229,23 @@ EOF # the Dockerfile is not part of the published npm package) docker build -t mcp-server-tron . +mkdir -p logs +# Ensure the host logs directory is writable by UID/GID 1000:1000. + # 3. Run the container with --env-file docker run -d \ -p 3001:3001 \ - -v $(pwd)/logs:/app/logs \ + -v "$(pwd)/logs:/app/logs" \ --env-file .env.docker \ mcp-server-tron ``` :::warning -Never pass API keys with `-e KEY=value` on the command line — the value will appear in shell history and `docker inspect` output. Always use `--env-file` with a file excluded from version control (add `.env.docker` to your `.gitignore`). +Use `--env-file` with a file excluded from version control (add `.env.docker` to `.gitignore`) to keep literal keys out of shell commands. Docker administrators can still inspect container environment variables; an env file does not hide them from `docker inspect`. ::: +The v1.1.11 image runs as **`node` (UID/GID 1000:1000)**. Application files are root-owned; within `/app`, only `/app/logs` is writable by the service. A bind mount replaces the image directory permissions, so prepare host log-directory ownership before starting. Do not mount host credential directories or the Docker socket; host log collectors must avoid following links into credential files. + The container exposes port 3001 and writes date-stamped logs to the mounted `logs/` directory. A health check endpoint is available at `http://localhost:3001/health`. :::tip @@ -234,7 +256,8 @@ The Docker image is designed for read-only cloud deployments. For local write op If you're configuring an MCP client to point to your local server: -- **If running via npx or source**: Use the appropriate command in your MCP client's configuration (e.g., `command: npx` with `args: ["-y", "@bankofai/mcp-server-tron"]`) +- **Published npm package (Option A)**: Use `command: "npx"` with `args: ["-y", "@bankofai/mcp-server-tron@latest"]` (currently 1.1.7). +- **Source stdio build (Option B)**: Use `command: "node"` with `args: ["/absolute/path/to/mcp-server-tron/build/index.js"]`; replace the path with your checkout's absolute path after building. This runs the source build directly. - **If running in HTTP mode or Docker**: Point your client to `http://localhost:3001/mcp` via the HTTP URL configuration option If your MCP client does not inherit system environment variables, you'll need to configure them explicitly in the client settings. **Make sure any configuration file storing credentials is never shared or committed to version control**. diff --git a/docs/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md b/docs/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md index a02a3a88..23417798 100644 --- a/docs/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md +++ b/docs/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md @@ -23,7 +23,7 @@ Since the cloud service is read-only, you never need to provide a wallet private **2. Official maintenance and continuous updates** -The cloud service is maintained by the official team and always runs the latest stable version of TRON MCP Server. This includes: +The cloud service is maintained by the official team. Its deployed version is separate from both the source tag and npm `latest`; check the server information at `https://tron-mcp-server.bankofai.io/` for the advertised version. Maintenance includes: - Updates with new tools and features - Adaptations for underlying TRON network upgrades diff --git a/docs/McpServer-Skills/MCP/TRONMCPServer/ToolList.md b/docs/McpServer-Skills/MCP/TRONMCPServer/ToolList.md index aa36dc39..c6c217d2 100644 --- a/docs/McpServer-Skills/MCP/TRONMCPServer/ToolList.md +++ b/docs/McpServer-Skills/MCP/TRONMCPServer/ToolList.md @@ -15,6 +15,10 @@ Each tool is labeled with a **mode** — "read" or "write": Write tools are always visible in the AI’s tool list, but wallet availability is checked at execution time. If no wallet is configured, calling a write tool returns a wallet error (see [FAQ](./FAQ.md#wallet-error-messages)). In **read-only mode** (cloud service or `--readonly` flag), the 29 write tools and the 2 write prompts (`prepare_transfer`, `interact_with_contract`) are not registered, leaving 68 read tools and 4 prompts. ::: +:::info Source v1.1.11 input limits +Across all tool arguments, array elements and object keys have a combined limit of **10,000**, checked before schema validation. Large ABI and multicall inputs count toward this limit. The HTTP transport also accepts only uncompressed JSON bodies up to **1 MiB**. These limits describe source v1.1.11; npm `latest` is still 1.1.7 as of 2026-11-12. +::: + :::tip `network` parameter Most tools include an optional `network` parameter used to specify the target network (`mainnet`, `nile`, or `shasta`; `tron` / `trx` are aliases for `mainnet` and `testnet` for `nile`). If not specified, the default is `mainnet`. diff --git a/docs/wallet-cli/command-reference.md b/docs/wallet-cli/command-reference.md index 7f705e87..fe3c98c1 100644 --- a/docs/wallet-cli/command-reference.md +++ b/docs/wallet-cli/command-reference.md @@ -6,7 +6,7 @@ description: "Commands and payment options for wallet-cli." # Wallet CLI Command Reference -This reference targets the published **4.15.1** package. Use schema discovery to inspect command parameters. +This reference targets the published **4.16.0** package. Use schema discovery to inspect command parameters. ```bash wallet-cli --json-schema -o json @@ -19,9 +19,9 @@ wallet-cli bai recharge --json-schema -o json - `--network`: explicit payment network; use `tron:728126428` for TRON mainnet. - `--account`: wallet-cli account selection. - `--token` or `--asset` and `--decimals`: select an asset according to the schema. -- `--max-amount` / `--max-raw-amount`: mutually exclusive payment caps. `--max-raw-amount` is in smallest units and requires `--token` or `--asset`, because a raw amount has no unit. Without `--max-amount` or `--max-raw-amount`, a built-in ceiling of $1 per payment applies to known stablecoins; routes priced above it are dropped before signing, and the command fails with `amount_exceeds_limit` when every offered route is above it. A `--dry-run` preview does not apply this built-in cap, so a preview can pass while the real payment still fails with `amount_exceeds_limit`. +- `--max-amount` / `--max-raw-amount`: mutually exclusive payment caps. `--max-raw-amount` is in smallest units and requires `--token` or `--asset`, because a raw amount has no unit. The first route matching the network and asset/scheme filters is checked against your explicit cap; if it exceeds that cap, the command fails with `amount_exceeds_limit` before signing, including under `--dry-run`. It does not search later offers for a cheaper route. Without either explicit cap, actual payments use the SDK's known-stablecoin allowlist and $1 per-payment ceiling. A preview does not apply that built-in ceiling, so it can pass while the real payment still fails with `amount_exceeds_limit`. - `--dry-run`: read payment requirements without signing. -- `--method`, `--header`, `--body` / `--body-file`: HTTP request options. +- `--method`, `--header`, `--body` / `--body-file`: HTTP request options. The default method is `GET`, which rejects both body options with `invalid_option` before any request. For a body, explicitly select a method such as `POST`; `--body-file -` reads stdin and cannot share stdin with `--password-stdin` or another stdin-consuming flag. - `--out `: write the response body byte-for-byte to a new file instead of `data.response`; an existing file is refused before any request is sent. Binary media types (such as `application/octet-stream`, images, audio, video, PDF, and archives) require `--out`. - `--password-stdin`: secure master-password input for signing. - `-o json`: machine output. @@ -42,7 +42,7 @@ The paid response is in `data.response`. On failure inspect `error.details.payme | --- | --- | --- | | `missing_wallet_address` | 1 | No wallet-cli account is configured (also for `--dry-run`) | | `auth_required` | 1 | A real payment was attempted without `--password-stdin` | -| `invalid_option` | 2 | `--max-raw-amount` without `--token` / `--asset`, a binary response without `--out`, or mutually exclusive flags | +| `invalid_option` | 2 | `--max-raw-amount` without `--token` / `--asset`, a body with `GET`, a binary response without `--out`, or mutually exclusive flags | | `output_exists` | 2 | The `--out` file already exists; nothing was sent | | `no_matching_requirement` | 1 | No route matched `--network` / `--token` / `--asset` / `--scheme`, or, without `--max-amount` / `--max-raw-amount`, no route uses an asset the built-in spend control allows; `paymentStatus: "not_sent"` | | `amount_exceeds_limit` | 1 | The route's price is above `--max-amount`, `--max-raw-amount` or the built-in $1 cap; `not_sent` | @@ -51,7 +51,7 @@ The paid response is in `data.response`. On failure inspect `error.details.payme | `provider_error` / `provider_rate_limited` | 1 | The endpoint or facilitator failed or returned 429 (`error.details.retryAfterSeconds` when sent) | | `invalid_x402_response` | 1 | The paid response could not be decoded; may carry `paymentStatus: "settled"` | -`paymentStatus` appears in `error.details` only for real payments; a `--dry-run` failure carries no `error.details`. +Failures may include `paymentStatus` in `error.details`, including `not_sent` when an explicit amount limit rejects a `--dry-run` preview. Some earlier validation or request failures omit these details. A preview never signs or pays; the presence of payment-status details does not mean a payment was sent. ## B.AI recharge diff --git a/docs/wallet-cli/faq.md b/docs/wallet-cli/faq.md index 0e6561e2..e0446033 100644 --- a/docs/wallet-cli/faq.md +++ b/docs/wallet-cli/faq.md @@ -8,7 +8,7 @@ description: "Installation, wallet, and payment questions for wallet-cli." ## Does a preview need a wallet? -`x402 pay --dry-run` requires a configured account but does not sign. Catalog queries need neither a wallet nor a password. Actual payments need the master password through a secure input source. +`x402 pay --dry-run` requires a configured account but does not sign. Actual payments need the master password through a secure input source. ## Should I retry a failed payment? diff --git a/docs/wallet-cli/index.md b/docs/wallet-cli/index.md index 553dae80..0845c664 100644 --- a/docs/wallet-cli/index.md +++ b/docs/wallet-cli/index.md @@ -1,20 +1,19 @@ --- title: "Wallet CLI and x402" -description: "Use wallet-cli for payments and service discovery." +description: "Use wallet-cli for x402 payments." --- # Wallet CLI and x402 -Use **`@tron-walletcli/wallet-cli@4.15.1`** for new command-line integrations. +Use **`@tron-walletcli/wallet-cli@4.16.0`** for new command-line integrations. + +As of 2026-11-12, this is the npm `latest` release and declares **TronWeb 6.5.1** as an exact dependency. It does not automatically install TronWeb 6.5.2. The wallet-cli Skill has its own CLI version pin; follow the [Skills quick start](/McpServer-Skills/SKILLS/QuickStart/) when using that Skill. | Task | Entry point | | --- | --- | | Pay a protected HTTP API | `wallet-cli x402 pay` | | Test a local paywall | `wallet-cli x402 serve`, `wallet-cli x402 roundtrip` | -| Browse providers and endpoints | `wallet-cli x402 provider-list`, `provider-show`, `endpoint-list` | -| Refresh the catalog cache | `wallet-cli x402 update-catalog` | | B.AI recharge and records | `wallet-cli bai recharge`, `recharge-orders` | -| Gateway deployment, configuration and catalog builds | [Gateway deployment guide](/x402/core-concepts/gateway/#run-your-own-gateway) and [Catalog guide](/x402/api-catalog/) | Configure and select accounts through wallet-cli. An agent-wallet configuration does not automatically become a wallet-cli account. Use decimal CAIP-2 network IDs for the CLI: Nile `tron:3448148188`, TRON mainnet `tron:728126428`, BSC `eip155:56`, and Base `eip155:8453`. Protocol documentation can use hexadecimal TRON IDs; do not substitute those into CLI examples. diff --git a/docs/wallet-cli/quickstart.md b/docs/wallet-cli/quickstart.md index 98be7010..c29e92dc 100644 --- a/docs/wallet-cli/quickstart.md +++ b/docs/wallet-cli/quickstart.md @@ -11,7 +11,7 @@ Requires Node.js 22.23.4+ (22.x), 24.22.1+ (24.x), or 26.12.1+. ## Install and inspect ```bash -npm install -g @tron-walletcli/wallet-cli@4.15.1 +npm install -g @tron-walletcli/wallet-cli@4.16.0 wallet-cli --version wallet-cli x402 pay --json-schema -o json ``` @@ -33,27 +33,17 @@ wallet-cli list -o json wallet-cli current -o json ``` -## Browse the catalog - -```bash -wallet-cli x402 provider-list -o json -wallet-cli x402 provider-show dia -o json -wallet-cli x402 endpoint-list dia -o json -``` - -Choose the network-specific `x402Routes[].url` and fill in its path placeholders. Do not construct a Gateway URL from the catalog FQN. - ## Preview a payment -This reads DIA's payment requirements **without signing or paying**. A configured account is still required for payment previews. +Start the TRON resource server from the [seller quickstart](/x402/getting-started/quickstart-for-sellers/) on port 4021, configured for Nile, or use a test endpoint you control. This reads its payment requirements **without signing or paying**. A configured account is still required for payment previews. ```bash -wallet-cli x402 pay https://x402-gateway.bankofai.io/providers/dia-price-tron/v1/quotation/BTC \ +wallet-cli x402 pay http://localhost:4021/credit \ --method GET \ - --network tron:728126428 \ + --network tron:3448148188 \ --token USDT \ --scheme exact \ - --max-amount 0.01 \ + --max-amount 1 \ --dry-run -o json ``` diff --git a/docs/x402/AGENTS.md b/docs/x402/AGENTS.md index afacdca3..30f61b4a 100644 --- a/docs/x402/AGENTS.md +++ b/docs/x402/AGENTS.md @@ -88,7 +88,7 @@ Documentation must reflect code changes immediately. Follow these dependency map - **Settlement Asset**: Use official Base USDC at `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`. - **Payment Scheme**: Use `exact` with EIP-3009 authorization; do not describe Base USDC as Permit2. - **Address Format**: Payout and token addresses use EVM hexadecimal (`0x`) format. -- **Catalog Scope**: Public catalog examples use Base Mainnet only. Base Sepolia (`eip155:84532`) may appear only in explicit CLI/SDK testing documentation. +- **Network Scope**: Production examples use Base Mainnet. Base Sepolia (`eip155:84532`) may appear only in explicit CLI/SDK testing documentation. diff --git a/docs/x402/api-catalog/get-started.md b/docs/x402/api-catalog/get-started.md deleted file mode 100644 index f5796d7b..00000000 --- a/docs/x402/api-catalog/get-started.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Catalog Quick Start" -description: "Discover catalog services and preview payments with wallet-cli." ---- - -# Catalog Quick Start - -Install Wallet CLI using the [Wallet CLI quick start](/wallet-cli/quickstart/). Catalog reads need no wallet or password; payment previews and payments require a configured account. - -## Browse providers - -```bash -wallet-cli x402 update-catalog -o json -wallet-cli x402 provider-list -o json -wallet-cli x402 provider-show dia -o json -wallet-cli x402 endpoint-list dia -o json -``` - -`update-catalog` downloads the catalog to the local cache. `provider-list`, `provider-show`, and `endpoint-list` read that cache and download from the catalog only when the cache is missing or lacks what was asked for; they never refresh it, so run `update-catalog` again when you want the latest providers and prices. `provider-list` supports `--network`, `--category`, and `--capability` filters. - -## Choose an endpoint and network - -Read the network-specific URL from the CLI JSON's `x402Routes[].url` and fill in path placeholders. Gateway provider IDs differ from catalog FQNs, so do not construct URLs yourself. For example, preview DIA's TRON BTC quotation endpoint: - -```bash -wallet-cli x402 pay https://x402-gateway.bankofai.io/providers/dia-price-tron/v1/quotation/BTC \ - --method GET \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.01 \ - --dry-run -o json -``` - -This only previews the payment. For an actual payment, review the network and amount, obtain authorization, and use `--password-stdin` from a secure source. Cap GasFree fees separately; reconcile uncertain transactions before considering another payment. - -For direct API access, read the [Catalog JSON](https://x402-catalog.bankofai.io/api/catalog.json) for the service list, and `/api/providers/.json` for endpoints and their `x402_routes`. The static API uses snake_case field names, except inside `i18n` and route objects (for example `assetTransferMethod`); use the CLI's schema and documentation for its output shape rather than mixing the two. - -- [Catalog data and API reference](/x402/api-catalog/reference/) -- [List your service](/x402/api-catalog/list-your-service/) -- [Payment command reference](/wallet-cli/command-reference/) diff --git a/docs/x402/api-catalog/index.md b/docs/x402/api-catalog/index.md deleted file mode 100644 index 9cf05710..00000000 --- a/docs/x402/api-catalog/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: API Catalog Introduction -sidebar_label: Introduction -description: BANK OF AI's wallet-native service catalog — where AI Agents discover, call, and pay for any API, settled on-chain via x402. ---- - -import ThemedImage from '@theme/ThemedImage'; - -# API Catalog - -Traditional API onboarding is designed for humans: create an account, request an API key, link a credit card, subscribe monthly. When an AI Agent wants to call an API on its own, it fails at the very first step — it has no email, no credit card, and it shouldn't be holding a pile of secret keys for you anyway. - -The **API Catalog** is BANK OF AI's wallet-native service catalog. AI Agents discover services here, call them by name, and pay per call — every call settles on-chain via x402. No accounts, no API keys: **your wallet is your identity**. The catalog covers TRON, BNB Chain, and Base Mainnet. - -## What it solves - -- **For Agents / developers**: discover every callable service in one catalog and pay per call — no separate sign-ups or key management for each service. -- **For service providers**: list your existing API so Agents can discover, call, and pay for it directly, with payments settled straight to your own wallet — without changing a single line of code. - -## How it works - -The catalog itself is just a public list of services: it keeps no database and accepts no upstream secrets — it makes services discoverable, and never touches calls or funds. - -To get listed, a provider submits two **public** files to the catalog repository (you can start with the application form and we'll help you through); the call addresses inside the files point to the gateway of your choice — BANK OF AI hosted or self-hosted. The platform validates, scans for sensitive data, then publishes: - - - -Three consumers share the same data: - -- **[Catalog website](https://bankofai.io/catalog)**: for humans to browse and compare services. -- **wallet-cli**: search, inspect, and make paid calls from the command line. -- **MCP**: `@x402/mcp` (the official MCP integration used since SDK 2.1.0) lets an Agent pay for an x402 endpoint over MCP. Catalog-aware MCP discovery — browsing the catalog by name from inside an MCP client — is not shipped yet; use `wallet-cli x402 provider-list` for discovery today. - -## What's in the catalog - -The first live services cover token creation plus DeFi market data and on-chain security, with routes settling across TRON, BNB Chain, and Base Mainnet as published by each provider: - -| Service | What it does | Billing | -|---|---|---| -| SunPump | One-call agent/meme token launch, paid via x402 — submit token metadata (name, symbol, description, image) and the gateway forwards your request after settlement | $0.000001 / call | -| DefiLlama | Aggregated DeFi data — protocol TVL, token prices (current & historical), and pool yields/APY | $0.000001 / call | -| DexScreener | Real-time DEX pairs, prices and liquidity, token search, and the latest new-listing profiles | $0.000001 / call | -| DIA | Decentralized, multi-source oracle prices by symbol or by chain + contract address | $0.000001 / call | -| GoPlus | Token and address security checks — honeypot/scam screening, malicious-address and risky-approval detection | $0.000001 / call | - -All of the above are in the **Finance** category. Check each endpoint's `x402_routes` for its currently published TRON, BNB Chain, and Base Mainnet routes — they appear in `/api/providers/.json`, `/api/pay/.json` and `/api/search-index.json`, not in the summary-only `/api/catalog.json`. - -:::note -The live service list and statistics (service count, chain count, etc.) are **generated dynamically** from catalog data — treat `/api/catalog.json` as the source of truth for the service list and counts (it carries provider summaries only — per-endpoint routes live in the per-provider files above); this page hard-codes no numbers, and the catalog grows as new services are listed. -::: - -## Next steps - -- Want your Agent to use these services → [Catalog Quick Start](./get-started.md) -- Want to list and monetize your own API → [List Your Service](./list-your-service.md) -- Want the data structures and API details → [Data Format & API Reference](./reference.md) diff --git a/docs/x402/api-catalog/list-your-service.md b/docs/x402/api-catalog/list-your-service.md deleted file mode 100644 index 4b31c8ff..00000000 --- a/docs/x402/api-catalog/list-your-service.md +++ /dev/null @@ -1,339 +0,0 @@ ---- -title: List Your Service -sidebar_label: List Your Service -description: List your API in the API Catalog — apply via the form or open a PR directly; two public files; official or self-hosted gateway both work. Once live, every AI Agent can discover it and pay per call. ---- - -# List Your Service - -List once — every AI Agent call after that is revenue in. - -Put your API behind the Gateway and it appears in the catalog: any Agent can discover it, call it, and pay for it. Payments settle to the wallet you specify in real time — **no platform escrow, no payout cycle**; settle on TRON, BNB Chain, or Base Mainnet; your existing API stays exactly as it is, **not one line of code changes**, and you set the prices. - -## The big picture: what listing actually means - -Listing comes down to one action: opening a PR against the [catalog repository](https://github.com/BofAI/x402-catalog) with just two **public** files: - -| File | Purpose | -|---|---| -| `providers//catalog.json` | Public service info used by the frontend, CLI, and Agents | -| `providers//pay.md` | Human- and Agent-readable call & payment instructions | - -`` is your service's globally unique identifier (lowercase letters, digits, hyphens) and must match the directory name. - -The catalog repository **stores public discovery data only**: it keeps no database and never accepts upstream API keys, tokens, passwords, `provider.yml`, or `.env`. With a self-hosted gateway your secrets stay on your machine; with the official gateway your credentials are held on the gateway side — either way, secrets **never enter the catalog repository**. - -Before you start, make two decisions. - -## Decision 1: whose gateway? - -This determines the call addresses in your two files — each endpoint's `url` and its `x402Routes[].url`. (`serviceUrl` is your service's public website, not a gateway address.) - -| | Official gateway (hosted) | Self-hosted gateway | -|---|---|---| -| Call address in your files | Official domain (`x402-gateway.bankofai.io/...`) | Your own gateway domain | -| Who runs the gateway | BANK OF AI | You | -| Funds & traffic | Proxied through the official gateway, settled to your wallet | Straight to your gateway and wallet, never passing through BANK OF AI | -| Where upstream credentials live | Held by the official gateway | Your machine only | -| Best for | Fastest launch, nothing to deploy | Full control over credentials and infrastructure | - -Either way, the catalog handles **discovery** only: what Agents actually call is always the gateway address registered in your files. - -## Decision 2: pick a submission route - -Two routes, one destination — that PR. - -**Route 1: apply first, we'll contact you** (recommended for first-time providers) - -1. **Submit the application form** — via the **Apply to list your service** entry at the bottom of the [catalog page](https://bankofai.io/catalog): service name, short description, API URL, preferred settlement network(s), and contact info. If you've registered an ERC-8004 identity address, include it — verified applicants are **prioritized**. -2. **We get in touch** — within **1–2 business days** by email or Telegram, to confirm endpoints, pricing, payout wallet, and whether you'll use the official or a self-hosted gateway. -3. **Open the PR** — once everything is confirmed, follow the steps below; your service goes live when it merges. - -**Route 2: open a PR directly** (for providers familiar with the flow) - -Skip the form and follow the steps below to prepare the files and open the PR. - -## Step 1: Prepare the two public files - -**Self-hosted gateway**: prepare `catalog.json` and `pay.md` using the formats below. Include public endpoints, prices, and payment details only. Before you do, [run and validate your Gateway](/x402/core-concepts/gateway/#run-your-own-gateway). - -**Official gateway**: once onboarding is confirmed, fill in the two files using the official addresses assigned to you, following the examples below. The gateway uses one provider ID per payment chain, which differs from your catalog `fqn` — for example `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron`, `…-bsc`, and `…-base`. - -### What catalog.json looks like - -The real **SunPump** file, `providers/sunpump-token-launch/catalog.json`: - -```json -{ - "version": 1, - "fqn": "sunpump-token-launch", - "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 Mainnet, BNB Smart Chain and Base Mainnet 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\nTRON Mainnet defaults to `exact` + `permit2` and also supports `exact_gasfree`. First inspect the payment requirements:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nThen pay and submit the launch request with Wallet CLI:\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network tron:728126428 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\nBNB Smart Chain Mainnet supports `exact` + `permit2`:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network eip155:56 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\n## Base Mainnet payment\n\nBase Mainnet uses official USDC on `eip155:8453` with x402 `exact` and EIP-3009. A successful call still launches the token on TRON Mainnet.", - "useCase": "Use this provider when an app, agent, or CLI workflow needs to launch a SunPump token after a successful x402 payment. Choose a TRON Mainnet, BNB Smart Chain, or Base Mainnet payment route; every successful launch creates the token on TRON Mainnet.", - "i18n": { - "zh-CN": { - "title": "SunPump", - "subtitle": "用结构化元数据一次付费发币。", - "description": "## 能做什么\n\nSunPump Agent 发币 API 允许 Agent、脚本和应用先完成 x402 支付,再把发币元数据提交给 SunPump。Gateway 在支付结算后把调用方的 JSON 请求体转发到 SunPump 发币接口。\n\n## 适合场景\n\n- 需要基于结构化元数据创建 meme token 或 agent token 的 Agent 工作流。\n- 希望用一次付费 API 调用完成发币的运营工具。\n- 在 TRON 主网、BNB Smart Chain 主网和 Base 主网使用同一套 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\nTRON 主网默认使用 `exact` + `permit2`,同时支持 `exact_gasfree`。先查看支付要求:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n然后使用 Wallet CLI 支付并提交发币请求:\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network tron:728126428 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\nBNB Smart Chain 主网支持 `exact` + `permit2`:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network eip155:56 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\n## Base 主网支付\n\nBase 主网路由使用 `eip155:8453` 官方 USDC,通过 x402 `exact` + EIP-3009 支付;成功调用仍会在 TRON 主网创建 Token。", - "useCase": "适合应用、Agent 或 CLI 流程在 x402 支付成功后调用 SunPump 发币接口。可选择 TRON 主网、BNB Smart Chain 或 Base 主网支付路由;成功后均在 TRON 主网创建 Token。", - "mainTitle": "一次付费完成 Agent 代币发行" - } - }, - "logo": "https://sunpump.meme/favicon.ico", - "category": "finance", - "chains": [ - "tron:0x2b6653dc", - "eip155:56", - "eip155:8453" - ], - "isFirstParty": true, - "isFeatured": true, - "featuredTags": [ - "sunpump", - "token-launch", - "agent-token", - "tron", - "bsc", - "base" - ], - "serviceUrl": "https://sunpump.meme", - "endpoints": [ - { - "method": "POST", - "path": "/pump-api/ai/agentTokenLaunch", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch", - "x402Routes": [ - { - "network": "tron:0x2b6653dc", - "provider": "sunpump-token-launch-tron", - "scheme": "exact", - "assetTransferMethod": "permit2", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch" - }, - { - "network": "tron:0x2b6653dc", - "provider": "sunpump-token-launch-tron", - "scheme": "exact_gasfree", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch" - }, - { - "network": "eip155:56", - "provider": "sunpump-token-launch-bsc", - "scheme": "exact", - "assetTransferMethod": "permit2", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch" - }, - { - "provider": "sunpump-token-launch-base", - "network": "eip155:8453", - "scheme": "exact", - "assetTransferMethod": "eip3009", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base/pump-api/ai/agentTokenLaunch" - } - ], - "title": "Launch Agent Token", - "subtitle": "Create a SunPump token from metadata", - "description": "Submit token metadata to SunPump after x402 payment settlement. `imageBase64` can carry a base64-encoded token image; when it is empty or omitted, SunPump generates an image automatically. The response includes SunPump status and token data such as token id, owner address, contract address, logo URL, create transaction hash, reserves, and market data when available.", - "useCase": "Use this endpoint when an agent or backend has already validated launch metadata and is ready to create the token.", - "i18n": { - "zh-CN": { - "title": "Agent 发币", - "subtitle": "根据元数据创建 SunPump token", - "description": "在 x402 支付结算后向 SunPump 提交发币元数据。`imageBase64` 可以携带 base64 编码的 token 图片;为空或不传时,SunPump 会自动生成图片。响应包含 SunPump 状态和 token 数据,例如 token id、owner address、contract address、logo URL、create transaction hash、储备和市场数据等。", - "useCase": "适合 Agent 或后端已经校验好发币元数据,准备正式创建 token 的场景。" - } - }, - "metered": true, - "minPriceUsd": 0.000001, - "maxPriceUsd": 0.000001 - } - ], - "status": { - "catalog": "listed", - "gateway": "configured", - "payment": "mainnet", - "upstream": "public" - } -} -``` - -Full field definitions: [Data Format & API Reference](./reference.md). - -### How to write pay.md - -`pay.md` is read by humans and Agents alike. Three parts are recommended: basic service info, endpoint addresses and prices, and copy-paste call examples. The catalog's CI tests require every `pay.md` to contain a `wallet-cli x402 pay` example with `--network tron:728126428` and `--scheme exact`, to mention `exact_gasfree`, and to cover Base Mainnet: the text must contain `Base Mainnet`, `eip155:8453`, a `-base` gateway provider, `USDC`, and `EIP-3009`, and must not mention `Sepolia` or `eip155:84532`. The real SunPump file, `providers/sunpump-token-launch/pay.md`: - -````markdown -# SunPump Agent Token Launch API - -SunPump Agent Token Launch API is an x402-paid gateway provider for launching a TRON Mainnet SunPump token from structured metadata. It exposes the same launch request shape across TRON Mainnet, BNB Smart Chain and Base Mainnet payment routes. - -Use it when an agent, backend workflow, or CLI script has validated launch metadata and is ready to create a token through a paid API call. - -## Service - -- FQN: `sunpump-token-launch` -- Service URL: `https://sunpump.meme` -- Category: `finance` -- Payment chains: `tron:0x2b6653dc`, `eip155:56`, `eip155:8453` -- TRON schemes: `exact` + `permit2` (default), `exact_gasfree` -- BNB Smart Chain scheme: `exact` + `permit2` -- Base Mainnet scheme: `exact` + official USDC EIP-3009 -- TRON Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron` -- BNB Smart Chain gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc` -- Base Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base` - -## CLI Quick Start - -Install or update Wallet CLI and configure an account before paying: - -```bash -npm install -g @tron-walletcli/wallet-cli@4.14.0 -``` - -The examples use the active account. Supply its master password through standard input for `--password-stdin`. `--max-amount` limits the payment in whole units of the selected token. - -Call the route matching the payment chain you want to use. - -TRON Mainnet: - -```bash -curl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \ - -H 'Content-Type: application/json' \ - --data '{"name":"X402MainA","symbol":"X4M17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402MainA","symbol":"X4M17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -BNB Smart Chain: - -```bash -curl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \ - -H 'Content-Type: application/json' \ - --data '{"name":"X402BscA","symbol":"X4B17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network eip155:56 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402BscA","symbol":"X4B17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -Base Mainnet: - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network eip155:8453 \ - --token USDC \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402BaseA","symbol":"X4BA17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -The Base Mainnet route changes only the payment network. A successful call still creates a token on TRON Mainnet. - -## Endpoint - -### POST /pump-api/ai/agentTokenLaunch - -Create a SunPump token from JSON metadata after x402 payment settlement. - -Required request fields: - -- `name`: token name, 1-20 characters. -- `symbol`: token symbol. Use a unique value. -- `description`: token description. -- `imageBase64`: optional base64-encoded token image. Leave it empty or omit it to let SunPump generate an image automatically. -- `twitterUrl`, `telegramUrl`, `websiteUrl`: optional social links, or empty strings. -- `tweetUsername`: optional tweet username, or an empty string. - -The upstream response returns SunPump status and token launch data such as token id, owner address, contract address, create transaction hash, logo URL, reserves, and market data when available. - -## Integration Notes - -- The endpoint has side effects: a successful paid call can create a token. -- Validate metadata before paying. In particular, keep `name` within 1-20 characters. -- You can provide your own token image with `imageBase64`; otherwise the launch service generates one. -- Current listed prices are fixed per request across all listed payment routes. -- The public catalog does not contain gateway runtime secrets or wallet keys. -```` - -### Pre-submission checklist - -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. TRON IDs must be `tron:0x2b6653dc`, `tron:0xcd8690dc`, or `tron:0x94a9059e` — the decimal form (`tron:728126428`) is rejected; see [Chain IDs](./reference.md#chain-ids). CI tests require every provider to list Base Mainnet `eip155:8453` and reject Base Sepolia `eip155:84532`. -- `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`. -- `serviceUrl`, every endpoint `url`, and every route `url` must start with `https://`. -- Unknown fields are rejected — at the top level and in endpoints, routes, `i18n.`, and `status`. -- `x402Routes` is optional in the schema, but CI tests require every endpoint to publish exactly one Base Mainnet route: `scheme` `exact`, `assetTransferMethod` `eip3009`, and a `provider` ending in `-base`. Every route's `network` must also appear in `chains`, and `exact_gasfree` is allowed only on TRON networks. Every route needs `network`, `provider`, `scheme`, and `url`; an `exact` route must also carry `assetTransferMethod` (`permit2` or `eip3009`), and an `exact_gasfree` route must **omit** it. A network may appear more than once — TRON typically publishes both an `exact` and an `exact_gasfree` route — as long as each `(provider, network, scheme, url)` combination is unique. Legacy `fee` / `feeConfig` fields are rejected. See the [reference](./reference.md#x402routes--multi-network-routing). -- On every endpoint with TRON routes, the first TRON route must be `exact` + `permit2` (the default), and the service-level `description` — including its `i18n` translations — must not contain `--scheme exact_gasfree`. -- The service and every endpoint must provide `i18n.zh-CN` translations for `title`, `subtitle`, `description`, and `useCase`. -- `status` is optional, but if present it must include all four keys, and only accepts: `catalog` `listed`/`unlisted`; `gateway` `configured`/`unknown`/`unavailable`; `payment` `paid-route`/`mainnet`/`testnet`/`unknown`; `upstream` `public`/`authenticated`/`unknown`/`unavailable`. -- `pay.md` must be submitted together with `catalog.json`; both files are scanned for sensitive data. -- No keys, private keys, or private network addresses anywhere. - -## Step 2: Validate locally - -Before submitting, install the validation dependency, then run validation, build, and the unit tests locally — the same steps CI runs. The scripts need Python 3.11 or newer (CI uses 3.12); on 3.10 they fail with `ImportError: cannot import name 'UTC' from 'datetime'`. - -```bash -pip install -r requirements.txt -python3 scripts/validate.py -python3 scripts/build.py -python3 -m unittest discover -s tests -``` - -The first two print `validated N provider(s)` and `built N provider(s) into dist`, where N counts every provider in the repository, yours included. - -:::note Pinned counts in the tests -`tests/test_build.py` pins current catalog totals, such as the number of Base Mainnet routes across all providers. A new provider that passes `validate.py` can still fail those assertions (for example `AssertionError: 20 != 18`); update the expected counts in the same PR. -::: - -## Step 3: Open the Pull Request - -Add the two files to the [catalog repository](https://github.com/BofAI/x402-catalog) under the matching directory, together with the regenerated `dist/` files: - -```text -providers//catalog.json -providers//pay.md -dist/ -``` - -:::caution Security red line: these two files are public -**Never** include upstream API keys, bearer tokens, wallet private keys, passwords, `provider.yml`, `.env`, or any internal/local addresses (such as `localhost`, `127.0.0.1`, `10.x`, `192.168.x`). CI scans for these patterns and rejects the merge on any hit. -::: - -## Step 4: Merge = go live - -After your PR merges, the release process refreshes the freshly built `dist/` to the Catalog Server / CDN. Your service is live in the catalog and starts taking Agent calls. - -## Next steps - -- All fields, categories, and API structures → [Data Format & API Reference](./reference.md) -- Want to try the caller side first? → [Catalog Quick Start](./get-started.md) diff --git a/docs/x402/api-catalog/reference.md b/docs/x402/api-catalog/reference.md deleted file mode 100644 index a7e99d02..00000000 --- a/docs/x402/api-catalog/reference.md +++ /dev/null @@ -1,254 +0,0 @@ ---- -title: Data Format & API Reference -sidebar_label: Data Format & API -description: Field definitions for catalog.json / pay.md, allowed categories and chain IDs, and the response structures of the Catalog static API (/api/*). ---- - -# Data Format & API Reference - -This page is the API Catalog's data contract: the `catalog.json` fields providers submit to the [catalog repository](https://github.com/BofAI/x402-catalog), the allowed values, and the structures of the `/api/*` endpoints the catalog exposes after build. - -## provider catalog.json fields - -Each service is described in `providers//catalog.json`. Top-level fields: - -| Field | Type | Required | Description | -|---|---|---|---| -| `version` | number | Yes | Always `1` | -| `fqn` | string | Yes | Globally unique ID, regex `^[a-z0-9][a-z0-9-]{1,62}$`, must match the directory name | -| `title` | string | Yes | Service name (typically a clean brand name, e.g. `DefiLlama`) | -| `subtitle` | string | Yes | One-line subtitle | -| `mainTitle` | string | No | Display tagline for the card/header (e.g. `Aggregated DeFi data — TVL, prices & yields`); falls back to `title` | -| `description` | string | Yes | Service description | -| `useCase` | string | Yes | When to use it — helps Agents decide when to call | -| `i18n` | object | Yes | Translations, must include `zh-CN` (see below) | -| `logo` | string | Yes | Logo image URL | -| `category` | string | Yes | Must be an allowed value (see [allowed categories](#allowed-categories)) | -| `chains` | string[] | Yes | Settlement chains, at least one, CAIP-2 style | -| `serviceUrl` | string | Yes | The service's public website (e.g. `https://defillama.com`), starting with `https://`. Gateway call addresses go in each endpoint's `url` and `x402Routes[].url` | -| `endpoints` | object[] | Yes | Endpoint list, at least one (see below) | -| `isFirstParty` | boolean | Yes | First-party service or not | -| `isFeatured` | boolean | Yes | Featured or not (affects catalog ordering, see [aggregate fields and ordering](#catalogjson-aggregate-fields-and-ordering)) | -| `featuredTags` | string[] | Yes | Featured tags, may be an empty array `[]` | -| `status` | object | No | Status block (see [status block](#status-block)) | - -### i18n translations - -`i18n.zh-CN` is required and must contain Chinese translations for `title`, `subtitle`, `description`, and `useCase`. It may also include `mainTitle` (Chinese display tagline). Every endpoint needs its own `i18n.zh-CN` as well. - -### endpoint fields - -| Field | Type | Required | Description | -|---|---|---|---| -| `method` | string | Yes | HTTP method, must be uppercase (e.g. `GET`) | -| `path` | string | Yes | Path, must start with `/` | -| `url` | string | Yes | Full endpoint URL | -| `title` | string | Yes | Endpoint name | -| `subtitle` | string | Yes | Subtitle | -| `description` | string | Yes | Description | -| `useCase` | string | Yes | When to use it | -| `i18n` | object | Yes | Endpoint-level Chinese translations (same four fields) | -| `metered` | boolean | Yes | Metered billing or not | -| `minPriceUsd` | number | Yes | Minimum price (USD) | -| `maxPriceUsd` | number | Yes | Maximum price (USD), must not be less than `minPriceUsd` | -| `x402Routes` | object[] | No | Per-network payment routes (see below) | - -### x402Routes — multi-network routing - -An endpoint may serve the same capability across several chains, each settling through its own gateway provider and payment scheme. List those alternatives in `x402Routes`; each route describes one network: - -| Field | Type | Description | -|---|---|---| -| `network` | string | CAIP-2 chain ID this route settles on (e.g. `tron:0x2b6653dc`, `eip155:56`, `eip155:8453`). For TRON the catalog accepts only the hexadecimal IDs listed under [Chain IDs](#chain-ids); aliases such as `tron:nile` and the decimal form `tron:728126428` are both rejected by the catalog's validation. | -| `provider` | string | The gateway provider `fqn` that handles this network | -| `scheme` | string | x402 payment scheme for this route: `exact` or, on TRON, `exact_gasfree` — each route declares its own | -| `assetTransferMethod` | string | **Required** for every `exact` route: use `permit2` for TRON/BSC routes and `eip3009` for Base USDC routes. **Omit** it only on `exact_gasfree` routes. | -| `url` | string | Full gateway URL for this network's route | - -The build passes this through to outputs as `x402_routes`. When present, callers/agents pick the route matching their intended payment chain; the top-level `url` remains the default route. - -:::note GasFree routes -On TRON you can add an `exact_gasfree` route alongside the `exact` one for the same endpoint: a relayer pays the network energy and deducts its fee from the payment token, so the payer needs no TRX. GasFree routes are TRON-only and must not carry `assetTransferMethod`. Since x402 SDK 1.0.1 the relayer cost is estimated client-side, so catalog routes must **not** publish the legacy `fee` or `feeConfig` fields. -::: - -For example, an endpoint may expose one route per supported chain — TRON Mainnet, BSC Mainnet, and Base Mainnet — each with its own `provider` and `scheme`. To call one, point `wallet-cli x402 pay` at the chosen route's `url` and pass the matching `--network` / `--scheme`: - -```bash -wallet-cli x402 pay --dry-run -o json 'https://x402-gateway.bankofai.io/providers//' \ - --method POST \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{ ... }' -``` - -The other routes reuse the same request body, swapping only the route `url`, `--network`, and the route's declared `--scheme`. - -### status block - -`status` is optional and describes the state of each stage of the service, with four keys: `catalog` / `gateway` / `payment` / `upstream`. When present, all four keys are required. When omitted, the build output (service detail) fills in defaults automatically: - -```json -{ "catalog": "listed", "gateway": "unknown", "payment": "unknown", "upstream": "unknown" } -``` - -Allowed values: - -| Key | Values | -|---|---| -| `catalog` | `listed`, `unlisted` | -| `gateway` | `configured`, `unknown`, `unavailable` | -| `payment` | `paid-route`, `mainnet`, `testnet`, `unknown` | -| `upstream` | `public`, `authenticated`, `unknown`, `unavailable` | - -## pay.md - -Submitted alongside `catalog.json` in the same directory — a human- and Agent-readable call guide, and a **required** file. Recommended contents: basic service info (FQN, entry address, category, settlement chains), each endpoint's address and price, plus copy-paste call examples. The catalog's CI tests currently require a `wallet-cli x402 pay` example with `--network tron:728126428` and `--scheme exact`, a mention of `exact_gasfree`, and Base Mainnet coverage (the strings `Base Mainnet`, `eip155:8453`, `-base`, `USDC`, and `EIP-3009`, with no `Sepolia` or `eip155:84532`). Like `catalog.json`, this file goes through the sensitive-data scan (see below). - -## Allowed categories - -`category` must be one of: - -```text -ai_ml cloud compute data -devtools finance identity media -messaging other productivity search -security shopping storage translation -``` - -## Chain IDs - -`chains` uses CAIP-2 style chain identifiers. Mainnets and testnets are both recognized: - -:::note TRON ID format -The catalog schema accepts TRON chains only in the hexadecimal form below. The x402 SDK (since 2.0.0) and Wallet CLI use the decimal CAIP-2 IDs — `tron:728126428` (mainnet), `tron:3448148188` (Nile), `tron:2494104990` (Shasta). The SDK still accepts the hexadecimal values as deprecated aliases of the same chains; Wallet CLI's global `--network` (used by `x402 pay` and account commands) does not — use the decimal ID or an alias such as `tron`, `nile` or `shasta`; only the catalog filter `x402 provider-list --network` also accepts the hex form. That is why the CLI examples pass `--network tron:728126428` while `catalog.json` lists `tron:0x2b6653dc`. -::: - -| Chain | ID | -|---|---| -| TRON mainnet | `tron:0x2b6653dc` | -| TRON Nile testnet | `tron:0xcd8690dc` | -| TRON Shasta testnet | `tron:0x94a9059e` — schema-level only: the gateway has no Shasta token registry and the official facilitator does not settle it, so it cannot back a live route | -| BNB Chain (BSC) | `eip155:56` | -| BNB Smart Chain testnet | `eip155:97` | -| Base mainnet | `eip155:8453` | -| Base Sepolia testnet | `eip155:84532` — schema-level only: the build has no display metadata for it, so `label` falls back to the raw chain ID and `chain_kinds` reports `evm` instead of `base`. The catalog's CI tests also reject it in `chains` | - -Per-endpoint routes are published in `/api/providers/.json` and `/api/pay/.json` (as `x402_routes`), not in the summary-only `/api/catalog.json`. The build resolves each chain ID into display metadata (`kind` / `label` / `label_zh`) so the frontend doesn't have to parse CAIP-2 itself — see [Frontend display fields](#frontend-display-fields). - -## Validation and secret scanning - -Every submission goes through field validation and a sensitive-data scan; any hit rejects the submission. The scan covers: - -- **Secret field names**: `api_key`, `secret`, `password`, `token`, `authorization`, `bearer`, `private_key`, `provider.yml`, `.env`, etc. -- **Secret values**: tokens shaped like `sk-...` or `Bearer ...`, and 64-character hex strings starting with `0x` (private-key signature). -- **Private network addresses**: `localhost`, `127.0.0.1`, `0.0.0.0`, `10.x`, `192.168.x`, `172.16-31.x`, etc. - -Both `catalog.json` and `pay.md` are scanned. - -## Build outputs and API - -CI builds the static snapshot `dist/`, which the Catalog Server serves under the `/api/` path (CORS enabled): - -| Endpoint | Contents | -|---|---| -| `GET /api/catalog.json` | List-page data: service summaries + aggregate stats + frontend config | -| `GET /api/categories.json` | Categories in use and their counts | -| `GET /api/search-index.json` | Lightweight search index | -| `GET /api/providers/.json` | Single service detail (full endpoints + status) | -| `GET /api/pay/.json` | Payment & call summary for Agents / CLI | -| `GET /api/pay/.md` | Human-readable call guide | -| `GET /api/status.json` | Build status and service count | - -### catalog.json aggregate fields and ordering - -Besides the `providers` array, the list endpoint carries dynamic stats — frontends should read them directly, never hard-code: - -| Field | Description | -|---|---| -| `version` | Always `1` | -| `base_url` | Base URL of the static API | -| `provider_count` | Total services live | -| `first_party_count` | First-party service count | -| `chain_count` | Chains covered | -| `generated_at` | Build time (UTC) | -| `frontend.featured_fqns` | `fqn` list of featured services | -| `frontend.categories` | Categories in use — each `{ id, label, label_zh, count }` | -| `frontend.chains` | Chains in use — each `{ id, kind, label, label_zh, count }` | - -The `providers` array is pre-sorted at build time by **featured first → category → fqn**; frontends can render it as-is. Use `frontend.categories` / `frontend.chains` to drive filter UIs — including their `label` / `label_zh` display names — rather than hard-coding category or chain lists. - -### Derived fields - -Build outputs add derived fields on top of the raw data and convert top-level and endpoint field names to snake_case (e.g. `useCase` → `use_case`, `x402Routes` → `x402_routes`). The `i18n` block and the objects inside `x402_routes` are passed through unchanged, so they keep camelCase keys such as `mainTitle` and `assetTransferMethod`: - -| Field | Description | -|---|---| -| `endpoint_count` | Number of endpoints | -| `has_metering` | Whether any endpoint is metered | -| `has_free_tier` | Whether any endpoint has `minPriceUsd` of 0 | -| `min_price_usd` / `max_price_usd` | The service's price range across all endpoints | -| `sha` | Content hash of `catalog.json` + `pay.md`, for change detection | - -### Frontend display fields - -To save the frontend from parsing raw IDs and picking translations, the build also emits ready-to-render fields on each provider summary and detail: - -| Field | Description | -|---|---| -| `title_zh` | Chinese service name (from `i18n.zh-CN.title`, falls back to `title`) | -| `main_title` | Display tagline (from `mainTitle`, falls back to `title`) | -| `main_title_zh` | Chinese display tagline (from `i18n.zh-CN.mainTitle` / `mainTitle`, falls back to `title`) | -| `sub_title` | Secondary display line (from `subtitle`) | -| `sub_title_zh` | Chinese secondary display line (from `i18n.zh-CN.subtitle`, falls back to `subtitle`) | -| `category_meta` | `{ id, label, label_zh }` for the category | -| `chain_kinds` | De-duplicated friendly chain kinds, e.g. `["tron"]`, `["bnb"]`, `["base"]` | -| `chains_meta` | Per-chain `{ id, kind, label, label_zh }`, so the frontend never parses CAIP-2 | - -These are additive — the raw `title`, `subtitle`, `category`, `chains`, and `i18n.zh-CN` are still present. - -### Other output structures - -- **`/api/pay/.json`**: payment summary for Agents / CLI. Top level includes `version`, `fqn`, `title`, `title_zh`, `main_title`, `main_title_zh`, `sub_title`, `sub_title_zh`, `subtitle`, `description`, `use_case`, `i18n`, `service_url`, `chains`, `chain_kinds`, `chains_meta`, `sha`; `endpoints[]` keeps the call-relevant fields `method`, `path`, `url`, `description`, `metered`, `min_price_usd`, `max_price_usd`, plus `x402_routes` when the endpoint defines multi-network routes. -- **`/api/search-index.json`**: `{ version, generated_at, documents[] }`, each document carrying a reduced set of service fields — `fqn`, `title`, `subtitle`, `description`, `use_case`, `category`, `category_meta`, `chains`, `chain_kinds`, `chains_meta`, `featured_tags`, `service_url` — plus each endpoint's `method` / `path` / `title` / `description` (and `x402_routes` when present). -- **`/api/categories.json`**: array of categories in use, each `{ id, label, label_zh, count }` — a direct export of `frontend.categories`. -- **`/api/status.json`**: `{ version, generated_at, provider_count, status }`; `status` of `ok` means the build is healthy. - -## Local build and run - -Requires Python 3.11 or newer. - -```bash -# install the validation dependency (jsonschema) -pip install -r requirements.txt - -# validate all providers -python3 scripts/validate.py - -# build the static snapshot into dist/ -python3 scripts/build.py - -# run the unit tests -python3 -m unittest discover -s tests -``` - -Container mode (validates and builds `dist/` at image build time, then serves from `/api/`): - -```bash -docker compose build catalog -docker compose up -d catalog -curl http://127.0.0.1:8088/api/status.json -``` - -The port can be overridden with the `X402_CATALOG_PORT` environment variable (default `8088`; the container listens on `8080` internally). - -:::note CI scheduling -The catalog repository's CI (GitHub Actions) runs validation, build, and the unit tests on every PR, on pushes to `main`, on release tags, and every 30 minutes; it can also be triggered manually. -::: - -## Related pages - -- [List Your Service](./list-your-service.md) — submission flow and security red lines -- [Get Started](./get-started.md) — onboarding from the caller's side diff --git a/docs/x402/core-concepts/OfficialFacilitator.md b/docs/x402/core-concepts/OfficialFacilitator.md index c6f736ac..b6aa65e5 100644 --- a/docs/x402/core-concepts/OfficialFacilitator.md +++ b/docs/x402/core-concepts/OfficialFacilitator.md @@ -1,3 +1,8 @@ +--- +title: 'Official Facilitator' +description: 'Connect to the hosted x402 Facilitator, manage API keys, and handle cache refreshes and authentication outages.' +--- + # Official Facilitator ## What is an Official Facilitator? @@ -122,6 +127,18 @@ Therefore, it is **strongly recommended to apply for and configure an API Key** --- +### Key refreshes and temporary authentication failures + +Facilitator v2.3.2 reads active keys from DevCenter into a cache; the built-in production configuration refreshes it every **5 seconds**. Both key creation and deletion affect authentication after the next successful refresh, rather than immediately. Each process refreshes independently; replicas need not apply changes together, and database read time also affects the delay. + +While the cache is fresh, incorrect keys, keys not yet synced, and revoked keys after syncing are treated as anonymous rather than uniformly rejected with HTTP 401. A successful call does not prove that a key was recognized. In particular, transaction-hash and authorization-identity lookups apply seller filtering only for a **valid, recognized key**. + +If DevCenter becomes unavailable, the previous snapshot remains usable for up to three refresh intervals (**15 seconds** with the production configuration, measured from the last successful read). Once it expires, requests carrying `X-API-KEY` to `/verify`, `/settle`, `/payments`, and `/payments/tx/{tx_hash}` receive HTTP **503** with reason code `api_key_auth_unavailable` until refreshes recover. This error has no `Retry-After` header. Retain the key and retry with backoff; do not remove the authentication header to bypass the error. Anonymous requests continue under the existing policy. + +See [Facilitator API key cache](../facilitator#api-key-cache-and-authentication-availability) for each endpoint's error response. + +--- + ## Apply for an API Key To unlock production-level throughput, please apply for a free API Key in the admin backend: [https://admin-facilitator.bankofai.io](https://admin-facilitator.bankofai.io) @@ -135,7 +152,7 @@ This is an admin panel accessible via a browser, where you can register an accou - **API Key leakage is equivalent to identity leakage**: Anyone holding your API Key can consume your rate limit quota in your name. Please protect it like a password. - **Do not commit to code repositories**: Ensure that the `.env` file has been added to `.gitignore` to avoid uploading keys to public platforms like GitHub. -- **1 Key per account limit**: If you believe your Key has been leaked, please log in to the admin backend to delete the old Key and recreate a new one. The old Key will become invalid immediately. +- **1 Key per account limit**: If you believe your Key has been leaked, please log in to the admin backend to delete the old Key and recreate a new one. The old Key becomes invalid after the next successful Facilitator key-cache refresh. - **Signature authorization does not equal transfer**: The wallet signature during login is only used for identity verification and will not trigger any asset transfers. ::: @@ -227,7 +244,7 @@ Click the **"Create API Key"** button on the page. The system will pop up a conf After clicking **"Confirm"**, you will return to the Dashboard page, and the API Key will be displayed in a hidden state by default. You can manage it in the following ways: - **View / Hide**: Click the **View** button to the right of the API Key to switch between plain text display and hidden state. You can copy the Key directly whether it is currently displayed or hidden. -- **Delete**: Click the **Delete** button on the far right to delete the current API Key. After deletion, the old Key will become invalid immediately, and you can recreate a new Key. +- **Delete**: Click the **Delete** button on the far right to delete the current API Key. After deletion, the old Key becomes invalid after the next successful Facilitator key-cache refresh, and you can recreate a new Key.
When an API Key is provided, these interfaces only return payment records associated with your account; you will not see data from other sellers. +> When a valid API Key recognized by Facilitator is provided, these interfaces only return payment records associated with your account; you will not see data from other sellers. :::danger Without an API Key The `tx_hash` and `network` + `nonce` lookups add **no seller filter** when the request is anonymous, so the response may include records bound to a seller — anyone holding an exact identifier can resolve the corresponding record. The `/payments` list endpoint still requires authentication, so there is no unauthenticated listing endpoint; but these lookups are not rate-limited either (the official service's 10-requests-per-IP-per-minute anonymous limit covers `/verify` and `/settle` only), and settlement tx hashes are public on-chain data. Treat settlement metadata as effectively public rather than seller-private. @@ -307,7 +324,7 @@ Yes, it can run, but the official service limits `/verify` and `/settle` to 10 r **Q: Does the API Key expire?** -Currently, API Keys do not actively expire, but if you actively delete and recreate one, the old Key will become invalid immediately. +Currently, API Keys do not actively expire, but if you actively delete and recreate one, the old Key becomes invalid after the next successful Facilitator key-cache refresh. **Q: Can I use the same API Key for multiple projects?** @@ -315,7 +332,7 @@ Yes, the same API Key can be reused across multiple service instances. On the of **Q: I want to change my API Key, how do I do it?** -After logging in to the admin backend, click **Delete** on the Dashboard to delete the current Key, then click **"Create API Key"** again to generate a new Key. The old Key will become invalid immediately after deletion. Please ensure that you have updated the new Key in all active projects before deleting to avoid service interruption. +After logging in to the admin backend, click **Delete** on the Dashboard to delete the current Key, then click **"Create API Key"** again to generate a new Key. The old Key becomes invalid after the next successful Facilitator key-cache refresh. Each account allows one key, so schedule a rotation window: delete the old key, create the replacement, update all active projects, and verify calls after the cache refreshes. **Q: Will Facilitator hold my funds?** diff --git a/docs/x402/core-concepts/client-server.md b/docs/x402/core-concepts/client-server.md index 7b561731..e934fd62 100644 --- a/docs/x402/core-concepts/client-server.md +++ b/docs/x402/core-concepts/client-server.md @@ -62,7 +62,7 @@ In the x402 protocol, a typical interaction between client and server proceeds a 2. **Server Requires Payment**: Responds with `402 Payment Required`, including payment details in the `PAYMENT-REQUIRED` header (Base64-encoded). 3. **Client Submits Payment**: Generates a signature and resends the request with the signed payload in the `PAYMENT-SIGNATURE` header (Base64-encoded). 4. **Server Validates Payment**: Calls the Facilitator service to verify the received payment payload. -5. **Server Delivers Resource, then Settles**: Under the default `authorization` payment flow — the flow every built-in scheme declares — the resource server runs its handler first and settles through the Facilitator afterwards, returning the resource with settlement confirmation (transaction hash) in the `PAYMENT-RESPONSE` header. A server that opts into a settle-first flow, and the BANK OF AI gateway, invert this step: they settle first and deliver afterwards. +5. **Server Delivers Resource, then Settles**: Under the default `authorization` payment flow — the flow every built-in scheme declares — the resource server runs its handler first and settles through the Facilitator afterwards, returning the resource with settlement confirmation (transaction hash) in the `PAYMENT-RESPONSE` header. A server that opts into a settle-first flow reverses this order: it settles first and delivers afterwards. /v1/...`, where the id comes from the catalog entry's `url` — it is not the catalog FQN) — they never reach your upstream API directly. -- **The gateway forwards requests.** Once payment is verified (or the endpoint is free), it proxies the request upstream and returns the upstream response body to the Agent unchanged — a fixed set of response headers is stripped — hop-by-hop headers plus `set-cookie`, `authorization`, `content-encoding`, `content-length` and every x402 payment header (so an upstream `PAYMENT-RESPONSE` never leaks through) — and a `PAYMENT-RESPONSE` header is added, and an operator can configure a response contract that turns an upstream `200` carrying a business error into a gateway error. -- **Never a wallet private key.** Settlement uses a wallet **address** only; callers pay on-chain from their own wallets. Neither side of the gateway ever touches a private key. -- **Upstream keys stay isolated.** If your upstream API needs auth, that API key lives only on the side running the gateway — in your local YAML / env for a self-hosted gateway, or held by us for the official gateway. Either way the caller never sees it, and it never enters the public catalog. -- **You decide pricing per endpoint.** Price an endpoint in the config and it takes the paid flow; leave it unpriced (price 0) and it's forwarded directly — free endpoints stay free. - - - -## Anatomy of a call - -### Paid endpoints: the HTTP 402 flow - -Every paid call clears on-chain via x402 — the price in the response is always the single source of truth. - -1. **Agent calls** — requests the target endpoint. -2. **Gateway quotes** — returns the price (HTTP `402`). -3. **Wallet authorizes** — the client signs the selected payment requirement and retries with a `PAYMENT-SIGNATURE` header. -4. **Verified & settled** — the facilitator verifies the signed payload and settles the payment on-chain to your payout wallet. -5. **Response returns** — the gateway forwards the request upstream and returns the result to the Agent. - -### Free endpoints: straight pass-through - -Unpriced endpoints skip the quote step entirely and trigger no on-chain transaction: - -1. **Agent calls** — requests the target endpoint. -2. **Gateway forwards** — proxies upstream and returns the result. - -That means one service can mix paid and free endpoints — say `/v1/current` billed per call while `/v1/ping` stays free. An Agent tells them apart from the endpoint's `metered` flag and `min_price_usd` in the catalog output (there is no separate free-endpoint marker). Every endpoint published in the catalog today is metered, so this is a gateway capability rather than something the current listings demonstrate. - -:::note -Paid or free, the caller gets access by paying on-chain and needs no API key; any upstream credentials stay gateway-side and the calling Agent can never touch them. -::: - -## Built for both sides - -Providers turn calls into cash flow. Agents turn calls into capabilities. The gateway is the bridge. - -### For API providers: list your API, earn on every call - -- **Straight to your wallet** — payments settle to your payout wallet in real time; no platform escrow, no payout cycle. -- **Native multi-chain** — settle on TRON, BNB Chain, or Base Mainnet, according to the provider's published route. -- **Zero-touch onboarding** — your existing API stays exactly as it is, not one line changes. -- **You set the price** — flexible per-endpoint, per-tier pricing; free routes stay free. - -→ [List your API](../api-catalog/list-your-service.md) - -### For AI Agents: one catalog, many APIs, pay as you go - -- **CLI discovery today** — `wallet-cli x402 provider-list` / `provider-show` / `endpoint-list` find the right API and its routes. Paying over MCP is supported via `@x402/mcp`; catalog-aware MCP discovery is not shipped yet. -- **Per-call pricing** — no subscriptions, no minimums. -- **Live price transparency** — the gateway returns the computed price in its `402` response, and the client's authorization binds the selected payment requirement. The quote itself is not a gateway cryptographic signature. -- **No accounts, no keys** — your wallet is your identity; nothing to register or manage. - -→ [Browse the API Catalog](../api-catalog/index.md) - -## How to plug your API in - -Three steps to launch — your API stays untouched: - -1. **Pick a gateway** — use BANK OF AI's hosted gateway, or run your own (differences below). -2. **Set your price list** — decide the endpoints, per-endpoint pricing, and the payout wallet; no SDK to install, no code to rewrite. -3. **Get listed** — submit two public files to the catalog repository (or start with the application form and we'll help you through). Once your service appears in the [API Catalog](../api-catalog/index.md), any Agent can discover it, call it, and pay automatically. - -Full steps: [List Your Service](../api-catalog/list-your-service.md). - -### Official gateway, or run your own? - -- **Official gateway (hosted)**: BANK OF AI runs the gateway, proxies your API, and handles payment — you deploy nothing; the call addresses in your listing files use the official domain (like `x402-gateway.bankofai.io/providers/`). -- **Run your own**: deploy the gateway on your own machine; upstream credentials and payout config stay local; the call addresses in your listing files use your own domain. For providers who want full control over credentials and infrastructure. Setup steps: [Run your own gateway](#run-your-own-gateway). - -Either way, the calling Agent's experience is identical: discovery, quoting, payment, and the call all follow the same x402 flow. - -:::note Why list in the catalog if I run my own gateway? -The gateway and the catalog solve two different problems: **the gateway collects the money; the catalog gets you discovered.** The catalog is just a public list of services — it never touches calls or funds. What Agents call is always the gateway address registered in the catalog; with a self-hosted gateway that's your own domain, so traffic and funds go straight to you. The point of listing: every Agent, CLI user, and catalog visitor plugged into the BANK OF AI catalog can discover and call your service — not just the people who happen to know your domain. -::: - -## Run your own gateway - -These steps use gateway release **v1.0.5** and the Docker image `bankofai/x402-gateway:v1.0.5`. This release uses `@bankofai/x402-tron` / `@bankofai/x402-tron-extensions` **2.1.1** with official `@x402/core` **2.29.0**; repository and Docker installations pin Zod to **4.6.6**. Source installations require Node.js **24.22.1+ (24.x) or 26.12.1+**; Docker and CI pin 24.22.1. Full reference: [x402-gateway v1.0.5 README](https://github.com/BofAI/x402-gateway/blob/v1.0.5/README.md). - -### 1. Write a provider file - -Each provider lives in its own directory as `provider.yml` (or `provider.yaml`), for example `providers/example/provider.yml`: - -```yaml -name: example-provider -forward_url: ${X402_PROVIDER_FORWARD_URL} - -operator: - network: tron:3448148188 # TRON Nile; mainnet is tron:728126428 - currencies: - usd: ["USDT"] - recipient: ${X402_PROVIDER_RECIPIENT} - scheme: exact - protocol: exact - facilitator_url: ${X402_FACILITATOR_URL} - facilitator_api_key_env: X402_FACILITATOR_API_KEY - valid_for_seconds: 300 - -endpoints: - - method: GET - path: /v1/ping - metering: - dimensions: - - tiers: - - price_usd: 0.002 -``` - -- `network` must be a decimal CAIP-2 ID. Aliases such as `tron:nile` are rejected. -- `recipient` is your payout **address**. The gateway never needs a private key. -- Endpoints without `metering` are forwarded for free. -- If your upstream needs an API key, add a `routing.auth` block that reads it from an environment variable. See the README's *Provider Config* section. - -### 2. Set the environment - -Put the values the YAML references in a `.env` file next to the `providers/` directory: - -```bash -X402_PROVIDER_FORWARD_URL=https://api.example.com -X402_PROVIDER_RECIPIENT= -X402_FACILITATOR_URL=https://facilitator.bankofai.io -X402_FACILITATOR_API_KEY= -X402_GATEWAY_ADMIN_TOKEN= -X402_GATEWAY_PUBLIC_BASE_URL=https://gateway.example.com -``` - -`X402_GATEWAY_PUBLIC_BASE_URL` is the public origin Agents call. It is also the base of the addresses you publish in the catalog. Because `facilitator_api_key_env` is set, the gateway refuses to start without `X402_FACILITATOR_API_KEY`. For the facilitator's API key, see [Official Facilitator](./OfficialFacilitator.md). - -### 3. Validate the configuration - -```bash -docker run --rm --env-file .env \ - -v "$PWD/providers:/app/providers:ro" \ - bankofai/x402-gateway:v1.0.5 \ - x402-gateway check --providers /app/providers -``` - -`check` validates YAML syntax, required fields, environment expansion, network IDs and endpoint shape. It does not call your upstream, the facilitator or the chain. - -### 4. Start the gateway - -```bash -docker run -d --name x402-gateway --env-file .env \ - -p 4020:8080 \ - -v "$PWD/providers:/app/providers:ro" \ - bankofai/x402-gateway:v1.0.5 -``` - -The image listens on `0.0.0.0:8080` inside the container. For production, pin the image by digest instead of tag, as the README recommends. - -### 5. Check health and the payment challenge - -```bash -curl http://127.0.0.1:4020/__402/health -curl -i http://127.0.0.1:4020/providers/example-provider/v1/ping -``` - -The `curl -i` request to the metered endpoint should return `402 Payment Required` with a `PAYMENT-REQUIRED` header. The provider path segment is the `name` field from the YAML. Once both checks pass and the public URL is reachable, continue with [List Your Service](../api-catalog/list-your-service.md). - -### Optional: sponsor the first TRON approval - -To let the facilitator sponsor a payer's first `approve(Permit2)`, add the `payment` setting to a metered TRON `exact` Permit2 endpoint. For example, replace the `/v1/ping` endpoint above with: - -```yaml -endpoints: - - method: GET - path: /v1/ping - payment: - trc20_approval_resource_sponsoring: true - metering: - dimensions: - - tiers: - - price_usd: 0.002 -``` - -This advertises `trc20ApprovalResourceSponsoring` in the 402 challenge. The client must also register `createTrc20ApprovalResourceSponsoringClientExtension(signer)`, and the facilitator must enable its sponsoring runtime; the gateway flag alone does not configure them. The flag requires a TRON `exact` Permit2 payment option and does not apply to EVM-only or GasFree-only endpoints. The official facilitator requires an API Key for Nile USDT sponsorship; see [Official Facilitator](/x402/core-concepts/OfficialFacilitator/). - -Ordinary payments use `X402_GATEWAY_FACILITATOR_TIMEOUT_MS`, defaulting to 10,000 milliseconds. Sponsored TRON Permit2 payments and GasFree payments use `X402_GATEWAY_RESOURCE_SPONSORING_TIMEOUT_MS` and `X402_GATEWAY_GASFREE_TIMEOUT_MS`, respectively; each defaults to the greater of 240,000 milliseconds and the ordinary timeout. These settings cover a single facilitator call and its complete response body; they do not extend the client's request upload timeout. The resource-sponsoring timeout applies only when the endpoint enables sponsorship and the payment carries the extension. - -### Payment failure responses - -After successful payment, the gateway returns the upstream response with the settlement result in `PAYMENT-RESPONSE`. In v1.0.5, a consumed Permit2 authorization is an explicit client rejection: when the facilitator returns `success: false`, the matching network, `errorReason: "permit2_nonce_consumed"`, and `transaction: ""`, the gateway returns **HTTP 400** without calling upstream: - -```json -{"error":"payment authorization already used","code":"permit2_nonce_consumed"} -``` - -When the facilitator returns an HTTP success response but its settlement result is unsuccessful or its network does not match the selected requirement, the gateway returns **HTTP 502** unless it meets the consumed-authorization condition above: - -```json -{"error":"settlement failed"} -``` - -Facilitator HTTP errors and timeouts use separate responses. If the facilitator returns HTTP 429 with a valid JSON response, the gateway returns **HTTP 429** and forwards `Retry-After` when present: - -```json -{"error":"facilitator rate limited"} -``` - -If the facilitator request times out, including while reading its response body, the gateway returns **HTTP 504**: - -```json -{"error":"facilitator request timed out"} -``` - -These failures during facilitator verification or settlement do not forward the request upstream or include `PAYMENT-RESPONSE`. Do not replay a consumed authorization. A settlement timeout does not prove that no payment occurred: the facilitator may still complete the transaction. For a timeout or an ambiguous settlement result, reconcile the original transaction and payment record before deciding whether to create another payment. - -### Upstream API failure after settlement - -The gateway calls the upstream API after settlement succeeds. If that call then fails to connect, times out, or fails the configured business-response validation, the gateway returns the corresponding error status (typically **502**, or **504** for an upstream timeout) with: - -```json -{"error":"upstream failed after payment settlement","settled":true} -``` - -This response still includes the settlement receipt in `PAYMENT-RESPONSE`. Retain the receipt and transaction ID to resolve the delivery failure; do not automatically create another payment as if settlement had failed. If upstream simply returns an HTTP error without failing a configured business-response check, the gateway forwards its status and body while retaining `PAYMENT-RESPONSE`. An HTTP error status alone therefore does not establish whether payment settled. - -## Next steps - -- [List your API](../api-catalog/list-your-service.md) — submission flow, required info, and security red lines -- [Browse the API Catalog](../api-catalog/index.md) — see what's already live -- [API Catalog · Get Started](../api-catalog/get-started.md) — onboard from the caller's perspective diff --git a/docs/x402/core-concepts/network-and-token-support.md b/docs/x402/core-concepts/network-and-token-support.md index d5e2a7ac..0f83be99 100644 --- a/docs/x402/core-concepts/network-and-token-support.md +++ b/docs/x402/core-concepts/network-and-token-support.md @@ -23,7 +23,7 @@ Use the exported constants from `@bankofai/x402-tron` (`TRON_MAINNET`, `TRON_NIL | **TRON Shasta** | `tron:2494104990` | `TRON_SHASTA` | TRON Shasta Testnet | | **TRON Nile** | `tron:3448148188` | `TRON_NILE` | TRON Nile Testnet | -> **TRON ID format**: since `@bankofai/x402-tron` 2.0.0 the SDK constants use decimal CAIP-2 references. The older hexadecimal forms (`tron:0x2b6653dc`, `tron:0xcd8690dc`, `tron:0x94a9059e`) are still accepted as input aliases and are normalized to the decimal form. The official facilitator reports the decimal identifiers in `/supported`; the API Catalog still lists the hexadecimal forms. +> **TRON ID format**: since `@bankofai/x402-tron` 2.0.0 the SDK constants use decimal CAIP-2 references. The older hexadecimal forms (`tron:0x2b6653dc`, `tron:0xcd8690dc`, `tron:0x94a9059e`) are still accepted as input aliases and are normalized to the decimal form. The official facilitator reports the decimal identifiers in `/supported`. --- @@ -46,7 +46,7 @@ Base uses canonical EIP-155 identifiers on the x402 wire: | Network Name | Protocol ID | Description | | :----------- | :---------- | :---------- | -| **Base Mainnet** | `eip155:8453` | Production network; published by the API Catalog | +| **Base Mainnet** | `eip155:8453` | Production network | | **Base Sepolia** | `eip155:84532` | CLI/SDK test network | Base Mainnet uses official USDC and the `exact` scheme with EIP-3009 authorization. The payer signs a `transferWithAuthorization` message off-chain; no Permit2 approval is required. @@ -68,7 +68,7 @@ The protocol uses secure signing mechanisms to ensure tamper-resistant message a | **BSC Mainnet** | **Mainnet** | **Production network** for real-value assets | | **BSC Testnet** | **Testnet** | **Recommended testnet** for BSC development | | **Base Mainnet** | **Mainnet** | **Production network** using official USDC | -| **Base Sepolia** | **Testnet** | CLI/SDK testing; not published in the API Catalog | +| **Base Sepolia** | **Testnet** | CLI/SDK testing | --- diff --git a/docs/x402/faq.md b/docs/x402/faq.md index ecb3fbf6..2632abba 100644 --- a/docs/x402/faq.md +++ b/docs/x402/faq.md @@ -173,11 +173,13 @@ The flow mirrors a human user: Install the published packages in your TypeScript app and build against npm, for example: ```bash -pnpm add @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.1 @x402/evm@2.29.0 @bankofai/agent-wallet +pnpm add @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.2 @x402/evm@2.29.0 @bankofai/agent-wallet pnpm add @x402/express@2.29.0 ``` -Use the framework package that matches your server (`@x402/express`, `@x402/hono`, `@x402/fastify`, or `@x402/next`), at the same `2.29.0` as `@x402/core` — `@bankofai/x402-tron` 2.1.1 requires exactly `@x402/core@2.29.0`. Add `@bankofai/x402-tron-extensions@2.1.1` only if you use TRON resource sponsoring. The [`examples/typescript`](https://github.com/BofAI/x402/tree/main/examples/typescript) workspace is a runnable reference for client → server → facilitator flows, not a prerequisite for application development. +Use the framework package that matches your server (`@x402/express`, `@x402/hono`, `@x402/fastify`, or `@x402/next`), at the same `2.29.0` as `@x402/core` — `@bankofai/x402-tron` 2.1.2 requires exactly `@x402/core@2.29.0`. Add `@bankofai/x402-tron-extensions@2.1.2` only if you use TRON resource sponsoring. The [`examples/typescript`](https://github.com/BofAI/x402/tree/main/examples/typescript) workspace is a runnable reference for client → server → facilitator flows, not a prerequisite for application development. + +For TronWeb HTTP dependency overrides in your own application, see [Dependency security](/x402/sdk-features/#dependency-security). When upgrading an existing application, align all official `@x402/*` transports too. If you use `@x402/core/schemas`, migrate to Zod 4 and replace `error.errors` with `error.issues`; see the [SDK Feature Matrix](/x402/sdk-features/). diff --git a/docs/x402/getting-started/quickstart-for-agent.md b/docs/x402/getting-started/quickstart-for-agent.md index 06991611..48a2f7bc 100644 --- a/docs/x402/getting-started/quickstart-for-agent.md +++ b/docs/x402/getting-started/quickstart-for-agent.md @@ -9,15 +9,15 @@ Use **wallet-cli** for new payment integrations; do not install the standalone x 1. Follow the [Wallet CLI quick start](/wallet-cli/quickstart/), configure an account locally, and verify its address. 2. If using a Skill, follow the [Skills quick start](/McpServer-Skills/SKILLS/QuickStart/) and match its dependency version to the CLI. -3. Discover an endpoint through the [API Catalog](/x402/api-catalog/get-started/), then preview it with `wallet-cli x402 pay --dry-run`. +3. Obtain the x402 endpoint URL from the service provider, then preview it with `wallet-cli x402 pay --dry-run`. 4. Show the network, recipient, token, amount, and fees. Sign only within the user's authorization, using an approved secure password source. 5. Inspect structured results and retain the transaction hash. Submission or unconfirmed credit does not mean the entire operation completed. Example agent request: -> Use wallet-cli to inspect DIA's BTC quotation endpoint. Preview the TRON mainnet USDT payment with a 0.01 cap. Do not pay. +> Use wallet-cli to inspect the local test endpoint `http://localhost:4021/credit`. Preview the TRON Nile (`tron:3448148188`) USDT payment using `--dry-run`, with a cap of 1 USDT. Do not sign or pay. -Never print private keys or master passwords into chat, logs, or command arguments. Do not use `echo` to reveal a private key as a setup check. Use a testnet endpoint you control for test payments; production catalog services may support mainnet only. +Never print private keys or master passwords into chat, logs, or command arguments. Do not use `echo` to reveal a private key as a setup check. Use a testnet endpoint you control for test payments; production services may support mainnet only. On `paymentStatus: "unknown"` or `retryPayment: false`, reconcile the original transaction rather than allowing an automatic repeat payment. diff --git a/docs/x402/getting-started/quickstart-for-human.md b/docs/x402/getting-started/quickstart-for-human.md index aa66297c..dad3569e 100644 --- a/docs/x402/getting-started/quickstart-for-human.md +++ b/docs/x402/getting-started/quickstart-for-human.md @@ -99,11 +99,13 @@ x402 is a **TypeScript-only** SDK: the TRON mechanism ships as `@bankofai/x402-t Install the published npm packages in your TypeScript application: ```bash -pnpm add @bankofai/agent-wallet @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.1 +pnpm add @bankofai/agent-wallet @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.2 pnpm add -D tsx # to run the TypeScript entry point below ``` -Use `npm install` or `yarn add` with the same package names if your project does not use pnpm. Keep `@x402/core` and `@x402/fetch` at exactly `2.29.0` — `@bankofai/x402-tron` 2.1.1 declares `@x402/core@2.29.0` as an exact peer dependency. +Use `npm install` or `yarn add` with the same package names if your project does not use pnpm. Keep `@x402/core` and `@x402/fetch` at exactly `2.29.0` — `@bankofai/x402-tron` 2.1.2 declares `@x402/core@2.29.0` as an exact peer dependency. + +For TronWeb HTTP dependency overrides in your own application, see [Dependency security](/x402/sdk-features/#dependency-security). When upgrading an existing application, align all official `@x402/*` transports too. If you use `@x402/core/schemas`, migrate to Zod 4 and replace `error.errors` with `error.issues`; see the [SDK Feature Matrix](/x402/sdk-features/). diff --git a/docs/x402/getting-started/quickstart-for-sellers.md b/docs/x402/getting-started/quickstart-for-sellers.md index 4d40107b..99310c61 100644 --- a/docs/x402/getting-started/quickstart-for-sellers.md +++ b/docs/x402/getting-started/quickstart-for-sellers.md @@ -140,11 +140,13 @@ Deposit a small amount of official USDC on Base Mainnet. The resource server onl Install official Core, the Express adapter and the TRON/EVM payment schemes in your TypeScript API project: ```bash -pnpm add express @x402/core@2.29.0 @x402/express@2.29.0 @bankofai/x402-tron@2.1.1 @x402/evm@2.29.0 +pnpm add express @x402/core@2.29.0 @x402/express@2.29.0 @bankofai/x402-tron@2.1.2 @x402/evm@2.29.0 pnpm add -D tsx # to run the TypeScript entry point below ``` -Use the framework package that matches your server (`@x402/express`, `@x402/hono`, `@x402/fastify`, or `@x402/next`), at the same `2.29.0` as `@x402/core` — `@bankofai/x402-tron` 2.1.1 declares `@x402/core@2.29.0` as an exact peer dependency. Install `@x402/evm` only for BSC/Base routes. Use `npm install` or `yarn add` with the same package names if your project does not use pnpm. +Use the framework package that matches your server (`@x402/express`, `@x402/hono`, `@x402/fastify`, or `@x402/next`), at the same `2.29.0` as `@x402/core` — `@bankofai/x402-tron` 2.1.2 declares `@x402/core@2.29.0` as an exact peer dependency. Install `@x402/evm` only for BSC/Base routes. Use `npm install` or `yarn add` with the same package names if your project does not use pnpm. + +For TronWeb HTTP dependency overrides in your own application, see [Dependency security](/x402/sdk-features/#dependency-security). When upgrading an existing application, align all official `@x402/*` transports too. If you use `@x402/core/schemas`, migrate to Zod 4 and replace `error.errors` with `error.issues`; see the [SDK Feature Matrix](/x402/sdk-features/). @@ -356,6 +358,8 @@ new HTTPFacilitatorClient({ }); ``` +> **Key refreshes and retries:** Key creation and deletion take effect after the next successful Facilitator cache refresh (every 5 seconds in the built-in production configuration, independently per process). While the cache is fresh, unrecognized keys use anonymous access, so a successful call does not prove authentication. In v2.3.2, keyed verification and settlement requests receive `503 api_key_auth_unavailable` if the cache expires while refreshes are failing. Retain the authentication header and retry with backoff; see [authentication availability](../../core-concepts/facilitator#api-key-cache-and-authentication-availability). + > ⚠️ **Security reminder:** Your API Key is a service credential — **treat it like a password and never commit it to Git**. > ✅ **Done!** The Official Facilitator is configured — **no local service to start**. Proceed directly to Step 5 to test. diff --git a/docs/x402/sdk-features.md b/docs/x402/sdk-features.md index a59386cb..38f97011 100644 --- a/docs/x402/sdk-features.md +++ b/docs/x402/sdk-features.md @@ -9,10 +9,26 @@ This page tracks the feature support of the x402 SDK. > **SDK (TypeScript-only)**: x402 is a **TypeScript-only** SDK. It publishes the TRON mechanism and the TRON resource-sponsoring extension as the `@bankofai/x402-tron` and `@bankofai/x402-tron-extensions` npm packages and builds on the official x402 Foundation `@x402/*` packages for Core, EVM, the HTTP/MCP integrations and the generic extensions. The source is maintained in a pnpm/turbo monorepo, but applications should depend on the published packages. The previous-generation Python + TypeScript SDK archive (`legacy/`) was removed from the repository in 2.0.0, and the `typescript/packages/legacy/` compatibility packages in 2.1.0. > -> **Current release: 2.1.1** (2026-10-30). The payment call chain now runs on official `@x402/core` `2.29.0`, which `@bankofai/x402-tron` `2.1.1` declares as an exact peer dependency; use the matching official HTTP/MCP integration (`@x402/fetch`, `@x402/axios`, `@x402/express`, `@x402/fastify`, `@x402/hono`, `@x402/next` or `@x402/mcp`, all `2.29.0`). TRON resource sponsoring ships as the separate `@bankofai/x402-tron-extensions` `2.1.1`, which pins the exact mechanism version — upgrade the two TRON packages together. EVM uses official `@x402/evm` `2.29.0` and the generic extensions official `@x402/extensions` `2.29.0`; the local EVM package and `@bankofai/x402-extensions` were removed. `@bankofai/x402-core` and the `@bankofai/x402-*` HTTP/MCP adapters built on it are not interchangeable with the 2.1 mechanism — new TRON integrations use official Core and adapters. Upgrading from 2.0 is a source migration; see the [TRON 2.1 migration guide](https://github.com/BofAI/x402/blob/main/docs/migrations/tron-2.1.md). The SDK requires **Node.js 24.22.1+**; the runnable examples use `@bankofai/agent-wallet` **3.0+**. +> **Current release: 2.1.2** (2026-11-10). The payment call chain now runs on official `@x402/core` `2.29.0`, which `@bankofai/x402-tron` `2.1.2` declares as an exact peer dependency; use the matching official HTTP/MCP integration (`@x402/fetch`, `@x402/axios`, `@x402/express`, `@x402/fastify`, `@x402/hono`, `@x402/next` or `@x402/mcp`, all `2.29.0`). TRON resource sponsoring ships as the separate `@bankofai/x402-tron-extensions` `2.1.2`, which pins the exact mechanism version — upgrade the two TRON packages together. EVM uses official `@x402/evm` `2.29.0` and the generic extensions official `@x402/extensions` `2.29.0`; the local EVM package and `@bankofai/x402-extensions` were removed. `@bankofai/x402-core` and the `@bankofai/x402-*` HTTP/MCP adapters built on it are not interchangeable with the 2.1 mechanism — new TRON integrations use official Core and adapters. Upgrading from 2.0 is a source migration; see the [TRON 2.1 migration guide](https://github.com/BofAI/x402/blob/main/docs/migrations/tron-2.1.md). The SDK requires **Node.js 24.22.1+**; the runnable examples use `@bankofai/agent-wallet` **3.0+**. > **2.1.1 schema migration:** official Core now uses native **Zod 4.6.6+**. If your application composes schemas from `@x402/core/schemas`, use Zod 4 and read validation details from `error.issues`; the Zod 3 `error.errors` alias is removed. Payment-option arrays (`accepts`) are limited to **1,024 entries**, with oversized collections rejected before element validation. Upgrade the exact Core peer and matching transports together with both TRON packages. +## Dependency security {#dependency-security} + +The SDK **2.1.2** repository lockfiles use **TronWeb 6.5.1** for both TRON packages and all 11 TypeScript examples. TronWeb 6.5.1 uses the same input snapshot for validation and execution in signing and contract calls. The official Core peer remains **2.29.0**. + +The published mechanism declares `tronweb: ^6.5.1`, so a fresh application install can resolve **6.5.2**. The resource extension still pins **6.5.1**, so both versions may be installed together. + +The SDK repository resolves TronWeb's Axios to **1.21.0** and follow-redirects to **1.16.2** through pnpm workspace overrides. **These overrides do not propagate to applications installing the npm packages.** Apply overrides in your own project, refresh its lockfile, and inspect the resolved dependency tree. The application example below covers TronWeb's `^6.5.1` range, including both 6.5.1 and 6.5.2. For pnpm, merge these entries into your root `pnpm-workspace.yaml`: + +```yaml +overrides: + "tronweb@^6.5.1>axios": "1.21.0" + "axios@1.21.0>follow-redirects": "1.16.2" +``` + +For other package managers, use their root-project override mechanism. An upstream TronWeb release that includes the patched dependencies is another option after verifying SDK compatibility. See the [2.1.2 release notes](https://github.com/BofAI/x402/blob/main/RELEASE_NOTES.md). + --- ## Packages @@ -63,9 +79,9 @@ This page tracks the feature support of the x402 SDK. | `eip155:8453` (Base Mainnet) | - | ✅ | | `eip155:84532` (Base Sepolia) | - | ✅ (CLI/SDK testing) | -> **TRON ID format**: since `@bankofai/x402-tron` 2.0.0 the SDK constants use decimal CAIP-2 references. The older hexadecimal forms (`tron:0x2b6653dc`, `tron:0xcd8690dc`, `tron:0x94a9059e`) are still accepted as input aliases and are normalized to the decimal form. The official facilitator reports the decimal identifiers in `/supported`; the API Catalog still lists the hexadecimal forms. +> **TRON ID format**: since `@bankofai/x402-tron` 2.0.0 the SDK constants use decimal CAIP-2 references. The older hexadecimal forms (`tron:0x2b6653dc`, `tron:0xcd8690dc`, `tron:0x94a9059e`) are still accepted as input aliases and are normalized to the decimal form. The official facilitator reports the decimal identifiers in `/supported`. -> EVM support comes from the official `@x402/evm` 2.29.0. Its default-asset registry covers Base, Base Sepolia, Ethereum, Polygon, Arbitrum One/Sepolia, Avalanche, Celo, Sei, MegaETH, Monad, Stable, XDC, Flare, Mezo, Radius, ADI, HPP, Igra and others — but **not BSC**. On BSC, price a route with an explicit `{ asset, amount, extra }` object (a `$` price fails with `No default asset configured for network eip155:56`), and clients must allowlist the asset in `spendControls.allowedAssets`. The public API Catalog publishes Base Mainnet routes only; Base Sepolia remains available for CLI/SDK testing. +> EVM support comes from the official `@x402/evm` 2.29.0. Its default-asset registry covers Base, Base Sepolia, Ethereum, Polygon, Arbitrum One/Sepolia, Avalanche, Celo, Sei, MegaETH, Monad, Stable, XDC, Flare, Mezo, Radius, ADI, HPP, Igra and others — but **not BSC**. On BSC, price a route with an explicit `{ asset, amount, extra }` object (a `$` price fails with `No default asset configured for network eip155:56`), and clients must allowlist the asset in `spendControls.allowedAssets`. Base Sepolia remains available for CLI/SDK testing. --- diff --git a/docusaurus.config.js b/docusaurus.config.js index 2f087e5e..6edf10af 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,6 +1,7 @@ import math from 'remark-math' import katex from 'rehype-katex' import { themes } from 'prism-react-renderer' +import ssrTemplate from './scripts/ssr-template.mjs' require('dotenv').config() export default { @@ -9,6 +10,7 @@ export default { url: 'https://docs.bankofai.io', baseUrl: '/', trailingSlash: true, + ssrTemplate, i18n: { defaultLocale: 'en', locales: ['en', 'zh-Hans'], diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/index.md index 5f4852f6..ecd81e21 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/index.md @@ -8,14 +8,54 @@ description: 'BANK OF AI 各产品的更新与公告——全部产品,按时 BANK OF AI 各产品的更新与公告。
-
2026-11-05
+
2026-11-12
-### 文档 1.5.2:补充网关赞助配置与结算后失败处理 +### Wallet CLI 4.16.0 与 TronWeb 安装说明 -
DocsFix
+
Docsx402
-- 更新 x402 网关的资源赞助配置、专用超时与已结算后的交付失败说明;文档版本升级为 1.5.2。[详情](./x402/) +- wallet-cli 指南同步已发布的 4.16.0,说明其精确依赖 TronWeb 6.5.1、GET 请求体限制及预览错误详情。wallet-cli Skill 继续使用自己的 CLI 版本锁定。[Wallet CLI 详情](./x402/) +- 明确 8004 TypeScript SDK 1.2.1 的 TronWeb 范围(`^6.5.1`)、源码锁文件(6.5.1)与全新安装结果(6.5.2)的区别,并链接业务项目的 HTTP 依赖覆盖配置。[安装指南](/zh-Hans/8004/Usage/Install/) + +
+
+ +
+
2026-11-12
+
+ +### TRON MCP 源码 v1.1.10 与 v1.1.11:主网 RPC 配置与 TronWeb 6.5.2 + +
DocsMCP
+ +- TRON MCP 文档同步至源码 v1.1.11:v1.1.10 引入按部署选择主网 RPC、恢复无 Key 时的默认节点,并限制 TronGrid 凭据转发;v1.1.11 将 TronWeb 升级为 6.5.2。npm `latest` 仍为 1.1.7。[详情](./mcp-server/) + +
+
+ +
+
2026-11-11
+
+ +### TRON MCP 源码 v1.1.9:部署与输入限制 + +
DocsMCP
+ +- TRON MCP 文档同步源码 v1.1.9:依赖修复、主网 RPC 回退、HTTP/工具输入限制及 Docker 日志权限。npm `latest` 仍为 1.1.7,部署文档明确区分源码与发布包的行为。[详情](./mcp-server/) + +
+
+ +
+
2026-11-11
+
+ +### SDK 2.1.2 与 Facilitator 2.3.1 + +
Docsx402
+ +- SDK 安装与依赖说明同步到 2.1.2,Facilitator 运行要求及 1Password Connect 部署说明同步到 2.3.1。[详情](./x402/)
@@ -24,11 +64,11 @@ BANK OF AI 各产品的更新与公告。
2026-11-04
-### x402 文档同步三个项目的新版本 +### x402 文档同步 SDK 与 Facilitator 新版本
Docsx402Fix
-- SDK 2.1.1 / 官方 Core 2.29.0 与 Zod 4 迁移、Facilitator 2.3.0 的 EVM nonce 恢复和运行要求、Gateway 1.0.5 部署及已使用 Permit2 授权的 HTTP 400 响应。[详情](./x402/) +- SDK 2.1.1 / 官方 Core 2.29.0 与 Zod 4 迁移、Facilitator 2.3.0 的 EVM nonce 恢复和运行要求。[详情](./x402/)
@@ -54,7 +94,7 @@ BANK OF AI 各产品的更新与公告。
文档x402修复
-- 基于官方 `@x402/core` 2.28.0 的 2.1.0 版本组合(TRON 资源赞助使用 `@bankofai/x402-tron-extensions`)、十进制 TRON ID、官方 Facilitator 匿名调用 `/verify` 与 `/settle` 各每分钟 10 次的限流、Nile 资源赞助,以及 API Catalog 其余的 CI 规则。[详情](./x402/) +- 基于官方 `@x402/core` 2.28.0 的 2.1.0 版本组合(TRON 资源赞助使用 `@bankofai/x402-tron-extensions`)、十进制 TRON ID、官方 Facilitator 匿名调用 `/verify` 与 `/settle` 各每分钟 10 次的限流、Nile 资源赞助。[详情](./x402/)
@@ -197,7 +237,7 @@ BANK OF AI 各产品的更新与公告。
文档x402Agent WalletSKILLS
-- 对 x402 SDK、CLI、目录、Gateway、Facilitator、Agent Wallet 与 Skills 各仓库做了第二轮校核。API 目录示例按真实 provider 文件重建——此前的示例缺少现已必填的 `assetTransferMethod`,照抄会校验失败——并删除了并不存在的 `subTitle` 字段。修正了载荷字段、重试范围与仅 TRON 可用的能力描述;EVM 授权 gas 代付按真实生效条件重新说明;Agent Wallet SDK 指南补充了 `resolveWallet()` 与 `SignOptions`。[x402 详情](./x402/) · [Agent Wallet 详情](./agent-wallet/) · [SKILLS 详情](./skills/) +- 对 x402 SDK、CLI、Facilitator、Agent Wallet 与 Skills 各仓库做了第二轮校核。修正了载荷字段、重试范围与仅 TRON 可用的能力描述;EVM 授权 gas 代付按真实生效条件重新说明;Agent Wallet SDK 指南补充了 `resolveWallet()` 与 `SignOptions`。[x402 详情](./x402/) · [Agent Wallet 详情](./agent-wallet/) · [SKILLS 详情](./skills/) @@ -210,7 +250,7 @@ BANK OF AI 各产品的更新与公告。
文档x402Agent WalletSKILLS
-- 已依据当前 x402 SDK、API Catalog、Gateway、CLI、Facilitator、Agent Wallet 与 Skills 仓库同步英文和简体中文文档。订正内容包括 Catalog 的 `assetTransferMethod` 契约、`auth-capture` 仅有 client 的当前状态、Gateway 的授权与结算流程、Privy 的 `--network` 例外,以及 `x402-payment` 技能必须使用准确版本 `x402-cli@1.0.1` 的要求;同时修复了仓库链接、MDX 语法与失效的站内链接。[x402 详情](./x402/) · [Agent Wallet 详情](./agent-wallet/) · [SKILLS 详情](./skills/) +- 已依据当前 x402 SDK、CLI、Facilitator、Agent Wallet 与 Skills 仓库同步英文和简体中文文档。订正内容包括 `auth-capture` 仅有 client 的当前状态、Privy 的 `--network` 例外,以及 `x402-payment` 技能必须使用准确版本 `x402-cli@1.0.1` 的要求;同时修复了仓库链接、MDX 语法与失效的站内链接。[x402 详情](./x402/) · [Agent Wallet 详情](./agent-wallet/) · [SKILLS 详情](./skills/) @@ -276,7 +316,7 @@ BANK OF AI 各产品的更新与公告。
新版本x402文档
- **x402 SDK 1.1.0**——付款流程显式化(`upfront` / `escrow` 通过 `extra.paymentFlow` 在协议中传递,默认 `authorization`)、客户端消费管控默认开启(单笔约 `$1` 上限 + 默认资产白名单)、付款选择策略与生命周期钩子、EVM 智能账户支持(ERC-7702、白名单内 ERC-6492),`HTTPFacilitatorClient` 默认超时 90 秒。11 个包需整体升级,要求 Node.js 22+。[SDK 功能矩阵](../x402/sdk-features/) -- **文档订正**——移除已废弃的 facilitator 计费内容(`base_fee`、`extra.fee`、`/fee/quote`);官方服务将匿名 `/settle` 限制为每个 IP 每分钟 1 次;不再宣称 GasFree 会被自动优选——CLI 取第一条匹配过滤条件的支付要求,需要强制时请传 `--scheme exact_gasfree`;TRON Shasta 现已注明「SDK/CLI 可签名、但官方 facilitator 不结算」(请用 Nile 或自建);CLI 页面标明了它的**锁定依赖**——CLI 1.0.2 内含的 `@bankofai/x402-*` SDK 包仍是 1.0.1(`x402-gateway` 为 1.0.2),因此尚不具备 1.1.0 的客户端消费管控;Skills 各页的安装命令统一改为 `npx skills add … -g`。[x402 文档](../) +- **文档订正**——移除已废弃的 facilitator 计费内容(`base_fee`、`extra.fee`、`/fee/quote`);官方服务将匿名 `/settle` 限制为每个 IP 每分钟 1 次;不再宣称 GasFree 会被自动优选——CLI 取第一条匹配过滤条件的支付要求,需要强制时请传 `--scheme exact_gasfree`;TRON Shasta 现已注明「SDK/CLI 可签名、但官方 facilitator 不结算」(请用 Nile 或自建);CLI 页面标明了它的**锁定依赖**——CLI 1.0.2 内含的 `@bankofai/x402-*` SDK 包仍是 1.0.1,因此尚不具备 1.1.0 的客户端消费管控;Skills 各页的安装命令统一改为 `npx skills add … -g`。[x402 文档](../) @@ -298,11 +338,11 @@ BANK OF AI 各产品的更新与公告。
2026-07-30
-### x402 CLI v1.0.2 · Catalog —— 支持 Base +### x402 CLI v1.0.2 —— 支持 Base
新版本x402Base
-- **CLI 已支持 Base**——`eip155:8453` 与 `eip155:84532` 均支持 USDC;服务目录目前只发布 `eip155:8453` Base 主网路由。Base 在 `exact` 方案下使用 EIP-3009 授权,而非 Permit2。 +- **CLI 已支持 Base**——`eip155:8453` 与 `eip155:84532` 均支持 USDC。Base 在 `exact` 方案下使用 EIP-3009 授权,而非 Permit2。 - **Agent Wallet 成为 CLI 默认付款方**——`pay` 用你当前激活的钱包签名,私钥不再进环境变量。若配置了钱包但没有激活项,CLI 会在签名前停下而不是替你选。[详情](./x402/) - 付费请求不再跟随 HTTP 重定向,避免 `PAYMENT-SIGNATURE` 流向其他源。 @@ -347,12 +387,11 @@ BANK OF AI 各产品的更新与公告。
2026-07-20
-### x402 CLI v1.0.1 · Catalog +### x402 CLI v1.0.1
新版本x402TRON
- **x402 CLI v1.0.1**——TRON **GasFree** 支付(`exact_gasfree`,无需 TRX)、标准 CAIP-2 网络标识(旧的 `tron:nile` 被拒绝)、`settled` 与 `delivered` 状态区分。基于 x402 SDK 1.0.1。[详情](./x402/) -- **x402 Catalog**——目录路由现支持 TRON 上的 `exact_gasfree`;网络标识必须用标准 CAIP-2;旧的 `fee` / `feeConfig` 字段已移除。[详情](./x402/)
@@ -379,7 +418,7 @@ BANK OF AI 各产品的更新与公告。
新版本x402CLI
-- **`v1.0.0` 首个正式版发布**——`@bankofai/x402-cli`,用于 x402 支付的 TypeScript 命令行客户端:`pay` 支付任意受保护 URL、`serve` 启动本地付费端点、`roundtrip` 端到端冒烟测试,以及管理 provider 文件与服务目录的 `gateway` / `catalog`。 +- **`v1.0.0` 首个正式版发布**——`@bankofai/x402-cli`,用于 x402 支付的 TypeScript 命令行客户端:`pay` 支付任意受保护 URL、`serve` 启动本地付费端点、`roundtrip` 端到端冒烟测试。 - 基于已发布的 `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 包构建;`scheme=exact` 配合 Permit2。 - 支持网络:TRON(`tron:mainnet` / `tron:nile` / `tron:shasta`)与 BSC(`eip155:56` / `eip155:97`)。[Wallet CLI 指引](/zh-Hans/wallet-cli/quickstart/) @@ -393,7 +432,7 @@ BANK OF AI 各产品的更新与公告。
更新新模型x402
-- **SKILLS**——新增 TRON 上 **`exact_gasfree` 方案**的说明,同时 API 目录更换为新地址。如果你锁定了旧版本,需要重新安装。[详情](./skills/) +- **SKILLS**——新增 TRON 上 **`exact_gasfree` 方案**的说明。如果你锁定了旧版本,需要重新安装。[详情](./skills/) - **LLM Service**——新增 **GPT-5.6** 系列:`sol`、`terra`、`luna`。[详情](./llm-service/) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/mcp-server.md b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/mcp-server.md index da1a39ad..3404a489 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/mcp-server.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/mcp-server.md @@ -7,6 +7,38 @@ description: 'MCP Server 的版本发布记录。' MCP Server 的版本发布记录。 +
+
2026-11-12
+
+ +### TRON MCP 源码 v1.1.10 与 v1.1.11:主网 RPC 配置与 TronWeb 6.5.2 + +
DocsMCP
+ +- 源码部署与升级命令更新到 tag `v1.1.11`,固定使用 TronWeb 6.5.2。截至本次核对,npm `latest` 仍为 1.1.7,继续区分源码与发布包的使用说明。 +- 说明 v1.1.10 引入、仅供部署环境配置的 `MCP_MAINNET_RPC_URL`:同时覆盖所有主网 RPC 主机,优先于 API Key 的自动选择,校验 HTTP/HTTPS URL,修改后须重启。Nile 与 Shasta 不受影响。 +- v1.1.10 还将无 Key 时的主网默认节点恢复为 `https://hptg.bankofai.io`,并将 TronGrid 凭据转发限制为官方 HTTPS TronGrid 源。`https://tg.ops.sunpump.xyz` 作为显式部署覆盖的示例。 + +👉 [本地部署](/zh-Hans/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment/) · [常见问题](/zh-Hans/McpServer-Skills/MCP/TRONMCPServer/FAQ/) + +
+
+ +
+
2026-11-11
+
+ +### TRON MCP 源码 v1.1.9:部署与输入限制 + +
DocsMCP
+ +- 源码 v1.1.9 使用 TronWeb 6.5.1、MCP SDK 1.32.2 与修复后的 Zod 4.6.7,Agent Wallet 保持 2.4.0。npm `latest` 仍为 1.1.7;源码部署改为锁定已核对的 tag 并使用 `npm ci`。 +- 说明未配置 Key 时的主网回退节点 `https://tg.ops.sunpump.xyz`、HTTP 未压缩 JSON 的 1 MiB 上限(413 / 415),以及工具参数元素与对象键合计 10,000 个的限制。 +- 更新 Docker UID/GID 1000 日志目录权限、root 所有的应用文件、源码 stdio 客户端配置,以及源码钱包错误与协议版本说明。 + +
+
+
2026-10-27
diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/skills.md b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/skills.md index cc24a342..5652f9be 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/skills.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/skills.md @@ -171,12 +171,11 @@ SKILLS 的版本发布记录。
2026-07-10
-### GasFree 支付说明与新的目录地址 +### GasFree 支付说明
更新x402
- Skills 现已支持并说明 TRON 上的 **`exact_gasfree` 支付方案**——账户里不备 TRX 也能付款调用 x402 服务。 -- **API 目录接口更换了新地址**。Skills 与 facilitator 配置同步更新;如果你锁定了旧版本,需要重新安装。
diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/x402.md b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/x402.md index bce2728d..57dacb11 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/x402.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-changelog/current/x402.md @@ -8,15 +8,32 @@ description: 'x402 支付协议、SDK 与 CLI 的版本发布记录。' x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布记录。
-
2026-11-05
+
2026-11-12
-### 文档 1.5.2:补充网关赞助配置与结算后失败处理 +### Wallet CLI 4.16.0 -
DocsFix
+
Docsx402
+ +- 当前安装说明及 Agent Wallet 集成中的 wallet-cli 版本由 4.15.1 更新为 npm `latest` 4.16.0。CLI 固定使用 TronWeb 6.5.1;wallet-cli Skill 仍须使用自身锁定的 CLI 版本。 +- 明确显式支付上限会拒绝超限的首条匹配报价,而不是继续寻找后续更便宜的路线。 +- 说明 GET 会在请求发出前拒绝 `--body` 和 `--body-file`,stdin 请求体不能与读取秘密的参数共用输入。修正预览错误说明:显式支付上限在 `--dry-run` 中也可能返回 `paymentStatus: "not_sent"`,不代表已签名或付款。 -- 补充 TRON 授权资源赞助的端点开关、客户端与 Facilitator 前置条件,以及普通付款、资源赞助和 GasFree 的超时设置。 -- 说明已结算后的上游失败响应、`settled: true` 与 `PAYMENT-RESPONSE`,避免按 HTTP 错误状态自动重复付款。 +👉 [快速入门](/zh-Hans/wallet-cli/quickstart/) · [命令参考](/zh-Hans/wallet-cli/command-reference/) + +
+
+ +
+
2026-11-11
+
+ +### SDK 2.1.2 与 Facilitator 2.3.1 + +
Docsx402
+ +- 两个 TRON 包同步到 2.1.2,使用 TronWeb 6.5.1,官方 Core 的精确 peer 仍为 2.29.0;明确业务项目需自行配置 HTTP 依赖覆盖。 +- Facilitator 部署说明同步到 2.3.1:Docker/CI 使用 Node.js 24.22.2,更新安全依赖,并说明 1Password Connect 的运行时凭据配置。
@@ -25,15 +42,14 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布
2026-11-04
-### 对齐 SDK 2.1.1、Facilitator 2.3.0 与 Gateway 1.0.5 +### 对齐 SDK 2.1.1 与 Facilitator 2.3.0
DocsFix
- **SDK 2.1.1**——中英文快速入门、FAQ 与功能矩阵同步升级到 TRON 机制和资源扩展 2.1.1,以及官方 `@x402/*` 2.29.0。补充原生 Zod 4.6.6+、`error.issues` 迁移与 `accepts` 最多 1,024 项的限制;保留 2.1.0 引入的迁移历史。 - **Facilitator 2.3.0**——补充官方 Core / EVM / extensions 迁移、Agent Wallet 3.1.0-beta.1 精确版本及 Node.js 24/26 运行要求。说明 EVM nonce 队列如何恢复原始签名交易及其进程内限制,并记录不完整 TRON 授权的协议级拒绝。 -- **Gateway 1.0.5**——Docker 部署示例升级到 v1.0.5,删除 npm 包仍停留在 1.0.2 的过时描述。补充已使用 Permit2 授权的 HTTP 400 `permit2_nonce_consumed` 响应,区分仍返回 502 的状态不明或网络不匹配结算。 -👉 [SDK 功能矩阵](/x402/sdk-features/) · [Facilitator](/x402/core-concepts/facilitator/) · [Gateway](/x402/core-concepts/gateway/) +👉 [SDK 功能矩阵](/x402/sdk-features/) · [Facilitator](/x402/core-concepts/facilitator/)
@@ -65,15 +81,14 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布 - **SDK 2.1.0**——SDK 相关页面按 2.1.0 版本组合更新:`@bankofai/x402-tron` 2.1.0 与新增的 `@bankofai/x402-tron-extensions` 2.1.0(两者需一起升级)运行在官方 `@x402/core` 2.28.0 之上,搭配官方 `@x402/*` HTTP/MCP 集成、`@x402/evm` 与 `@x402/extensions` 2.28.0。快速入门改为从 `@x402/core`、`@x402/fetch`、`@x402/express` 导入,并用 `new x402ResourceServer(...)` 取代 `@bankofai/x402-core` 的 `createResourceServer`(2.1 机制不使用它)。本地 EVM 包、`@bankofai/x402-extensions` 与 `typescript/packages/legacy/` 兼容包已在 2.1.0 删除(根目录 `legacy/`,含已退役的 Python SDK,早在 2.0.0 删除)。TRON 资源赞助现在需要显式注册 client 扩展;SDK 要求 Node.js 24.22.1+。官方 `@x402/evm` 不内置 BSC 默认资产,BSC 路由须用显式的 `{ asset, amount, extra }` 对象定价,client 也须放行 BSC 资产;在本文档涉及的网络中,默认资产现为 TRON 上的 USDT 与 Base / Base Sepolia 上的 USDC。 - **待确认结算**——补充了 `settlement_pending`:它不是终态,应对账而不是重新提交。2.1.0 新增可注入的 `pendingSettlementStore`(默认的 `InMemoryTronPendingSettlementStore` 只覆盖单个进程),以及 `settlement_store_unavailable`、`settlement_execution_failed` 错误码,并把 `chain_read_failed`(此前已用于 `exact` 的 Permit2 读取)扩展到 `upto` 的预检读取。`HTTPFacilitatorClient` 现在来自官方 Core,默认超时 90 秒;示例设置为 120 秒。 - **示例仅覆盖 TRON**——仓库示例现在只覆盖 TRON,卖家快速入门因此引导 BSC 与 Base 卖家使用官方 facilitator 或上游 `@x402/evm` 示例。官方 facilitator v2.2.1 与 v2.2.2 都是安全更新版本(更新 Node.js 与依赖;v2.2.2 还装入了修复 CVE-2026-111497 的系统 Brotli),文档中描述的行为不变。 -- **TRON ID 改为十进制**——示例和表格统一使用 `tron:728126428`(主网)、`tron:3448148188`(Nile)、`tron:2494104990`(Shasta),x402 SDK 仍接受十六进制写法作为输入,wallet-cli 的 `--network` 不接受。API Catalog 例外:它的 schema 目前只接受十六进制。 +- **TRON ID 改为十进制**——示例和表格统一使用 `tron:728126428`(主网)、`tron:3448148188`(Nile)、`tron:2494104990`(Shasta),x402 SDK 仍接受十六进制写法作为输入,wallet-cli 的 `--network` 不接受。 - **官方 Facilitator 限流**——匿名调用每个 IP 每分钟 10 次,API Key 每分钟 1,000 次,`/verify` 与 `/settle` 分别计数(两者都限流)。超限返回 `429` 并带 `Retry-After`。此前文档写的是每分钟一次 `/settle`。 - **Nile 资源赞助**——官方 Facilitator 在 `/supported` 中列出 `trc20ApprovalResourceSponsoring`,但仅在 Nile 为 Nile USDT 启用,且需要 API Key(否则返回 `sponsor_auth_required` / `sponsor_network_disabled`)。补充了 `GET /sponsoring/ready` 以及 `/verify`、`/settle` 的错误码。 - **结算记录**——成功的结算按 (network, asset, payer, nonce) 由部分唯一索引保证唯一。这更正了 9 月 9 日记录中"表上没有唯一约束"的说法。 -- **API Catalog**——本地自检需要 Python 3.11+;提交清单补齐其余 CI 规则(`pay.md` 必含的字符串、TRON 第一条路由须为 `exact` + `permit2`、不得出现 `--scheme exact_gasfree`、`status` 四个键必填),并说明写死数量的测试需在同一个 PR 里更新。列表命令读取本地缓存,只有缓存不存在或缺少所需内容时才下载,因此缓存可能过期时请运行 `update-catalog` 刷新。 - **Wallet CLI 命令参考**——改为以 `@tron-walletcli/wallet-cli@4.15.1` 为准,补充已知稳定币默认每笔最多 1 美元的上限(`amount_exceeds_limit`)、`--out`(二进制响应必须使用)、`--max-gasfree-fee-raw`,以及 `--max-raw-amount` 必须同时指定 `--token` 或 `--asset`。快速入门提示 TRON 上某代币的首次 `exact` 付款可能先广播一次 `approve(Permit2, MaxUint256)`;结果说明补充了结算后出现响应格式错误的情况(`retryPayment: false`)。快速入门还注明 wallet-cli Skill 锁定 4.14.0,配合 Skill 使用时应安装该版本。 - **协议细节**——`402` 的付款要求放在 Base64 编码的 `PAYMENT-REQUIRED` 头中,响应体为 `{}`;验证失败的原因也在该头的 `error` 字段;`exact` / `upto` 的 Permit2 额度不足返回 `412 permit2_allowance_required`。EVM `exact` 还支持 `upfront` 付款流程。Permit2 载荷使用 `payload.permit2Authorization`。代币表删除了 DHLU(现有代码均不再引用),BSC 主网 USDC 标注为仅可作为显式资产;官方 Facilitator 的限流计数按实例;npm 包许可证为 Apache-2.0(仓库 LICENSE 为 MIT)。 -👉 [SDK 功能](/zh-Hans/x402/sdk-features/) · [官方 Facilitator](/zh-Hans/x402/core-concepts/OfficialFacilitator/) · [上架服务](/zh-Hans/x402/api-catalog/list-your-service/) +👉 [SDK 功能](/zh-Hans/x402/sdk-features/) · [官方 Facilitator](/zh-Hans/x402/core-concepts/OfficialFacilitator/) @@ -86,12 +101,11 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布
文档CLI
-- **CLI 文档迁移**——x402 命令行指南从旧的 x402 CLI 页面移至 [Wallet CLI](/zh-Hans/wallet-cli/),统一使用 `@tron-walletcli/wallet-cli@4.14.0`。独立 x402-cli 的页面已移除,AI Agent 快速入门和 API Catalog 快速入门改用 `wallet-cli x402`。 -- **示例更明确**——Wallet CLI 与 Catalog 快速入门中的 DIA `wallet-cli x402 pay` 示例现已显式传入 `--method` 和 `--scheme`,路由同时提供 `exact` 和 `exact_gasfree` 时结果可预期。 +- **CLI 文档迁移**——x402 命令行指南从旧的 x402 CLI 页面移至 [Wallet CLI](/zh-Hans/wallet-cli/),统一使用 `@tron-walletcli/wallet-cli@4.14.0`。独立 x402-cli 的页面已移除,AI Agent 快速入门改用 `wallet-cli x402`。 +- **示例更明确**——Wallet CLI 快速入门中的 `wallet-cli x402 pay` 示例现已显式传入 `--method` 和 `--scheme`,路由同时提供 `exact` 和 `exact_gasfree` 时结果可预期。 - **安装提示**——`npm install -g` 报权限错误时,可在命令前加 `sudo`,或去掉 `-g` 后用 `npx wallet-cli` 运行。 -- **API Catalog 文档**——上架指南改用 SunPump 真实的 `catalog.json` 与 `pay.md`,提交清单与目录仓库 CI 保持一致:每个 `pay.md` 需包含带 `--network tron:728126428` 和 `--scheme exact` 的 `wallet-cli x402 pay` 示例,每个端点需有一条 Base 主网 `exact` + `eip3009` 路由,PR 需一并提交重新生成的 `dist/`。网关按支付链分配 provider ID(`…-tron`、`…-bsc`、`…-base`),`serviceUrl` 填服务的公开官网。 -👉 [Wallet CLI 快速入门](/zh-Hans/wallet-cli/quickstart/) · [Catalog 快速入门](/zh-Hans/x402/api-catalog/get-started/) +👉 [Wallet CLI 快速入门](/zh-Hans/wallet-cli/quickstart/) @@ -104,16 +118,13 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布
文档修复
-- **API 目录示例按真实 provider 重建**——`catalog.json` 与 `pay.md` 示例现已与 `providers/sunpump-token-launch/` 一致:三条链、四条路由,含 TRON `exact_gasfree` 与 Base 的 `eip3009` 路由。此前的示例缺少 `assetTransferMethod`,直接照抄会通不过 schema 校验。提交前检查清单也补上了该字段何时必填、何时必须省略,以及同一网络可以有多条路由。 - **结算记录的去重说法**——facilitator 页此前称成功的结算会按授权身份去重。实际并非如此:`/settle` 每次尝试都插入一行,表上没有唯一约束,也不存在 upsert 或预检。每个授权身份至多只有一条成功记录,仅仅是因为链上的重放保护只允许结算一次。同时补充了 `/payments` 记录流的 `limit`(默认 `50`、上限 `200`)与 `offset` 默认值,以及 `not_found` / `invalid_identity_query` / `missing_identity_or_auth` 三个错误码。 -- **字段修正**——`subTitle` 并非合法的 provider 字段(schema 拒绝未知键,只有 `subtitle`),已删除,连同引用它的 `sub_title` 推导说明。Base Sepolia 标注为仅 schema 层面可用:构建脚本没有它的展示元数据。 - **载荷描述准确化**——转账授权在 EIP-3009 路径下位于 `payload.authorization`,Permit2 路径下位于 `payload.permit2Authorization`。若 permit2 资产同时实现 EIP-2612,`extra` 会带上 `name`/`version`——这是客户端改签无 gas permit、而非广播 `approve` 的信号。 - **能力范围收窄**——余额感知的付款选择与最低价代币策略仅 TRON 可用;`HTTPFacilitatorClient` 的限流重试只作用于 `getSupported()`,`verify()` 与 `settle()` 会直接抛出 429。协议网络列表补上了 TRON Shasta。 - **支付记录查询**——修正了匿名访问的描述:不带 API Key 时,`tx_hash` 与 `network` + `nonce` 查询都不施加卖家过滤,任何持有准确标识符的人都能查到对应记录。虽然不存在免认证的列表接口,但这两个查询同样没有限流(官方服务按每个 IP 每分钟 1 次的匿名限流只覆盖 `/settle`),而结算 tx hash 又是链上公开数据,因此结算元数据事实上是公开的,而非按卖家隔离。文档已明确标注这是当前实现行为,不代表推荐的访问控制策略。 - **Facilitator**——删除了残留的手续费表述。EVM 的 ERC-20 授权 gas 代付按真实条件重新说明:SDK 不会自动注册,自建 facilitator 需显式启用,官方 facilitator 已为 BSC 与 Base 注册,且资源服务端必须在路由上声明该扩展才会生效。 -- **CLI 参考**——`/health` 与 `/.well-known/x402` 不限请求方法,后者还会返回 `rawAmount` 与 `pay_url`;补充了 `--providers-dir`、`--query` 别名,`catalog build` 位置参数的默认值,以及 `export-gateway` 的默认输出目录。 -👉 [API 目录参考](/zh-Hans/x402/api-catalog/reference/) · [提交你的服务](/zh-Hans/x402/api-catalog/list-your-service/) · [Wallet CLI 指引](/zh-Hans/wallet-cli/command-reference/) +👉 [Wallet CLI 指引](/zh-Hans/wallet-cli/command-reference/) @@ -126,12 +137,10 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布
文档修复
-- **API Catalog 契约**——现已正确注明每条 `exact` 路由都必须填写 `assetTransferMethod`:TRON/BSC 使用 `permit2`,Base USDC 使用 `eip3009`;只有 `exact_gasfree` 应省略该字段。目录仓库链接改为指向 `BofAI/x402-catalog`;旧拼写 `x402-catelog` 现在只能靠 GitHub 的改名重定向访问。 - **方案矩阵**——恢复 `auth-capture` 作为第五种命名方案,并准确标注当前范围:发布的 SDK 包含 EVM client,server 与 facilitator 实现尚未发布。 -- **Gateway 流程**——明确钱包签署支付授权后携带 `PAYMENT-SIGNATURE` 重试,再由 facilitator 验证并在链上结算;`402` 报价本身不是网关的密码学签名。 - **文档质量**——修复无效的 MDX 占位符与站内链接;两个语言版本均通过生产构建。 -👉 [SDK 功能矩阵](/zh-Hans/x402/sdk-features/) · [API Catalog 参考](/zh-Hans/x402/api-catalog/reference/) · [Gateway](/zh-Hans/x402/core-concepts/gateway/) +👉 [SDK 功能矩阵](/zh-Hans/x402/sdk-features/) @@ -208,22 +217,6 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布 -
-
2026-07-30
-
- -### x402 Catalog —— Base 路由 - -
更新CatalogBase
- -- 发布 `eip155:8453` **Base 主网目录路由**,配套支付指引与代码示例。CLI 仍支持 Base Sepolia,但服务目录未发布 Base Sepolia 路由。 -- `assetTransferMethod` 现在除 `permit2` 外还接受 **`eip3009`**——Base USDC 路由使用 `eip3009`。 - -👉 [API Catalog 参考](/zh-Hans/x402/api-catalog/reference/) - -
-
-
2026-07-29
@@ -259,23 +252,6 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布
-
-
2026-07-20
-
- -### x402 Catalog —— GasFree 路由与 CAIP-2 - -
更新Catalog
- -- 目录路由现已支持 TRON 上的 **`exact_gasfree`**,与 `exact` + Permit2 并存。 -- 网络标识必须使用**标准 CAIP-2**;旧的 TRON 别名如 `tron:nile` 会被 schema 校验拒绝。 -- 在 x402 SDK 1.0.1 下,GasFree 费用由客户端估算——目录路由不再发布旧的 `fee` / `feeConfig` 字段。 - -👉 [API Catalog 参考](/zh-Hans/x402/api-catalog/reference/) - -
-
-
2026-07-15
@@ -289,7 +265,6 @@ x402 协议、SDK 与 [Wallet CLI 指引](/zh-Hans/wallet-cli/) 的版本发布 - **`pay`** —— 支付任意受 x402 保护的 URL:探测接口、读取 `402` 支付要求、签名并重试 - **`serve`** —— 启动本地 x402 付费端点,通过 Facilitator 校验并结算 - **`roundtrip`** —— 启动临时服务、支付、退出:最快的端到端冒烟测试 -- **`gateway`** / **`catalog`** —— 校验与生成 provider 文件;搜索、缓存、导出服务目录 - 基于已发布的 `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 包构建;`scheme=exact` 配合 Permit2 - 支持网络:TRON(`tron:mainnet` / `tron:nile` / `tron:shasta`)与 BSC(`eip155:56` / `eip155:97`) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-devnotes/current/x402-stablecoin-payments-for-agents.md b/i18n/zh-Hans/docusaurus-plugin-content-docs-devnotes/current/x402-stablecoin-payments-for-agents.md index 61af2461..3471c06d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-devnotes/current/x402-stablecoin-payments-for-agents.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-devnotes/current/x402-stablecoin-payments-for-agents.md @@ -40,7 +40,7 @@ BANK OF AI x402 完全兼容 Coinbase x402 的核心 HTTP 支付协议与交互 ![BANK OF AI 产品矩阵](/img/devnotes/bankofai-product-matrix.svg) -在这套分层中,x402 是基础设施与标准层里的开放支付协议,与负责 Agent 身份和信誉的 8004 并列;MCP 则定义 Agent 与工具之间的上下文交互方式。x402 Gateway、x402 Facilitator、x402 Recharge Server、Agent Wallet、Skills 及各类 MCP Server 位于中间层,将这些协议转化为可直接调用的能力。各层可独立使用,也可按场景组合:需要支付时使用 x402,需要验证身份或信誉时使用 8004,需要连接工具或链上服务时通过 MCP。 +在这套分层中,x402 是基础设施与标准层里的开放支付协议,与负责 Agent 身份和信誉的 8004 并列;MCP 则定义 Agent 与工具之间的上下文交互方式。x402 Facilitator、x402 Recharge Server、Agent Wallet、Skills 及各类 MCP Server 位于中间层,将这些协议转化为可直接调用的能力。各层可独立使用,也可按场景组合:需要支付时使用 x402,需要验证身份或信誉时使用 8004,需要连接工具或链上服务时通过 MCP。 ## 3. BANK OF AI x402 的架构与支付流程 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json b/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json index f965e41e..52be579b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json @@ -267,14 +267,6 @@ "message": "进一步探索", "description": "The label for category Explore Further in sidebar docsSidebar" }, - "sidebar.docsSidebar.doc.Gateway": { - "message": "网关", - "description": "The label for the doc item Gateway in sidebar docsSidebar" - }, - "sidebar.docsSidebar.category.API Catalog": { - "message": "API 目录", - "description": "The label for category API Catalog in sidebar docsSidebar" - }, "sidebar.docsSidebar.category.Wallet CLI": { "message": "Wallet CLI", "description": "The label for category Wallet CLI in sidebar docsSidebar" diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/8004/Usage/Install.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/8004/Usage/Install.md index 35df961b..07be2ee4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/8004/Usage/Install.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/8004/Usage/Install.md @@ -75,6 +75,8 @@ npm run build > **注意**:所有依赖项都会在使用 npm 或 yarn 安装时自动安装。 +截至 2026-11-12,TypeScript SDK **1.2.1** 声明 `tronweb: ^6.5.1`。源码锁文件解析为 **6.5.1**,但业务项目全新安装可能解析到 **6.5.2**,应检查应用自己的锁文件,而不是假定与 SDK 仓库一致。覆盖这两个版本的项目根级 HTTP 依赖配置,见 [TronWeb 依赖安全](/zh-Hans/x402/sdk-features/#dependency-security)。 + ## 可选依赖 为了实现更强大的功能: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/SDK-Guide.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/SDK-Guide.md index 1acb7c11..c945d01a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/SDK-Guide.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/SDK-Guide.md @@ -18,7 +18,7 @@ Agent-wallet 3.x 只提供 TypeScript。PyPI 上的 Python 包 `bankofai-agent-w **检查 Node.js 版本** -请使用 Node.js `^22.23.4 || ^24.22.1 || >=26.12.1`,即 2026 年 10 月的安全更新版本。这是源码 `main` 分支声明的 `engines` 范围;npm 上已发布的 `3.0.0` 仍声明 `>=18.0.0`,但 wallet-cli `4.15.1` 本身就声明了同一范围。在 `main` 上,当 `wallet_cli` 钱包类型用当前 Node 通过 JavaScript 入口启动 wallet-cli 时(本地安装的包,或指向 `.js` 文件的 `AGENT_WALLET_WALLET_CLI_PATH`),会先检查同一范围;从 `PATH` 找到的 `wallet-cli` 可执行文件则不做此检查。(已发布的 `3.0.0` 中,该入口检查只要求 Node.js 20+。)检查当前版本: +请使用 Node.js `^22.23.4 || ^24.22.1 || >=26.12.1`,即 2026 年 10 月的安全更新版本。这是源码 `main` 分支声明的 `engines` 范围;npm 上已发布的 `3.0.0` 仍声明 `>=18.0.0`,但 wallet-cli `4.16.0` 本身就声明了同一范围。在 `main` 上,当 `wallet_cli` 钱包类型用当前 Node 通过 JavaScript 入口启动 wallet-cli 时(本地安装的包,或指向 `.js` 文件的 `AGENT_WALLET_WALLET_CLI_PATH`),会先检查同一范围;从 `PATH` 找到的 `wallet-cli` 可执行文件则不做此检查。(已发布的 `3.0.0` 中,该入口检查只要求 Node.js 20+。)检查当前版本: ```bash node -v diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/QuickStart.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/QuickStart.md index c3ad1261..7252c59a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/QuickStart.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/QuickStart.md @@ -29,7 +29,7 @@ Privy 用户:参见 [CLI 命令行手册 → Privy](./Developer/CLI-Reference. ### 1.1 准备环境:安装 Node.js -Agent-wallet 和 wallet-cli(路径 A)都要求 **Node.js 22.23.4+(22.x)、24.22.1+(24.x)或 26.12.1+**,即 2026 年 10 月的安全更新版本(已发布的 agent-wallet `3.0.0` 仍声明 `>=18`;wallet-cli `4.15.1` 及下一版 agent-wallet 声明了此范围)。安装最新的 LTS 即可满足。 +Agent-wallet 和 wallet-cli(路径 A)都要求 **Node.js 22.23.4+(22.x)、24.22.1+(24.x)或 26.12.1+**,即 2026 年 10 月的安全更新版本(已发布的 agent-wallet `3.0.0` 仍声明 `>=18`;wallet-cli `4.16.0` 及下一版 agent-wallet 声明了此范围)。安装最新的 LTS 即可满足。 打开终端(Mac 用户按 `Command + 空格` 搜索"终端"),输入: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/BANK-OF-AI/QuickStart.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/BANK-OF-AI/QuickStart.md index 65debe64..202f7e74 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/BANK-OF-AI/QuickStart.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/BANK-OF-AI/QuickStart.md @@ -11,7 +11,6 @@ description: "选择 BANK OF AI Skills,使用 wallet-cli 配置钱包与支付 | --- | --- | | 给 Agent 安装能力 | [Skills 快速入门](/zh-Hans/McpServer-Skills/SKILLS/QuickStart/) | | 钱包配置与 x402 支付 | [wallet-cli 快速入门](/zh-Hans/wallet-cli/quickstart/) | -| 查询可付费 API | [API Catalog](/zh-Hans/x402/api-catalog/get-started/) | | 充值 B.AI | [wallet-cli 充值说明](/zh-Hans/wallet-cli/command-reference/) | | DeFi 业务与数据查询 | [Skill 列表](/zh-Hans/McpServer-Skills/SKILLS/BANKOFAISkill/) | diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/FAQ.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/FAQ.md index ceadf408..7eec41bf 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/FAQ.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/FAQ.md @@ -14,7 +14,7 @@ 1. **检查 Node.js 版本**。声明的版本要求取决于你运行服务端的方式: - **`npx -y @bankofai/mcp-server-tron`** 运行的是 npm 包 `1.1.7`,它声明的是 Node.js `>=20`。 - - **源码检出**的 `main`(tag `v1.1.8`)要求 22.23.4+(22.x)或 24.22.1+(24.x)。其 `package.json` 里的版本号仍是 `1.1.7`,因此服务端上报的版本也是 `1.1.7`。 + - **源码 v1.1.11** 要求 22.23.4+(22.x)或 24.22.1+(24.x),服务端上报 `1.1.11`。截至 2026-11-12,npm `latest` 仍为 `1.1.7`;TronWeb 6.5.2、主网 RPC 覆盖,以及依赖和输入限制修复请使用源码构建。 无论哪种方式,都推荐使用 2026 年 10 月的安全更新版本 22.23.4+ 或 24.22.1+: ```bash @@ -51,6 +51,10 @@ 3. **防火墙拦截**。如果你从另一台机器访问本地 HTTP 服务,检查防火墙是否允许该端口的入站连接。 +### HTTP 413 / 415 或工具参数过大 + +源码 v1.1.11 中,**413** 表示 JSON 请求体超过 **1 MiB**,请拆分请求;**415** 表示请求体被压缩,请发送未压缩 JSON。工具参数中的**数组元素与对象键合计超过 10,000 个**时,MCP SDK 也会在工具处理函数运行前拒绝。较大的 ABI 或 multicall 批次可能触发此限制,请缩小批次;这些拒绝发生在工具执行之前。 + ### 写入工具出现但返回钱包错误 {#write-tools-wallet-error} 从 v1.1.7 起,写入工具(转账、质押等)始终出现在 AI 的工具列表中,但会在执行时检查钱包是否已配置。如果没有可用钱包就调用写入工具,会返回类似 `Error transferring TRX: <原因>` 的错误,其中 `<原因>` 来自 Agent Wallet——各条错误的含义见下方[钱包错误信息](#wallet-error-messages)。 @@ -87,10 +91,10 @@ TRON MCP Server 使用 [Agent Wallet](../../../Agent-Wallet/Intro.md) 进行所 | `Password required for local_secure wallets` | 钱包目录中有钱包,但没有解析到密码——既没有 `runtime_secrets.json`,也没有 `AGENT_WALLET_PASSWORD`。 | | `No active wallet set.` | 解析到了密码,但钱包目录中没有任何钱包。此时私钥和助记词环境变量都会被忽略——请用 Agent Wallet 创建或导入钱包,或去掉密码以走环境变量私钥路径。 | | `MAC mismatch — wrong password or corrupted file` | 找到了密码,但与 keystore 不匹配(见下一节)。 | -| `Wallet not configured.` | Agent Wallet 连配置都无法加载——例如 `runtime_secrets.json` 或 `wallets_config.json` 格式错误。使用 agent-wallet 2.3.x(源码检出按 `package-lock.json` 安装的版本)时,在走到环境变量路径时(见表格下方说明)同时设置了私钥和助记词,也会得到这条错误。 | -| `Provide only one of AGENT_WALLET_PRIVATE_KEY or AGENT_WALLET_MNEMONIC` | 使用 agent-wallet 2.4.0(`npx -y @bankofai/mcp-server-tron`,即 npm `1.1.7`、依赖 `^2.3.0`,当前安装的版本)时,走到了环境变量路径,且同时设置了私钥(`AGENT_WALLET_PRIVATE_KEY` 或 `TRON_PRIVATE_KEY`)和助记词(`AGENT_WALLET_MNEMONIC` 或 `TRON_MNEMONIC`)。服务端会原样透传这段文本,例如 `Error transferring TRX: Provide only one of …`,或 `get_wallet_address` 返回的 `Error: Provide only one of …`。去掉其中一个即可。 | +| `Wallet not configured.` | Agent Wallet 连配置都无法加载——例如 `runtime_secrets.json` 或 `wallets_config.json` 格式错误。 | +| `Provide only one of AGENT_WALLET_PRIVATE_KEY or AGENT_WALLET_MNEMONIC` | 使用 agent-wallet 2.4.0(源码 v1.1.11 锁定的版本,npm 1.1.7 的 `^2.3.0` 也解析到此版本)时,走到了环境变量路径,且同时设置了私钥(`AGENT_WALLET_PRIVATE_KEY` 或 `TRON_PRIVATE_KEY`)和助记词(`AGENT_WALLET_MNEMONIC` 或 `TRON_MNEMONIC`)。服务端会原样透传这段文本,例如 `Error transferring TRX: Provide only one of …`,或 `get_wallet_address` 返回的 `Error: Provide only one of …`。去掉其中一个即可。 | -两个 agent-wallet 版本都从 `AGENT_WALLET_PRIVATE_KEY` 或其别名 `TRON_PRIVATE_KEY` 读取私钥,从 `AGENT_WALLET_MNEMONIC` 或其别名 `TRON_MNEMONIC` 读取助记词。只有走到环境变量路径——解析不到任何密码**且**钱包目录里一个钱包都没有——时才会读取这些变量;否则它们会被静默忽略,上面两种「同时设置」引起的错误也都不会出现。 +Agent Wallet 2.4.0 从 `AGENT_WALLET_PRIVATE_KEY` 或其别名 `TRON_PRIVATE_KEY` 读取私钥,从 `AGENT_WALLET_MNEMONIC` 或其别名 `TRON_MNEMONIC` 读取助记词。只有走到环境变量路径——解析不到任何密码**且**钱包目录里一个钱包都没有——时才会读取这些变量;否则它们会被静默忽略,上面的「同时设置」错误也不会出现。 前两种情况的解决方法: @@ -116,7 +120,9 @@ TRON MCP Server 使用 [Agent Wallet](../../../Agent-Wallet/Intro.md) 进行所 2. **Key 是否仍然有效**。登录 [trongrid.io](https://www.trongrid.io/) 确认 API Key 处于激活状态。 -3. **密钥从环境变量读取,不走请求头。** 服务端从自身进程环境读取 `TRONGRID_API_KEY`,再以 `TRON-PRO-API-KEY` 转发给上游;它完全不解析进入的请求头。因此无法按请求给托管的云服务传 API Key——需要自己的配额,请在本地或自建实例上设置 `TRONGRID_API_KEY`。 +3. **密钥从环境变量读取,不走请求头。** 服务端从自身进程环境读取 `TRONGRID_API_KEY`,完全不解析进入的请求头。源码 v1.1.11 仅在上游为官方 HTTPS TronGrid 源时附加 `TRON-PRO-API-KEY`。因此无法按请求给托管的云服务传 API Key——需要自己的配额,请在本地或自建实例上设置 `TRONGRID_API_KEY`。 + +4. **检查主网 RPC 覆盖。** 源码 v1.1.11 中,`MCP_MAINNET_RPC_URL` 优先于 Key。覆盖为其他 RPC 源时不会发送 TronGrid 凭据。取消覆盖可恢复自动选择,或在部署环境中配置所需端点;修改后须重启服务。详见[网络配置](./LocalPrivatizedDeployment.md#覆盖主网-rpc源码-v1111)。 --- @@ -183,7 +189,7 @@ AI 可能将 TRON MCP Server 的能力与其他区块链工具混淆。如果它 几种常见原因和对策: -- **没有 TronGrid API Key**:未设置 `TRONGRID_API_KEY` 时,`v1.1.8` 起的源码检出中主网请求走 BANK OF AI 回退节点 `https://hptg.bankofai.io`,npm `1.1.7`(`npx` 运行的版本)则不带 Key 访问 `https://api.trongrid.io`。配置免费的 API Key 后,两个版本都会以你自己的配额访问 `https://api.trongrid.io` +- **没有 TronGrid API Key**:未设置 `TRONGRID_API_KEY` 且未覆盖主网 RPC 时,源码 v1.1.11 中主网请求走 `https://hptg.bankofai.io`,npm `1.1.7`(`npx` 运行的版本)则不带 Key 访问 `https://api.trongrid.io`。配置免费的 API Key 后会使用你自己的 TronGrid 配额;源码 v1.1.11 需保持 `MCP_MAINNET_RPC_URL` 未设置,才会自动选择 TronGrid。 - **复杂的多工具工作流**:某些操作(如钱包全貌分析)需要多个串行调用,等待是正常的 - **使用测试网开发**:Nile 和 Shasta 测试网通常响应更快 - **提示词更明确**:减少 AI 的探索性调用——直接告诉它用哪个工具、查哪个网络 @@ -220,17 +226,18 @@ npx -y @bankofai/mcp-server-tron@latest npx clear-npx-cache ``` -如果你是从源码克隆的: +源码部署请拉取 tag,选择核对过的版本(目前为 `v1.1.11`),再使用其锁文件重新构建: ```bash cd mcp-server-tron -git pull -npm install +git fetch --tags origin +git checkout v1.1.11 +npm ci npm run build ``` ### 支持哪个 MCP 协议版本? -协议版本由 `@modelcontextprotocol/sdk` 协商决定,服务端对它的依赖是 `^1.22.0`;源码检出的 `package-lock.json` 锁定为 1.27.1。MCP 协议版本 **2025-11-25** 需要 SDK 1.24.1 或更高版本——SDK 1.22.0–1.24.0 最高只支持 2025-06-18。客户端请求的更早协议版本同样可以使用。 +协议版本由 `@modelcontextprotocol/sdk` 协商决定。源码 v1.1.11 依赖 `^1.32.2`,锁定为 **1.32.2**;npm 1.1.7 声明 `^1.22.0`,实际 SDK 版本取决于安装时的锁文件。MCP 协议版本 **2025-11-25** 需要 SDK 1.24.1 或更高版本——SDK 1.22.0–1.24.0 最高只支持 2025-06-18。客户端请求的更早协议版本同样可以使用。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/Intro.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/Intro.md index f23d69aa..39e720f2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/Intro.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/Intro.md @@ -1,5 +1,7 @@ # 简介 +> **版本状态(2026-11-12)**:本次核对的源码 tag 为 **v1.1.11**,npm `latest` 仍为 **1.1.7**。v1.1.11 将 TronWeb 升级为 6.5.2,保留 v1.1.10 引入的按部署覆盖主网 RPC 配置与 TronGrid 凭据转发限制,以及 v1.1.9 的依赖修复、工具输入限制和 HTTP、Docker 边界。需要这些更新时,请按[本地部署文档](/zh-Hans/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment/#方式-b从源码克隆)使用源码方式。 + ## TRON MCP Server 是什么? TRON MCP Server 是连接 AI 助手与 TRON 区块链的桥梁。它基于 [Model Context Protocol (MCP)](../Intro.md) 标准协议,让你可以用自然语言与区块链交互——查余额、发起转账、调用智能合约——而无需编写任何代码。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md index ee3a696a..ea2d2a6f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md @@ -1,5 +1,9 @@ # 本地私有化部署 +:::info 源码与 npm 版本不同 +截至 **2026-11-12**,源码 tag 为 **v1.1.11**,npm `latest` 仍为 **1.1.7**。下文针对 v1.1.11 说明的主网 RPC 覆盖、依赖覆盖、输入限制与 Docker 行为适用于源码构建。需要这些更新时使用**方式 B**;`npx ...@latest` 目前仍运行 1.1.7。 +::: + ## 什么是本地私有化部署? 本地私有化部署是指在你自己的机器上运行 TRON MCP Server,让 AI 助手获得对 TRON 区块链的 **完整读写能力**。 @@ -29,7 +33,7 @@ | 要求 | 说明 | | :--- | :--- | -| **Node.js** | 推荐 22.23.4+(22.x)或 24.22.1+(24.x),即 2026 年 10 月的安全更新版本([下载](https://nodejs.org/))。源码检出的 `main`(tag `v1.1.8`,即下文方式 B)要求这一范围(其 `package.json` 里的版本号仍是 `1.1.7`,因此服务端上报的版本也是 `1.1.7`);`npx` 运行的 npm 包 `1.1.7`(方式 A)声明的是 `>=20`。 | +| **Node.js** | 源码 v1.1.11 要求 **22.23.4+(22.x)或 24.22.1+(24.x)**([下载](https://nodejs.org/));20.x、23.x、25.x 与 26.x 不在其声明范围内。npm 1.1.7 声明 `>=20`,两种方式均请使用上述 22.x/24.x 安全基线。 | | **TronGrid API Key** | 可选但推荐([申请地址](https://www.trongrid.io/)) | 验证 Node.js 版本: @@ -65,7 +69,7 @@ TRON MCP Server 使用 [Agent Wallet](../../../Agent-Wallet/Intro.md) 管理钱 | 运行时切换钱包 | 是 | | 推荐场景 | 所有使用场景 | -> TRON MCP Server 依赖 Agent Wallet **2.x**(`@bankofai/agent-wallet ^2.3.0`)。[Agent-Wallet 文档](../../../Agent-Wallet/Intro.md)描述的是 3.x,本服务端尚未使用该版本——请按本页的 2.x 命令操作。 +> TRON MCP Server 依赖 Agent Wallet **2.x**(源码 v1.1.11 使用 `@bankofai/agent-wallet ^2.4.0`,锁定为 2.4.0;npm 1.1.7 使用 `^2.3.0`)。[Agent-Wallet 文档](../../../Agent-Wallet/Intro.md)描述的是 3.x,本服务端尚未使用该版本——请按本页的 2.x 命令操作。 首先,安装 Agent Wallet 2.x CLI: @@ -98,60 +102,69 @@ agent-wallet start local_secure --save-runtime-secrets 如果你已经有想使用的私钥,通过 `AGENT_WALLET_PRIVATE_KEY` 环境变量设置(Agent Wallet 也接受别名 `TRON_PRIVATE_KEY`,以及通过 `AGENT_WALLET_MNEMONIC` 或 `TRON_MNEMONIC` 设置助记词)。注意优先级:只有在**解析不到任何密码**(既没有 `runtime_secrets.json`,也没有 `AGENT_WALLET_PASSWORD`)**且**钱包目录里一个钱包都没有时,才会走到这条环境变量路径。如果你已经执行过「路径 1」、保存过运行时密码,或跑过 Openclaw 安装器,密钥库路径会优先生效,这些变量会被静默忽略。 -```bash -export AGENT_WALLET_PRIVATE_KEY=你的私钥 -``` - -:::tip -如需在每次打开终端时自动生效,可将其写入 shell 配置文件: +在本地终端以隐藏输入方式设置,避免把私钥值写入 shell 历史: ```bash -echo 'export AGENT_WALLET_PRIVATE_KEY=你的私钥' >> ~/.zshrc # zsh(macOS 默认) -echo 'export AGENT_WALLET_PRIVATE_KEY=你的私钥' >> ~/.bashrc # bash(Linux 默认) -source ~/.zshrc # 或 source ~/.bashrc — 无需重启终端即可立即生效 +printf 'Private key (hidden input): ' +read -r -s AGENT_WALLET_PRIVATE_KEY +printf '\n' +export AGENT_WALLET_PRIVATE_KEY ``` -验证环境变量已生效: +:::tip +只验证变量是否存在,不要打印其值。需要持久化存储时,使用路径 1 的加密 Agent Wallet,不要把私钥写入 shell 启动配置文件。 ```bash -echo $AGENT_WALLET_PRIVATE_KEY +node -e 'console.log(Boolean(process.env.AGENT_WALLET_PRIVATE_KEY))' ``` ::: - - --- ### 第二步:配置网络(可选) #### TronGrid API Key -在 `v1.1.8` 起的源码检出中,API Key 还决定了服务端访问哪个主网节点。对于频繁的链上查询,建议配置一个免费的 TronGrid API Key: +在源码 v1.1.11 中,未设置 `MCP_MAINNET_RPC_URL` 时,API Key 决定默认主网节点。对于频繁的链上查询,建议配置一个免费的 TronGrid API Key: ```bash # 添加到 ~/.zshrc 或 ~/.bashrc export TRONGRID_API_KEY="<你的-TronGrid-API-Key>" ``` -在 [trongrid.io](https://www.trongrid.io/) 免费注册即可获取。该变量对各网络的影响(各版本唯一的差别在于未配置 Key 时的主网): +在 [trongrid.io](https://www.trongrid.io/) 免费注册即可获取。未覆盖主网 RPC 时,默认选择如下: | 网络 | 已设置 `TRONGRID_API_KEY` | 未设置 `TRONGRID_API_KEY` | | :--- | :--- | :--- | -| **Mainnet** | `https://api.trongrid.io`,并以 `TRON-PRO-API-KEY` 请求头携带你的 Key(使用你自己的配额) | `v1.1.8` 起的源码检出:回退到 BANK OF AI 节点 `https://hptg.bankofai.io`。npm `1.1.7`(`npx` 运行的版本):不带 Key 访问 `https://api.trongrid.io` | +| **Mainnet** | `https://api.trongrid.io`,并以 `TRON-PRO-API-KEY` 请求头携带你的 Key(使用你自己的配额) | 源码 v1.1.11:回退到 `https://hptg.bankofai.io`。npm `1.1.7`(`npx` 运行的版本):不带 Key 访问 `https://api.trongrid.io` | | **Nile** | `https://nile.trongrid.io`(同样携带 Key 请求头) | `https://nile.trongrid.io` | | **Shasta** | `https://api.shasta.trongrid.io`(同样携带 Key 请求头) | `https://api.shasta.trongrid.io` | 不配置 Key 也能正常使用,但不带 Key 发往 TronGrid 的请求(npm `1.1.7` 的主网,以及 Nile / Shasta)共用 TronGrid 的公共限流,高频使用时可能遇到限流错误。如果希望主网请求走 TronGrid 并使用你自己的配额,再配置即可。 +#### 覆盖主网 RPC(源码 v1.1.11) + +在服务端部署环境设置 `MCP_MAINNET_RPC_URL`,可以同时覆盖主网的 full node、solidity node 和 event server。它优先于 `TRONGRID_API_KEY`,适用于 `mainnet`、`tron`、`trx`,不影响 Nile 和 Shasta,也不能通过 MCP 工具参数设置。 + +例如,测试部署可以显式使用以下主网 RPC: + +```bash +export MCP_MAINNET_RPC_URL="https://tg.ops.sunpump.xyz" +``` + +这仍然连接主网。生产部署保持未设置即可沿用上表的默认选择。只接受不含凭据、查询串或片段的绝对 HTTP/HTTPS URL,可以包含基础路径。RPC 客户端有缓存,修改后须重启服务。Docker 部署可将该变量写入 `.env.docker`,或在 `docker run` 中传入 `-e MCP_MAINNET_RPC_URL=https://tg.ops.sunpump.xyz`。 + +源码 v1.1.11 仅当所配置 RPC URL 的源为官方 HTTPS TronGrid(`https://api.trongrid.io`、`https://nile.trongrid.io` 或 `https://api.shasta.trongrid.io`)时附加 `TRON-PRO-API-KEY`。其他 RPC 源即使设置了 `TRONGRID_API_KEY` 也不会收到该 Key。 + --- ### 第三步:本地私有化部署 -提供多种部署方式。对于大多数用户,方式 A 就够了。 +需要本次核对的 v1.1.11 源码及安全更新时,使用方式 B。方式 A 运行的是较早发布的 npm 包。 -#### 方式 A:npx 直接运行(推荐) +#### 方式 A:使用 npx 运行已发布包 -无需克隆仓库,通过 `npx` 直接运行最新版本。这也是下文[配置说明](#配置说明)中使用的命令。 +无需克隆仓库,通过 `npx` 运行已发布的 npm 包(目前是 1.1.7),不会运行源码 v1.1.11。这也是下文[配置说明](#配置说明)中使用的命令。 ```bash npx -y @bankofai/mcp-server-tron @@ -159,15 +172,17 @@ npx -y @bankofai/mcp-server-tron #### 方式 B:从源码克隆 -适用于需要修改源码或参与贡献的开发者: +使用本次核对的源码 tag、锁文件和安全覆盖配置构建: ```bash -git clone https://github.com/BofAI/mcp-server-tron.git +git clone --branch v1.1.11 --depth 1 https://github.com/BofAI/mcp-server-tron.git cd mcp-server-tron -npm install +npm ci npm run build ``` +源码 v1.1.11 固定使用 **TronWeb 6.5.2**,依赖 MCP SDK **^1.32.2** 与 Zod **^4.6.7**,Agent Wallet 仍为 **2.x**。根级覆盖修复 TronWeb 的 Axios,并将 Agent Wallet 的解析器统一到服务端的 Zod 4;请保留 `package-lock.json` 与覆盖配置。npm 1.1.7 包不包含这些源码项目的覆盖。 + #### 方式 C:以 HTTP 模式运行 启动服务器的 HTTP 模式,然后通过 HTTP 端点连接你的 MCP 客户端。用已发布的包时传 `--http` 即可,无需克隆源码: @@ -188,6 +203,8 @@ npm run start:http 这会启动一个本地无状态 Streamable HTTP 服务器(默认:`http://localhost:3001/mcp`),对 `/mcp` 的 `GET` 和 `DELETE` 返回 `405`(不支持 SSE),`GET /` 返回服务信息。每个请求独立处理,不维护会话状态。 +源码 v1.1.11 的 HTTP 入口只接受 **1 MiB 以内的未压缩 JSON**;压缩请求体返回 **415**,超大请求体返回 **413**。stdio 与 HTTP 两种模式下,工具参数中的**数组元素与对象键合计最多 10,000 个**,在 schema 校验前检查。这些是源码 v1.1.11 的限制,不能直接套用于 npm 1.1.7 或尚未核实版本的云部署。 + 你可以通过环境变量自定义端口和主机: ```bash @@ -210,18 +227,23 @@ EOF # 2. 构建镜像 docker build -t mcp-server-tron . # 需要「方式 B」的源码检出——Dockerfile 不包含在已发布的 npm 包里 +mkdir -p logs +# 确保宿主机日志目录可由 UID/GID 1000:1000 写入。 + # 3. 使用 --env-file 运行容器 docker run -d \ -p 3001:3001 \ - -v $(pwd)/logs:/app/logs \ + -v "$(pwd)/logs:/app/logs" \ --env-file .env.docker \ mcp-server-tron ``` :::warning -切勿在命令行中通过 `-e KEY=value` 传递 API 密钥——该值会出现在 shell 历史记录和 `docker inspect` 输出中。请始终使用 `--env-file` 配合一个排除在版本控制之外的文件(将 `.env.docker` 添加到 `.gitignore`)。 +使用 `--env-file`,并将文件排除在版本控制之外(把 `.env.docker` 加入 `.gitignore`),避免把密钥值直接写在命令行中。Docker 管理员仍可检查容器环境变量;env 文件不会让密钥从 `docker inspect` 中隐藏。 ::: +v1.1.11 镜像以 **`node`(UID/GID 1000:1000)** 运行,应用文件归 root 所有;服务在 `/app` 内只可写 `/app/logs`。bind mount 会覆盖镜像目录权限,因此启动前须准备宿主机日志目录的属主与写权限。不要挂载宿主机凭据目录或 Docker socket;宿主机日志采集器也须避免跟随链接读取凭据文件。 + 容器暴露 3001 端口,日志按日期写入挂载的 `logs/` 目录。健康检查端点:`http://localhost:3001/health`。 :::tip @@ -232,7 +254,8 @@ Docker 镜像适用于只读云部署。如需本地写入操作(转账、质 如果你要配置 MCP 客户端指向本地服务器: -- **如果通过 npx 或源码运行**:在 MCP 客户端配置中使用相应的命令(例如 `command: npx` 加上 `args: ["-y", "@bankofai/mcp-server-tron"]`) +- **npm 已发布包(方式 A)**:使用 `command: "npx"` 和 `args: ["-y", "@bankofai/mcp-server-tron@latest"]`(目前是 1.1.7)。 +- **源码 stdio 构建(方式 B)**:使用 `command: "node"` 和 `args: ["/absolute/path/to/mcp-server-tron/build/index.js"]`;构建后将路径替换为源码检出的绝对路径,直接运行源码构建产物。 - **如果以 HTTP 模式或 Docker 运行**:通过 HTTP URL 配置选项将客户端指向 `http://localhost:3001/mcp` 如果你的 MCP 客户端不继承系统环境变量,则需要在客户端设置中显式配置它们。**请确保任何存储凭证的配置文件不会被分享或提交到版本控制系统**。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md index ab971335..a4bfe99b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/OfficialServerAccess.md @@ -23,7 +23,7 @@ **2. 官方维护与持续升级** -云服务由官方统一维护,始终运行最新稳定版本的 TRON MCP Server。包括: +云服务由官方统一维护。实际部署版本与源码 tag、npm `latest` 是独立的,请通过 `https://tron-mcp-server.bankofai.io/` 返回的服务信息核对其上报版本。维护内容包括: - 新工具和功能的更新 - 底层 TRON 网络升级的适配 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/ToolList.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/ToolList.md index 8f7ea9c0..b1167b82 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/ToolList.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/McpServer-Skills/MCP/TRONMCPServer/ToolList.md @@ -15,6 +15,10 @@ TRON MCP Server 提供 **97 个工具**、**6 个提示词模板**和 **1 个资 写入工具始终会出现在 AI 的可用工具列表中,但会在执行时检查钱包是否已配置。如果没有配置钱包,调用写入工具会返回钱包错误(见[常见问题](./FAQ.md#wallet-error-messages))。在**只读模式**(云服务或 `--readonly` 标志)下,29 个写入工具和 2 个写入类提示词模板(`prepare_transfer`、`interact_with_contract`)不会被注册,只剩 68 个读取工具和 4 个提示词模板。 ::: +:::info 源码 v1.1.11 输入限制 +全部工具参数中的数组元素与对象键**合计最多 10,000 个**,在 schema 校验前检查;较大的 ABI 与 multicall 参数也计入此限制。HTTP 入口另外只接受 **1 MiB** 以内的未压缩 JSON。这些限制针对源码 v1.1.11;截至 2026-11-12,npm `latest` 仍为 1.1.7。 +::: + :::tip network 参数 大多数工具都有一个可选的 `network` 参数,用于指定目标网络(`mainnet`、`nile` 或 `shasta`;`tron` / `trx` 等同于 `mainnet`,`testnet` 等同于 `nile`)。不指定时默认走主网。在测试阶段,建议每次都明确指定 `nile`,避免意外操作主网。 ::: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/command-reference.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/command-reference.md index 32ef0d43..bf6d9cce 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/command-reference.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/command-reference.md @@ -6,7 +6,7 @@ description: "wallet-cli 命令与支付参数。" # Wallet CLI 命令参考 -以 **4.15.1** 发布包为准。通过命令 schema 查询可用参数。 +以 **4.16.0** 发布包为准。通过命令 schema 查询可用参数。 ```bash wallet-cli --json-schema -o json @@ -19,9 +19,9 @@ wallet-cli bai recharge --json-schema -o json - `--network`:指定支付网络;TRON 主网使用 `tron:728126428`。 - `--account`:选择 wallet-cli 账户。 - `--token` 或 `--asset`、`--decimals`:按 schema 指定支付资产。 -- `--max-amount` / `--max-raw-amount`:二选一,限制支付数量。`--max-raw-amount` 以最小单位计,必须同时指定 `--token` 或 `--asset`,因为原始数量本身没有单位。`--max-amount` 和 `--max-raw-amount` 都不指定时,已知稳定币默认每笔上限 1 美元;超过该价格的路线会在签名前被排除;所有路线都超过时,命令以 `amount_exceeds_limit` 失败。`--dry-run` 预览不应用这个内置上限,所以预览能通过,实际付款仍可能以 `amount_exceeds_limit` 失败。 +- `--max-amount` / `--max-raw-amount`:二选一,限制支付数量。`--max-raw-amount` 以最小单位计,必须同时指定 `--token` 或 `--asset`,因为原始数量本身没有单位。命令会对首条匹配网络及资产/方案筛选条件的路线检查显式上限;超限时在签名前以 `amount_exceeds_limit` 失败,`--dry-run` 也一样,不会继续寻找后续更便宜的报价。两个显式上限都不指定时,实际付款采用 SDK 内置的已知稳定币允许列表及每笔 1 美元上限。预览不应用这个内置上限,所以可能预览通过,实际付款仍以 `amount_exceeds_limit` 失败。 - `--dry-run`:读取支付要求,不签名。 -- `--method`、`--header`、`--body` / `--body-file`:HTTP 请求配置。 +- `--method`、`--header`、`--body` / `--body-file`:HTTP 请求配置。默认方法为 `GET`,带任一请求体参数时会在请求发出前以 `invalid_option` 拒绝;需要请求体时须显式指定 `POST` 等方法。`--body-file -` 从 stdin 读取,不能与 `--password-stdin` 或其他读取 stdin 的参数共用输入。 - `--out `:把响应体按原始字节写入新文件,而不是放在 `data.response`;文件已存在时在发出任何请求前即拒绝。二进制媒体类型(如 `application/octet-stream`、图片、音视频、PDF、压缩包)必须使用 `--out`。 - `--password-stdin`:实际签名所需主密码的安全输入通道。 - `-o json`:机器输出。 @@ -42,7 +42,7 @@ wallet-cli bai recharge --json-schema -o json | --- | --- | --- | | `missing_wallet_address` | 1 | 没有配置 wallet-cli 账户(`--dry-run` 也需要) | | `auth_required` | 1 | 实际付款时没有传 `--password-stdin` | -| `invalid_option` | 2 | `--max-raw-amount` 没带 `--token` / `--asset`、二进制响应没带 `--out`,或同时传了互斥参数 | +| `invalid_option` | 2 | `--max-raw-amount` 没带 `--token` / `--asset`、`GET` 带请求体、二进制响应没带 `--out`,或同时传了互斥参数 | | `output_exists` | 2 | `--out` 指定的文件已存在;未发出任何请求 | | `no_matching_requirement` | 1 | 没有路线匹配 `--network` / `--token` / `--asset` / `--scheme`,或在未传 `--max-amount` / `--max-raw-amount` 时,没有路线使用内置支出控制允许的资产;`paymentStatus: "not_sent"` | | `amount_exceeds_limit` | 1 | 路线价格高于 `--max-amount`、`--max-raw-amount` 或内置的 1 美元上限;`not_sent` | @@ -51,7 +51,7 @@ wallet-cli bai recharge --json-schema -o json | `provider_error` / `provider_rate_limited` | 1 | 端点或 facilitator 出错或返回 429(有则带 `error.details.retryAfterSeconds`) | | `invalid_x402_response` | 1 | 付费响应无法解码;可能带 `paymentStatus: "settled"` | -只有实际付款时 `error.details` 里才会带 `paymentStatus`;`--dry-run` 失败时没有 `error.details`。 +失败时可能在 `error.details` 中携带 `paymentStatus`,包括显式金额上限拒绝 `--dry-run` 预览时的 `not_sent`。部分更早的参数校验或请求失败可能没有这些详情。预览始终不签名、不付款;出现支付状态详情不代表已经发送付款。 ## B.AI 充值 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/faq.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/faq.md index 2661e3e2..b03635af 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/faq.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/faq.md @@ -8,7 +8,7 @@ description: "wallet-cli 的安装、钱包及支付问题。" ## 预览需要钱包吗? -`x402 pay --dry-run` 需要已配置的账户,但不签名;目录查询不需要钱包或密码。实际付款需要安全输入主密码。 +`x402 pay --dry-run` 需要已配置的账户,但不签名。实际付款需要安全输入主密码。 ## 支付失败可以重试吗? diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/index.md index 847047e6..8d0d75b7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/index.md @@ -1,20 +1,19 @@ --- title: "Wallet CLI 与 x402" -description: "使用 wallet-cli 进行支付和服务发现。" +description: "使用 wallet-cli 进行 x402 支付。" --- # Wallet CLI 与 x402 -新的命令行接入使用 **`@tron-walletcli/wallet-cli@4.15.1`**。 +新的命令行接入使用 **`@tron-walletcli/wallet-cli@4.16.0`**。 + +截至 2026-11-12,这是 npm `latest` 版本,精确依赖 **TronWeb 6.5.1**,不会自动安装 TronWeb 6.5.2。wallet-cli Skill 有自己的 CLI 版本锁定;通过该 Skill 使用时,请遵循 [Skills 快速入门](/zh-Hans/McpServer-Skills/SKILLS/QuickStart/)。 | 需求 | 新入口 | | --- | --- | | 支付受保护的 HTTP API | `wallet-cli x402 pay` | | 本地测试收费服务 | `wallet-cli x402 serve`、`wallet-cli x402 roundtrip` | -| 浏览服务和接口 | `wallet-cli x402 provider-list`、`provider-show`、`endpoint-list` | -| 刷新目录缓存 | `wallet-cli x402 update-catalog` | | B.AI 充值及记录 | `wallet-cli bai recharge`、`recharge-orders` | -| Gateway 部署、配置和目录构建 | [Gateway 部署文档](/zh-Hans/x402/core-concepts/gateway/#run-your-own-gateway)及 [Catalog 文档](/zh-Hans/x402/api-catalog/) | 钱包由 wallet-cli 配置和选择,原有 agent-wallet 配置不会自动变成 wallet-cli 账户。CLI 网络参数使用十进制 CAIP-2 标识,例如 Nile `tron:3448148188`、TRON 主网 `tron:728126428`、BSC `eip155:56`、Base `eip155:8453`。不要将协议文档中的十六进制 TRON 标识直接替换到 CLI 示例中。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/quickstart.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/quickstart.md index 3fd2b0e0..31ad054a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/quickstart.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/wallet-cli/quickstart.md @@ -11,7 +11,7 @@ description: "安装 wallet-cli 并预览 x402 支付。" ## 安装和检查 ```bash -npm install -g @tron-walletcli/wallet-cli@4.15.1 +npm install -g @tron-walletcli/wallet-cli@4.16.0 wallet-cli --version wallet-cli x402 pay --json-schema -o json ``` @@ -33,27 +33,17 @@ wallet-cli list -o json wallet-cli current -o json ``` -## 查询目录 - -```bash -wallet-cli x402 provider-list -o json -wallet-cli x402 provider-show dia -o json -wallet-cli x402 endpoint-list dia -o json -``` - -从结果中选择网络对应的 `x402Routes[].url`,替换路径占位符。不要根据目录 FQN 猜测 Gateway URL。 - ## 预览支付 -以下命令访问 DIA 的报价接口,**不签名、不付款**。支付预览仍需要已配置账户。 +先按[卖家快速入门](/zh-Hans/x402/getting-started/quickstart-for-sellers/)在 4021 端口启动配置为 Nile 的 TRON 资源服务端,或使用你控制的测试接口。以下命令读取支付要求,**不签名、不付款**。支付预览仍需要已配置账户。 ```bash -wallet-cli x402 pay https://x402-gateway.bankofai.io/providers/dia-price-tron/v1/quotation/BTC \ +wallet-cli x402 pay http://localhost:4021/credit \ --method GET \ - --network tron:728126428 \ + --network tron:3448148188 \ --token USDT \ --scheme exact \ - --max-amount 0.01 \ + --max-amount 1 \ --dry-run -o json ``` diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/AGENTS.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/AGENTS.md index 40921997..d5490e46 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/AGENTS.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/AGENTS.md @@ -80,7 +80,7 @@ import TabItem from '@theme/TabItem'; - **Settlement Asset**: Use official Base USDC at `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`. - **Payment Scheme**: Use `exact` with EIP-3009 authorization; do not describe Base USDC as Permit2. - **Address Format**: Payout and token addresses use EVM hexadecimal (`0x`) format. -- **Catalog Scope**: Public catalog examples use Base Mainnet only. Base Sepolia (`eip155:84532`) may appear only in explicit CLI/SDK testing documentation. +- **Network Scope**: Production examples use Base Mainnet. Base Sepolia (`eip155:84532`) may appear only in explicit CLI/SDK testing documentation. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/get-started.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/get-started.md deleted file mode 100644 index 14e31e86..00000000 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/get-started.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Catalog 快速入门" -description: "用 wallet-cli 查询目录和预览付费接口。" ---- - -# Catalog 快速入门 - -先按 [Wallet CLI 快速入门](/zh-Hans/wallet-cli/quickstart/)安装 Wallet CLI。目录查询不需要钱包或密码,支付预览和付款需要已配置账户。 - -## 浏览目录 - -```bash -wallet-cli x402 update-catalog -o json -wallet-cli x402 provider-list -o json -wallet-cli x402 provider-show dia -o json -wallet-cli x402 endpoint-list dia -o json -``` - -`update-catalog` 把目录下载到本地缓存。`provider-list`、`provider-show` 和 `endpoint-list` 读取该缓存,只有缓存不存在或缺少所需内容时才从目录下载;它们不会刷新缓存,需要最新的服务和价格时请重新运行 `update-catalog`。`provider-list` 支持 `--network`、`--category` 和 `--capability` 过滤。 - -## 选择接口和网络 - -从 CLI JSON 的 `x402Routes[].url` 读取网络对应的 URL,并填入接口路径中的占位符。Gateway provider id 与目录 FQN 不同,不能自行拼接。例如 DIA 的 TRON BTC 报价接口: - -```bash -wallet-cli x402 pay https://x402-gateway.bankofai.io/providers/dia-price-tron/v1/quotation/BTC \ - --method GET \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.01 \ - --dry-run -o json -``` - -该命令只预览。实际支付需核对金额及网络、取得授权并通过安全来源提供 `--password-stdin`。GasFree 另设手续费上限;结果不确定时先核对交易,不能重复付款。 - -需要直接读取目录数据时,服务列表见 [Catalog JSON](https://x402-catalog.bankofai.io/api/catalog.json),端点及其 `x402_routes` 见 `/api/providers/.json`。静态 API 的字段名为 snake_case,但 `i18n` 和路由对象里的字段保持原样(如 `assetTransferMethod`);CLI 的输出字段以其 schema 和文档为准,不要混用。 - -- [目录数据与接口参考](/zh-Hans/x402/api-catalog/reference/) -- [提交服务](/zh-Hans/x402/api-catalog/list-your-service/) -- [支付命令参考](/zh-Hans/wallet-cli/command-reference/) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/index.md deleted file mode 100644 index b2bd5e14..00000000 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: API 目录介绍 -sidebar_label: 介绍 -description: BANK OF AI 的钱包原生服务目录 —— AI Agent 在这里发现、调用并为任意 API 按次付费,通过 x402 在链上结算。 ---- - -import ThemedImage from '@theme/ThemedImage'; - -# API 目录 - -传统 API 的门槛是为人设计的:注册账号、申请 API Key、绑定信用卡、按月订阅。可一个 AI Agent 想自主调用一个接口时,光是「开户」这一步就走不通——它没有邮箱、没有信用卡,也不该替你保管一长串密钥。 - -**API 目录**(API Catalog)是 BANK OF AI 的钱包原生服务目录。AI Agent 在这里发现服务、按名称调用、按次付费,每一笔调用都通过 x402 在链上结算。没有账号,没有 API Key,**钱包即身份**。目录覆盖 TRON、BNB Chain 和 Base 主网。 - -## 它解决什么 - -- **对 Agent / 开发者**:在一个目录里发现所有可调用的服务,按次付费,无需为每个服务单独注册和管理密钥。 -- **对服务方**:把已有 API 上架为可被 Agent 直接发现、调用、付费的服务,款项直接结算到自己的钱包,且无需改动一行代码。 - -## 它怎么运作 - -目录本身只是一份公开的服务清单:不保存数据库,也不接收任何上游密钥——它负责让服务被发现,不经手调用和资金。 - -服务方向目录仓库提交两份**公开**文件即可上架(可先填表申请,由我们联系协助);文件里的调用地址指向所选网关——BANK OF AI 官方托管或自建均可。平台自动校验、扫描敏感信息后对外发布: - - - -三个消费入口共用同一份数据: - -- **[前端目录站](https://bankofai.io/catalog)**:给人浏览、比较服务。 -- **wallet-cli**:在命令行里搜索、查看、直接付费调用。 -- **MCP**:`@x402/mcp`(SDK 2.1.0 起使用的官方 MCP 集成)让 Agent 能通过 MCP 为 x402 端点付款。支持目录发现的 MCP(在 MCP 客户端里按名称浏览目录)尚未发布,当前请用 `wallet-cli x402 provider-list` 做发现。 - -## 目录里有什么 - -首批上线服务覆盖发币、DeFi 市场数据与链上安全;每个服务根据其已发布路由支持 TRON、BNB Chain 或 Base 主网结算: - -| 服务 | 它能做什么 | 计费 | -|---|---|---| -| SunPump | 一次付费完成 Agent/meme 代币发行 —— 提交发币元数据(名称、符号、描述、图片),支付结算后由网关转发你的请求 | $0.000001 / 次 | -| DefiLlama | 聚合 DeFi 数据 —— 协议 TVL、代币价格(实时与历史)、池子收益/APY | $0.000001 / 次 | -| DexScreener | 实时 DEX 交易对、价格与流动性、代币搜索,以及最新上新档案 | $0.000001 / 次 | -| DIA | 去中心化、多源预言机价格,按符号或链 + 合约地址查询 | $0.000001 / 次 | -| GoPlus | 代币与地址安全检测 —— 蜜罐/诈骗筛查、恶意地址与高风险授权识别 | $0.000001 / 次 | - -以上服务均属 **金融(Finance)** 类目。请查看各端点的 `x402_routes`,确认当前已发布的 TRON、BNB Chain 和 Base 主网路由——该字段位于 `/api/providers/.json`、`/api/pay/.json` 与 `/api/search-index.json`,只含摘要的 `/api/catalog.json` 里没有。 - -:::note -在架服务清单与统计数字(服务数、链数等)均由目录数据**动态生成**,以 `/api/catalog.json` 的实时内容为准(它只含服务摘要,各端点的路由在上文的单服务文件里),本文不写死具体数量;目录会随新服务上架而增长。 -::: - -## 下一步 - -- 想让你的 Agent 用上这些服务 → [Catalog 快速入门](./get-started.md) -- 想把自己的 API 上架变现 → [上架你的服务](./list-your-service.md) -- 想了解数据结构与接口细节 → [数据格式与 API 参考](./reference.md) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/list-your-service.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/list-your-service.md deleted file mode 100644 index a94e12cf..00000000 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/list-your-service.md +++ /dev/null @@ -1,339 +0,0 @@ ---- -title: 上架你的服务 -sidebar_label: 上架你的服务 -description: 把你的 API 上架到 API 目录 —— 填表申请或直接提交 PR,两份公开文件,官方网关与自建网关均可,上线后即可被全网 AI Agent 发现并按次付费。 ---- - -# 上架你的服务 - -上架一次,此后每一次 AI Agent 调用都是一笔入账。 - -把你的 API 接到网关之后,它就会出现在目录里:任意 Agent 都能发现它、调用它、为它付费。款项实时结算到你指定的钱包,**无平台托管、无结算周期**;可在 TRON、BNB Chain 或 Base 主网上结算;现有 API 保持原样,**无需改动任何代码**,定价也由你自己说了算。 - -## 先看懂全景:上架到底是在做什么 - -上架的全部动作,就是向[目录仓库](https://github.com/BofAI/x402-catalog)提交一个 PR,里面只有两份**公开**文件: - -| 文件 | 作用 | -|---|---| -| `providers//catalog.json` | 供前端、CLI、Agent 使用的公开服务信息 | -| `providers//pay.md` | 人和 Agent 可读的调用与支付说明 | - -其中 `` 是你的服务全局唯一标识(小写字母、数字、连字符),且必须与目录名一致。 - -目录仓库**只保存公开的发现数据**:不保存数据库,也不接收任何上游 API key、token、password、`provider.yml` 或 `.env`。自建网关时,密钥只留在你本地;用官方网关时,凭证托管在网关侧——两种情况下,密钥都**不会进入目录仓库**。 - -动手之前,先做两个决定。 - -## 决定一:用谁的网关 - -这决定两份文件里的调用地址填谁——即各端点的 `url` 及其 `x402Routes[].url`。(`serviceUrl` 填的是服务的公开官网,不是网关地址。) - -| | 官方网关(托管) | 自建网关 | -|---|---|---| -| 文件里的调用地址 | 官方域名(`x402-gateway.bankofai.io/...`) | 你自己的网关域名 | -| 谁运行网关 | BANK OF AI | 你自己 | -| 资金与流量 | 经官方网关转发,结算到你的钱包 | 直达你的网关与钱包,不经过 BANK OF AI | -| 上游凭证放在哪 | 托管给官方网关 | 只留在你本地 | -| 适合谁 | 想最快上线、不想自己部署 | 希望凭证与基础设施完全自主 | - -无论哪种,目录都只负责**发现**:Agent 实际调用的,永远是文件里登记的那个网关地址。 - -## 决定二:选一条提交途径 - -两条途径,终点相同——都是提交那个 PR。 - -**途径一:先填表,我们联系你**(推荐第一次接入) - -1. **提交申请表单** —— 通过[目录页](https://bankofai.io/catalog)底部的 **Apply to list your service** 入口,填写服务名称、简介、API 地址、期望结算网络与联系方式;已注册 ERC-8004 身份地址的可一并填写,会被**优先处理**。 -2. **等待联系** —— 我们会在 **1–2 个工作日**内通过邮箱或 Telegram 联系你,一起确认接口、定价、收款钱包,以及用官方网关还是自建网关。 -3. **提交 PR** —— 沟通确认后,按下文步骤提交两份文件,合入即上线。 - -**途径二:直接提 PR**(熟悉流程的服务方) - -跳过表单,直接按下文步骤准备文件、提交 PR。 - -## 第 1 步:准备两份公开文件 - -**自建网关**:按下文格式编写 `catalog.json` 和 `pay.md`,只包含公开接口、价格和收款信息。编写前,先[运行并验证自己的 Gateway](/zh-Hans/x402/core-concepts/gateway/#run-your-own-gateway)。 - -**官方网关**:接入沟通确认后,按分配给你的官方地址填写两份文件即可,格式参考下面的示例。网关按支付链各分配一个 provider ID,与目录里的 `fqn` 不同,例如 `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron`、`…-bsc` 和 `…-base`。 - -### catalog.json 长什么样 - -SunPump 服务的真实文件 `providers/sunpump-token-launch/catalog.json`: - -```json -{ - "version": 1, - "fqn": "sunpump-token-launch", - "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 Mainnet, BNB Smart Chain and Base Mainnet 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\nTRON Mainnet defaults to `exact` + `permit2` and also supports `exact_gasfree`. First inspect the payment requirements:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\nThen pay and submit the launch request with Wallet CLI:\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network tron:728126428 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\nBNB Smart Chain Mainnet supports `exact` + `permit2`:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network eip155:56 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\n## Base Mainnet payment\n\nBase Mainnet uses official USDC on `eip155:8453` with x402 `exact` and EIP-3009. A successful call still launches the token on TRON Mainnet.", - "useCase": "Use this provider when an app, agent, or CLI workflow needs to launch a SunPump token after a successful x402 payment. Choose a TRON Mainnet, BNB Smart Chain, or Base Mainnet payment route; every successful launch creates the token on TRON Mainnet.", - "i18n": { - "zh-CN": { - "title": "SunPump", - "subtitle": "用结构化元数据一次付费发币。", - "description": "## 能做什么\n\nSunPump Agent 发币 API 允许 Agent、脚本和应用先完成 x402 支付,再把发币元数据提交给 SunPump。Gateway 在支付结算后把调用方的 JSON 请求体转发到 SunPump 发币接口。\n\n## 适合场景\n\n- 需要基于结构化元数据创建 meme token 或 agent token 的 Agent 工作流。\n- 希望用一次付费 API 调用完成发币的运营工具。\n- 在 TRON 主网、BNB Smart Chain 主网和 Base 主网使用同一套 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\nTRON 主网默认使用 `exact` + `permit2`,同时支持 `exact_gasfree`。先查看支付要求:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n然后使用 Wallet CLI 支付并提交发币请求:\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402MainA\",\"symbol\":\"X4M17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network tron:728126428 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\nBNB Smart Chain 主网支持 `exact` + `permit2`:\n\n```bash\ncurl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n -H 'Content-Type: application/json' \\\n --data '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}'\n```\n\n```bash\nwallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \\\n --password-stdin \\\n --method POST \\\n --header 'Content-Type: application/json' \\\n --body '{\"name\":\"X402BscA\",\"symbol\":\"X4B17\",\"description\":\"x402 launch\",\"imageBase64\":\"\",\"twitterUrl\":\"\",\"telegramUrl\":\"\",\"websiteUrl\":\"\",\"tweetUsername\":\"\"}' \\\n --network eip155:56 \\\n --token USDT \\\n --scheme exact \\\n --max-amount 0.000001\n```\n\n## Base 主网支付\n\nBase 主网路由使用 `eip155:8453` 官方 USDC,通过 x402 `exact` + EIP-3009 支付;成功调用仍会在 TRON 主网创建 Token。", - "useCase": "适合应用、Agent 或 CLI 流程在 x402 支付成功后调用 SunPump 发币接口。可选择 TRON 主网、BNB Smart Chain 或 Base 主网支付路由;成功后均在 TRON 主网创建 Token。", - "mainTitle": "一次付费完成 Agent 代币发行" - } - }, - "logo": "https://sunpump.meme/favicon.ico", - "category": "finance", - "chains": [ - "tron:0x2b6653dc", - "eip155:56", - "eip155:8453" - ], - "isFirstParty": true, - "isFeatured": true, - "featuredTags": [ - "sunpump", - "token-launch", - "agent-token", - "tron", - "bsc", - "base" - ], - "serviceUrl": "https://sunpump.meme", - "endpoints": [ - { - "method": "POST", - "path": "/pump-api/ai/agentTokenLaunch", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch", - "x402Routes": [ - { - "network": "tron:0x2b6653dc", - "provider": "sunpump-token-launch-tron", - "scheme": "exact", - "assetTransferMethod": "permit2", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch" - }, - { - "network": "tron:0x2b6653dc", - "provider": "sunpump-token-launch-tron", - "scheme": "exact_gasfree", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch" - }, - { - "network": "eip155:56", - "provider": "sunpump-token-launch-bsc", - "scheme": "exact", - "assetTransferMethod": "permit2", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch" - }, - { - "provider": "sunpump-token-launch-base", - "network": "eip155:8453", - "scheme": "exact", - "assetTransferMethod": "eip3009", - "url": "https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base/pump-api/ai/agentTokenLaunch" - } - ], - "title": "Launch Agent Token", - "subtitle": "Create a SunPump token from metadata", - "description": "Submit token metadata to SunPump after x402 payment settlement. `imageBase64` can carry a base64-encoded token image; when it is empty or omitted, SunPump generates an image automatically. The response includes SunPump status and token data such as token id, owner address, contract address, logo URL, create transaction hash, reserves, and market data when available.", - "useCase": "Use this endpoint when an agent or backend has already validated launch metadata and is ready to create the token.", - "i18n": { - "zh-CN": { - "title": "Agent 发币", - "subtitle": "根据元数据创建 SunPump token", - "description": "在 x402 支付结算后向 SunPump 提交发币元数据。`imageBase64` 可以携带 base64 编码的 token 图片;为空或不传时,SunPump 会自动生成图片。响应包含 SunPump 状态和 token 数据,例如 token id、owner address、contract address、logo URL、create transaction hash、储备和市场数据等。", - "useCase": "适合 Agent 或后端已经校验好发币元数据,准备正式创建 token 的场景。" - } - }, - "metered": true, - "minPriceUsd": 0.000001, - "maxPriceUsd": 0.000001 - } - ], - "status": { - "catalog": "listed", - "gateway": "configured", - "payment": "mainnet", - "upstream": "public" - } -} -``` - -各字段的完整定义见 [数据格式与 API 参考](./reference.md)。 - -### pay.md 怎么写 - -`pay.md` 是人和 Agent 都会读的调用说明,建议包含三部分:服务基本信息、各端点的地址与价格、可直接复制的调用示例。目录仓库的 CI 测试要求每个 `pay.md` 都包含带 `--network tron:728126428` 和 `--scheme exact` 的 `wallet-cli x402 pay` 示例、提到 `exact_gasfree`,并覆盖 Base 主网:文中必须出现 `Base Mainnet`、`eip155:8453`、以 `-base` 结尾的 gateway provider、`USDC` 和 `EIP-3009`,且不得出现 `Sepolia` 或 `eip155:84532`。SunPump 的真实文件 `providers/sunpump-token-launch/pay.md`: - -````markdown -# SunPump Agent Token Launch API - -SunPump Agent Token Launch API is an x402-paid gateway provider for launching a TRON Mainnet SunPump token from structured metadata. It exposes the same launch request shape across TRON Mainnet, BNB Smart Chain and Base Mainnet payment routes. - -Use it when an agent, backend workflow, or CLI script has validated launch metadata and is ready to create a token through a paid API call. - -## Service - -- FQN: `sunpump-token-launch` -- Service URL: `https://sunpump.meme` -- Category: `finance` -- Payment chains: `tron:0x2b6653dc`, `eip155:56`, `eip155:8453` -- TRON schemes: `exact` + `permit2` (default), `exact_gasfree` -- BNB Smart Chain scheme: `exact` + `permit2` -- Base Mainnet scheme: `exact` + official USDC EIP-3009 -- TRON Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron` -- BNB Smart Chain gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc` -- Base Mainnet gateway base: `https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base` - -## CLI Quick Start - -Install or update Wallet CLI and configure an account before paying: - -```bash -npm install -g @tron-walletcli/wallet-cli@4.14.0 -``` - -The examples use the active account. Supply its master password through standard input for `--password-stdin`. `--max-amount` limits the payment in whole units of the selected token. - -Call the route matching the payment chain you want to use. - -TRON Mainnet: - -```bash -curl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \ - -H 'Content-Type: application/json' \ - --data '{"name":"X402MainA","symbol":"X4M17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-tron/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402MainA","symbol":"X4M17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -BNB Smart Chain: - -```bash -curl -sS -X POST 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \ - -H 'Content-Type: application/json' \ - --data '{"name":"X402BscA","symbol":"X4B17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-bsc/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network eip155:56 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402BscA","symbol":"X4B17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -Base Mainnet: - -```bash -wallet-cli x402 pay 'https://x402-gateway.bankofai.io/providers/sunpump-token-launch-base/pump-api/ai/agentTokenLaunch' \ - --password-stdin \ - --method POST \ - --network eip155:8453 \ - --token USDC \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{"name":"X402BaseA","symbol":"X4BA17","description":"x402 launch","imageBase64":"","twitterUrl":"","telegramUrl":"","websiteUrl":"","tweetUsername":""}' -``` - -The Base Mainnet route changes only the payment network. A successful call still creates a token on TRON Mainnet. - -## Endpoint - -### POST /pump-api/ai/agentTokenLaunch - -Create a SunPump token from JSON metadata after x402 payment settlement. - -Required request fields: - -- `name`: token name, 1-20 characters. -- `symbol`: token symbol. Use a unique value. -- `description`: token description. -- `imageBase64`: optional base64-encoded token image. Leave it empty or omit it to let SunPump generate an image automatically. -- `twitterUrl`, `telegramUrl`, `websiteUrl`: optional social links, or empty strings. -- `tweetUsername`: optional tweet username, or an empty string. - -The upstream response returns SunPump status and token launch data such as token id, owner address, contract address, create transaction hash, logo URL, reserves, and market data when available. - -## Integration Notes - -- The endpoint has side effects: a successful paid call can create a token. -- Validate metadata before paying. In particular, keep `name` within 1-20 characters. -- You can provide your own token image with `imageBase64`; otherwise the launch service generates one. -- Current listed prices are fixed per request across all listed payment routes. -- The public catalog does not contain gateway runtime secrets or wallet keys. -```` - -### 提交前的校验清单 - -CI 会强制以下规则,建议提交前逐条对照: - -- `version` 必须为 `1`。 -- `fqn` 为小写字母/数字/连字符,且与目录名一致。 -- `category` 必须是合法类目之一(见[参考](./reference.md#合法类目))。 -- `chains` 至少一条,使用 CAIP-2 风格的链 ID。TRON 链 ID 只能是 `tron:0x2b6653dc`、`tron:0xcd8690dc` 或 `tron:0x94a9059e`,十进制形式(`tron:728126428`)会被拒绝,见[链 ID](./reference.md#链-id)。CI 测试要求每个服务都列出 Base 主网 `eip155:8453`,并拒绝 Base Sepolia `eip155:84532`。 -- `isFirstParty`、`isFeatured`(布尔值)与 `featuredTags`(字符串数组,可为空 `[]`)为**必填**,缺一即校验失败。 -- 每个 endpoint 的 `method` 必须大写、`path` 以 `/` 开头、`maxPriceUsd` 不小于 `minPriceUsd`。 -- `serviceUrl`、各端点 `url` 和各路由 `url` 都必须以 `https://` 开头。 -- 不允许出现未定义的字段——顶层、端点、路由、`i18n.` 和 `status` 都会拒绝未知字段。 -- `x402Routes` 在 schema 中是选填,但 CI 测试要求每个端点恰好发布一条 Base 主网路由:`scheme` 为 `exact`、`assetTransferMethod` 为 `eip3009`,`provider` 以 `-base` 结尾。每条路由的 `network` 都必须出现在 `chains` 里,`exact_gasfree` 只能用于 TRON 网络。每条路由都需要 `network`、`provider`、`scheme` 和 `url`;`exact` 路由还必须带 `assetTransferMethod`(`permit2` 或 `eip3009`),`exact_gasfree` 路由则必须**省略**该字段。同一网络可以出现多次——TRON 通常同时发布 `exact` 与 `exact_gasfree` 两条路由——只要每组 `(provider, network, scheme, url)` 唯一即可。旧的 `fee` / `feeConfig` 字段会被拒绝。详见[参考](./reference.md#x402routes--多网络路由)。 -- 凡有 TRON 路由的端点,第一条 TRON 路由必须是 `exact` + `permit2`(默认方式);服务级 `description`(含 `i18n` 翻译)不得包含 `--scheme exact_gasfree`。 -- 服务与每个 endpoint 都必须提供 `i18n.zh-CN` 的 `title`、`subtitle`、`description`、`useCase`。 -- `status` 可不填;如填写,四个键都必须给出,取值只能是:`catalog` 为 `listed`/`unlisted`;`gateway` 为 `configured`/`unknown`/`unavailable`;`payment` 为 `paid-route`/`mainnet`/`testnet`/`unknown`;`upstream` 为 `public`/`authenticated`/`unknown`/`unavailable`。 -- `pay.md` 必须与 `catalog.json` 一同提交,两份文件都会被敏感信息扫描。 -- 不得包含任何密钥、私钥或内网地址。 - -## 第 2 步:本地自检 - -提交前先安装校验依赖,再在本地跑一遍校验、构建和单元测试(与 CI 的步骤相同)。脚本需要 Python 3.11 或更高版本(CI 用 3.12);在 3.10 上会报 `ImportError: cannot import name 'UTC' from 'datetime'`。 - -```bash -pip install -r requirements.txt -python3 scripts/validate.py -python3 scripts/build.py -python3 -m unittest discover -s tests -``` - -前两条会输出 `validated N provider(s)` 和 `built N provider(s) into dist`,N 是仓库里全部服务的数量(包括你新加的)。 - -:::note 测试里写死的数量 -`tests/test_build.py` 固定了目录当前的若干总数,例如所有服务的 Base 主网路由总数。新服务即使通过 `validate.py`,也可能在这些断言上失败(例如 `AssertionError: 20 != 18`);请在同一个 PR 里更新期望值。 -::: - -## 第 3 步:提交 Pull Request - -把这两份文件加入[目录仓库](https://github.com/BofAI/x402-catalog)对应目录,并一起提交重新生成的 `dist/` 文件: - -```text -providers//catalog.json -providers//pay.md -dist/ -``` - -:::caution 安全红线:这两份文件是公开的 -**绝不要**在其中包含上游 API key、bearer token、钱包私钥、密码、`provider.yml`、`.env`,或任何内网/本地地址(如 `localhost`、`127.0.0.1`、`10.x`、`192.168.x`)。CI 会自动扫描这些模式,命中即拒绝合并。 -::: - -## 第 4 步:合入即上线 - -PR 合入后,发布流程会把最新构建的 `dist/` 刷新到 Catalog Server / CDN,你的服务即在目录中上线,开始接受 Agent 调用。 - -## 下一步 - -- 查看全部字段、类目与接口结构 → [数据格式与 API 参考](./reference.md) -- 想先体验调用方视角?→ [Catalog 快速入门](./get-started.md) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/reference.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/reference.md deleted file mode 100644 index a30db1f2..00000000 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/api-catalog/reference.md +++ /dev/null @@ -1,254 +0,0 @@ ---- -title: 数据格式与 API 参考 -sidebar_label: 数据格式与 API -description: catalog.json / pay.md 的字段定义、合法类目与链 ID,以及 Catalog 静态 API(/api/*)的响应结构。 ---- - -# 数据格式与 API 参考 - -本页是 API 目录的数据契约:服务方向[目录仓库](https://github.com/BofAI/x402-catalog)提交的 `catalog.json` 字段、合法取值,以及目录构建后对外暴露的 `/api/*` 接口结构。 - -## provider catalog.json 字段 - -每个服务在 `providers//catalog.json` 中描述。顶层字段: - -| 字段 | 类型 | 必填 | 说明 | -|---|---|---|---| -| `version` | number | 是 | 固定为 `1` | -| `fqn` | string | 是 | 全局唯一标识,正则 `^[a-z0-9][a-z0-9-]{1,62}$`,须与目录名一致 | -| `title` | string | 是 | 服务名称(通常是简洁品牌名,如 `DefiLlama`) | -| `subtitle` | string | 是 | 一句话副标题 | -| `mainTitle` | string | 否 | 卡片/头部展示用的 tagline(如 `聚合 DeFi 数据 — TVL、价格、收益率`),缺省回退到 `title` | -| `description` | string | 是 | 服务简介 | -| `useCase` | string | 是 | 适用场景,帮助 Agent 判断何时调用 | -| `i18n` | object | 是 | 多语言翻译,至少包含 `zh-CN`(见下) | -| `logo` | string | 是 | Logo 图片 URL | -| `category` | string | 是 | 类目,须为合法取值之一(见[合法类目](#合法类目)) | -| `chains` | string[] | 是 | 结算链,至少一条,CAIP-2 风格 | -| `serviceUrl` | string | 是 | 服务的公开官网(如 `https://defillama.com`),须以 `https://` 开头。网关调用地址填在各端点的 `url` 和 `x402Routes[].url` 里 | -| `endpoints` | object[] | 是 | 端点列表,至少一个(见下) | -| `isFirstParty` | boolean | 是 | 是否自营 | -| `isFeatured` | boolean | 是 | 是否精选(影响目录排序,见[聚合字段与排序](#catalogjson-的聚合字段与排序)) | -| `featuredTags` | string[] | 是 | 精选标签,可为空数组 `[]` | -| `status` | object | 否 | 状态块(见 [status 块](#status-块)) | - -### i18n 翻译 - -`i18n.zh-CN` 为必填,需包含 `title`、`subtitle`、`description`、`useCase` 四项中文翻译,也可以附带 `mainTitle`(中文展示 tagline)。每个 endpoint 同样需要各自的 `i18n.zh-CN`。 - -### endpoint 字段 - -| 字段 | 类型 | 必填 | 说明 | -|---|---|---|---| -| `method` | string | 是 | HTTP 方法,必须大写(如 `GET`) | -| `path` | string | 是 | 路径,必须以 `/` 开头 | -| `url` | string | 是 | 端点完整地址 | -| `title` | string | 是 | 端点名称 | -| `subtitle` | string | 是 | 副标题 | -| `description` | string | 是 | 说明 | -| `useCase` | string | 是 | 适用场景 | -| `i18n` | object | 是 | 端点级中文翻译(同上四项) | -| `metered` | boolean | 是 | 是否按量计费 | -| `minPriceUsd` | number | 是 | 最低价格(美元) | -| `maxPriceUsd` | number | 是 | 最高价格(美元),不小于 `minPriceUsd` | -| `x402Routes` | object[] | 否 | 按网络分的支付路由(见下) | - -### x402Routes —— 多网络路由 - -同一个端点可以在多条链上提供相同能力,每条链通过各自的 gateway provider 和支付方案结算。把这些备选路由列在 `x402Routes` 里,每条路由描述一个网络: - -| 字段 | 类型 | 说明 | -|---|---|---| -| `network` | string | 该路由结算所在的 CAIP-2 链 ID(如 `tron:0x2b6653dc`、`eip155:56`、`eip155:8453`)。TRON 只接受[链 ID](#链-id) 中列出的十六进制形式;`tron:nile` 之类的别名和十进制形式 `tron:728126428` 都会被目录的校验拒绝。 | -| `provider` | string | 处理该网络的 gateway provider `fqn` | -| `scheme` | string | 该路由的 x402 支付方案:`exact`,或在 TRON 上 `exact_gasfree` —— 由每条路由各自声明 | -| `assetTransferMethod` | string | 每条 `exact` 路由都**必须填写**:TRON/BSC 路由使用 `permit2`,Base USDC 路由使用 `eip3009`。只有 `exact_gasfree` 路由应省略该字段。 | -| `url` | string | 该网络路由的完整 gateway URL | - -构建时该字段以 `x402_routes` 透传到产物。存在时,调用方/Agent 按目标支付链选择对应路由;顶层 `url` 仍是默认路由。 - -:::note GasFree 路由 -在 TRON 上,可以为同一端点在 `exact` 路由之外再加一条 `exact_gasfree` 路由:由 relayer 代付网络能量、并从支付代币里扣除手续费,付款方无需 TRX。GasFree 路由仅限 TRON,且不能带 `assetTransferMethod`。自 x402 SDK 1.0.1 起,relayer 费用由客户端估算,因此目录路由**不得**再发布旧的 `fee` 或 `feeConfig` 字段。 -::: - -例如一个端点可以为每条支持的链各提供一条路由 —— TRON 主网、BSC 主网和 Base 主网,各有自己的 `provider` 和 `scheme`。调用时把 `wallet-cli x402 pay` 指向所选路由的 `url`,并传入匹配的 `--network` / `--scheme`: - -```bash -wallet-cli x402 pay --dry-run -o json 'https://x402-gateway.bankofai.io/providers//' \ - --method POST \ - --network tron:728126428 \ - --token USDT \ - --scheme exact \ - --max-amount 0.000001 \ - --header 'Content-Type: application/json' \ - --body '{ ... }' -``` - -其余路由复用同一套请求体,只需替换路由 `url`、`--network` 和该路由声明的 `--scheme`。 - -### status 块 - -`status` 为选填,描述服务各环节的状态,包含 `catalog` / `gateway` / `payment` / `upstream` 四个键;填写时四个键都必须给出。未提供时,构建产物(服务详情)会自动填充默认值: - -```json -{ "catalog": "listed", "gateway": "unknown", "payment": "unknown", "upstream": "unknown" } -``` - -合法取值: - -| 键 | 取值 | -|---|---| -| `catalog` | `listed`、`unlisted` | -| `gateway` | `configured`、`unknown`、`unavailable` | -| `payment` | `paid-route`、`mainnet`、`testnet`、`unknown` | -| `upstream` | `public`、`authenticated`、`unknown`、`unavailable` | - -## pay.md - -与 `catalog.json` 同目录提交、面向人和 Agent 的可读调用说明,为**必交**文件。建议包含:服务基本信息(FQN、入口地址、类目、结算链)、各端点的地址与价格,以及可直接复制的调用示例。目录仓库的 CI 测试要求包含带 `--network tron:728126428` 和 `--scheme exact` 的 `wallet-cli x402 pay` 示例、提到 `exact_gasfree`,并覆盖 Base 主网(须出现 `Base Mainnet`、`eip155:8453`、`-base`、`USDC` 和 `EIP-3009`,不得出现 `Sepolia` 或 `eip155:84532`)。该文件与 `catalog.json` 一样会经过敏感信息扫描(见下)。 - -## 合法类目 - -`category` 必须是以下之一: - -```text -ai_ml cloud compute data -devtools finance identity media -messaging other productivity search -security shopping storage translation -``` - -## 链 ID - -`chains` 采用 CAIP-2 风格的链标识,主网与测试网均可识别: - -:::note TRON ID 格式 -目录 schema 只接受下表中十六进制形式的 TRON 链 ID。x402 SDK(2.0.0 起)和 Wallet CLI 使用十进制 CAIP-2 ID —— `tron:728126428`(主网)、`tron:3448148188`(Nile)、`tron:2494104990`(Shasta)。SDK 仍把十六进制值作为同一条链的已弃用别名接受;Wallet CLI 的全局 `--network`(`x402 pay` 和账户类命令使用)不接受——请用十进制 ID 或 `tron`、`nile`、`shasta` 等别名;只有目录筛选 `x402 provider-list --network` 也接受十六进制写法。因此 CLI 示例传 `--network tron:728126428`,而 `catalog.json` 写 `tron:0x2b6653dc`。 -::: - -| 链 | ID | -|---|---| -| TRON 主网 | `tron:0x2b6653dc` | -| TRON Nile 测试网 | `tron:0xcd8690dc` | -| TRON Shasta 测试网 | `tron:0x94a9059e` —— 仅 schema 层面接受:gateway 没有 Shasta 代币注册表,官方 facilitator 也不结算,因此无法支撑真实路由 | -| BNB Chain (BSC) | `eip155:56` | -| BNB 测试网 | `eip155:97` | -| Base 主网 | `eip155:8453` | -| Base Sepolia 测试网 | `eip155:84532` —— 仅 schema 层面可用:构建脚本没有它的展示元数据,`label` 会回退成原始链 ID,`chain_kinds` 也会报 `evm` 而不是 `base`;目录仓库的 CI 测试也不允许它出现在 `chains` 里 | - -各端点的路由(`x402_routes`)发布在 `/api/providers/.json` 和 `/api/pay/.json` 中,只含摘要的 `/api/catalog.json` 里没有。构建时会把每个链 ID 解析为展示元数据(`kind` / `label` / `label_zh`),前端无需自己解析 CAIP-2 —— 见[前端展示字段](#前端展示字段)。 - -## 校验与安全扫描 - -提交会经过字段校验与敏感信息扫描,命中任意一项即被拒绝。扫描覆盖: - -- **密钥字段名**:`api_key`、`secret`、`password`、`token`、`authorization`、`bearer`、`private_key`、`provider.yml`、`.env` 等。 -- **密钥值**:形如 `sk-...`、`Bearer ...` 的令牌,以及 `0x` 开头的 64 位十六进制(私钥特征)。 -- **私网地址**:`localhost`、`127.0.0.1`、`0.0.0.0`、`10.x`、`192.168.x`、`172.16-31.x` 等。 - -`catalog.json` 与 `pay.md` 都会被扫描。 - -## 生成产物与 API - -CI 构建后生成静态快照 `dist/`,由 Catalog Server 通过 `/api/` 路径对外提供(支持 CORS): - -| 接口 | 内容 | -|---|---| -| `GET /api/catalog.json` | 列表页数据:服务摘要数组 + 聚合统计 + 前端配置 | -| `GET /api/categories.json` | 出现过的类目及其计数 | -| `GET /api/search-index.json` | 轻量搜索索引 | -| `GET /api/providers/.json` | 单个服务详情(完整 endpoints + status) | -| `GET /api/pay/.json` | 供 Agent / CLI 读取的支付与调用摘要 | -| `GET /api/pay/.md` | 可读版调用说明 | -| `GET /api/status.json` | 构建状态与服务数 | - -### catalog.json 的聚合字段与排序 - -列表接口除 `providers` 数组外,还包含动态统计,前端应直接读取,不要写死: - -| 字段 | 说明 | -|---|---| -| `version` | 固定为 `1` | -| `base_url` | 静态 API 基地址 | -| `provider_count` | 在架服务总数 | -| `first_party_count` | 自营服务数 | -| `chain_count` | 覆盖链数 | -| `generated_at` | 构建时间(UTC) | -| `frontend.featured_fqns` | 精选服务的 `fqn` 列表 | -| `frontend.categories` | 在用类目 —— 每项为 `{ id, label, label_zh, count }` | -| `frontend.chains` | 在用链 —— 每项为 `{ id, kind, label, label_zh, count }` | - -`providers` 数组在构建时已按 **精选优先 → 类目 → fqn** 排序,前端按原顺序渲染即可。筛选项请用 `frontend.categories` / `frontend.chains` 驱动(含其 `label` / `label_zh` 展示名),不要写死类目或链列表。 - -### 派生字段 - -构建产物在原始字段基础上会补充派生字段,并把顶层和端点的字段名转为 snake_case(如 `useCase` → `use_case`、`x402Routes` → `x402_routes`)。`i18n` 块和 `x402_routes` 里的路由对象原样保留,仍是 `mainTitle`、`assetTransferMethod` 这样的 camelCase: - -| 字段 | 说明 | -|---|---| -| `endpoint_count` | 端点数量 | -| `has_metering` | 是否存在按量计费端点 | -| `has_free_tier` | 是否存在 `minPriceUsd` 为 0 的端点 | -| `min_price_usd` / `max_price_usd` | 该服务所有端点的价格区间 | -| `sha` | `catalog.json` + `pay.md` 的内容哈希,用于变更检测 | - -### 前端展示字段 - -为省去前端解析原始 ID 和挑选译文,构建还会在每个服务摘要和详情上输出可直接渲染的字段: - -| 字段 | 说明 | -|---|---| -| `title_zh` | 中文服务名(取自 `i18n.zh-CN.title`,回退到 `title`) | -| `main_title` | 展示 tagline(取自 `mainTitle`,回退到 `title`) | -| `main_title_zh` | 中文展示 tagline(取自 `i18n.zh-CN.mainTitle` / `mainTitle`,回退到 `title`) | -| `sub_title` | 次级展示行(取自 `subtitle`) | -| `sub_title_zh` | 中文次级展示行(取自 `i18n.zh-CN.subtitle`,回退到 `subtitle`) | -| `category_meta` | 类目的 `{ id, label, label_zh }` | -| `chain_kinds` | 去重后的友好链类型,如 `["tron"]`、`["bnb"]`、`["base"]` | -| `chains_meta` | 每条链的 `{ id, kind, label, label_zh }`,前端无需解析 CAIP-2 | - -这些是增量字段 —— 原始的 `title`、`subtitle`、`category`、`chains`、`i18n.zh-CN` 依然保留。 - -### 其它产物结构 - -- **`/api/pay/.json`**:供 Agent / CLI 读取的支付摘要。顶层包含 `version`、`fqn`、`title`、`title_zh`、`main_title`、`main_title_zh`、`sub_title`、`sub_title_zh`、`subtitle`、`description`、`use_case`、`i18n`、`service_url`、`chains`、`chain_kinds`、`chains_meta`、`sha`;`endpoints[]` 保留调用所需字段 `method`、`path`、`url`、`description`、`metered`、`min_price_usd`、`max_price_usd`,端点定义了多网络路由时还会带 `x402_routes`。 -- **`/api/search-index.json`**:`{ version, generated_at, documents[] }`,每个 document 只含部分服务字段——`fqn`、`title`、`subtitle`、`description`、`use_case`、`category`、`category_meta`、`chains`、`chain_kinds`、`chains_meta`、`featured_tags`、`service_url`——再加上端点的 `method` / `path` / `title` / `description`(存在时还有 `x402_routes`)。 -- **`/api/categories.json`**:出现过的类目数组,每项为 `{ id, label, label_zh, count }`,是 `frontend.categories` 的直接导出。 -- **`/api/status.json`**:`{ version, generated_at, provider_count, status }`,`status` 为 `ok` 时表示构建正常。 - -## 本地构建与运行 - -需要 Python 3.11 或更高版本。 - -```bash -# 安装校验依赖(jsonschema) -pip install -r requirements.txt - -# 校验所有 provider -python3 scripts/validate.py - -# 构建静态快照到 dist/ -python3 scripts/build.py - -# 运行单元测试 -python3 -m unittest discover -s tests -``` - -容器方式(构建时先校验并生成 `dist/`,再从 `/api/` 提供): - -```bash -docker compose build catalog -docker compose up -d catalog -curl http://127.0.0.1:8088/api/status.json -``` - -端口可用环境变量 `X402_CATALOG_PORT` 覆盖(默认 `8088`,容器内部监听 `8080`)。 - -:::note CI 调度 -目录仓库的 CI(GitHub Actions)会在每个 PR、推送到 `main`、发布标签时以及每 30 分钟运行一次校验、构建和单元测试,也可以手动触发。 -::: - -## 相关页面 - -- [上架你的服务](./list-your-service.md) —— 提交流程与安全红线 -- [快速开始](./get-started.md) —— 调用方接入方式 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/OfficialFacilitator.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/OfficialFacilitator.md index c342fad7..0c7c3fea 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/OfficialFacilitator.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/OfficialFacilitator.md @@ -1,3 +1,7 @@ +--- +title: '官方 Facilitator' +description: '官方 x402 Facilitator 的接入、API Key 管理、缓存刷新与认证故障处理。' +--- # 官方 Facilitator @@ -131,6 +135,18 @@ curl -X POST https://facilitator.bankofai.io/settle \ --- +### Key 刷新与暂时性认证故障 + +Facilitator v2.3.2 从 DevCenter 读取活动 Key 并缓存;内置生产配置每 **5 秒**刷新一次。新建和删除 Key 都须等到下一次成功刷新后才会影响认证,不能视为即时生效。各进程独立刷新,多副本不保证同时生效,数据库读取耗时也会影响实际生效时间。 + +缓存仍有效时,错误、尚未同步或已同步撤销的 Key 会按匿名请求处理,不会统一返回 401;成功调用不代表 Key 已被识别。尤其是按交易哈希或授权身份查询记录时,只有**有效且已识别的 Key**才会应用卖家过滤。 + +如果 DevCenter 暂时不可用,已有快照最多继续使用三个刷新间隔(生产配置为 **15 秒**,从最后一次成功读取起算)。达到期限后,带 `X-API-KEY` 的 `/verify`、`/settle`、`/payments` 与 `/payments/tx/{tx_hash}` 返回 HTTP **503**,原因码为 `api_key_auth_unavailable`,直到刷新恢复。该错误不带 `Retry-After`;请保留 Key 并退避重试,不要删除认证头来绕过错误。匿名请求继续遵循原有策略。 + +各接口的具体错误响应见 [Facilitator API Key 缓存说明](../facilitator#api-key-缓存与认证不可用)。 + +--- + ## 申请 API Key 要解锁生产级别的吞吐量,请在管理后台免费申请 API Key:[https://admin-facilitator.bankofai.io](https://admin-facilitator.bankofai.io) @@ -145,7 +161,7 @@ curl -X POST https://facilitator.bankofai.io/settle \ - **API Key 泄露等同于身份泄露**:任何持有你的 API Key 的人都可以以你的名义消耗你的限速配额,请像保护密码一样保护它。 - **不要提交到代码仓库**:确保 `.env` 文件已添加到 `.gitignore`,避免将密钥上传到 GitHub 等公共平台。 -- **每个账户限 1 个 Key**:如果你认为 Key 已泄露,请登录管理后台删除旧 Key 并重新创建,旧 Key 将立即失效。 +- **每个账户限 1 个 Key**:如果你认为 Key 已泄露,请登录管理后台删除旧 Key 并重新创建,旧 Key 在 Facilitator 下一次成功刷新 Key 缓存后失效。 - **签名授权不等于转账**:登录时的钱包签名仅用于身份验证,不会触发任何资产转移。 ::: @@ -237,7 +253,7 @@ curl -X POST https://facilitator.bankofai.io/settle \ 点击 **"确认"** 后,你将回到 Dashboard 页面,API Key 默认以隐藏状态显示。你可以通过以下方式管理: - **查看 / 隐藏**:点击 API Key 右侧的 **View** 按钮,即可在明文显示与隐藏之间切换。无论当前是显示还是隐藏状态,都可以直接复制 Key。 -- **删除**:点击最右侧的 **Delete** 按钮,可以删除当前 API Key。删除后旧 Key 立即失效,你可以重新创建一个新的 Key。 +- **删除**:点击最右侧的 **Delete** 按钮,可以删除当前 API Key。删除后旧 Key 在 Facilitator 下一次成功刷新 Key 缓存后失效,你可以重新创建一个新的 Key。
提供 API Key 时,这两个接口只返回与你的账户关联的支付记录,不会看到其他卖家的数据。 +> 提供有效且已被 Facilitator 识别的 API Key 时,这两个接口只返回与你的账户关联的支付记录,不会看到其他卖家的数据。 :::danger 不带 API Key 时 匿名请求下,`tx_hash` 与 `network` + `nonce` 查询**不添加卖家过滤**,返回结果可能包含已绑定卖家的记录——任何持有准确标识符的人都能查到对应记录。`/payments` 列表接口仍要求身份验证,因此不存在免认证的列表接口;但这两个查询接口也没有限流(官方服务按每个 IP 每分钟 10 次的匿名限流只覆盖 `/verify` 与 `/settle`),而结算 tx hash 又是链上公开数据。请把结算元数据视为事实上公开,而非按卖家隔离。 @@ -317,7 +333,7 @@ curl -X POST https://facilitator.bankofai.io/settle \ **Q:API Key 会过期吗?** -目前 API Key 不会主动过期,但如果你主动删除并重新创建,旧 Key 将立即失效。 +目前 API Key 不会主动过期,但如果你主动删除并重新创建,旧 Key 在 Facilitator 下一次成功刷新 Key 缓存后失效。 **Q:我可以在多个项目中使用同一个 API Key 吗?** @@ -325,7 +341,7 @@ curl -X POST https://facilitator.bankofai.io/settle \ **Q:我想更换 API Key,怎么操作?** -登录管理后台后,在 Dashboard 点击 **Delete** 删除当前 Key,然后重新点击 **"创建 API Key"** 即可生成新的 Key。删除后旧 Key 立即失效,请确保在删除前已将新 Key 更新到所有使用中的项目里,避免服务中断。 +登录管理后台后,在 Dashboard 点击 **Delete** 删除当前 Key,然后重新点击 **"创建 API Key"** 即可生成新的 Key。删除后旧 Key 在 Facilitator 下一次成功刷新 Key 缓存后失效。每个账户限一个 Key,请安排更换窗口:删除旧 Key、创建新 Key、更新所有使用中的项目,并等待缓存刷新后验证调用。 **Q:Facilitator 会持有我的资金吗?** diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/client-server.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/client-server.md index 3702c53c..30a333de 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/client-server.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/client-server.md @@ -56,7 +56,7 @@ import ThemedImage from '@theme/ThemedImage'; 2. **服务端要求付费**:响应 `402 Payment Required` 状态码,并在 `PAYMENT-REQUIRED` 标头中包含支付要求(Base64 编码)。 3. **客户端提交支付**:根据要求生成签名,并将签名载荷放入 `PAYMENT-SIGNATURE` 标头(Base64 编码)中重新发送请求。 4. **服务端验证支付**:调用 Facilitator 服务对接收到的支付载荷进行验证。 -5. **服务端先交付资源、再结算**:在默认的 `authorization` 付款流程下——所有内置方案声明的都是这个流程——资源服务端会先执行业务处理函数,之后再通过 Facilitator 结算,并在返回资源时于 `PAYMENT-RESPONSE` 标头中带上结算确认信息(内含交易哈希)。若服务端选用了「先结算」的流程,以及 BANK OF AI 网关,则顺序相反:先结算再转发到上游。 +5. **服务端先交付资源、再结算**:在默认的 `authorization` 付款流程下——所有内置方案声明的都是这个流程——资源服务端会先执行业务处理函数,之后再通过 Facilitator 结算,并在返回资源时于 `PAYMENT-RESPONSE` 标头中带上结算确认信息(内含交易哈希)。若服务端选用了「先结算」的流程,则顺序相反:先结算再交付资源。 /v1/...`,其中的 id 来自目录条目的 `url`,并不是目录 FQN),不会直接触达你的上游 API。 -- **网关负责转发**。验款通过(或端点免费)后,网关把请求代理到上游,再把上游响应体原样返回给 Agent——会剥离固定的一批响应头——逐跳头,外加 `set-cookie`、`authorization`、`content-encoding`、`content-length` 以及全部 x402 支付相关头(因此上游的 `PAYMENT-RESPONSE` 绝不会透传出去)——并加上 `PAYMENT-RESPONSE` 头;运营方还可以配置响应契约,把上游返回 `200` 但业务失败的情况转成网关错误。 -- **永远不需要钱包私钥**。收款只用一个钱包**地址**;调用方用自己的钱包在链上付费。网关两侧都不碰任何私钥。 -- **上游密钥不外泄**。如果你的上游接口需要鉴权,那个 API Key 只待在运行网关的那一侧——自建网关时留在你本地的 yaml 或环境变量,用官方网关时由我们托管。无论哪种,调用方全程接触不到,密钥也不会进入公开目录。 -- **收不收费由你按端点决定**。在配置中为端点定价即走付费流程;不定价(价格为 0)的端点直接转发,免费接口依然免费。 - - - -## 一次调用的完整流程 - -### 付费端点:HTTP 402 流程 - -每一笔付费调用都通过 x402 在链上清算——响应中返回的报价始终是唯一真实价格。 - -1. **Agent 发起调用** —— 请求目标接口。 -2. **网关报价** —— 返回价格(HTTP `402`)。 -3. **钱包授权** —— 客户端签署所选支付要求,并携带 `PAYMENT-SIGNATURE` 请求头重试。 -4. **验款并结算** —— facilitator 验证签名载荷,并在链上把款项结算至你的收款钱包。 -5. **返回结果** —— 网关把请求转发到上游 API,将结果返回给 Agent。 - -### 免费端点:直接转发 - -未定价的端点没有报价环节,也不发生任何链上交易: - -1. **Agent 发起调用** —— 请求目标接口。 -2. **网关直接转发** —— 代理到上游 API,把结果返回给 Agent。 - -也就是说,同一个服务可以付费端点与免费端点并存——比如 `/v1/current` 按次收费,而 `/v1/ping` 保持免费。Agent 通过目录输出里该端点的 `metered` 标志与 `min_price_usd` 来区分(并没有单独的「免费端点」标记)。目前目录里已发布的端点全部是计费的,因此这属于网关具备的能力,而非当前上架服务已经在用的特性。 - -:::note -无论付费与否,调用方靠链上付费获得访问权,不需要任何 API Key;上游凭证(如有)始终保留在网关侧,调用方 Agent 全程无法接触。 -::: - -## 为供需双方而建 - -提供方将每一次调用转化为现金流,Agent 将每一次调用转化为能力,网关连接供需两端。 - -### 面向 API 提供方:上架 API,让每一次调用都产生收入 - -- **资金直接入账** —— 款项实时结算至收款钱包,无平台托管,无结算周期。 -- **原生多链** —— 可根据服务商发布的路由在 TRON、BNB Chain 或 Base 主网结算。 -- **零改动接入** —— 现有 API 保持原样,无需改动任何代码。 -- **定价自主** —— 可按接口、按档位灵活定价,免费接口依然免费。 - -→ [上架你的 API](../api-catalog/list-your-service.md) - -### 面向 AI Agent:一个目录,汇聚海量 API,按需付费 - -- **当前用 CLI 发现** —— `wallet-cli x402 provider-list` / `provider-show` / `endpoint-list` 可定位所需 API 及其路由。通过 MCP 付款由 `@x402/mcp` 支持;支持目录发现的 MCP 尚未发布。 -- **按次计费** —— 无需订阅,无最低消费。 -- **实时价格透明** —— 网关在 `402` 响应中返回实时计算的价格,客户端授权会绑定所选支付要求;报价本身并不是网关的密码学签名。 -- **无账号、无密钥** —— 钱包即身份,无需注册或管理任何 API Key。 - -→ [浏览 API 目录](../api-catalog/index.md) - -## 怎么把你的 API 接进来 - -三步即可上线,现有 API 无需任何改动: - -1. **选网关** —— 用 BANK OF AI 官方托管的网关,或自己部署一个(两种方式的区别见下)。 -2. **定好价目表** —— 确定接口、各端点定价与收款钱包;无需集成 SDK,无需重写任何代码。 -3. **上架目录** —— 向目录仓库提交两份公开文件(可先填表申请,由我们联系协助)。服务出现在 [API 目录](../api-catalog/index.md) 后,任意 Agent 都能发现、调用并自动付费。 - -完整步骤见 [上架你的服务](../api-catalog/list-your-service.md)。 - -### 官方网关,还是自己运行? - -- **官方网关(托管)**:由 BANK OF AI 运行网关,代理你的 API 并处理收款,你无需部署任何东西;上架文件里的调用地址填官方域名(形如 `x402-gateway.bankofai.io/providers/`)。 -- **自己运行网关**:在自己的机器上部署网关,上游凭证与收款配置只留在本地;上架文件里的调用地址填你自己的域名。适合希望完全自主掌控凭证与基础设施的服务方。部署步骤见[自建网关](#run-your-own-gateway)。 - -无论哪种方式,调用方 Agent 的体验完全一致:发现、报价、付款、调用走的都是同一套 x402 流程。 - -:::note 自建网关了,为什么还要上架目录? -网关和目录解决的是两件事:**网关负责收钱,目录负责让你被发现**。目录只是一份公开的服务清单,不经手任何调用与资金——Agent 调用的永远是目录里登记的网关地址。自建网关时,登记的就是你自己的域名,流量与款项直接到你;上架的意义在于:所有接入 BANK OF AI 目录的 Agent、CLI 用户与目录站访客都能发现并调用你的服务,而不只是知道你域名的人。 -::: - -## 自建网关 {#run-your-own-gateway} - -以下步骤基于网关 **v1.0.5**,使用 Docker 镜像 `bankofai/x402-gateway:v1.0.5`。该版本搭配 `@bankofai/x402-tron` / `@bankofai/x402-tron-extensions` **2.1.1** 与官方 `@x402/core` **2.29.0**,仓库与 Docker 安装将 Zod 固定为 **4.6.6**。源码安装要求 Node.js **24.22.1+(24.x)或 26.12.1+**;Docker 与 CI 固定为 24.22.1。完整说明见 [x402-gateway v1.0.5 README](https://github.com/BofAI/x402-gateway/blob/v1.0.5/README.md)。 - -### 1. 编写 provider 文件 - -每个 provider 单独一个目录,文件名为 `provider.yml`(或 `provider.yaml`),例如 `providers/example/provider.yml`: - -```yaml -name: example-provider -forward_url: ${X402_PROVIDER_FORWARD_URL} - -operator: - network: tron:3448148188 # TRON Nile;主网为 tron:728126428 - currencies: - usd: ["USDT"] - recipient: ${X402_PROVIDER_RECIPIENT} - scheme: exact - protocol: exact - facilitator_url: ${X402_FACILITATOR_URL} - facilitator_api_key_env: X402_FACILITATOR_API_KEY - valid_for_seconds: 300 - -endpoints: - - method: GET - path: /v1/ping - metering: - dimensions: - - tiers: - - price_usd: 0.002 -``` - -- `network` 必须是十进制 CAIP-2 ID,`tron:nile` 之类的别名会被拒绝。 -- `recipient` 填收款**地址**,网关不需要任何私钥。 -- 没有 `metering` 的端点免费转发。 -- 上游需要 API Key 时,添加 `routing.auth` 配置,从环境变量读取。详见 README 的 *Provider Config* 一节。 - -### 2. 配置环境变量 - -在 `providers/` 目录旁创建 `.env`,写入 YAML 引用的变量: - -```bash -X402_PROVIDER_FORWARD_URL=https://api.example.com -X402_PROVIDER_RECIPIENT=<你的收款地址> -X402_FACILITATOR_URL=https://facilitator.bankofai.io -X402_FACILITATOR_API_KEY= -X402_GATEWAY_ADMIN_TOKEN= -X402_GATEWAY_PUBLIC_BASE_URL=https://gateway.example.com -``` - -`X402_GATEWAY_PUBLIC_BASE_URL` 是 Agent 调用的公网地址,也是你在目录中登记地址的前缀。由于配置了 `facilitator_api_key_env`,缺少 `X402_FACILITATOR_API_KEY` 时网关会拒绝启动。Facilitator API Key 的获取方式见[官方 Facilitator](./OfficialFacilitator.md)。 - -### 3. 校验配置 - -```bash -docker run --rm --env-file .env \ - -v "$PWD/providers:/app/providers:ro" \ - bankofai/x402-gateway:v1.0.5 \ - x402-gateway check --providers /app/providers -``` - -`check` 校验 YAML 语法、必填字段、环境变量展开、网络 ID 和端点格式,不会调用上游、Facilitator 或链。 - -### 4. 启动网关 - -```bash -docker run -d --name x402-gateway --env-file .env \ - -p 4020:8080 \ - -v "$PWD/providers:/app/providers:ro" \ - bankofai/x402-gateway:v1.0.5 -``` - -镜像在容器内监听 `0.0.0.0:8080`。生产环境请按 README 建议,用镜像 digest 而不是 tag 固定版本。 - -### 5. 检查健康状态和付款挑战 - -```bash -curl http://127.0.0.1:4020/__402/health -curl -i http://127.0.0.1:4020/providers/example-provider/v1/ping -``` - -`curl -i` 请求的是计费端点,应返回 `402 Payment Required`,并带有 `PAYMENT-REQUIRED` 响应头。路径中的 provider 段即 YAML 里的 `name`。两项检查都通过、公网地址可访问后,继续阅读[上架你的服务](../api-catalog/list-your-service.md)。 - -### 可选:赞助首次 TRON 授权 - -如果希望 Facilitator 为用户首次 `approve(Permit2)` 提供资源赞助,请在已有的 TRON `exact` Permit2 计费端点中添加 `payment` 配置。例如,将上述 `/v1/ping` 端点改为: - -```yaml -endpoints: - - method: GET - path: /v1/ping - payment: - trc20_approval_resource_sponsoring: true - metering: - dimensions: - - tiers: - - price_usd: 0.002 -``` - -这会在 402 挑战中声明 `trc20ApprovalResourceSponsoring`。客户端还须注册 `createTrc20ApprovalResourceSponsoringClientExtension(signer)`,Facilitator 也须启用对应资源赞助 runtime;仅设置网关标志不会完成这些配置。该标志要求端点包含 TRON `exact` Permit2 付款选项,不适用于纯 EVM 或纯 GasFree 端点。官方 Facilitator 的 Nile USDT 赞助要求 API Key;详见[官方 Facilitator](/x402/core-concepts/OfficialFacilitator/)。 - -普通付款的 Facilitator 请求超时由 `X402_GATEWAY_FACILITATOR_TIMEOUT_MS` 控制,默认 10,000 毫秒。受赞助的 TRON Permit2 付款与 GasFree 付款分别使用 `X402_GATEWAY_RESOURCE_SPONSORING_TIMEOUT_MS` 和 `X402_GATEWAY_GASFREE_TIMEOUT_MS`,默认取 240,000 毫秒与普通超时中的较大值。这些设置覆盖单次 Facilitator 调用及完整响应体读取;不会延长客户端上传请求的超时。只有端点启用了资源赞助且付款携带对应扩展时,才使用资源赞助专用超时。 - -### 付款失败响应 - -付款成功后,网关返回上游响应,并通过 `PAYMENT-RESPONSE` 响应头携带结算结果。v1.0.5 将已使用的 Permit2 授权明确映射为客户端错误:当 Facilitator 返回 `success: false`、匹配的网络、`errorReason: "permit2_nonce_consumed"` 且 `transaction: ""` 时,网关返回 **HTTP 400**,不调用上游: - -```json -{"error":"payment authorization already used","code":"permit2_nonce_consumed"} -``` - -当 Facilitator 的 HTTP 请求成功,但返回的结算结果不成功或网络与所选付款要求不匹配时,除上述已使用授权的情况外,网关返回 **HTTP 502**: - -```json -{"error":"settlement failed"} -``` - -Facilitator 的 HTTP 错误与超时使用不同的响应。如果 Facilitator 返回 HTTP 429 且响应是有效 JSON,网关返回 **HTTP 429**,并在上游提供时转发 `Retry-After`: - -```json -{"error":"facilitator rate limited"} -``` - -如果调用 Facilitator 超时(包括读取响应体超时),网关返回 **HTTP 504**: - -```json -{"error":"facilitator request timed out"} -``` - -这些发生在 Facilitator 验证或结算阶段的失败都不会将请求转发到上游 API,也不包含 `PAYMENT-RESPONSE`。不要重放已使用的授权。结算超时不代表未付款:Facilitator 仍可能完成交易。若发生超时或结算状态不明确,应先核对原交易和付款记录,再决定是否发起新付款。 - -### 已结算,但上游 API 调用失败 - -付款结算成功后,网关才调用上游 API。如果之后发生连接失败、超时或配置的业务响应校验失败,网关返回对应错误状态(通常为 **502**;上游超时为 **504**),响应体为: - -```json -{"error":"upstream failed after payment settlement","settled":true} -``` - -此响应仍包含 `PAYMENT-RESPONSE` 结算凭证。应保存凭证和交易 ID,并据此处理交付失败;不要把它当成未付款而自动创建新付款。若上游仅返回 HTTP 错误,且未触发配置的业务响应校验失败,网关会透传上游状态与响应体,同时保留 `PAYMENT-RESPONSE`。因此,不能仅凭 HTTP 状态码判断是否已结算。 - -## 下一步 - -- [上架你的 API](../api-catalog/list-your-service.md) —— 提交流程、所需信息与安全红线 -- [浏览 API 目录](../api-catalog/index.md) —— 看看已经在架的服务 -- [API 目录·快速开始](../api-catalog/get-started.md) —— 从调用方视角接入 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/network-and-token-support.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/network-and-token-support.md index 210d9636..9906db85 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/network-and-token-support.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/core-concepts/network-and-token-support.md @@ -23,7 +23,7 @@ x402 采用 CAIP-2 网络标识符格式:`tron:`(十进制 | **TRON Shasta** | `tron:2494104990` | `TRON_SHASTA` | TRON Shasta 测试网 | | **TRON Nile** | `tron:3448148188` | `TRON_NILE` | TRON Nile 测试网 | -> **TRON 标识格式**:自 `@bankofai/x402-tron` 2.0.0 起,SDK 常量使用十进制 CAIP-2 引用。旧的十六进制形式(`tron:0x2b6653dc`、`tron:0xcd8690dc`、`tron:0x94a9059e`)仍可作为输入别名使用,并会被规范化为十进制形式。官方 facilitator 的 `/supported` 返回十进制标识;API Catalog 目前仍列出十六进制形式。 +> **TRON 标识格式**:自 `@bankofai/x402-tron` 2.0.0 起,SDK 常量使用十进制 CAIP-2 引用。旧的十六进制形式(`tron:0x2b6653dc`、`tron:0xcd8690dc`、`tron:0x94a9059e`)仍可作为输入别名使用,并会被规范化为十进制形式。官方 facilitator 的 `/supported` 返回十进制标识。 ## BSC 网络标识符 @@ -44,7 +44,7 @@ Base 在 x402 链路中使用标准 EIP-155 标识符: | 网络名称 | 协议标识符 | 说明 | | :------- | :--------- | :--- | -| **Base Mainnet** | `eip155:8453` | 生产网络;API Catalog 发布该网络路由 | +| **Base Mainnet** | `eip155:8453` | 生产网络 | | **Base Sepolia** | `eip155:84532` | CLI/SDK 测试网络 | Base 主网使用官方 USDC,通过 `exact` 方案和 EIP-3009 授权完成支付。付款方在链下签署 `transferWithAuthorization`,无需 Permit2 approve。 @@ -64,7 +64,7 @@ x402 专为区块链生态设计,实现了原生的链上支付验证与结算 | **BSC Mainnet** | **Mainnet** | **生产网络**:用于处理真实价值资产。 | | **BSC Testnet** | **Testnet** | **推荐测试网**:BSC 首选的开发与调试环境。 | | **Base Mainnet** | **Mainnet** | **生产网络**:使用官方 USDC。 | -| **Base Sepolia** | **Testnet** | CLI/SDK 测试;不在 API Catalog 发布。 | +| **Base Sepolia** | **Testnet** | CLI/SDK 测试 | ## 支持的代币 {#supported-tokens} diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/faq.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/faq.md index d423f4bb..1305e07a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/faq.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/faq.md @@ -155,11 +155,13 @@ x402 定义了五种命名支付方案。其中四种可端到端使用;`auth- 在您的 TypeScript 应用中安装已发布的 npm 包并基于这些包开发,例如: ```bash -pnpm add @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.1 @x402/evm@2.29.0 @bankofai/agent-wallet +pnpm add @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.2 @x402/evm@2.29.0 @bankofai/agent-wallet pnpm add @x402/express@2.29.0 ``` -请根据服务框架选择对应包(`@x402/express`、`@x402/hono`、`@x402/fastify` 或 `@x402/next`),版本与 `@x402/core` 一致为 `2.29.0`——`@bankofai/x402-tron` 2.1.1 要求精确的 `@x402/core@2.29.0`。仅在使用 TRON 资源赞助时再安装 `@bankofai/x402-tron-extensions@2.1.1`。[`examples/typescript`](https://github.com/BofAI/x402/tree/main/examples/typescript) 工作区是 client → server → facilitator 流程的可运行参考,不是应用开发的前置条件。 +请根据服务框架选择对应包(`@x402/express`、`@x402/hono`、`@x402/fastify` 或 `@x402/next`),版本与 `@x402/core` 一致为 `2.29.0`——`@bankofai/x402-tron` 2.1.2 要求精确的 `@x402/core@2.29.0`。仅在使用 TRON 资源赞助时再安装 `@bankofai/x402-tron-extensions@2.1.2`。[`examples/typescript`](https://github.com/BofAI/x402/tree/main/examples/typescript) 工作区是 client → server → facilitator 流程的可运行参考,不是应用开发的前置条件。 + +业务项目还需自行配置 TronWeb 的 HTTP 依赖覆盖,见[依赖安全](/zh-Hans/x402/sdk-features/#dependency-security)。 升级现有应用时,请同步升级所有官方 `@x402/*` 传输包;若使用 `@x402/core/schemas`,需迁移到 Zod 4,并将 `error.errors` 改为 `error.issues`。详见 [SDK 功能矩阵](/x402/sdk-features/)。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-agent.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-agent.md index 15e57082..14516f98 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-agent.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-agent.md @@ -9,15 +9,15 @@ description: "使用 wallet-cli 配置 Agent 的支付入口。" 1. 按 [Wallet CLI 快速入门](/zh-Hans/wallet-cli/quickstart/)安装 CLI,在本地配置账户并核对地址。 2. 如需 Skill,按 [Skills 快速入门](/zh-Hans/McpServer-Skills/SKILLS/QuickStart/)选择安装;核对 Skill 的依赖版本与 CLI 一致。 -3. 从 [API Catalog](/zh-Hans/x402/api-catalog/get-started/)查询接口,先运行 `wallet-cli x402 pay` 的 `--dry-run` 预览。 +3. 向服务提供方获取 x402 接口 URL,先运行 `wallet-cli x402 pay` 的 `--dry-run` 预览。 4. 向用户展示网络、收款地址、币种、金额和费用;得到相应授权后,使用已批准的安全密码来源进行签名。 5. 检查结构化结果,保留交易哈希;不要把“已提交”或“入账未确认”报告为全部完成。 可以这样要求 Agent: -> 使用 wallet-cli 查看 DIA 的 BTC 报价接口。先预览 TRON 主网 USDT 支付要求,上限 0.01,不要付款。 +> 使用 wallet-cli 查看本地测试接口 `http://localhost:4021/credit`。先用 `--dry-run` 预览 TRON Nile(`tron:3448148188`)的 USDT 支付要求,上限 1 USDT,不要签名或付款。 -不要把私钥或主密码输出到聊天、日志或命令参数中。无需为了验证配置而执行 `echo` 打印私钥。测试支付应使用你控制的测试网收费接口;目录中的生产服务可能只支持主网。 +不要把私钥或主密码输出到聊天、日志或命令参数中。无需为了验证配置而执行 `echo` 打印私钥。测试支付应使用你控制的测试网收费接口;生产服务可能只支持主网。 出现 `paymentStatus: "unknown"` 或 `retryPayment: false` 时,先核对原交易;不要让 Agent 自动重新支付。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-human.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-human.md index 33103229..d5093076 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-human.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-human.md @@ -99,11 +99,13 @@ x402 是**仅 TypeScript** 的 SDK:TRON 机制以 `@bankofai/x402-tron` 发布 在您的 TypeScript 应用中安装已发布的 npm 包: ```bash -pnpm add @bankofai/agent-wallet @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.1 +pnpm add @bankofai/agent-wallet @x402/core@2.29.0 @x402/fetch@2.29.0 @bankofai/x402-tron@2.1.2 pnpm add -D tsx # 运行下面的 TypeScript 入口文件 ``` -如果您的项目不使用 pnpm,也可以用 `npm install` 或 `yarn add` 安装同名包。`@x402/core` 与 `@x402/fetch` 请保持精确的 `2.29.0`——`@bankofai/x402-tron` 2.1.1 将 `@x402/core@2.29.0` 声明为精确版本的 peer 依赖。 +如果您的项目不使用 pnpm,也可以用 `npm install` 或 `yarn add` 安装同名包。`@x402/core` 与 `@x402/fetch` 请保持精确的 `2.29.0`——`@bankofai/x402-tron` 2.1.2 将 `@x402/core@2.29.0` 声明为精确版本的 peer 依赖。 + +业务项目还需自行配置 TronWeb 的 HTTP 依赖覆盖,见[依赖安全](/zh-Hans/x402/sdk-features/#dependency-security)。 升级现有应用时,请同步升级所有官方 `@x402/*` 传输包;若使用 `@x402/core/schemas`,需迁移到 Zod 4,并将 `error.errors` 改为 `error.issues`。详见 [SDK 功能矩阵](/x402/sdk-features/)。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-sellers.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-sellers.md index 0ba6b2cf..011f6dbc 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-sellers.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/getting-started/quickstart-for-sellers.md @@ -140,11 +140,13 @@ git --version # 版本控制工具 在您的 TypeScript API 项目中安装官方 Core、Express 适配器以及 TRON/EVM 支付 scheme: ```bash -pnpm add express @x402/core@2.29.0 @x402/express@2.29.0 @bankofai/x402-tron@2.1.1 @x402/evm@2.29.0 +pnpm add express @x402/core@2.29.0 @x402/express@2.29.0 @bankofai/x402-tron@2.1.2 @x402/evm@2.29.0 pnpm add -D tsx # 运行下面的 TypeScript 入口文件 ``` -请根据服务框架选择对应包(`@x402/express`、`@x402/hono`、`@x402/fastify` 或 `@x402/next`),版本与 `@x402/core` 一致为 `2.29.0`——`@bankofai/x402-tron` 2.1.1 将 `@x402/core@2.29.0` 声明为精确版本的 peer 依赖。`@x402/evm` 仅在使用 BSC/Base 路由时需要。如果项目不使用 pnpm,也可以用 `npm install` 或 `yarn add` 安装同名包。 +请根据服务框架选择对应包(`@x402/express`、`@x402/hono`、`@x402/fastify` 或 `@x402/next`),版本与 `@x402/core` 一致为 `2.29.0`——`@bankofai/x402-tron` 2.1.2 将 `@x402/core@2.29.0` 声明为精确版本的 peer 依赖。`@x402/evm` 仅在使用 BSC/Base 路由时需要。如果项目不使用 pnpm,也可以用 `npm install` 或 `yarn add` 安装同名包。 + +业务项目还需自行配置 TronWeb 的 HTTP 依赖覆盖,见[依赖安全](/zh-Hans/x402/sdk-features/#dependency-security)。 升级现有应用时,请同步升级所有官方 `@x402/*` 传输包;若使用 `@x402/core/schemas`,需迁移到 Zod 4,并将 `error.errors` 改为 `error.issues`。详见 [SDK 功能矩阵](/x402/sdk-features/)。 @@ -354,6 +356,8 @@ new HTTPFacilitatorClient({ }); ``` +> **Key 刷新与重试:** 新建或删除 Key 在 Facilitator 下一次成功刷新缓存后才生效(内置生产配置每 5 秒刷新,各进程独立维护)。缓存仍有效时,未识别的 Key 按匿名请求处理,成功调用不代表认证成功。v2.3.2 在缓存过期且无法刷新时,对带 Key 的验证和结算请求返回 `503 api_key_auth_unavailable`。请保留认证头并退避重试,详见[认证可用性说明](../../core-concepts/facilitator#api-key-缓存与认证不可用)。 + > ⚠️ **安全提醒:** API Key 是服务凭据——**像密码一样保管,切勿提交到 Git**。 > ✅ **完成!** 官方 Facilitator 已配置——**无需启动本地服务**。直接进入第五步测试。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/sdk-features.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/sdk-features.md index 6aa6b188..ff32771d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/sdk-features.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/x402/sdk-features.md @@ -9,10 +9,26 @@ description: 'x402 TypeScript SDK 的功能支持矩阵:基于官方 @x402/* C > **SDK(仅 TypeScript)**:x402 是一个**仅 TypeScript** 的 SDK。TRON 机制与 TRON 资源赞助扩展以 `@bankofai/x402-tron` 与 `@bankofai/x402-tron-extensions` npm 包发布,Core、EVM、HTTP/MCP 集成和通用扩展则直接使用 x402 Foundation 官方的 `@x402/*` 包。源码由 pnpm/turbo monorepo 维护,但应用应依赖已发布的包。上一代 Python + TypeScript SDK 的 `legacy/` 归档已在 2.0.0 中从仓库移除,`typescript/packages/legacy/` 下的兼容包也已在 2.1.0 中移除。 > -> **当前版本:2.1.1**(2026-10-30)。付款调用链改为基于官方 `@x402/core` `2.29.0`,`@bankofai/x402-tron` `2.1.1` 将其声明为精确版本的 peer 依赖;请搭配对应的官方 HTTP/MCP 集成(`@x402/fetch`、`@x402/axios`、`@x402/express`、`@x402/fastify`、`@x402/hono`、`@x402/next` 或 `@x402/mcp`,均为 `2.29.0`)。TRON 资源赞助由独立的 `@bankofai/x402-tron-extensions` `2.1.1` 提供,它锁定机制包的精确版本——两个 TRON 包需一起升级。EVM 直接使用官方 `@x402/evm` `2.29.0`,通用扩展使用官方 `@x402/extensions` `2.29.0`;本地 EVM 包与 `@bankofai/x402-extensions` 已移除。`@bankofai/x402-core` 及基于它的 `@bankofai/x402-*` HTTP/MCP 适配器不能与 2.1 机制混用——新的 TRON 集成请使用官方 Core 与适配器。从 2.0 升级需要迁移源码,见 [TRON 2.1 迁移指南](https://github.com/BofAI/x402/blob/main/docs/migrations/tron-2.1.md)。SDK 要求 **Node.js 24.22.1+**;可运行示例使用 `@bankofai/agent-wallet` **3.0+**。 +> **当前版本:2.1.2**(2026-11-10)。付款调用链改为基于官方 `@x402/core` `2.29.0`,`@bankofai/x402-tron` `2.1.2` 将其声明为精确版本的 peer 依赖;请搭配对应的官方 HTTP/MCP 集成(`@x402/fetch`、`@x402/axios`、`@x402/express`、`@x402/fastify`、`@x402/hono`、`@x402/next` 或 `@x402/mcp`,均为 `2.29.0`)。TRON 资源赞助由独立的 `@bankofai/x402-tron-extensions` `2.1.2` 提供,它锁定机制包的精确版本——两个 TRON 包需一起升级。EVM 直接使用官方 `@x402/evm` `2.29.0`,通用扩展使用官方 `@x402/extensions` `2.29.0`;本地 EVM 包与 `@bankofai/x402-extensions` 已移除。`@bankofai/x402-core` 及基于它的 `@bankofai/x402-*` HTTP/MCP 适配器不能与 2.1 机制混用——新的 TRON 集成请使用官方 Core 与适配器。从 2.0 升级需要迁移源码,见 [TRON 2.1 迁移指南](https://github.com/BofAI/x402/blob/main/docs/migrations/tron-2.1.md)。SDK 要求 **Node.js 24.22.1+**;可运行示例使用 `@bankofai/agent-wallet` **3.0+**。 > **2.1.1 Schema 迁移**:官方 Core 现使用原生 **Zod 4.6.6+**。应用若组合 `@x402/core/schemas` 中的 Schema,须使用 Zod 4,并通过 `error.issues` 读取校验详情;Zod 3 的 `error.errors` 别名已移除。付款选项数组(`accepts`)最多 **1,024 项**,超长集合会在逐项校验前被拒绝。升级两个 TRON 包时,同时升级精确版本的 Core peer 及对应传输包。 +## 依赖安全 {#dependency-security} + +SDK **2.1.2** 仓库的锁文件中,两个 TRON 包及全部 11 个 TypeScript 示例使用 **TronWeb 6.5.1**。该版本在签名与合约调用中使用同一份输入快照进行校验和执行;官方 Core peer 仍为 **2.29.0**。 + +已发布的机制包声明 `tronweb: ^6.5.1`,因此业务项目全新安装时可能解析到 **6.5.2**。资源扩展仍固定为 **6.5.1**,两个版本可能同时存在。 + +SDK 仓库通过 pnpm 工作区覆盖,将 TronWeb 的 Axios 解析为 **1.21.0**、follow-redirects 解析为 **1.16.2**。**这些覆盖不会传递给安装 npm 包的应用。** 业务项目须自行配置覆盖、刷新锁文件并检查实际依赖树。下方业务项目示例覆盖 TronWeb 的 `^6.5.1` 范围,包括 6.5.1 与 6.5.2。使用 pnpm 时,将以下条目合并到根目录的 `pnpm-workspace.yaml`: + +```yaml +overrides: + "tronweb@^6.5.1>axios": "1.21.0" + "axios@1.21.0>follow-redirects": "1.16.2" +``` + +其他包管理器请使用项目根级别的依赖覆盖机制。也可在验证 SDK 兼容性后,使用已包含修复依赖的上游 TronWeb 版本。详见 [2.1.2 发布说明](https://github.com/BofAI/x402/blob/main/RELEASE_NOTES.md)。 + --- ## 包 @@ -63,9 +79,9 @@ description: 'x402 TypeScript SDK 的功能支持矩阵:基于官方 @x402/* C | `eip155:8453`(Base 主网) | - | ✅ | | `eip155:84532`(Base Sepolia) | - | ✅(CLI/SDK 测试) | -> **TRON 标识格式**:自 `@bankofai/x402-tron` 2.0.0 起,SDK 常量使用十进制 CAIP-2 引用。旧的十六进制形式(`tron:0x2b6653dc`、`tron:0xcd8690dc`、`tron:0x94a9059e`)仍可作为输入别名使用,并会被规范化为十进制形式。官方 facilitator 的 `/supported` 返回十进制标识;API Catalog 目前仍列出十六进制形式。 +> **TRON 标识格式**:自 `@bankofai/x402-tron` 2.0.0 起,SDK 常量使用十进制 CAIP-2 引用。旧的十六进制形式(`tron:0x2b6653dc`、`tron:0xcd8690dc`、`tron:0x94a9059e`)仍可作为输入别名使用,并会被规范化为十进制形式。官方 facilitator 的 `/supported` 返回十进制标识。 -> EVM 支持来自官方 `@x402/evm` 2.29.0。其默认资产注册表覆盖 Base、Base Sepolia、Ethereum、Polygon、Arbitrum One/Sepolia、Avalanche、Celo、Sei、MegaETH、Monad、Stable、XDC、Flare、Mezo、Radius、ADI、HPP、Igra 等链,但**不包括 BSC**。在 BSC 上,路由价格须写成显式的 `{ asset, amount, extra }` 对象(写 `$` 价格会报 `No default asset configured for network eip155:56`),client 也须把该资产加入 `spendControls.allowedAssets`。公开 API Catalog 只发布 Base 主网路由;Base Sepolia 保留用于 CLI/SDK 测试。 +> EVM 支持来自官方 `@x402/evm` 2.29.0。其默认资产注册表覆盖 Base、Base Sepolia、Ethereum、Polygon、Arbitrum One/Sepolia、Avalanche、Celo、Sei、MegaETH、Monad、Stable、XDC、Flare、Mezo、Radius、ADI、HPP、Igra 等链,但**不包括 BSC**。在 BSC 上,路由价格须写成显式的 `{ asset, amount, extra }` 对象(写 `$` 价格会报 `No default asset configured for network eip155:56`),client 也须把该资产加入 `spendControls.allowedAssets`。Base Sepolia 保留用于 CLI/SDK 测试。 --- diff --git a/package.json b/package.json index d565282d..ffcde952 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,8 @@ { "name": "@x402-tron/docs", - "version": "1.5.7", + + "version": "1.5.8", + "description": "x402-tron documentation", "license": "MIT", "resolutions": { diff --git a/scripts/ssr-template.mjs b/scripts/ssr-template.mjs new file mode 100644 index 00000000..198f076e --- /dev/null +++ b/scripts/ssr-template.mjs @@ -0,0 +1,14 @@ +import {createRequire} from 'node:module' + +const require = createRequire(import.meta.url) +const upstreamTemplate = require('@docusaurus/core/lib/ssg/ssgTemplate.html.js').default +const appHtmlTag = '<%~ it.appHtml %>' + +if (!upstreamTemplate.includes(appHtmlTag)) { + throw new Error('Docusaurus SSR template changed; review the React 18 UTF-8 padding workaround') +} + +// React 18 can emit unused buffer bytes at multibyte text boundaries: +// https://github.com/facebook/react/pull/26228 +// Remove this padding before HTML minification and search indexing. +export default upstreamTemplate.replace(appHtmlTag, "<%~ it.appHtml.replace(/\\0/g, '') %>") diff --git a/scripts/ssr-template.test.mjs b/scripts/ssr-template.test.mjs new file mode 100644 index 00000000..339a8bae --- /dev/null +++ b/scripts/ssr-template.test.mjs @@ -0,0 +1,34 @@ +import assert from 'node:assert/strict' +import {PassThrough} from 'node:stream' +import {text} from 'node:stream/consumers' +import test from 'node:test' +import React from 'react' +import {renderToPipeableStream, renderToStaticMarkup} from 'react-dom/server' +import {compileSSGTemplate} from '@docusaurus/core/lib/ssg/ssgTemplate.js' +import ssrTemplate from './ssr-template.mjs' + +test('streamed Chinese text and anchors survive UTF-8 chunk boundaries', async () => { + const app = React.createElement('article', null, ...Array.from({length: 300}, (_, key) => + React.createElement('a', {key, href: '#中文标题'}, '中文链接文本🔗'), + )) + const stream = new PassThrough() + const html = text(stream) + const renderer = renderToPipeableStream(app, { + onAllReady() { renderer.pipe(stream) }, + onError(error) { stream.destroy(error) }, + }) + const renderTemplate = await compileSSGTemplate(ssrTemplate) + const page = renderTemplate({ + appHtml: await html, + htmlAttributes: 'lang="zh-Hans"', bodyAttributes: '', + version: '3.10.2', baseUrl: '/', + metaAttributes: ['中文标题'], headTags: '', + preBodyTags: '', postBodyTags: '', + scripts: ['assets/main.js'], stylesheets: ['assets/main.css'], + }) + + assert.ok(page.includes(`
${renderToStaticMarkup(app)}
`)) + assert.ok(page.includes('')) + assert.ok(page.includes('中文标题')) + assert.ok(!page.includes('\0')) +}) diff --git a/sidebars.js b/sidebars.js index ab8897bd..9dfaf2fa 100644 --- a/sidebars.js +++ b/sidebars.js @@ -56,18 +56,6 @@ const sidebars = { 'x402/core-concepts/client-server', 'x402/core-concepts/facilitator', 'x402/core-concepts/OfficialFacilitator', - 'x402/core-concepts/gateway', - { - type: 'category', - label: 'API Catalog', - collapsed: true, - items: [ - 'x402/api-catalog/index', - 'x402/api-catalog/get-started', - 'x402/api-catalog/list-your-service', - 'x402/api-catalog/reference', - ], - }, 'x402/core-concepts/wallet', 'x402/core-concepts/network-and-token-support', ], diff --git a/static/img/devnotes/bankofai-product-matrix-en.svg b/static/img/devnotes/bankofai-product-matrix-en.svg index 9a54da81..ee76d1b3 100644 --- a/static/img/devnotes/bankofai-product-matrix-en.svg +++ b/static/img/devnotes/bankofai-product-matrix-en.svg @@ -35,7 +35,7 @@ Marketplaces - x402 Marketplace · Skill Catalog + Skill Catalog @@ -60,7 +60,7 @@ x402 Payment Services - Gateway · Facilitator · Recharge Server + Facilitator · Recharge Server diff --git a/static/img/devnotes/bankofai-product-matrix.svg b/static/img/devnotes/bankofai-product-matrix.svg index 0db242a8..96aa6a92 100644 --- a/static/img/devnotes/bankofai-product-matrix.svg +++ b/static/img/devnotes/bankofai-product-matrix.svg @@ -35,7 +35,7 @@ Marketplaces - x402 Marketplace · Skill Catalog + Skill Catalog @@ -60,7 +60,7 @@ x402 Payment Services - Gateway · Facilitator · Recharge Server + Facilitator · Recharge Server diff --git a/static/img/diagrams/x402-api-catalog-pipeline.light.svg b/static/img/diagrams/x402-api-catalog-pipeline.light.svg deleted file mode 100644 index a9070f95..00000000 --- a/static/img/diagrams/x402-api-catalog-pipeline.light.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - API Catalog — from a pull request to three consumers - The catalog keeps no database and holds no upstream secrets. It makes services discoverable; it never touches calls or funds. - PROVIDER - - - catalog.json - pay.md - (two public files) - - open PR - CATALOG REPO (CI) - - - field & sensitive-data scan - build static snapshot dist/ - - publish - DISTRIBUTION - - - /api/catalog.json - /api/providers/<fqn>.json - /api/pay/<fqn>.json · .md - - same data, three ways in - - - - - Catalog website - humans browse & compare - - - - wallet-cli - search, inspect, paid calls - - - - MCP - Pays endpoints; no catalog lookup yet - diff --git a/static/img/diagrams/x402-api-catalog-pipeline.svg b/static/img/diagrams/x402-api-catalog-pipeline.svg deleted file mode 100644 index 2534bdb0..00000000 --- a/static/img/diagrams/x402-api-catalog-pipeline.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - API Catalog — from a pull request to three consumers - The catalog keeps no database and holds no upstream secrets. It makes services discoverable; it never touches calls or funds. - PROVIDER - - - catalog.json - pay.md - (two public files) - - open PR - CATALOG REPO (CI) - - - field & sensitive-data scan - build static snapshot dist/ - - publish - DISTRIBUTION - - - /api/catalog.json - /api/providers/<fqn>.json - /api/pay/<fqn>.json · .md - - same data, three ways in - - - - - Catalog website - humans browse & compare - - - - wallet-cli - search, inspect, paid calls - - - - MCP - Pays endpoints; no catalog lookup yet - diff --git a/static/img/diagrams/x402-api-catalog-pipeline.zh.light.svg b/static/img/diagrams/x402-api-catalog-pipeline.zh.light.svg deleted file mode 100644 index 3cccaa65..00000000 --- a/static/img/diagrams/x402-api-catalog-pipeline.zh.light.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - API Catalog —— 从一个 PR 到三个消费端 - 目录本身不存数据库、不接收上游密钥:只负责让服务可被发现,不碰调用也不碰资金。 - 服务提供方 - - - catalog.json - pay.md - (两个公开文件) - - 提交 PR - 目录仓库(CI) - - - 字段与敏感信息扫描 - 构建静态快照 dist/ - - 校验发布 - 分发 - - - /api/catalog.json - /api/providers/<fqn>.json - /api/pay/<fqn>.json · .md - - 同一份数据,三种接入方式 - - - - - 目录网站 - 供人浏览与比较 - - - - wallet-cli - 搜索、查看、付费调用 - - - - MCP - 仅付费调用 · 暂不支持按目录查找 - diff --git a/static/img/diagrams/x402-api-catalog-pipeline.zh.svg b/static/img/diagrams/x402-api-catalog-pipeline.zh.svg deleted file mode 100644 index 413c525e..00000000 --- a/static/img/diagrams/x402-api-catalog-pipeline.zh.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - API Catalog —— 从一个 PR 到三个消费端 - 目录本身不存数据库、不接收上游密钥:只负责让服务可被发现,不碰调用也不碰资金。 - 服务提供方 - - - catalog.json - pay.md - (两个公开文件) - - 提交 PR - 目录仓库(CI) - - - 字段与敏感信息扫描 - 构建静态快照 dist/ - - 校验发布 - 分发 - - - /api/catalog.json - /api/providers/<fqn>.json - /api/pay/<fqn>.json · .md - - 同一份数据,三种接入方式 - - - - - 目录网站 - 供人浏览与比较 - - - - wallet-cli - 搜索、查看、付费调用 - - - - MCP - 仅付费调用 · 暂不支持按目录查找 - diff --git a/static/img/diagrams/x402-gateway-topology.light.svg b/static/img/diagrams/x402-gateway-topology.light.svg deleted file mode 100644 index 503da74a..00000000 --- a/static/img/diagrams/x402-gateway-topology.light.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Gateway — a cashier and relay in front of your API - Technically a reverse proxy. Agents only ever hit the gateway address; your upstream API stays exactly as it is. - - - Agent - pays on-chain from - its own wallet - - request - - - Gateway - quote / verify / settle - (paid endpoints only) - - forwards - - - Your upstream API - unchanged — not one - line of code - - Never a private key - Settlement uses a wallet address only. Neither side of the gateway ever touches a private key. - - Upstream keys stay isolated - Your API key lives only gateway-side — local YAML/env if self-hosted, held by us if official. Callers never see it. - - You price each endpoint - Priced endpoints take the 402 flow; unpriced (price 0) endpoints are forwarded straight through. - diff --git a/static/img/diagrams/x402-gateway-topology.svg b/static/img/diagrams/x402-gateway-topology.svg deleted file mode 100644 index 7e75c81f..00000000 --- a/static/img/diagrams/x402-gateway-topology.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Gateway — a cashier and relay in front of your API - Technically a reverse proxy. Agents only ever hit the gateway address; your upstream API stays exactly as it is. - - - Agent - pays on-chain from - its own wallet - - request - - - Gateway - quote / verify / settle - (paid endpoints only) - - forwards - - - Your upstream API - unchanged — not one - line of code - - Never a private key - Settlement uses a wallet address only. Neither side of the gateway ever touches a private key. - - Upstream keys stay isolated - Your API key lives only gateway-side — local YAML/env if self-hosted, held by us if official. Callers never see it. - - You price each endpoint - Priced endpoints take the 402 flow; unpriced (price 0) endpoints are forwarded straight through. - diff --git a/static/img/diagrams/x402-gateway-topology.zh.light.svg b/static/img/diagrams/x402-gateway-topology.zh.light.svg deleted file mode 100644 index 978f965a..00000000 --- a/static/img/diagrams/x402-gateway-topology.zh.light.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Gateway —— 挡在你 API 前面的收银台兼中继 - 本质是一层反向代理。Agent 只访问网关地址,你的上游 API 保持原样。 - - - Agent - 用自己的钱包 - 在链上付款 - - 请求 - - - Gateway - 报价 / 校验 / 结算 - (仅付费端点) - - 转发 - - - 你的上游 API - 完全不改 - 一行代码 - - 永远不碰私钥 - 结算只用钱包地址,网关两侧都不接触私钥。 - - 上游密钥隔离 - API Key 只存在网关一侧 —— 自建则在本地 YAML/env,官方网关则由我们保管,调用方永远看不到。 - - 价格按端点自定 - 标价的端点走 402 流程;未标价(价格为 0)的端点直接转发。 - diff --git a/static/img/diagrams/x402-gateway-topology.zh.svg b/static/img/diagrams/x402-gateway-topology.zh.svg deleted file mode 100644 index e50fd36a..00000000 --- a/static/img/diagrams/x402-gateway-topology.zh.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Gateway —— 挡在你 API 前面的收银台兼中继 - 本质是一层反向代理。Agent 只访问网关地址,你的上游 API 保持原样。 - - - Agent - 用自己的钱包 - 在链上付款 - - 请求 - - - Gateway - 报价 / 校验 / 结算 - (仅付费端点) - - 转发 - - - 你的上游 API - 完全不改 - 一行代码 - - 永远不碰私钥 - 结算只用钱包地址,网关两侧都不接触私钥。 - - 上游密钥隔离 - API Key 只存在网关一侧 —— 自建则在本地 YAML/env,官方网关则由我们保管,调用方永远看不到。 - - 价格按端点自定 - 标价的端点走 402 流程;未标价(价格为 0)的端点直接转发。 -