x402 icon indicating copy to clipboard operation
x402 copied to clipboard

feat: Enable Custom WebSocket URLs for Solana Payments

Open amilz opened this issue 2 months ago • 4 comments

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

amilz avatar Oct 16 '25 13:10 amilz

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

cb-heimdall avatar Oct 16 '25 13:10 cb-heimdall

@amilz is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 16 '25 13:10 vercel[bot]

@CarsonRoscoe please let us know if this looks good or needs more work.

Think it's ready for merge

notorious-d-e-v avatar Oct 31 '25 07:10 notorious-d-e-v

@CarsonRoscoe - wondering if you could take a look at this one when you get a chance.

amilz avatar Nov 13 '25 06:11 amilz