Skip to main content

x402aff - Python

PyPI Python versions License: MIT

The x402aff kit (Python): an installable x402aff package with the one-object Affiliation facade on top. This is the implementation validated end-to-end on Base mainnet.

Install

pip install x402aff                  # from PyPI
pip install 'x402aff[cdp]'           # with the CDP discovery extra

Or from a checkout / straight from git, to track unreleased changes:

pip install ./python                 # from a clone, at the repo root
pip install '.[cdp]'                 # from inside python/, with the CDP extra
pip install 'x402aff[cdp] @ git+https://github.com/MiroShark/x402aff@main#subdirectory=python'

The cdp extra adds cdp-sdk, needed only for the CDP-index discovery path (monitor, aff.scan() / pending() / splits_payload()). Without it the request-time payTo and payout-calldata paths work fine.

Vendoring instead of installing works too - copy python/x402aff/ into your project as a subpackage; the modules import each other relatively, so nothing needs rewriting and none of the generic names (split, monitor, resolver) leak into your top-level namespace.

Use

from x402aff import Affiliation

aff = Affiliation(app_code="bc_yourcode", seller_payout="0xYourWallet")

# on your x402 route:
#   pay_to=aff.pay_to           per-request split, from the X-Builder-Code header
#   extensions=aff.extensions   declares your app code `a`

# release payouts, later (permissionless):
calls, balance = aff.release("bc_alice")

Full integration guide (money path, trust model, wiring, caveats): ../docs/INTEGRATION.md. The TypeScript port lives in ../ts/ and resolves the identical split address.

Modules

File Role
__init__.py The package's public surface (from x402aff import Affiliation, …).
affiliation.py Start here. The Affiliation facade wrapping everything below.
builder_code.py Declare a; decode a/s/w off a settle tx.
resolver.py Builder code → registered payout address (one eth_call).
split.py Builder code + price → the split plan (recipients + bps).
push_split.py The plan → 0xSplits calldata + counterfactual address.
payto.py Request-time payTo resolver. Cached, never raises.
distribute.py The (deploy + distribute) calldata to release a funded split.
monitor.py Which splits hold distributable funds (via CDP's index).
buyer_client.py Buyer-side extension that attaches s (via marked_service_codes).
cdp_sql.py · queries.sql CDP SQL API client + attribution queries.

Develop

pip install -e '.[cdp,dev]'   # editable install with the CDP + test extras
pytest                        # runs tests/ against the x402aff package

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

x402aff-0.2.2.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x402aff-0.2.2-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

Details for the file x402aff-0.2.2.tar.gz.

File metadata

  • Download URL: x402aff-0.2.2.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for x402aff-0.2.2.tar.gz
Algorithm Hash digest
SHA256 94c08c36c2895b085ffecfc023088a24bd7b038baeceee884f3ae8c04e711e86
MD5 a926f16ea6f45682153d6f23affbcd49
BLAKE2b-256 83b4fda6efa225888c18af590b2b975c1d0044daa222a7e95f4f43d48ba2c3a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for x402aff-0.2.2.tar.gz:

Publisher: release.yml on MiroShark/x402aff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file x402aff-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: x402aff-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 39.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for x402aff-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1214303cf9a447f77cdbe042f0e3ddad19d89854827047c7c2d0084aaec7b8dd
MD5 6bdcae70dd32b867d5e0e5351062d8be
BLAKE2b-256 40cbb73255dc513b486891ae42dab4d810c281d08e8fe936e3fe577cd9939ec1

See more details on using hashes here.

Provenance

The following attestation bundles were made for x402aff-0.2.2-py3-none-any.whl:

Publisher: release.yml on MiroShark/x402aff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page