Add A2A x402 adapter#30
Merged
abhicris merged 1 commit intoMay 13, 2026
Merged
Conversation
Contributor
|
Welcome to kcolbchain, @kingzzoov-ctrl — glad you're here. 🌱 Here's what happens from this PR:
While you wait:
What happens after your first merge
Thanks for writing the code. We're building this to last. |
Contributor
|
🤖 Audit verdict: Adapter adds A2A x402 protocol support through pure data transformation with no external dependencies, network calls, credential leakage, or malicious wallet/address manipulation. Audited by the kcolbchain PR pipeline. See pipeline docs. |
Contributor
|
Merged — thank you, @kingzzoov-ctrl. Your first kcolbchain contribution is in. 🎉 A few things that unlocked with this merge:
If you want to stay in the loop on what we're shipping: https://kcolbchain.com/ROADMAP.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a dependency-free
switchboard.adapters.a2a_x402bridge for issue #29.The adapter converts Switchboard payment envelopes to/from the standalone Google A2A x402 JSON metadata flow:
to_a2a_request(offer: PaymentOffer) -> dictmessage/sendbody withx402.payment.status: payment-requiredx402.payment.requiredresponse withPaymentRequirementsbase,base-sepolia,sepolia,ethereum) and unknown chain IDs toeip155:<id>from_a2a_response(payload: dict) -> PaymentProofPaymentPayloadobjectsPaymentProofdocs/adapters/a2a-x402.mdwith an end-to-end usage example and supported network mappingValidation
python3 -m venv .venv .venv/bin/python -m pip install -e '.[dev]' .venv/bin/python -m pytest tests/test_a2a_x402_adapter.py tests/test_x402_middleware.py -q .venv/bin/python -m ruff check switchboard/adapters/a2a_x402.py tests/test_a2a_x402_adapter.py switchboard/x402_middleware.py git diff --checkResult:
I also ran the full test suite with
.venv/bin/python -m pytest -q: this branch has 64 passed, 1 skipped, and 6 failures intests/test_nonce_manager.py. Those nonce-manager failures are outside the adapter scope and are not touched by this PR.Note
While adding the adapter tests, importing
switchboard.x402_middlewarein an environment without optionalaiohttpexposed an existing import-time annotation issue. I moved the optional dependency check to_get_session()so dataclasses and pure adapters can be imported withoutaiohttp, while actual HTTP usage still raises the same actionableImportError.Closes #29