Skip to content

Coinbase main#5

Merged
sasurobert merged 40 commits intomainfrom
coinbase-main
Jan 27, 2026
Merged

Coinbase main#5
sasurobert merged 40 commits intomainfrom
coinbase-main

Conversation

@sasurobert
Copy link
Owner

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits

manifoldfrs and others added 30 commits January 13, 2026 11:23
* update facilitator client to match api

* add unit test
Co-authored-by: jithinraj <jithinraj@users.noreply.github.com>
Co-authored-by: web3luka <192097530+web3luka@users.noreply.github.com>
* rencom

* move im

* update url
* feat: added bazaar extension spec

* feat: pr feedback
Free, public x402 facilitator for Base and Solana networks.

Features:
- Full verify + settle flow with on-chain USDC transfers
- Supports Base, Base Sepolia, Solana, and Solana Devnet
- No API keys required
- EIP-3009 (Base) and SPL (Solana) token support

Public endpoint: https://facilitator.x402endpoints.online
* fix hono paywall bypass

* fix formatting
…nbase#982)

Add `hasExtension()` method to x402ResourceServer to check if an
extension is already registered. Update all HTTP middleware packages
(next, express, hono) to skip the dynamic import of @x402/extensions/bazaar
when the extension has been pre-registered.

This fixes deployment issues on serverless platforms (e.g., Vercel)
where dynamic imports with `webpackIgnore: true` fail because
node_modules are not available at runtime. Users can now pre-register
the bazaar extension using a static import:

```typescript
import { bazaarResourceServerExtension } from "@x402/extensions/bazaar"

const server = new x402ResourceServer(facilitator)
server.registerExtension(bazaarResourceServerExtension)
```

The static import is bundled correctly, and with this change the
middleware skips the dynamic import entirely, avoiding the runtime error.
Free, open-source x402 facilitator. Or become your own facilitator
for $5/month.

Category: Facilitators
Website: https://www.openfacilitator.io
Base URL: https://pay.openfacilitator.io
Networks: Base, Solana
Supports: verify, settle, supported, list (discovery)
* fix: v2 description is missing from bazaar submission

* feat: Add description and mime type extraction to discovered resources within the bazaar facilitator.

* refactor: remove duplicate comment in facilitator.go

* refactor: remove conditional addition of resource description to requirements extra data
Add SolPay as a Solana x402 facilitator with USDC payment support.

- Facilitator URL: https://x402.solpay.cash
- Networks: Solana mainnet
- Schemes: exact
- Assets: SPL (USDC)
- Supports: verify, settle, list (Bazaar discovery)
BlockRun.AI is a pay-as-you-go AI gateway providing ChatGPT and all major LLMs (Anthropic, Google, DeepSeek, xAI) via x402 on Base. It also features a catalog to discover all x402 services available on the market.

Website: https://blockrun.ai
* export go facilitator errors as constants

* extend to server and client

