825 Commits

Author SHA1 Message Date
phdargen
a24dc9437d
chore: version python package (#2293) npm-@x402/mcp@v2.12.0 npm-@x402/axios@v2.12.0 npm-@x402/fetch@v2.12.0 npm-@x402/paywall@v2.12.0 npm-@x402/fastify@v2.12.0 npm-@x402/next@v2.12.0 npm-@x402/hono@v2.12.0 npm-@x402/express@v2.12.0 npm-@x402/svm@v2.12.0 npm-@x402/stellar@v2.12.0 npm-@x402/aptos@v2.12.0 npm-@x402/avm@v2.12.0 npm-@x402/evm@v2.12.0 npm-@x402/extensions@v2.12.0 npm-@x402/core@v2.12.0 2026-05-13 17:33:27 +02:00
phdargen
dd6d7e6fc2
Harden workflows (#2287)
* add --ignore-scripts

* update to pnpm 11 and node 22

* align dep

* fix axios headers

* pin workflow actions

* fix paywall

* remove cache from publishing

* add hedera publishing

* remove e2e workflow

* increase minminimumReleaseAge to 3days
2026-05-13 17:33:05 +02:00
Dimitry Fiuse
1c192819df
test(paywall): replace placeholder entrypoint test (#2292) 2026-05-13 14:53:39 +02:00
Vedant Anand
8eee9646af
fix(python): use named constants for erc20-approval gas fee defaults (#2278)
The Permit2 erc20-approval client was hardcoding 1_000_000_000 / 100_000_000
as gas fee fallbacks. TypeScript already exposes these as
DEFAULT_MAX_FEE_PER_GAS / DEFAULT_MAX_PRIORITY_FEE_PER_GAS in evm/constants;
add the matching Python constants and use them. No behavior change.

Also adds the first unit tests for sign_erc20_approval_transaction covering
the fallback and successful estimate paths.
2026-05-13 14:36:04 +02:00
A1igator
850e3cefef
Add authCapture scheme specification (#1425)
* Add escrow scheme specification

Introduces the `escrow` scheme for x402, built on Base's Commerce Payments
Protocol. Supports two settlement paths: authorize (funds held in escrow)
and charge (direct to receiver), both refundable post-settlement.

Refs: #834, #1011

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review feedback on escrow scheme specs

- Generalize scheme_escrow.md to be network-agnostic
- Tighten verification: strict amount equality, tokenCollector
  recipient check, settlement simulation
- Add error codes section and assetTransferMethod note
- Simplify nonce derivation explanation

* Rename scheme to commerce and align spec with implementation

- Rename escrow → commerce per reviewer feedback
- Add expiry fields to PaymentRequirements example
- Align expiry field descriptions and example values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* spec: rename escrow/commerce scheme to authCapture, add EVM payload schema

Renames the scheme directory from commerce/ to authCapture/ and rewrites
the EVM spec to cover both ERC-3009 and Permit2 payment-collector paths.

Key spec additions:
- extra field schema (captureAuthorizer, captureDeadline, refundDeadline,
  feeRecipient, min/maxFeeBps, autoCapture, assetTransferMethod)
- Wire format + EIP-712 derivation tables for ERC-3009 and Permit2
- Spec -> on-chain PaymentInfo field mapping (preserves canonical Solidity
  names so EIP-712 typehash matches the AuthCaptureEscrow contract)
- Universal contract addresses block (CREATE2-deterministic)
- Verification step list aligned with facilitator implementation:
  preApprovalExpiry <= captureDeadline <= refundDeadline (>= allowed,
  matching contract _validatePayment)

* spec: use canonical base/commerce-payments addresses

Defer to the live deployment from base/commerce-payments@v1.0.0 instead
of redeploying via CREATE2. Drop the now-obsolete inline address tables
and salt-scheme paragraph; the Canonical Addresses annex now links to
the upstream release notes (and Uniswap deployments docs for Permit2),
matching scheme_exact_evm.md's third-party 'Canonical Permit2' annex
pattern.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 17:40:43 -07:00
Erik Reppel
d93db8cabd
Update footer to Linux Foundation (#2283) 2026-05-12 21:14:35 +02:00
erikreppel-cb
2081a4124a
Create TSC.md (#2253)
* Create TSC.md

Create TSC.md outlining the technical steering committee members as outlined by the x402 foundation charter.

* Fix spelling

---------

Co-authored-by: Erik <erikreppel@gmail.com>
2026-05-12 12:13:55 -07:00
phdargen
7c239c42f5
Add batch-settlement blog (#2277)
* add batch-settlement blog post

* add img
2026-05-12 16:45:11 +02:00
Andrew Reder
81e611c230
Revert "Add Writing hub and batch settlement blog post (#2269)" (#2270)
This reverts commit 973de09b31d081b4fd2200ff6cc1542b6bbed53c.
2026-05-11 17:37:40 -07:00
jnix.base.eth
973de09b31
Add Writing hub and batch settlement blog post (#2269)
* Add Writing hub and batch settlement blog post

* style(site): format tsconfig.json with Prettier
2026-05-11 17:00:45 -07:00
phdargen
1a3730a475
chore: version typescript packages (#2268)
* chore: version typescript packages

* fix format
2026-05-11 14:56:12 -07:00
phdargen
1bb718f91e
chore(go): release v2.11.0 (#2267) go-x402@v2.11.0 go/v2.11.0 2026-05-11 13:04:46 -07:00
phdargen
3df5223968
update-bazaar-docs (#2263) 2026-05-11 09:16:22 -07:00
phdargen
153819de96
Update scheme docs (#2264)
* updated batch-settlement docs

* add ton

* add missing files
2026-05-11 09:15:51 -07:00
jnix.base.eth
2e54665f47
Docs/batch settlement and cleanup (#2261)
* Adding batch settlement details, plus a general cleanup of some stale content and onchain vs on-chain typos

* Additional minor polishing updates

* Merging SDK features mechanisms table with main and adding batch-settlement to resolve conflict
2026-05-11 13:19:10 +02:00
Shinya Fujino
cd87caaed3
docs: fix indentation in x402 v2 spec examples (#2260) 2026-05-10 14:16:26 +02:00
phdargen
b0d5e48293
updated docs with new hook primitives (#2247) 2026-05-08 23:07:07 -04:00
Ryan R. Fox
ee7c1562d0
chore: bump viem floor to ^2.48.11 across monorepo + refresh lockfiles (#2242)
Tightens the viem floor in every package.json that lists viem (41 refs
across 40 files), refreshes all three lockfiles so every direct viem
resolution reads 2.48.11, and regenerates the paywall bundled templates
so the EVM/SVM/AVM bundles match the new viem chain database.

## Why floor-tightening matters

PR #2013 bumped lockfiles to 2.47.14, but later PRs (#2061, #2197, ...)
added sub-packages with ^2.39.x / ^2.43.x floors. pnpm re-resolved on
subsequent installs and the solver picked the lowest acceptable version
across constraints. ^-ranges with low floors do NOT preserve a bump --
lockfile refreshes erode the floor.

This PR fixes that incomplete tightening from #2013 by raising every
floor to ^2.48.11. The same regression will recur if any future PR adds
a viem-using sub-package with a lower floor. Gate criterion: new
packages must use ^2.48.11 (or tighter) for viem.

## Acceptance verification

- pnpm install --frozen-lockfile clean across typescript/,
  examples/typescript/, and e2e/.
- pnpm format:check, lint:check, build, test green for typescript/.
- pnpm format:check, lint:check green for examples/typescript/.
- All direct viem resolutions read 2.48.11 in all three workspaces.
- Paywall bundled templates regenerated via
  pnpm --filter @x402/paywall run build:paywall.
2026-05-08 16:19:24 +02:00
Аркадий Стена
e0ba324d0f
feat: add TVM exact-payment mechanism to Python SDK (#1944)
* feat: add TVM exact-payment mechanism to Python SDK

- add TVM exact client, server, and facilitator implementations
- add TVM signers, codecs, provider, and settlement helpers
- add unit and integration coverage for TON testnet/mainnet flows
- add Python examples and e2e wiring for TVM

* Enable TVM exact flows in Python e2e and tighten facilitator validation

Add TVM support to the Python e2e clients and servers, switch TVM usage to direct `ExactTvm*Scheme` registration after removing the old register helpers, and refresh docs/examples for testnet setup.
Also reject exact TVM settlements with excessively large attached TON amounts and cover the new validation with tests.

* fix: clarify minimum balance of the facilitator

* refactor(tvm): release settlement cache entry on confirmed settlement

  On-chain seqno advances after a successful relay, so any retry of the same settlement BOC will fail at the W5 contract's seqno check regardless of the dedup reservation. Drop the entry as soon as the confirmation worker records success, so the invariant becomes "every is_duplicate=False is paired with a release" and TTL pruning is left as a crash safety-net only.

* feat(tvm): add TonAPI provider support

* feat(tvm): update e2e tests  to make them compatible with new providers

* fix(tvm): update timeouts

* fix(tvm): increase http client timeout

* fix(tvm): align unit tests

* revert(e2e): remove .env-local config load

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 16:13:22 +02:00
Carson Roscoe
2b7914c72e
feat: batch settlement go sdk (#2230)
* feat: add batch-settlement implementation to Go SDK

* feat: add batch-settlement examples for go sdk

* feat: updated typescript examples to match go examples

* feat: add e2e testing for batch-settlement in go

* Batch-settlement: go-ts parity (#2227)

* fix PendingRequest and refund cleanup

* fix lint

* remove duplicate payer info from storage

* fix PAYMENT-RESPONSE field ordering

* clean up comments

* consolidate ProcessSettlementWithExtensions into ProcessSettlement

---------

Co-authored-by: phdargen <p.dargent@cern.ch>
2026-05-07 18:26:39 -07:00
Ethan Oroshiba
d235050d95
feat: log bazaar EXTENSION-RESPONSES header in resource servers (#2161)
* add extension responses header logging

* add changelogs and log whole sanitized header

* remove envelope attachment

* use list instead of map

* update changelog entries

* add facilitator examples
2026-05-07 18:03:04 +02:00
Aristotle Satoshi
ebb56382b6
feat(ecosystem): add XRPL x402 facilitator (#2190) 2026-05-07 14:10:52 +02:00
Tyler Frederick
e7150b3601
feat(evm): add Radius Network and Radius Testnet SBC as default stablecoin (Permit2 + EIP-2612) (#2038)
* feat(evm): add Radius Network and Radius Testnet default stablecoin (Permit2 + EIP-2612)

Add SBC as the default stablecoin for Radius Network (eip155:723487)
and Radius Testnet (eip155:72344) across Go, TypeScript, and Python SDKs.

SBC does not support EIP-3009, so Permit2 is the required transfer
method. SBC does support EIP-2612 permit() for gasless approval.

* docs: add Radius default-stablecoin entries to user-facing docs

* chore(paywall): update generated Radius decimals
2026-05-07 12:56:42 +02:00
pc_club_builder
3f1cd58e70
fix(python): exclude MCP tests from wheel (#2155) 2026-05-07 12:38:37 +02:00
mintlify[bot]
dc638f296b
Document Hedera network support in x402 (#2121)
* Update docs/sdk-features.md

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/sdk-features.md

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/core-concepts/network-and-token-support.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/core-concepts/network-and-token-support.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/core-concepts/network-and-token-support.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/core-concepts/network-and-token-support.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/core-concepts/network-and-token-support.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-05-07 09:47:50 +02:00
mintlify[bot]
f33cffbed8
Update docs/extensions/bazaar.mdx (#2209)
Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-05-07 09:45:38 +02:00
aayushijain-cb
608034f15a
feat: add service metadata on resource to all 3 SDKs (#2200)
* docs: add repo move note to README (#40)

* add service metadata on resource to all 3 SDKs

* lint

* changelog

* review: harden iconUrl validators + tighten signatures

* review: constrain serviceName/tags to printable ASCII

* add checks to harden iconurl + tag/name validators

* update v2 spec + python lint

* python format

---------

Co-authored-by: Ash <105402607+Must-be-Ash@users.noreply.github.com>
2026-05-06 14:13:33 -04:00
phdargen
c763d05adc
Batch-settlement scheme specification for EVM (#2051)
* batch-settlement on EVM

* update refund flow and payloads

* move corrective 402 info from errorDetails to requirements.extra.ChannelState and compute channelID from EIP712Hash

* align payment-response for all payloads

* post audit updates

* add deposit collector addresses

* update error codes
2026-05-05 07:55:33 -04:00
Carson Roscoe
a0f444c60e
feat: added cdk to example (#2197)
* feat: added cdk to example

* feat: pin x402 package versions

* feat: updated pin to float patch
2026-05-05 20:54:02 +09:00
Carson Roscoe
e01f40ff6a
fix: documentation (#2194) 2026-05-05 16:11:51 +09:00
Carson Roscoe
12708ef73f
feat: improved aws lambda examples documentation (#2192) 2026-05-04 13:53:16 -07:00
phdargen
45d7d19250
Batch-settlement TS sdk (#2061)
* spec + sdk

* add auto recover and topUp; add filestorage

* add session manager

* fix nonce reset

* add cooperativeWithdraw to spec/contract

* add cooperative withdraw to sdk

* update sdk to match spec v1.2

* change to auto-generated getters

* improve server devx

* improve client devx

* added concurrent request example

* minor fixes

* add cas

* add streaming example

* rename files to batched*

* updated scheme name deferred -> batched

* update to new contracts

* align paymentresponse.extra for all payloads

* fix recovery after refund

* fix withdraw -> refund flag

* fix channel manager

* rename to batch-settlement

* align with cloudflare specs

* remove claim/refund without sign

* add tx sim

* improve specs

* specs ready

* add unit/integration tests

* fix tests

* improve typing, remove dead code

* add readmes

* add e2e tests

* fix fileStorage

* increase depositMultiplier for streaming

* refund without paid request

* refactor convertToTokenAmount

* refactor scheme

* fix recovery for refund flow

* refactor client scheme

* rename session -> channel

* remove chargedCumulativeAmount from deposit payload

* scheme hook adapters

* add enrichSettlementPayload/enrichSettlementResponse hooks

* move batch-settlement scheme to scheme hook adapters and enrichSettlementResponse

* refactor refund and other payloads

* add client hook adapters

* align payment-response shapes

* move corrective 402 info from errorDetails to requirements.extra.channelState

* fix corrective deposit flow

* update to latest deployment and change channelId computation to EIP-712

* add hook to handle route handler failures

* add atomic channel update and request context primitives

* guard channels with pending reservations

* fix concurrent claim/settle

* skip facilitator and verify locally if onchain state fresh

* add redis storage

* add fullstack next example with redis and fix settlementOverride for next package

* align payment-response for all payloads

* add permit2 support and fix extra enrichment for nested objects

* fix DEPOSIT_WITNESS_TYPE_STRING

* test client state-loss recovery scenario in e2e

* fix recovery for axios

* improve channel manager

* update client deposit policy

* clean up examples

* add to testnet facilitator

* update READMEs

* for the culture

* add changesets

* update to latest deployment

* align error codes

* remove receiverAuthorizer fallback
2026-05-04 16:43:57 -04:00
Cloud
1e0434b18e
docs: add builder_code.md spec (#2050)
* docs: add builder_code.md spec

* support services array
2026-05-04 14:18:52 -04:00
Ash
78f05191b6
fix(site): remove x402 demo endpoint (#2172)
The /api/x402/demo endpoint did not help the isitagentready.com scanner
detect x402 support. Removing dead code.
2026-05-02 16:25:12 +09:00
Margaret Sommers
08e75685cd
feat(site): redesign hero section and update navigation CTAs (#2165)
- Replace Contact nav button with Get Started (links to buyer quickstart docs)
- Move Contact link to footer; add GitHub and Discord icon links to nav
- Move Trusted By partner logos into HeroSection below the code snippet
- Pin platform stats to bottom of hero left column on desktop (xl) with mt-auto
- Fix HeroIllustration not rendering at xl: remove broken animation, add min-w-0
- Replace unreliable Tailwind xl: variants with explicit @media rules in globals.css
- Fix mobile hero left column overflow by scoping items-start to lg+ only
- Add copyCode prop to CodeSnippet to separate display from clipboard content
- Adjust phone illustration vertical position for top alignment at xl
2026-05-01 13:51:06 -07:00
Daniil Okhlopkov
01abe6cc6b
specs(exact): propose TON exact scheme for x402 v2 (spec-only) (#1455)
* specs(exact): propose TON exact scheme for x402 v2 (spec-only)

Adds scheme_exact_ton.md defining the exact payment scheme for TON blockchain.
Uses W5 wallet internal_signed messages for gasless Jetton (TEP-74) transfers.
Updates scheme_exact.md with TON-specific validation rules.

* specs(exact/ton): address review feedback — exact amounts, commission bounds, stateInit verification

- Change amount verification from >= to == (exact match), aligning with
  all other chain specs (SVM, Stellar, EVM). The relay commission is a
  separate jetton_transfer in the W5 batch, not bundled into the payment.
- Add extra.maxRelayCommission field to PaymentRequirements, allowing
  resource servers to cap the relay commission amount.
- Add stateInit verification rule: when seqno == 0, facilitator must
  verify contract code against a known W5 wallet code hash allowlist.
- Tighten action count: W5 message must contain exactly the payment
  transfer and optionally a relay commission transfer, nothing else.

* specs(exact/ton): rewrite to self-relay architecture — address all review comments

* chore(spec): simplify TON spec — remove external_signed, condense references

- Remove external_signed (0x7369676e) mode — all x402 payments use
  gasless internal_signed. External mode deferred to future extension.
- Remove on-chain proof table (7 tx links) — promotional, not normative.
  Proofs already linked in PR comments.
- Condense Reference Implementations to 3 lines (was 20+).
- Settlement Logic now single-path (no dual-mode branching).
- 349 → 320 lines. Closer to SVM/Stellar spec size.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(spec): remove 50% gas buffer — emulation is already worst-case

* specs(exact/ton): address all review comments — remove /prepare, add RPC

Changes:
- Remove /prepare endpoint: client resolves seqno + jetton wallet via
  TON RPC directly (same pattern as SVM/Stellar/Aptos)
- Remove nonce field: dedup uses BoC hash, not nonce
- Transfer amount: strict equality (== not >=)
- Add jetton wallet verification: recipient MUST match
  get_wallet_address(payTo) on the asset master
- Seqno check: MUST NOT be less than on-chain seqno (was SHOULD)
- Add client balance check requirement
- Move simulation to /verify (was optional pre-settlement)
- Remove HTTP header references (transport-agnostic)
- Replace hardcoded 600s with maxTimeoutSeconds
- Add Client RPC Requirements appendix section

* specs(exact/ton): add facilitator safety, explicit jetton wallet check

- Add section 3 (Facilitator Safety): facilitator address MUST NOT
  appear as sender or Jetton transfer source. Matches SVM/Stellar.
- Make get_wallet_address check explicit per @skywardboundd: the
  destination in the deserialized BoC must match the resolved wallet.
- Align verification intro phrasing with SVM/Stellar style.

* specs(exact/ton): add areFeesSponsored flag per Stellar pattern

Follows Stellar's approach: extra.areFeesSponsored boolean, currently
always true. Non-sponsored flow (client pays gas) to be added later.

* specs(exact/ton): fix validUntil duplication, add stateInit code hash check

- Remove duplicate validUntil check from section 2 (already in section 5)
- Add stateInit code hash verification for seqno==0 deployments
  (per arjun215-eng's earlier feedback)

* specs(exact/ton): add payload.to and source Jetton wallet checks

Per @skywardboundd review:
1. payload.to MUST equal requirements.payTo (explicit metadata check)
2. Source Jetton wallet (W5 internal msg destination) MUST match
   get_wallet_address(from) — prevents substitute source contract
3. jetton_transfer body destination MUST equal requirements.payTo

Tested against deployed facilitator with real on-chain data.
Facilitator commit: ohld/x402-ton-facilitator@6f92320

* specs(exact/ton): remove facilitatorUrl, fix dedup TTL, add canonical W5R1 hash

- Remove facilitatorUrl from extra (implementation detail, not protocol field)
- Fix dedup TTL: use fixed 300s instead of per-request maxTimeoutSeconds
- Add canonical W5R1 code hash for stateInit verification
- Note simulation as alternative to code hash checks for seqno>0

Per @phdargen review on coinbase/x402#1455

* specs(exact/ton): internal message BoC, minimal payload, strict seqno

Major rework based on TON Core team review:
- settlementBoc is now an internal message (not external)
- Payload reduced to {settlementBoc, asset}, all fields derived from BoC
- Public key derived from stateInit or on-chain get_public_key
- Seqno check changed to strict equality (TON requirement)
- Internal message must be bounceable
- Removed facilitatorUrl, nonce, walletPublicKey
- Clarified simulation in /verify, extensibility for non-gasless flows
- Updated parent scheme_exact.md TON section

* spec: address skywardboundd review -- account states, asset clarification, simulation chain

- Replace seqno==0 with proper TON account states (nonexist/uninit) for stateInit condition
- Clarify that payload.asset is a JSON field, not a BoC-internal field (TEP-74 has no asset)
- Add full TEP-74 transfer chain verification to simulation section
- Remove non-normative timing note from settlement step 7
- Add W5 gasless transactions reference link

* spec: address remaining review comments from skywardboundd

- Narrow wallet scope to W5 v5r1 (not v5r1+), only version that exists today
- Remove redundant "x402 protocol-level requirement" sentence
- Add get_jetton_data hint for decimal resolution
- Add walletId to derived fields list
- Rename section 2 to "Message and signature verification"
- Move balance check from Replay protection to Payment intent
- Remove redundant seqno explanation sentence

* spec: clarify TON exact flow for optional jetton transfer params

Refine the TON `exact` scheme spec to better describe how client-signed W5 jetton transfers are verified and relayed by the facilitator.

This update expands the TON payment requirements and verification rules to account for optional jetton transfer parameters exposed through `extra`, and clarifies how those parameters are interpreted when they are omitted.

Changes included:
- add optional `extra.forwardPayload` and `extra.forwardTonAmount` to TON
  `PaymentRequirements` and define their effective defaults as zero-bit payload and `"0"`
- add optional `extra.responseDestination` and define its effective default as `addr_none`
- require facilitators to compare the effective values of `responseDestination`, `forwardPayload`, and `forwardTonAmount` between `accepted.extra` and `requirements.extra`
- extend payment intent validation so the facilitator derives and checks `response_destination`, `forward_payload`, and `forward_ton_amount` from the signed W5 action
- clarify that the facilitator-funded relay must cover both outer relay execution and the value expected by the client-signed inner transfer
- clarify that the client-signed inner message must carry enough TON to fund payer-side execution from the payer jetton wallet to the source jetton wallet
- specify that the outbound internal message from the client W5 wallet to the source jetton wallet must be bounceable
- specify that the `settlementBoc` wrapper itself does not need to be bounceable
- clean up terminology and consistency across the document: `BoC`, `zero-bit`, `forwardPayload`, `forwardTonAmount`, and derived field descriptions

This is a spec clarification/update only. It does not introduce a new TON payment scheme, but makes the existing gas-sponsored W5 relay flow more precise.

* specs(exact/ton): clarify W5 account states and extra field semantics

* soec(exact/ton): clarify code hash check

* spec(exact/ton): update reference implementations

* spec(exact/ton): allow sending mode 3

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Arkadiy Stena <arkadiystena@gmail.com>
2026-05-01 19:30:02 +09:00
Ethan Oroshiba
7ec7815257
feat(bazaar): update WithBazaar SDK wrappers with search, unified auth, and Python alignment (#2094)
* update withBazaar

* Fix bazaar MCP discovery parity across TS/Python/Go; tighten e2e validation; update docs/examples.

* python format

* remove formatting-only changes

* remove formatting-only changes

* reinstate old comments

* clean up response shape

* revert pagination to object instead of top level fields

* address review comments
2026-04-30 02:19:09 +09:00
erikreppel-cb
e048247b0f
Add codeowners per-network (#2082)
* Add codeowners per-network

* Update CODEOWNERS
2026-04-28 17:25:57 -07:00
Ash
582a3d1118
feat(site): add x402 demo API endpoint for scanner discoverability (#2152)
The isitagentready.com scanner cannot detect x402 support through
the existing /protected page (tried sitemap inclusion, Link headers,
X-X402-Supported header). Add a dedicated API endpoint at /api/x402/demo
that returns a clean HTTP 402 with PAYMENT-REQUIRED header using the
same payment config as /protected.
2026-04-28 11:29:58 -07:00
phdargen
bed58c70e0
chore(go): release v2.10.0 (#2150) pypi-x402@v2.9.0 go-x402@v2.10.0 go/v2.10.0 2026-04-28 02:15:46 +09:00
phdargen
af26d09182
chore: version python package (#2149) npm-@x402/mcp@v2.11.0 npm-@x402/axios@v2.11.0 npm-@x402/fetch@v2.11.0 npm-@x402/paywall@v2.11.0 npm-@x402/fastify@v2.11.0 npm-@x402/next@v2.11.0 npm-@x402/hono@v2.11.0 npm-@x402/express@v2.11.0 npm-@x402/svm@v2.11.0 npm-@x402/core@v2.11.0 npm-@x402/stellar@v2.11.0 npm-@x402/aptos@v2.11.0 npm-@x402/avm@v2.11.0 npm-@x402/evm@v2.11.0 npm-@x402/extensions@v2.11.0 2026-04-28 01:43:06 +09:00
phdargen
ce4748d050
chore: version typescript packages (#2148) 2026-04-28 01:42:49 +09:00
Ryan R. Fox
484030b21e
chore(paywall): regenerate bundle + add recurrence guard (#2054)
The committed @x402/paywall bundle on main was last generated against an
older viem than the lockfile currently pins. pnpm install --frozen-lockfile
resolves viem 2.47.12 (via #2013), but the bundled src/evm/gen/template.ts
(and its Python + Go siblings) were built against an earlier resolution
that pre-dated chain definitions for Mezo, MegaETH, Stable, Radius (each
with a testnet variant), and 33 others. EvmPaywall.tsx throws
"Unsupported chain ID" at init for any eip155:<id> whose chain isn't in
the bundled viem/chains.

This PR:
  1. Regenerates all nine auto-generated template files (TypeScript,
     Python, and Go for EVM/SVM/AVM) against the current lockfile. No
     source changes on any runtime path.
  2. Teaches build:paywall to emit output matching the repo's formatters
     (prettier / ruff), so generated files stay clean under pnpm run
     format + uvx ruff format.
  3. Adds a PR-time drift check
     (.github/workflows/check_paywall_template.yml) so a future lockfile
     or @x402/evm change that invalidates the bundle fails loudly
     instead of shipping silently.

Scope is limited to @x402/paywall because it is the only package in this
repo that bakes viem chain definitions into a built artifact.

Verified on a fork-internal test PR running on ubuntu-latest
(Node 24, pnpm 10.7.0): check_format, check_lint, check_go, check_python,
check_package_lock, and the new check_paywall_template drift check all
pass. Additional local evidence:

  - Chain-presence in regenerated bundle: Mezo 31612/31611, MegaETH
    4326/6343, Stable 988/2201, Radius 723487/72344, Base/Arbitrum/
    Polygon all present (mainnet/testnet ordering).
  - Cross-platform determinism: a clean-slate rebuild on macOS produces
    byte-identical output to ubuntu-latest CI.
  - Tarball install into a throwaway consumer: all expected chain IDs
    present in the published dist/esm/evm/index.js.
  - Browser smoke test (Chrome, served from a local HTTP server):
    EvmPaywall mounts without Unsupported-chain throw for
    eip155:31611 (Mezo Testnet) and eip155:723487 (Radius); DOM
    renders the expected token/chain labels.

Fixes #1971.
2026-04-26 22:47:13 +09:00
Ash
4feebcf481
fix(site): improve x402 discoverability for scanner (#2128)
- Add /protected to sitemap so scanners can discover the 402 endpoint
- Add X-X402-Supported header on homepage to signal x402 support

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-26 15:22:48 +09:00
Ryan R. Fox
032295b8ce
fix(paywall): use dynamic token decimals instead of hardcoding 6 (#1980)
* fix(paywall): use dynamic token decimals instead of hardcoding 6

The EVM paywall displays incorrect amounts for any token that does not
use 6 decimal places. An 18-decimal token priced at 0.001 raw units
renders as $1,000,000,000 because the code divides by 10^6 everywhere.

Root cause: the paywall was built assuming USDC (6 decimals) is the
only payment token. This assumption appears in three places:

1. Server-side HTML generation (index.ts) divides the raw amount by
   a hardcoded 10^6 to produce the display value injected into the
   template.

2. Client-side balance display (EvmPaywall.tsx) calls formatUnits
   with a hardcoded 6 and reads the token address from a 3-chain
   USDC lookup table that returns 0 for any other chain.

3. The balance utility (utils.ts) only knows USDC addresses on
   Ethereum, Base, and Base Sepolia — every other chain silently
   shows a zero balance.

Fix:

Server-side (index.ts): look up the token's decimal precision from a
known-decimals map aligned with DEFAULT_STABLECOINS. Only non-6-decimal
chains need entries; everything else falls back to 6. This keeps the
server-side path simple with no RPC calls.

Client-side (EvmPaywall.tsx): read the token contract address from
the payment requirement's `asset` field (which the server already
populates) and query the standard ERC-20 decimals() function on-chain.
This works for any compliant token without maintaining a lookup table.

utils.ts: replace the USDC-specific getUSDCBalance (internal helper,
not part of the public API) with generic getTokenBalance and
getTokenDecimals functions that accept a token address parameter.
The function signature changes from 2 args to 3, but no external
consumer can import it — it is only used by the bundled React
component inside the paywall HTML template.

**Breaking change note:** the internal helper getUSDCBalance in utils.ts
is removed and replaced by getTokenBalance (different signature: takes
an explicit token address instead of looking it up by chain ID). This
function is not exported from the package's public API — it is only
consumed by the bundled EvmPaywall React component inside the paywall
HTML template. No server operator code calls it directly. However,
anyone who has forked the paywall and imports from the file path
(bypassing package exports) would need to update their import and
call site.

Regenerated Go, Python, and TS paywall templates.

**AI disclosure:** This PR was prepared with the assistance of a coding agent and
reviewed by Ryan R. Fox (an actual human) before submission.

* style: ruff format paywall templates

* fix(paywall): use DEFAULT_STABLECOINS lookup + BigInt formatUnits

Removes the parallel KNOWN_DECIMALS map in @x402/paywall/src/evm/index.ts
that mirrored DEFAULT_STABLECOINS from @x402/evm. The paywall now resolves
token decimals through the same registry that scheme implementations and
@x402/core's inline scheme dispatch already read from.

evmPaywall.generateHtml changes:
  * getDefaultTokenDecimals helper looks up requirement.network directly in
    @x402/evm's DEFAULT_STABLECOINS, with a 6 (USDC default) fallback when
    the network is unknown.
  * Atomic-to-display conversion uses Number(formatUnits(BigInt(amount),
    decimals)) instead of parseFloat(amount) / 10**decimals. parseFloat
    silently rounds sub-cent precision on real 18-decimal amounts before
    the divide; BigInt + formatUnits preserves precision through the
    conversion. BigInt also rejects non-integer atomic strings, which
    matches the spec's atomic-integer contract.

@x402/paywall package.json: @x402/evm moves from devDependencies to
dependencies because the new server-side import of DEFAULT_STABLECOINS is
on the runtime path emitted into dist/.

@x402/evm now publicly re-exports DEFAULT_STABLECOINS from
./shared/defaultAssets so consumers can read the canonical default-asset
registry directly. Both @x402/evm and @x402/paywall get a minor bump
for the additive public API.

Adds 6 unit tests:
  * getDefaultTokenDecimals returns 18 for Mezo Testnet (registry path)
  * getDefaultTokenDecimals returns 6 for Base mainnet, asserted alongside
    DEFAULT_STABLECOINS so an empty registry would fail the test
  * getDefaultTokenDecimals falls back to 6 for unknown networks
  * evmPaywall.generateHtml renders 1e15-atomic Mezo mUSD as
    'amount: 0.001,' end-to-end (regression test for the /1e6 bug)
  * evmPaywall.generateHtml renders 1e6-atomic Base USDC as 'amount: 1,'
  * evmPaywall.generateHtml throws on a non-integer atomic ('1.5'),
    pinning the BigInt strictness so a future revert to parseFloat fails

Closes #1979.

* refactor(paywall): generate evm decimals at build time, drop @x402/evm runtime dep

Addresses @phdargen's review: rather than promoting @x402/evm to a
runtime dependency of @x402/paywall, keep it a devDependency and
emit a codegen'd `src/evm/gen/decimals.ts` that mirrors just the
per-network `decimals` field of `DEFAULT_STABLECOINS`.

Pattern-consistent with the existing `src/evm/gen/template.ts` codegen
(HTML bundle) — same build step (`src/evm/build.ts`), same "AUTO-GENERATED
DO NOT EDIT" banner, same commit-the-generated-file workflow. The CI
drift check queued in #2054 (`check_paywall_template.yml`) will pick up
`decimals.ts` under the existing `typescript/packages/http/paywall/**`
trigger glob once that PR merges; in the meantime an in-process drift
invariant test in `network-handlers.test.ts` asserts `NETWORK_DECIMALS`
matches `DEFAULT_STABLECOINS` key-for-key.

Runtime behaviour is unchanged. `getDefaultTokenDecimals` now reads the
generated `NETWORK_DECIMALS` map instead of reading `DEFAULT_STABLECOINS`
at runtime; the same Mezo-18, Base-6, unknown→6 cases still hold, and
the existing 6 regression tests in `network-handlers.test.ts` pass
without modification. A seventh test pins the drift invariant described
above.

package.json: `@x402/evm` moved from `dependencies` to `devDependencies`.
Runtime module graph for `@x402/paywall` no longer pulls `@x402/evm`;
the only surviving `@x402/evm` references in paywall src are:
  * `browserAdapter.ts` — `import type { ClientEvmSigner }` (type-only,
    erased at build time)
  * `EvmPaywall.tsx` — `ExactEvmScheme` (bundled into `gen/template.ts`
    by esbuild, not part of the server-side runtime path)
  * `build.ts` and `network-handlers.test.ts` — build-time / test-time
    consumers; devDep is available in both.

Both the root `typescript/pnpm-lock.yaml` and `examples/typescript/pnpm-lock.yaml`
are updated to reflect the dep move — both workspaces reference the
paywall package manifest via `workspace:~`.
2026-04-26 13:57:49 +09:00
Natsuki Yamaguchi
9b99acdf60
refactor: deduplicate checkIfBazaarNeeded across HTTP packages (#1925)
* checkIfBazaarNeeded を @x402/core に統合し、4パッケージの重複を排除

* 重複した checkIfBazaarNeeded 定義を削除

* 各HTTPパッケージの vi.mock に checkIfBazaarNeeded を追加
2026-04-26 13:34:12 +09:00
Natsuki Yamaguchi
60d467d7a2
fix: use dynamic decimals in getDisplayAmount instead of hardcoded USDC 6 (#1926)
* getDisplayAmount でトークンの decimals を動的取得し USDC ハードコードを修正

* Amount 表示で末尾の0を削除し動的 decimals を適用

* decimals を [0, 100] にクランプし toFixed の RangeError を防ぐ

* x402ResourceServer.ts の prettier フォーマットを修正
2026-04-26 13:31:40 +09:00
Alfred Tom
05f0e0489f
feat: add auth-hints extension to streamline scheme-level authentication (#1902)
* feat: add auth-hints extension to streamline scheme-level authentication

- Described general auth scheme for x402, mainly on HTTP transports
- Initial support for two auth method types: oauth2 (Bearer/DPoP) and sign-in-with-x
- Defined scheme and acceptIndex hints.

* feat: settle on acceptIndexes, schemeAuth->authRequirements, remove references to scheme-based hints
2026-04-24 08:57:32 -07:00
Peter Swierzy
bd6d7d47b9
feat(hedera): add initial @x402/hedera package (#1360)
* feat(hedera): add @x402/hedera package with exact payment scheme

  - New @x402/hedera package implementing the x402 v2 exact scheme
  - Uses @hiero-ledger/sdk for signing and submission
  - Onchain preflight transfer check before settlement
  - Settlement receipt validation (USDC + HBAR coverage)
  - HEDERA_ACCOUNT_ID / HEDERA_PRIVATE_KEY / HEDERA_NETWORK env vars
  - Integrated with advanced clients (axios, fetch), facilitators, and HTTP adapters (hono, fastify, next)
  - E2E tests for Hono, Next.js, and Fastify servers
  - Testnet faucet docs and token association notes

Signed-off-by: Piotr Swierzy <piotr.swierzy@blockydevs.com>

* refactor: use convertToAtomicAmount function from @x402/core/utils

Signed-off-by: Piotr Swierzy <piotr.swierzy@blockydevs.com>

---------

Signed-off-by: Piotr Swierzy <piotr.swierzy@blockydevs.com>
2026-04-24 23:57:23 +09:00
mintlify[bot]
ba1a65af3e
Document ResourceServerExtension hooks property (#2114)
* Update docs/extensions/overview.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/overview.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/overview.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/advanced-concepts/lifecycle-hooks.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-04-24 13:51:49 +09:00