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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is the rules knowledge base. Every file here is a **self-contained rule sheet** Claude loads on demand when the touched code matches its scope. Rules override defaults; CLAUDE.md at the repo root sets the floor.

The SDK is a **TypeScript-only** pnpm/turbo monorepo under [typescript/](../../typescript/CLAUDE.md). `core` and `mechanisms/evm` are **upstream forks** (keep byte-identical, additions go in overlays); `mechanisms/tron` is in-house. There is no Python in the current SDK. (The previous-generation Python + old TypeScript code lives under `legacy/` and is slated for removal — these rules do **not** cover it.)
The SDK is a **TypeScript-only** pnpm/turbo monorepo under [typescript/](../../typescript/CLAUDE.md). `core` and `mechanisms/evm` are **upstream forks** (keep byte-identical, additions go in overlays); `mechanisms/tron` is in-house. There is no Python in the current SDK.

## When Claude reads what

Expand Down
4 changes: 0 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<!--
Thanks for contributing to x402!
Please fill out the information below to help reviewers understand your changes.

Note: We require commit signing.
See here for instructions: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification
-->

## Description
Expand Down Expand Up @@ -33,7 +30,6 @@ For TypeScript: Run `pnpm test` from the `/typescript` directory
- [ ] I have formatted and linted my code
- [ ] All new and existing tests pass
- [ ] I added a Changeset for publishable package changes, or this PR does not require one
- [ ] My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits

<!--
For TypeScript: Run `pnpm lint` from `/typescript`
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ marimo/_lsp/
__marimo__/
/.idea/
/.vscode/
/legacy/examples/typescript/client-web/node_modules/
/legacy/examples/typescript/client/node_modules/
*node_modules/
.specify/

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added automated pull request title and description validation.
- Added pull request CI for policy tests, formatting, linting, build, and unit tests.

### Removed

- Removed the root `legacy/` archive containing the retired Python SDK, old TypeScript SDK, and
superseded examples and specifications. The compatibility npm packages under
`typescript/packages/legacy/` remain supported by the current workspace.

## [1.1.0] - 2026-08-25

### Upgrade notes
Expand Down
35 changes: 18 additions & 17 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,31 @@ This file tells Claude Code how to work in this repository.

x402 is an open-source SDK for the **x402 open payment standard** — an HTTP `402 Payment Required` challenge-response protocol for serverless on-chain payments. Three roles participate: **Client** (payer), **Server** (resource provider), **Facilitator** (on-chain settlement).

This repository hosts the BankofAI SDK (Python + TypeScript), the reference facilitator bindings, on-chain mechanisms for TRON and EVM, and the protocol specs.
This repository hosts the TypeScript BankofAI SDK, reference facilitator bindings, on-chain
mechanisms for TRON and EVM, runnable examples, and the protocol specs.

## Components

Each component has its own `CLAUDE.md` (where present) with build/test commands and conventions.

> The `legacy/` tree holds the previous-generation SDK (Python + old TypeScript + e2e), kept only as reference and **slated for removal**. New work lives in `typescript/` and `examples/`.
Each component has its own guidance with build/test commands and conventions where needed.

| Path | Language | Purpose |
|---|---|---|
| [legacy/python/x402/](legacy/python/x402/) | Python | SDK: client, server (FastAPI/Flask), facilitator, mechanisms (EVM + TRON). |
| [legacy/typescript/](legacy/typescript/) | TypeScript | SDK: fetch client, server middleware, facilitator, mechanisms (EVM + TRON). |
| [legacy/specs/](legacy/specs/) | Markdown | Protocol specs (`protocol.md`, `roles.md`, `config.md`, `schemes/*.md`) + in-flight feature specs (`NNN-<slug>/`). Read **first** when touching wire formats. Mirrors upstream `x402-foundation/x402/specs/` layout. |
| [typescript/](typescript/) | TypeScript | Current SDK monorepo: core, EVM/TRON mechanisms, extensions, HTTP adapters, and MCP. |
| [specs/](specs/) | Markdown | Normative v2 protocol, transport, scheme, and extension specifications. Read **first** when touching wire formats. |
| [examples/typescript/](examples/typescript/) | TypeScript | Runnable client, server, facilitator, logging, and MCP examples. |
| [docs/solutions.md](docs/solutions.md) | Markdown | Hard-won debugging knowledge. **Read before investigating bugs in related areas.** |
| [legacy/examples/](legacy/examples/) | Mixed | Smoke tests and integration examples. |
| [legacy/integration/](legacy/integration/) | Python | Generic step runner used by `legacy/e2e/scenarios/`. |
| [legacy/e2e/](legacy/e2e/) | Python | End-to-end scenarios (mock facilitator + resource server + client). See [legacy/e2e/README.md](legacy/e2e/README.md). Wired into CI via `check_e2e.yml`. |
| [tron-contribution/](tron-contribution/) | Markdown | Upstream contribution planning for `x402-foundation/x402`. |