* more error constants; lint fix
Signed-off-by: vraspar <v2parikh@uwaterloo.ca>
Signed-off-by: 0xZensh <txr1883@gmail.com>
* 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 (coinbase#863)

* fix format

* fix lint

* fix build

* fix pytest

* Fix syntax errors and missing imports in manual integration example (coinbase#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)  (coinbase#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) (coinbase#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 (coinbase#901)

* python-v2: add svm mechanism (coinbase#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 (coinbase#929)

* add bazaar extension

* strip query params for discovery

* fix 862

* updated e2e tests

* Add advanced Python client examples (coinbase#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 (coinbase#950)

* add facilitator example

* improve svm signer

* add description to DiscoveredResource

* add facilitator e2e

* add paywall builder (coinbase#953)

* Add Python custom client example (coinbase#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 (coinbase#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 (coinbase#968)

* make create_facilitator_config work with both V1 and V2

* fix lint

* feat: add Python SDK v2 server advanced example (FastAPI) (coinbase#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 (coinbase#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 (coinbase#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 (coinbase#976)

* Porting docs and updating for v2 changes (coinbase#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>
* 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
…nbase#980)

* feat(examples): Add CloudFront Lambda@Edge x402 payment handler

feat(examples): add CloudFront Lambda@Edge server example

Reference implementation for adding x402 payments at the edge without
modifying backend code.

- Add complete Lambda@Edge handler implementation for x402 payment verification
- Include configuration system for route-based pricing and payment settings
- Add payment verification and settlement logic via x402 facilitator
- Include response formatting for 402 Payment Required and success cases
- Include advanced patterns for WAF integration, caching optimization, and cookie-based sessions

* docs(cloudfront-lambda-edge): Update package.json for monorepo development

- Change @x402/core dependency to use workspace:* for monorepo development
- Add documentation note explaining workspace dependency usage
- Include migration instructions for standalone project setup
- Clarify version replacement needed when copying example outside monorepo

* Minimze type defenition, use x402/core built it types

* refactor(examples): Restructure CloudFront Lambda@Edge to use x402HTTPResourceServer

- Add `adapter.ts` with `CloudFrontHTTPAdapter` to translate CloudFront requests to standard HTTPAdapter interface
- Add `server.ts` with `x402HTTPResourceServer` setup and route configuration using `@x402/core` types
- Remove `config.ts` and `payment.ts` — functionality now handled by x402HTTPResourceServer
- Update `index.ts` to use new server architecture with lazy initialization
- Update `responses.ts` with Lambda@Edge response helpers
- Add `@x402/evm` dependency to `package.json`
- Expand README with detailed configuration examples, route setup, and advanced patterns
- Update file structure documentation to reflect new adapter and server modules
- Consolidate payment configuration into `server.ts` for single source of truth
- Ensure consistency with other x402 implementations by using shared `RouteConfig` type

* refactor(examples): Restructure CloudFront Lambda@Edge with middleware pattern

- Split monolithic handler into origin-request and origin-response handlers for verify → execute → settle pattern
- Extract configuration into dedicated config.ts file for easier customization
- Create reusable middleware layer in lib/ directory with createX402Middleware and createX402Server factories
- Reorganize library code (adapter, responses, middleware, server) for future @x402/lambda-edge package
- Implement fair billing: customers only charged when origin returns success (status < 400)
- Update README with sequence diagram showing two-phase Lambda@Edge flow and deployment instructions
- Add origin-response handler to settle payments only after successful origin responses
- Improve code organization and separation of concerns between configuration, handlers, and reusable utilities

* chore(examples): Update pnpm lock file for CloudFront Lambda@Edge server

- Add CloudFront Lambda@Edge server entry to pnpm-lock.yaml

* docs(cloudfront-lambda-edge): Restructure README with improved clarity

- Add mermaid diagram showing CloudFront + Lambda@Edge architecture
- Reorganize "Why This Approach?" section with em-dash formatting for consistency
- Add "Getting Started" section with guidance for existing and new users
- Create table of key files with their purposes for quick reference
- Add collapsible details section documenting Lambda@Edge constraints and quotas
- Simplify "Quick Start" instructions with clearer step descriptions
- Remove verbose sequence diagram in favor of concise architecture overview
- Update configuration examples to be more concise and actionable
- Improve navigation and readability with better section hierarchy
- Consolidate AWS documentation links for CloudFront and Lambda@Edge learning
…g error (coinbase#1018)

* fix: removed stray character causing JSON parsing error on Kobaru facilitator file, introduced on PR coinbase#910

* fix: removed stray character causing JSON parsing error on Kobaru facilitator file, introduced on PR coinbase#910
…nse (coinbase#1003)

* new extension hooks

* updated hook args

* update tests

* remove verify hook

* fix workflows

* update specs
* add onPaymentRequired hook

* add tests
sudomon and others added 10 commits January 23, 2026 11:40
Signed-off-by: sudomon <mounica551@gmail.com>
Adds SocioLogic RNG API to the ecosystem directory under Services/Endpoints.
SocioLogic RNG provides cryptographically secure, verifiable randomness
via x402 micropayments (USDC on Base).
* make facilitator mentions neutral

* update language

* update langauge

* Update docs/core-concepts/bazaar-discovery-layer.mdx

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

---------

Co-authored-by: phdargen <pdargent@icloud.com>
* Update docs/getting-started/quickstart-for-buyers.mdx

* Update docs/getting-started/quickstart-for-buyers.mdx

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Faris Habib <faris.habib@coinbase.com>
* add new onRequest hook

* add unit tests
* feat: imference api integration

* fix: cloud logo imference
Co-authored-by: cusma <cosimo.bassi@algorand.foundation>
Co-authored-by: tasosbit <tasos.bitsios@algorand.foundation>
Co-authored-by: nullun <steve.ferrigno@algorand.foundation>
Co-authored-by: emg110 <emg110@gmail.com>
@sasurobert sasurobert merged commit 463933c into main Jan 27, 2026
7 of 14 checks passed
@sasurobert sasurobert deleted the coinbase-main branch January 27, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.