feat: replace manual Solana x402 with official x402 SDK#4
Closed
notorious-d-e-v wants to merge 1 commit intoBlockRunAI:mainfrom
Closed
feat: replace manual Solana x402 with official x402 SDK#4notorious-d-e-v wants to merge 1 commit intoBlockRunAI:mainfrom
notorious-d-e-v wants to merge 1 commit intoBlockRunAI:mainfrom
Conversation
Replace ~200 lines of manual Solana transaction construction, ATA derivation, and signing code with the official x402 Python SDK (pip install x402[svm]). This fixes two known bugs in the manual implementation: - Wrong Associated Token Program ID (caused recipient_mismatch errors) - Missing v0 version prefix when signing (caused signature failures) The official SDK handles all of this correctly and is maintained by Coinbase, ensuring future protocol compatibility. Changes: - pyproject.toml: replace solders+base58 with x402[svm] in solana deps - x402.py: remove Solana section (~180 lines), keep EVM code unchanged - solana_client.py: use x402ClientSync + KeypairSigner + ExactSvmScheme for payment creation instead of manual transaction construction - tests: replace manual Solana payload tests with x402 SDK integration tests (ATA derivation, signer, header decoding) Closes BlockRunAI#3
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
pip install x402[svm])Changes
pyproject.tomlsolders+base58withx402[svm]in solana optional depsblockrun_llm/x402.pyblockrun_llm/solana_client.pyx402ClientSync+KeypairSigner+ExactSvmSchemefor payment signingtests/unit/test_x402.pyHow it works
Notes
solanaoptional dependency now requires Python ≥3.10 (x402 SDK requirement). Base EVM functionality still works on Python 3.9.Test plan
Closes #3