## Key reading order (new contributor)

1. [legacy/specs/protocol.md](legacy/specs/protocol.md) — wire format, headers, encoding
2. [legacy/specs/roles.md](legacy/specs/roles.md) — Client / Server / Facilitator; **payment selection pipeline** (policy hook at step 5)
3. [legacy/specs/config.md](legacy/specs/config.md) — network + contract registry
4. Scheme spec for the scheme you are touching: [`schemes/exact.md`](legacy/specs/schemes/exact.md) · [`schemes/exact-permit.md`](legacy/specs/schemes/exact-permit.md) · [`schemes/exact-gasfree.md`](legacy/specs/schemes/exact-gasfree.md)
5. [docs/solutions.md](docs/solutions.md) — bug-avoidance checklist (TRON address hex, GasFree deadline bounds, balance source, etc.)
1. [specs/x402-specification-v2.md](specs/x402-specification-v2.md) — shared wire objects,
facilitator API, discovery, and security rules
2. Transport spec for the surface you are touching: [HTTP](specs/transports-v2/http.md) or
[MCP](specs/transports-v2/mcp.md)
3. Scheme overview and network binding under [specs/schemes/](specs/schemes/)
4. [specs/CONTRIBUTING.md](specs/CONTRIBUTING.md) — normative documentation rules and review
checklist
5. [docs/solutions.md](docs/solutions.md) — bug-avoidance checklist (TRON address hex, GasFree
deadline bounds, balance source, etc.)

## Conventions

Expand Down Expand Up @@ -65,7 +64,9 @@ This repo uses a Claude-Code-native layout: rules, commands, and agents that let
| [.claude/commands/x402/](.claude/commands/x402/) | Slash-command wizards (`/x402:compound`) |
| [.claude/agents/](.claude/agents/) | Specialized subagents (`code-reviewer`, `security-reviewer`) |

Each major component also has its own `CLAUDE.md` with build/test commands and local conventions: [legacy/python/x402/](legacy/python/x402/CLAUDE.md), [legacy/typescript/](legacy/typescript/CLAUDE.md), [legacy/e2e/](legacy/e2e/CLAUDE.md), [legacy/examples/](legacy/examples/CLAUDE.md), [docs/](docs/CLAUDE.md), [legacy/specs/](legacy/specs/CLAUDE.md), [legacy/integration/](legacy/integration/CLAUDE.md).
Component-specific instructions live in [typescript/CLAUDE.md](typescript/CLAUDE.md),
[docs/CLAUDE.md](docs/CLAUDE.md), [specs/CONTRIBUTING.md](specs/CONTRIBUTING.md), and
[.claude/rules/CLAUDE.md](.claude/rules/CLAUDE.md).

## Safety rules

Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ workflow.
- **SDK**: [`typescript/`](typescript/CLAUDE.md) — pnpm/turbo monorepo, packages published as `@bankofai/x402-*` (`core`, `mechanisms/{evm,tron}`, `extensions`, `http/*`, `mcp`).
- **Examples**: [`examples/typescript/`](examples/typescript/) — runnable client/server/facilitator trios per scheme.
- **Agent rules & reviewers**: [`.claude/`](.claude/rules/CLAUDE.md) — conventions and specialized review subagents.
- **Legacy**: [`legacy/`](legacy/) — previous-generation Python + TypeScript SDK, reference-only and **slated for removal**. Don't build on it.

---

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ x402 currently supports the **TRON** and **BSC** networks, with plans to expand

