Skip to content

Feat(developer-sdk:typescript): x402 Swig Transaction Preparation - #187

Open
thewuhxyz wants to merge 3 commits into
mainfrom
wuh/x402-swig-transaction-ts
Open

Feat(developer-sdk:typescript): x402 Swig Transaction Preparation#187
thewuhxyz wants to merge 3 commits into
mainfrom
wuh/x402-swig-transaction-ts

Conversation

@thewuhxyz

Copy link
Copy Markdown
Collaborator

Summary

Adds x402 exact-Solana payment preparation to the TypeScript Developer SDK.

Developers can pass a resource server’s 402 Payment Required response directly to a Swig wallet:

const prepared = await wallet.x402.prepareFromResponse(response, {
  acceptedIndex,
});

When acceptedIndex is omitted, transaction-service selects the first eligible requirement and returns its original index.

Changes

  • Validate PAYMENT-REQUIRED using the pinned @x402/core V2 schema.
  • Add x402 preparation to server and browser wallet handles.
  • Add the /x402/prepare browser-proxy route.
  • Use the existing requester-authority resolution behavior.
  • Normalize the x402 prepared-transaction kind and signature requests.
  • Reuse the generic prepared-transaction signing helpers.
  • Add createX402Payment to assemble:
    • The x402 PaymentPayload
    • A Record<"PAYMENT-SIGNATURE", string> header
  • Preserve supported x402 extension values and property presence.
  • Validate transaction encoding, network, wire size, and outbound header size.
  • Add SDK documentation and a minor-version changeset.
  • Pin @x402/core to 2.21.0.

Validation

  • 116 Developer SDK tests passed.
  • TypeScript typecheck passed.
  • ESLint passed.
  • Package build passed.
  • Prettier and git diff --check passed.

Scope

This PR contains only TypeScript Developer SDK changes.

@thewuhxyz
thewuhxyz requested a review from edo-chan August 17, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant