feat: Enable Custom WebSocket URLs for Solana Payments
Description
Introduces rpcSubscriptionsUrl to the SvmConfig that we introduced in #416. Though the existing logic includes public websocket endpoints and sensible/common default rules (replace 'http' with 'ws' to derive a websocket url from RPC endpoint), sometimes operators have websocket endpoints that do not comply with that assumption. In particular, the local test validator operates on different ports so the simple text replace does not work (http://127.0.0.1:8899 currently maps to ws://127.0.0.1:8899 but actually needs port 8900).
The primary upgrade here is to getRpcSubscriptions to allow custom URLs when passed with some simple helper functions for readability/reusability.
I have also shared/reviewed with @notorious-d-e-v (thank you 🙏).
Tests
Updated:
- [x]
typescript/packages/x402/src/shared/svm/rpc.test.ts - [x]
typescript/packages/x402/src/schemes/exact/svm/facilitator/settle.test.ts
Checklist
- [x] I have formatted and linted my code
- [x] All new and existing tests pass
- [x] My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
🟡 Heimdall Review Status
| Requirement | Status | More Info | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reviews |
🟡
0/1
|
Denominator calculation
|
@amilz is attempting to deploy a commit to the Coinbase Team on Vercel.
A member of the Team first needs to authorize it.
@CarsonRoscoe please let us know if this looks good or needs more work.
Think it's ready for merge
@CarsonRoscoe - wondering if you could take a look at this one when you get a chance.