44 Commits

Author SHA1 Message Date
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
erikreppel-cb
e048247b0f
Add codeowners per-network (#2082)
* Add codeowners per-network

* Update CODEOWNERS
2026-04-28 17:25:57 -07: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
Carson Roscoe
c6391b1585
feat: updated legacy npm packages to deploy via trusted publishing (#2039) 2026-04-16 13:45:32 +09:00
MG
a25800efed
feat(avm): Add Algorand (AVM) blockchain exact spec implementation and networks support for Typescript (#1560)
* Migrate all code from branch-algorand-v2-typescript-algokit

* Update format and lint pass on core and examples

* Reformat template files

* Update: Coinbase review changes applied

* Fix Paywall builder pattern

* Update: Reverted e2e/legacy, Remove: src/exact/v1 and src/v1

* Add Faucets URLs to AVM README

* Optimizing and shrinking PR

* Remove dead import

* Add optimization changes related unit tests

* Update coinbase review changes applied

* Update avm e2e, rebased to latest, linted and formatted

* Fix avm template format

* Remove python and Go AVM templates, Made AVM optional to facilitator and Add SERVER_ADDRESS

* Lint and format

* Update: made AVM optional in proxy.ts

* Rebased and Replayed some commits

* Reset e2e pnpm-lock.yaml

* Replayed correct updated lockfiles

* Reverted accidentally overwritten files during rebase replay

* Revert accidental overwritten files in examples
2026-04-11 08:01:20 +09:00
Carson Roscoe
536b92ea07
feat: updated pypi workflow to use trusted publishing (#1916) 2026-04-02 16:19:28 -07:00
Elliot Padfield
bd424988aa
Add Fastify framework adapter for x402 payment middleware (#1512)
* Add Fastify framework adapter for x402 payment middleware

* fix(fastify): preserve settlement response bytes and resource URLs

* chore(fastify): regenerate lockfiles for @x402/fastify workspace package

The pnpm-lock.yaml files in typescript/ and examples/typescript/ were missing
entries for the @x402/fastify package, causing CI to fail with
ERR_PNPM_OUTDATED_LOCKFILE on every workflow.

* feat(fastify): add e2e test server

Adds a Fastify server to the e2e test suite, following the same pattern as
Express and Hono. The test framework auto-discovers it via test.config.json.

Includes all standard endpoints: /protected (EVM), /protected-svm, /protected-aptos,
/protected-permit2, /protected-permit2-erc20, /protected-stellar, /health, /close.

* ci(fastify): add npm publishing workflow

Adds workflow_dispatch publishing workflow for @x402/fastify, matching the
pattern used by @x402/express and @x402/hono.
2026-03-24 15:24:06 +09:00
Marcelo Salloum dos Santos
013754554a
Add Stellar Blockchain Support (#711)
* Add @x402/stellar mechanism package with exact scheme

Implement Stellar support for the x402 protocol covering:
- Types, constants (network IDs, USDC contracts), and utility functions
- Ed25519 signer with client/facilitator variants
- Soroban transaction simulation and auth entry handling
- Client: builds transfer calls, signs auth entries, serializes XDR
- Server: parses prices, enhances payment requirements
- Facilitator: verify (structure, amounts, signatures, events) and
  settle (fee sponsorship, multi-signer round-robin, submission)

* Add unit tests for the Stellar mechanism

Cover signer, constants, utils, shared helpers, client/server
scheme logic, and facilitator verify/settle/getExtra flows.
150 tests across 9 test files.

* Add integration tests for Stellar exact scheme

End-to-end flows against Stellar testnet covering both the core
x402Client/Server/Facilitator and the HTTP middleware variants.
Includes resilience to testnet resets via automatic re-funding.

* Add Stellar README and cross-reference from evm/svm

Document the package API, usage examples, fee sponsorship model,
and multi-signer facilitator setup. Link back from evm and svm.

* Wire up Stellar in the advanced examples

Register Stellar client/server/facilitator schemes alongside EVM
and SVM in the all_networks examples. Guarded by env var presence
so existing setups keep working without Stellar credentials.

* Document Stellar setup in the advanced example READMEs

Add STELLAR_PRIVATE_KEY / STELLAR_ADDRESS env vars to .env-local
templates and update the example READMEs with Stellar usage notes.

* Add Stellar to the e2e test suite

Extend the test framework with Stellar network support, add
protected-stellar endpoints to express/hono/next servers, register
Stellar signers in axios/fetch clients and the TS facilitator.
Includes test configs, lockfile, and the Stellar family in the
test runner. All 8 server×client combos pass against testnet.

* Update e2e docs with Stellar setup and trustline instructions

Add STELLAR env vars to .env-local templates, document the Stellar
testnet account setup process (keypair, USDC trustline, faucet),
and update all server/client/facilitator READMEs.

* Add npm publish workflow for @x402/stellar

Manual-dispatch GitHub Actions workflow to publish the Stellar
package to npm with provenance, matching the pattern used by
the other mechanism packages.

* Add CHANGELOG for @x402/stellar v2.5.0
2026-03-04 13:56:52 -08:00
Notorious D.E.V.
384fc930bf
ci: add ruff format check to Python CI workflow (#1214)
The lint-python job in check_python.yml only ran `ruff check` (lint)
but never verified formatting with `ruff format --check`. This allowed
unformatted Python code to pass CI and be merged. Add the missing
format check step.
2026-02-23 18:00:35 +09:00
Carson Roscoe
167d923430
fix: github workflows for evm/paywall deploys which depend on extensions (#1274) 2026-02-20 15:52:35 -05:00
Jon
57a5488bcb
Add Aptos payment mechanism (#966)
* Add Aptos mechanism implementation for x402

* Revert go changes

* Fix go revert

* Fix e2e imports

* Add aptos to all server e2e tests, make optional

* Make aptos optional on site

* Fix lint / format issues

* Add workflow for x402 aptos package

* Update e2e tests

* Fix facilitator manager
2026-02-19 15:29:43 -05:00
Andrew Reder
fdbd15ea7d
feat(coinbase-x402): add e2e test workflow (#1181)
* add commenting

* test workflow

* validate secrets

* fix env generation

* add build step

* add min to testing

* test fix

* clean up output

* add better parallelization to e2e

* remove tempoary push trigger

* refactor e2e code
2026-02-17 15:11:51 -08:00
Carson Roscoe
885514cbc3
fix: allow prerelease tags (#1099) 2026-02-05 13:15:21 -08:00
Carson Roscoe
09b529ae00
feat: added x402MCPClient, x402MCPServer, middleware, and examples (#1056)
* feat: added x402MCPClient, x402MCPServer, middleware, and examples

* feat: expanded examples to simple & advanced mcp examples

* fix: format/lint

* feat: added npm deploy workflow and set version to 2.2.0-alpha

* feat: client side PR feedback

* feat: pr feedback

* fix: merge to main

* fear: pr feedback

* feat: added integration teast with SSE MCP

* feat: expose timeout, abort signal and reset timeout on progress options to x402MCPClient

* fix: rebased main

* fix: examples linting

* fix: remove unknown directive
2026-02-02 17:50:40 -08:00
Faris Habib
55feb97c07
Add Changelog Management (#1036)
* add changelog tooling + config

* add docs and baseline changelogs

* update gitignore

* align towncrier to agentkit verbage

* address PR review
2026-01-29 12:52:02 -08:00
phdargen
61d637636b
Added hooks to docs (#1026)
* added hooks to docs

* add links to quickstarts

---------

Co-authored-by: Faris Habib <faris.habib@coinbase.com>
2026-01-28 09:29:17 -08:00
Faris Habib
0bba14b2af
Migrate to mintlify (#925)
* migrate to mintlify

* rename README.md to introduction.md for Mintlify compatibility

* add vercel starter kit to docs

* update descriptions

* fix links

* fix legacy link

* nit

* adjust instructions for mintlify agent

* Update to use github api to detect code changes

* fix links

* fix links

* exclude website

* update facilitator token support

* update docs link

* fix minor linting

* update package paths, exlucde legacy

* update docs for python v2 sdk
2026-01-22 12:16:19 -08:00
Carson Roscoe
30a847d7d1
feat: New Python SDK with v2 support (#841)
* chore: renamed python/x402 to python/legacy

* feat: initial Python core SDK

* feat: added core HTTP wrappers

* feat: added core types

* feat: added evm mechanism for exact v1/v2

* feat: added httpx client

* feat: added requests client

* feat: added fastapi middleware

* feat: added flask middleware

* feat: added integration tests

* feat: added Python SDK to e2e tests

* python-v2: fix workflow checks (#863)

* fix format

* fix lint

* fix build

* fix pytest

* Fix syntax errors and missing imports in manual integration example (#902)

- Add missing imports (base64, json, Response, JSONResponse, PaymentPayload, FacilitatorClient)
- Fix function signature syntax error
- Fix dict initialization syntax (colon to equals)
- Add missing return statement after successful payment
- Remove trailing whitespace

* feat: add Python SDK v2 server examples (FastAPI, Flask)  (#879)

* feat: add fastapi example project configuration

* feat: add fastapi example with x402 payment middleware

* docs: add comprehensive README for fastapi example

* feat: add flask example project configuration

* feat: add flask example with x402 payment middleware

* docs: add comprehensive README for flask example

* feat: add test clients for fastapi and flask examples

* docs: add test client usage to READMEs

* chore - remove python-version and test-client.py

* docs - remove test client guide from README.md

* chore - remove license and classifier

* feat - add description and mime type

* feat - update .env-local

* feat: add Python v2 client examples (httpx & requests) (#857)

* feat: add Python v2 client examples (httpx & requests)

Add simple client examples demonstrating httpx (async) and requests (sync) usage with the x402 Python v2 SDK.

- examples/python/clients/example.py - Simple example showing both httpx and requests
- Uses EthAccountSigner with register_exact_evm_client helper
- Minimal configuration required

* refactor: split Python client examples into separate directories

Address PR review feedback:
- Separate httpx/ and requests/ directories
- Add pyproject.toml for uv sync support
- Add environment variable validation
- Add payment response header extraction
- Use context manager for requests session cleanup

Tested on Base Sepolia testnet:
- httpx: tx 0xce49f668aba01c4b0b1af2eb0d9a381f4c62295506a91f20af479e0e834ef350
- requests: tx 0xb83b6feefa5a744b7779ba5b37df33f9c7241f58119454d66102acd97a92f024

* Update examples/python/clients/httpx/main.py

Co-authored-by: phdargen <pdargent@icloud.com>

* Update examples/python/clients/requests/main.py

Co-authored-by: phdargen <pdargent@icloud.com>

---------

Co-authored-by: phdargen <pdargent@icloud.com>

* feat(python): Make v2 framework and client dependencies optional extras (#901)

* python-v2: add svm mechanism (#904)

* add svm mechanism

* add unit tests

* add integration tests

* update server examples

* add e2e tests

* update clients

* make EVM/SVM dependencies optional extras

* fix legacy uv paths

* V2 python bazaar (#929)

* add bazaar extension

* strip query params for discovery

* fix 862

* updated e2e tests

* Add advanced Python client examples (#947)

* Add advanced Python client examples

Implements 5 advanced patterns demonstrating x402 SDK v2 features:
- hooks.py: Payment lifecycle hooks (before, after, failure)
- preferred_network.py: Custom network preference selector
- builder_pattern.py: Network-specific registration with wildcards
- error_recovery.py: Error classification and recovery strategies
- custom_transport.py: Custom httpx transport with retry/timing

Includes:
- CLI entry point (index.py) for running examples
- Comprehensive test suite (40 unit tests)
- E2E integration tests
- README documentation

All tests passing.

* Remove tests and examples beyond TypeScript SDK parity

Address PR review feedback:
- Remove tests directory (tests belong in SDK, not examples)
- Remove custom_transport.py (runtime error, beyond TS parity)
- Remove error_recovery.py (duplicate of hooks.py, beyond TS parity)
- Update index.py, README.md, pyproject.toml accordingly

* Address PR feedback: add SVM support and use optional deps

- Update pyproject.toml to use x402[evm,svm,httpx] instead of
  listing dependencies separately
- Add Solana/SVM network examples to preferred_network.py
- Support both EVM and SVM signers for cross-chain flexibility
- Update .env-local with SOLANA_PRIVATE_KEY option

* Python-v2: facilitator example + e2e (#950)

* add facilitator example

* improve svm signer

* add description to DiscoveredResource

* add facilitator e2e

* add paywall builder (#953)

* Add Python custom client example (#954)

Demonstrates manual x402 v2 payment flow without convenience wrappers.

Shows the 6-step process:
1. Initialize client and register payment schemes
2. Make initial request, receive 402
3. Decode PAYMENT-REQUIRED header
4. Create signed payment payload
5. Retry with PAYMENT-SIGNATURE header
6. Handle success/failure response

Useful for integrating with non-standard HTTP libraries or implementing
custom retry logic.

* feat(v2-sdk): support async dynamic hooks for price and metadata (#900)

* feat(http): implement dual class design for sync/async support

- Add x402HTTPResourceServer (async) for FastAPI/Starlette
- Add x402HTTPResourceServerSync (sync) for Flask/Django
- Share common logic via _x402HTTPServerBase
- Remove dynamic description/resource (keep only dynamic price/payTo)
- Update Flask middleware to use sync server directly
- Integrate with enrich_extensions for bazaar support
- Add per-route hook_timeout_seconds configuration

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

* fix(types): add missing Awaitable import and fix test import sorting

- Add Awaitable import to types.py for DynamicPayTo/DynamicPrice type hints
- Fix import block sorting in test_async_hooks.py and test_core.py

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

* refactor: simplify API by removing unused types and making timeout opt-in

Address reviewer feedback from @phdargen:
- Remove SyncDynamicPayTo/SyncDynamicPrice (unused types that would require SyncPaymentOption to be useful)
- Change hook_timeout_seconds default to None (opt-in, matching TS/Go parity)
- Export x402HTTPResourceServerSync from http/__init__.py

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* python-v2: make create_facilitator_config work with both V1 and V2 (#968)

* make create_facilitator_config work with both V1 and V2

* fix lint

* feat: add Python SDK v2 server advanced example (FastAPI) (#952)

* feat - add pyproject.toml, uv.lock for advanced example

* feat - add bazaar extension

* feat - add hooks

* feat - add x402 extensions to pyproject.toml

* feat - add dynamic pricing feature

* feat - add dynamic pay-to and custom money parser features

* docs - add README for advanced server example

* style - apply lint

* chore - add comments for bazaar extension code

* fix: python v2 x402HTTPAdapter retry logic (#978)

* fix: fix consecutive payment bug in x402HTTPAdapter

- Replace instance-level _is_retry flag with per-request header
  to prevent state leakage between consecutive 402 requests.

* tests - add test case for consecutive payment with x402HTTPAdapter

* style - apply lint

* Python-v2: async lifecycle hooks (#975)

* add dual sync/async classes for server/client/facilitator

* update integration/e2e tests

* add unit tests for core, http and implement wrapHttpxWithPaymentFromConfig/wrapRequestsWithPayment

* refactor core server/client/facilitator

* refactor x402_http_server/facilitator_client/x402_http_client

* update exmamples

* add utility function that takes care of html-safe escaping

* add sdk readmes

* add retry unit tests to httpx client

* Update Python SDK Docs for v2 (#976)

* Porting docs and updating for v2 changes (#813)

* porting docs and updating for v2 changes

* update quickstart for sellers

* update quickstarts, miniapps, and mcp docs

* update doc links

* update FAQs

* fix getting started docs

* update core concepts

* remove miniapps guide

* update extensions

* fix bazaar code examples

* fix broken links and yaml file

* remove unnecessary protocol layer doc

* add migration guide

* update documentation for python v2 sdk

* testing pr preview

* docs(python): remove unused os imports and align with TS tab patterns

- Remove unused 'import os' from FastAPI and Flask examples in quickstart-for-sellers
- Update bazaar-discovery-layer Python example to use hardcoded '0xYourPrivateKey' to match TypeScript tab consistency

* update migration doc

* cleanup comments

* cleanup readme

* fix: Python facilitator e2e code

* fix: lint

---------

Co-authored-by: phdargen <p.dargent@cern.ch>
Co-authored-by: somesome <57699892+sohw400@users.noreply.github.com>
Co-authored-by: Logan Kang <kcs93023@gmail.com>
Co-authored-by: 1bcMax <viewitter@gmail.com>
Co-authored-by: phdargen <pdargent@icloud.com>
Co-authored-by: Vladimir Sotnikov <bubert9@gmail.com>
Co-authored-by: Shuhei <shuhei0866@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Faris Habib <faris.habib@coinbase.com>
2026-01-21 16:32:07 -08:00
phdargen
d5aa3723b4
Go CI workflow (#926)
* add go ci

* fix format

* add python to pr template

* fix lint
2026-01-08 10:01:35 -08:00
phdargen
b45a61ed06
add PR labeler (#888) 2026-01-05 17:21:27 -08:00
Carson Roscoe
ef78993823
chore: update publish branch for workflow (#766) 2025-12-11 11:00:59 -08:00
Carson Roscoe
cfa66539e2
chore: omit branch check from publish in workflow (#765) 2025-12-11 10:50:42 -08:00
Carson Roscoe
7fbd116711
chore: bring back @coinbase/x402 publish workflow (#764) 2025-12-11 10:40:06 -08:00
Carson Roscoe
d0f0fdfbe4
chore: update other scoped workflows (#759) 2025-12-11 08:48:19 -08:00
Carson Roscoe
808c4e0d0d
fix: @x402/core deploy workflow (#757) 2025-12-11 08:37:57 -08:00
Carson Roscoe
1a79feaf94
Development v2 (#705)
* chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders

* feat: added @x402/core to /typescript/packages

* feat: added @x402/evm to /typescript/packages/mechanism

* feat: added @x402/svm to /typescript/packages/mechanism

* feat: added @x402/extensions to /typescript/packages

* feat: added @x402/fetch to /typescript/packages/http

* feat: added @x402/axios to /typescript/packages/http

* feat: added @x402/paywall to /typescript/packages/http

* feat: added @x402/express to /typescript/packages/http

* feat: added @x402/hono to /typescript/packages/http

* feat: added @x402/next to /typescript/packages/http

* chore: update /typescript pnpm packaging

* feat: added core files to /go

* feat: added evm mechanism to /go

* feat: added svm mechanism to /go

* feat: added extensions to /go

* feat: added gin to /go/http

* feat: added tests to /go

* feat: rewrote e2e test suite system

* feat: added axios client to e2e suite

* feat: added fetch client to e2e suite

* feat: added go http client to e2e suite

* feat: added express server to e2e suite

* feat: added hono server to e2e suite

* feat: added next server to e2e suite

* feat: added gin server to e2e suite

* feat: added typescript facilitator to e2e suite

* feat: added go facilitator to e2e suite

* feat: added fetch example to examples/typescript/clients

* feat: added axios example to examples/typescript/clients

* feat: added advanced example to examples/typescript/clients

* feat: added custom example to examples/typescript/clients

* feat: added express example to examples/typescript/servers

* feat: added hono example to examples/typescript/servers

* feat: added advanced example to examples/typescript/servers

* feat: added custom example to examples/typescript/servers

* feat: added facilitator example to examples/typescript

* chore: update /examples/typescript pnpm packaging

* feat: added http client to examples/go/clients

* feat: added advanced client to examples/go/clients

* feat: added custom client to examples/go/clients

* feat: added gin server to examples/go/servers

* feat: added advanced server to examples/go/servers

* feat: added custom server to examples/go/servers

* feat: added facilitator to examples/go

* chore: updated github workflows

* fix: typescript examples fotmat/lint

* v2: next example (#706)

* fix legacy example builds

* add next example

* fix format

* upgrade to next 16

* fix legacy build

* fix e2e tests

* V2: next api wrapper (#707)

* add next route wrapper

* add protected api to example page

* add unit tests

* fix missing settle failure check

* added e2e tests for withX402

* add SettleResponse to ProcessSettleResultResponse

* add requirements to payment-header

* feat: add v2 support to x402.org facilitator

* feat: dynamically load bazaar extension in Next only when used

* fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure

* feat: add ERC1271 and ERC6492 support to Typescript facilitator

* feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support

* feat: add ERC1271 and ERC6492 support to Go facilitators

* feat: update go facilitator example & e2e test for ERC1271/ERC6492 support

* v2: express fixes + unit tests  (#712)

* add express fixes from v1

* add units test for express/hono

* added fetch/axios unit tests

* v2: Clean up paywall (#710)

* Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig

Remove Onramp functionality from EvmPaywall

Remove Coinbase fields from paywall template generation

* Migrate site to @x402/next with v2 protocol support

* Clean up tests

* remove CDP onramp from core paywall

* Update templates and build process

* Format

* Lockfile

* mock templates for CI

* Format

* Generate new templates

* Format

* v2: facilitator sync fix (#716)

* update next/react versions

* update site to next 16, tailwind 4 and fix env vars

* fix initializeOnStart pattern

* security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw

* v2:fix ts advanced/custom examples (#717)

* fix ts examples

* add clients/advanced/preferred-network example

* feat: improved e2e cli for external facilitator testing

* feat: updated evm & svm signer interfaces in go

* feat: updated evm & svm signer interfaces in typescript

* feat: reverted SupportedKind's kinds structure in go

* feat: reverted SupportedKind's kinds structure in typescript

* feat: refactor facilitator SVM signer interface in typescript

* go example fixes (#719)

* feat: cleanup go bazaar extension

* V2: docs update (#729)

* ts example docs

* improve ts package docs

* feat: dynamic bazaar import for all server middleware

* feat: allow dynamic response building for 402 response in typescript

* feat: allow dynamic response building for 402 response in go

* feat: added withBazaar HTTPFacilitatorClient wrapper

* feat: added linting to go

* fix: lint go

* improve go example docs (#733)

* feat: Solana PR review feedback in typescript

* feat: Solana PR review feedback in go

* fix: locks & paywall gen after rebase off main

* fix: format

* docs: improve @x402/extensions README with comprehensive documentation (#731)

* First draft of contributor docs (#738)

Correct ts contributing

Clean up contribution guidelines

* feat: updated specs for v2

* fix: merge with main, fixed lock

* v2: go settlement failure and initOnStart fixes (#720)

* go settlement failure and initOnStart fixes

* update go unit tests

* update readmes

* feat: review & improve examples & READMEs

* v2: add multiple payment options for go (#743)

* add multiple payment options for go

* fix SyncFacilitatorOnStart

* v2: add hooks for advanced go example (#745)

* add hooks for advanced go example

* fix legacy ts deps

* feat: added server initialization validation

* feat: added @x402 package workflows

* v2: add miniapp and mcp examples (#746)

* add miniapp example

* fix format

* add mcp example

* fix format

* v2: add manifest to miniapp example (#751)

* add manifest to miniapp

* fix format

* feat: x402 website redesign (#750)

* port new website to public repo

* chore: update pnpm-lock.yaml with motion dependency

* feat: add x402 V2 launch blog post and update hero code snippet

- Add /writing/x402-v2-launch blog post page
- Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png)
- Enable Writing nav link in NavBar and Footer
- Update hero code snippet to show V2 SDK usage
- Fix CodeSnippet to support multi-line code

* feat: edit nav for mobile

* Revert "feat: edit nav for mobile"

This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd.

* feat: add ecosystem page and minor home page tweaks

* feat: fix typography in ecosystem

* homepage qa fixes

* feat: add ecosystem icons and fix halftone

* cleanup assets

* fix: minor bug on faq

* feat: add hamburger menu to mobile

* Update README (#755)

* Update readme

* Install instructions and typos

* feat: update site sample code & reduce supported networks

* fix: v1 header in README updated to v2

---------

Co-authored-by: phdargen <p.dargent@cern.ch>
Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com>
Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com>
Co-authored-by: Faris Habib <frs@hbb.dev>
Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
Amanda McDermott
fa9b542c26
Revert "Add Meridian to x402 ecosystem website (#408)" (#435)
This reverts commit 053e0eb34299f2a15442c1e8f1fc32a79007ab50.
2025-10-03 13:19:42 -04:00
pinkie
053e0eb342
Add Meridian to x402 ecosystem website (#408)
* Add Meridian to x402 ecosystem website

* fix: Update the x402 bottom image from black front -> white front (#410)

* fix the x402 bottom image with a white font for the text

* chore: v0.6.5 release (#412)

* bumping version to 0.6.5 for release

* fix: Update the x402 bottom image from black front -> white front (#410)

* fix the x402 bottom image with a white font for the text

* fix(ci): correct duplicate steps key in check_python workflow (#324)

The GitHub Actions workflow `.github/workflows/check_python.yml` had
a nested `steps:` key inside the `test-python` job’s `steps` list,
causing a YAML parse error:

  (Line: 11, Col: 7): A mapping was not expected

This change removes the redundant `steps:` and ensures all steps are properly listed with `- name:` or `- uses:` entries, restoring workflow syntax validity so the CI pipeline can run.

* fix(bug): fix types export in package.json (#390)

The published x402 package does not contain an index.d.ts file leading to Typescript errors.

e.g.:
```
Could not find a declaration file for module 'x402'. '/Users/dylanfiedler/Documents/ario/ar-io/ar-io-node/node_modules/x402/dist/esm/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/x402` if it exists or add a new declaration (.d.ts) file containing `declare module 'x402';`ts(7016)
```

This PR updates it to use cjs types by default.

fix(package.json): use cjs by default in package.json

* feat: add peaq EVM support (chainId 3338) (#395)

* Revert "Merge branch 'main' into main"

This reverts commit 236d01ceb6515f96c735c85f0b6152cc2afbdc46, reversing
changes made to 1eb9a5e2b8e3a875fb4c621321f87a63318de9f3.

---------

Co-authored-by: fabrice-cheng <fabrice.cheng@coinbase.com>
Co-authored-by: Dennj <dennj.osele@gmail.com>
Co-authored-by: Dylan Fiedler <dtfiedler@users.noreply.github.com>
Co-authored-by: Lovish Arora <46993225+lavish0000@users.noreply.github.com>
2025-10-02 22:56:19 -04:00
Amanda McDermott
62f9a7ac44
fix: Fix python CI workflow (#428)
* Run pytest using uv

* Use correct lockfile location
2025-10-01 14:24:53 -07:00
Dennj
1b12c781a7
fix(ci): correct duplicate steps key in check_python workflow (#324)
The GitHub Actions workflow `.github/workflows/check_python.yml` had
a nested `steps:` key inside the `test-python` job’s `steps` list,
causing a YAML parse error:

  (Line: 11, Col: 7): A mapping was not expected

This change removes the redundant `steps:` and ensures all steps are properly listed with `- name:` or `- uses:` entries, restoring workflow syntax validity so the CI pipeline can run.
2025-09-25 16:26:05 -04:00
Amanda McDermott
5225b9117d
chore: Update examples docs (#345)
* Update docs

* Python examples readme

* Correct mcp docs
2025-08-18 16:16:58 -04:00
Carson Roscoe
ef390052fb
fix: package dir (#234) 2025-06-13 16:18:07 -07:00
erikreppel-cb
830976be46
[Draft] Add python support (#215)
* Start types

* Increase tests and fix type issues

* feat: completed fastapi draft and added example (#229)

* feat: fixed fastapi and added example

* chore: tweak README

* feat: python clients (#226)

* feat: httpx client and example

* fix: cleanup httpx example

* feat: added requests example

* feat: unit testing clients & helpers

* chore: format/lint

* chore: correct READMEs of examples

* fix: removed debug logs

* fix: removed artifact code from testing

* chore: removed excess comments

* feat: refactored from web3 to eth_account as accounts

* feat: refactored interfaces per pr feedback

* fix: pr feedback

* chore: rebase & merge

* chore: renamed x402 request exports

* fix: pr feedback

* feat: release GHA and improved readme (#232)

* feat: release GHA and improved readme

* chore: bump to v0.1.1

* chore: renamed PyPi token

---------

Co-authored-by: Carson Roscoe <CarsonRoscoe7@gmail.com>
2025-06-13 15:42:26 -07:00
Stefano Amorelli
add0b93b7a
[Feat] Java implementation (#178)
* chore(java): .gitignore

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* chore(java): project object model

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* chore(java): check style rules

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* chore(java): check style rule suppressions

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* chore(java): spotbugs exclude rules

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): json util function

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement payment payload model

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement payment required response

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement payment requirements model

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement draft crypto signer interface

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement payment kind class

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement SettlementResponse class

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement VerificationResponse class

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement facilitator client

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement X402HttpClient

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): implement PaymentFilter

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* test(java): add integration test

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* feat(java): expand exception handling in paymentfilter

* chore(java): improve javadocs

* doc(java): add README.md

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>

* refactor(crypto): introduce protocol-specific signing rules for CryptoSigner

* ci(java): setup java ci with maven and tests

---------

Signed-off-by: Stefano Amorelli <stefano@amorelli.tech>
2025-06-02 16:04:45 -07:00
Carson Roscoe
112c0f48bc
chore: added a PR draft template to guide OS contributors (#205) 2025-05-27 11:08:49 -04:00
mridul
e1f2dc5977
ci: fix YAML syntax in check_format workflow (#202) 2025-05-27 11:03:45 -04:00
Carson Roscoe
4e0a5e2643
fix: coinbase-x402 release gha (#112) 2025-05-06 10:30:48 -04:00
Carson Roscoe
500a93e236
feat: add back @coinbase/x402 package (#91)
* feat: re-added @coinbase/x402

* feat: pointed facilitator url to prod facilitator

* feat: unit test

* feat: mainnet server example

* fix: comment

* fix: cjs importing of @coinbase/x402

* fix: lock file

* feat: updated READMEs

* fix: improved coinbase/x402 readme

* bump: 0.3.0

* fix: format
2025-05-05 20:34:28 -04:00
Carson Roscoe
b157b587b9
feat: expanding gha scopes to lint/format/check locks (#88)
* feat: expanding gha scopes to lint/format/check locks

* fix: format/lint checks

* fix: lint/format examples

* fix: added lint:check and format:check to examples/typescript
2025-04-28 18:08:49 -04:00
Chris Gerber
905e320c55
fix: gha publishing, adding x402 to package build filter (#85) 2025-04-25 12:47:35 -07:00
Chris Gerber
e38da6d2ea
fix: gha publishing (#84) 2025-04-25 12:15:24 -07:00
Carson Roscoe
e5b90b4841
feat: initial npm modules (#68)
* first pass implementing gha for publishing packages

* feat: updated core types to align with updated protocol spec

* feat: package/x402 refactor

* feat: restructured x402 core

* feat: x402 refactor in preparation for middleware

* feat: middleware workspace project template

* feat: refactor x402-express into its own package

* feat: x402-express updated to new spec

* feat: express server example

* feat: facilitator express server example

* feat: added axios interceptor

* chore: refactor express server example down a folder

* feat: client script example using axios

* fix: improved env variable handling in examples

* fix: site paths now that site is not within the turbo repo

* fix: parsing of types per updated spec

* fix: tweaked examples

* feat: x402-xios and x402-express unit tests

* feat: added test to turbo commands

* chore: reformat

* chore: docstrings

* chore: updated docstring

* feat: added x402-fetch package and fetch client example

* feat: unit test fetch wrapper

* chore: docstring

* chore: reformat

* chore: updated docstring

* feat: x402-hono and hono server example

* feat: added unit tests

* chore: added docstring

* chore: removed excess comments

* chore: updated docstring

* feat: added lint and format to typescript monorepo

* feat: added check_format, check_lint and check_package_lock workflows

* feat: tighten up and improve linting checks

* chore: lint/format x402

* chore: expand tigthened linting to all packages/examples

* fix: format/lint x402

* fix: format/lint x402-axios

* fix: format/lint x402-express

* fix: format/lint x402-fetch

* fix: format/lint x402-hono

* fix: format/lint middleware-template

* fix: format/lint example facilitator

* fix: format/lint example express server

* fix: format/lint example hono server

* fix: eslint unused var false positives

* fix: format/lint example axios client

* fix: format/lint example fetch client

* fix: format/lint whole project

* fix: added explicit dev dependencies on eslint-plugin

* chore: updated package lock workflow name

* chore: format package.jsons

* fix: added explicit dev dependencies on eslint parser

* fix: define paymentRequirements type from toJsonSafe

* fix: added explicit dev dependencies on eslint plugin import

* feat: README for express and express example

* fix: README code snippet syntax

* chore: unit test github workflow

* fix: test -> test:watch, added new test scripts

* chore: removed build from examples

* fix: added missing dependencies

* fix: renamed unit test workflow

* fix: missing dev dependency on express types in x402-express

* fix: added explicite vite dev dependency, as its a peer dep of vitest

* feat: x402-hono and servers/hono example READMEs (#52)

* feat: x402-hono and servers/hono example READMEs

* fix: updated npm to pnpm in example readme

* feat: refactor server middleware to decode X-PAYMENT header

* feat: middleware returns array of PaymentRequirements

* fix: unit tests

* fix: paywall html takes array of paymentRequirements, but just uses first item in list

* feat: added selector logic for selecting payment requirements client side

* feat: support generic ERC20Permit contracts

* fix: toJsonSafe for arrays

* fix: paywall selector usage

* feat: jwt signing & createAuthHeader

* fix: wrap api keys in auth object and include paths

* fix: route paths updated to specs

* fix: format

* feat: using @coinbase/cdp-sdk/auth for generateJwt

* feat: middleware takes an array to generate auth headers

* feat: change routes to /verify and /settle, change default resource to include /v2/x402

* fix: removed duplicate import

* chore: drop node 18 unit tests

* feat: rename function and descriptions to createAuthHeaders

* fix: pr feedback

* feat: improved default behavior for facilitator auth

* feat: dev demo test changes

* feat: moved cdp logic to separate export

* fix: format/lint

* feat: added x402-next and examples/fullstack/next

* feat: added readmes and updated exported types

* fix: format/lint

* fix: updated next demo to type: module

* fix: format

* fix: updated x402-next to new spec

* fix: demo

* fix: format/lint

* feat: improved handling of default asset

* fix: added missing dependencies

* fix: added explicite vite dev dependency, as its a peer dep of vitest

* feat: migrated site to monorepo subproject

* fix: regenerate lock

* feat: added format/lint

* fix: package type is module

* fix: package type is module

* fix: removed npm from prerequisites

* chore: rebased

* feat: migrated site example to latest spec

* fix: regenerate lock file

* feat: added mcp client demo

* feat: migrated agent client

* feat: Added x402-fetch and clients/fetch example readmes

* feat: rename export to wrapFetchWithPayment

* feat: x402-axios and clients/axios example readmes

* fix: increased node version in readme

* feat: removed packages/typescript

* feat: removed middleware-template

* feat: migrated clients/agent example

* feat: migrated clients/axios example

* feat: migrated clients/fetch example

* feat: migrated clients/mcp example

* feat: migrated facilitator example

* feat: migrated fullstack/next example

* feat: migrated servers/express example

* feat: migrated servers/hono example

* feat: structured dual-workspace for turbo

* feat: deleted example root folder

* fix: removed old package-lock and normalized express types used

* feat: removed x402 dependency on hono

* feat: migrated x402/cdp to @coinbase/x402

* feat: add payerAddress to verify responses

* feat: added README to examples/typescript

* chore: format/lint

* feat: migrate site example to root

* second pass implementing gha for publishing packages

* refinements

* enabling debugging

* disabling git check for publishing dryrun

* package npm token isolation

* removing degugging

* chore: Update Go Middleware Package to Latest Spec

* feat: updated README to spec

* feat: updated exact evm scheme

* fix: updated missed paymentDetails -> paymentRequirements in refactor

* fix: quotes to match our linter

* feat: readded supported

* fix: pr feedback

* fix: pr feedback

* update go fields: accepts, paymentPayload, paymentRequirements

* fix: readme example

* fix: site readme node version

* fix: removed package-lock.json

* feat: added package manager to package json

* fix: json

* feat: moved site back to typescript

* fix: lock file

* feat: updated packageManager

* feat: updated package manager

* testing root package.json

* fix: x402 depedency in site

* feat: added build:vercel script

* fix: github workflow detecting packageManager from package.json

* feat: removed dotenv dependency in x402 for edge compatibility

* feat: inject facilitator url via vercel env vars

* feedback

* pnpm version

* removing debugging

* first pass adding payer to verify response

* feat: initial devx draft

* fix: format/lint

* feat: rename facilitator exported config

* fix: x402-next middleware routing supports verbs

* feat: devx feedback

* feat: updated examples

* fix: removed bad dependency

* feat: regenerated lock after rebase

* fix: pnpm-lock

* fix: middleware resource url fallback

* fix: README 1-liner example for correctness

* feat: updated READMEs

* feat: bump x402 to 0.2.0

* feat: added legacy route support to hosted test facilitator

* fix: moved client definition out of global scope

* feat: rename TokenAmount to ERC20TokenAmount

* fix: remove unused ts-expect-error

* feat: temporarily removed @coinbase/x402 package

* fix: examples

---------

Co-authored-by: Christopher Gerber <csgerber@gmail.com>
Co-authored-by: John Peterson <john.peterson@coinbase.com>
2025-04-25 12:05:40 -04:00
John Peterson
435f58db0f
chore: Use GHA Environment to Publish NPM (#23) 2025-03-21 14:03:24 -07:00
John Peterson
f20bfae70e
chore: GHA to Publish x402 NPM Package (#21) 2025-03-07 16:50:21 -08:00