Skip to content

feat! migrate @solana/pay to @solana/kit#288

Merged
amilz merged 5 commits intomainfrom
feat/solana-kit-refactor
Mar 27, 2026
Merged

feat! migrate @solana/pay to @solana/kit#288
amilz merged 5 commits intomainfrom
feat/solana-kit-refactor

Conversation

@amilz
Copy link
Copy Markdown
Collaborator

@amilz amilz commented Mar 26, 2026

Summary

  • Breaking: migrates core library from @solana/web3.js to @solana/kit — all RPC calls, transaction building, and type signatures updated accordingly
  • Introduces createSolanaPayClient convenience factory with merchant and wallet role plugins for a composable API
  • Refactors transfer/verification internals: batched RPC calls, unified transfer types, improved reference normalization
  • Add tests
  • Updates CI to pnpm, adds lint/typecheck jobs; cleans up legacy examples

Note: I moved/removed some sample code, so lots of files changed but bulk of PR is ~10 files in core/src and relevant tests in core/test.

Sample

// Merchant — encode a payment URL, generate QR, find & validate
const merchant = createMerchantClient({
  rpcUrl: 'https://api.mainnet-beta.solana.com',
});

const url = merchant.pay.encodeURL({ recipient, amount });
const qr = merchant.pay.createQR(url);

const found = await merchant.pay.findReference(reference);
await merchant.pay.validateTransfer(found.signature, { recipient, amount });

// Wallet — parse a URL, build transfer instructions
const wallet = createWalletClient({
  rpcUrl: 'https://api.mainnet-beta.solana.com',
  payer: signer,
});

const parsed = wallet.pay.parseURL(url);
const instructions = await wallet.pay.createTransfer({ recipient, amount });

Breaking Changes

@solana/web3.js peer dependency is replaced by @solana/kit. Public API types (addresses, transactions, signers) now use Kit primitives. Consumers must migrate to @solana/kit types.

See core/README.md for updated usage.

Test Plan

make install
make test

Replaces #272 and #283
Ref #286

amilz added 3 commits March 26, 2026 11:12
rebased #283
ci: add npm trusted publisher workflow for @solana/pay
chore: Update package.json

feat: add buildTransaction helper to merchant plugin

Adds `merchant.pay.buildTransaction(feePayer, instructions)` for the
transaction request flow, where a server builds a serialized transaction
for a remote wallet to sign. Returns a base64-encoded wire transaction.

docs: update w/ kit
@amilz amilz requested a review from lgalabru March 26, 2026 19:08
@amilz amilz self-assigned this Mar 26, 2026
lgalabru
lgalabru previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Collaborator

@lgalabru lgalabru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship it 🚀

@amilz amilz force-pushed the feat/solana-kit-refactor branch 2 times, most recently from 6c312e1 to c855baf Compare March 26, 2026 20:19
- Add typescript/package.json as workspace root with packageManager field
- Add typescript/pnpm-workspace.yaml for monorepo resolution
- Remove stale root pnpm-lock.yaml, commit typescript/pnpm-lock.yaml
- Declare missing peer/dev deps (@solana/keys, kit-plugin-*, rpc-subscriptions-*)
- Update CI workflows to install from typescript/ workspace root
@amilz amilz force-pushed the feat/solana-kit-refactor branch from c855baf to 26067e3 Compare March 26, 2026 20:20
@lgalabru lgalabru self-requested a review March 26, 2026 20:23
Copy link
Copy Markdown
Collaborator

@lgalabru lgalabru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amilz!

@amilz amilz merged commit c4baf5f into main Mar 27, 2026
4 checks passed
@amilz amilz deleted the feat/solana-kit-refactor branch March 27, 2026 15:58
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.

2 participants