Support smart-wallet Solana payments in exact SVM (SWIG first)#1964
Open
romeo4934 wants to merge 2 commits intox402-foundation:mainfrom
Open
Support smart-wallet Solana payments in exact SVM (SWIG first)#1964romeo4934 wants to merge 2 commits intox402-foundation:mainfrom
romeo4934 wants to merge 2 commits intox402-foundation:mainfrom
Conversation
32e8b1d to
b7ce934
Compare
b7ce934 to
99bb53a
Compare
Author
|
A bit of reviewer context: this PR intentionally takes a “known wrapped payment programs” approach rather than a generic extension hook. The goal is to keep the exact SVM facilitator simple and predictable while unlocking smart-wallet payment flows that still resolve to the same canonical SPL transfer. SWIG is the first built-in case because it is already used in production-like flows and maps cleanly to the exact-scheme safety checks. This means exact SVM now supports:
If other smart-wallet wrappers such as Squads need support later, they can be added explicitly following the same pattern. |
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
TransferCheckedsupport as the default exact SVM payment pathSignV2andSubAccountSignV1by decoding them into the same canonical transfer details used for direct paymentsWhy
Today the stock exact SVM facilitator only accepts transactions whose third top-level instruction is a direct SPL Token or Token-2022
TransferChecked. That blocks smart-wallet Solana payment flows where the exact same SPL payment is wrapped inside a higher-level wallet instruction.This shows up in practice with wallets such as SWIG: the payment is still an exact SPL token transfer, but it is expressed through a smart-wallet instruction rather than a direct top-level
TransferChecked.This PR keeps the existing exact-scheme safety checks on:
The change is that facilitators now recognize a small set of known wrapped payment programs in addition to the direct transfer shape. SWIG is the first built-in smart-wallet integration. Future wrappers such as Squads can be added explicitly using the same pattern.
Implementation
Go
SignV2andSubAccountSignV1TypeScript
Python
Tests
Added unit coverage in all three language implementations for:
SignV2wrapped paymentsSubAccountSignV1wrapped paymentsValidation run locally:
cd go && go test ./mechanisms/svm/... && go test ./...cd typescript/packages/mechanisms/svm && npm exec --yes pnpm@10.12.1 -- format && npm exec --yes pnpm@10.12.1 -- lint && npm exec --yes pnpm@10.12.1 -- testcd python && /opt/homebrew/bin/python3.11 -m black x402/mechanisms/svm/constants.py x402/mechanisms/svm/types.py x402/mechanisms/svm/utils.py x402/mechanisms/svm/exact/facilitator.py x402/mechanisms/svm/exact/v1/facilitator.py x402/tests/unit/mechanisms/svm/test_facilitator.py && /opt/homebrew/bin/python3.11 -m ruff check x402/mechanisms/svm/constants.py x402/mechanisms/svm/types.py x402/mechanisms/svm/utils.py x402/mechanisms/svm/exact/facilitator.py x402/mechanisms/svm/exact/v1/facilitator.py x402/tests/unit/mechanisms/svm/test_facilitator.py && /opt/homebrew/bin/python3.11 -m pytest x402/tests/unit/mechanisms/svm/test_facilitator.pyChecklist