Version `1.1.0`. The SDK is a **TypeScript-only** pnpm/turbo monorepo published as granular `@bankofai/x402-*` packages (there is no umbrella package). `core` and the EVM mechanism are forks of the [`x402-foundation/x402`](https://github.com/x402-foundation/x402) upstream; the TRON mechanism is in-house. Supported schemes: `exact` (ERC-3009 / Permit2), `upto`, `batch-settlement`, `auth-capture` (EVM), and `exact_gasfree` (TRON). See [the v1.1.0 release notes](RELEASE_NOTES.md#v110--payment-flow-and-wallet-compatibility) for upgrade details.

> The previous-generation Python + TypeScript SDK lives under [`legacy/`](legacy/) for reference and is slated for removal.

## Features

- **Protocol Native**: Restores the HTTP `402` status code to its intended purpose.
Expand Down
6 changes: 3 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Release date: July 2, 2026

## Highlights

The 1.0.0 release is a ground-up rewrite to a **TypeScript-only** pnpm/turbo monorepo. The previous-generation Python + TypeScript SDK moves to `legacy/` for reference. `core` and the EVM mechanism are forks of the [`x402-foundation/x402`](https://github.com/x402-foundation/x402) upstream; the TRON mechanism is in-house. Supported schemes: `exact` (ERC-3009 / Permit2), `upto`, `batch-settlement`, `auth-capture` (EVM), and `exact_gasfree` (TRON).
The 1.0.0 release is a ground-up rewrite to a **TypeScript-only** pnpm/turbo monorepo. At release time, the previous-generation Python + TypeScript SDK moved to a root `legacy/` archive, which has since been removed. `core` and the EVM mechanism are forks of the [`x402-foundation/x402`](https://github.com/x402-foundation/x402) upstream; the TRON mechanism is in-house. Supported schemes: `exact` (ERC-3009 / Permit2), `upto`, `batch-settlement`, `auth-capture` (EVM), and `exact_gasfree` (TRON).

## Changes

- **Monorepo restructure**: TypeScript-only SDK published as granular `@bankofai/x402-*` packages (`core`, `evm`, `tron`, `fetch`, `express`, `mcp`, `extensions`). The Python SDK and old TS SDK live under `legacy/`.
- **Monorepo restructure**: TypeScript-only SDK published as granular `@bankofai/x402-*` packages (`core`, `evm`, `tron`, `fetch`, `express`, `mcp`, `extensions`). The Python SDK and old TS SDK were archived under root `legacy/` for this release and removed later.
- **BSC USDT support**: express server `exact` example now advertises BSC testnet USDT (`0x337610d2…`, 18 dec, permit2) alongside DHLU and USDC. Mainnet USDT is registered in the default-asset registry (`eip155:56`, permit2).
- **Token symbol resolution**: fetch client `TOKEN_ADDRESSES` now indexes by chain family so the same symbol (e.g. `USDT`) resolves to the correct contract per network (BSC testnet vs TRON Nile).
- **TRON settle receipt accuracy**: facilitator transaction polling switched from `trx.getTransaction` (fullNode preconfirm, which could transiently read `REVERT` on mainnet and cause false settle failures) to the fullNode `gettransactioninfobyid` endpoint, waiting for `blockNumber` + `receipt.result`. ~3-6s latency with authoritative results — mirrors tronpy's `get_transaction_info`.
Expand All @@ -81,7 +81,7 @@ The 1.0.0 release is a ground-up rewrite to a **TypeScript-only** pnpm/turbo mon
## Compatibility

- TypeScript-only; Node.js >= 20, pnpm >= 11.
- The Python SDK is no longer published from `main`; it remains under `legacy/` for reference.
- The Python SDK is no longer published from `main`; its temporary root `legacy/` archive has since been removed.

# v0.6.1 — TRON exact_permit Wallet CLI Fix

Expand Down
71 changes: 0 additions & 71 deletions legacy/.env.example

This file was deleted.

61 changes: 0 additions & 61 deletions legacy/e2e/CLAUDE.md

This file was deleted.

56 changes: 0 additions & 56 deletions legacy/e2e/README.md

This file was deleted.

Loading
Loading