Add experimental v1 transaction support - #1
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideAdds an experimental, opt-in foundation for Solana v1 transaction messages to @solana/client, exposing a typed way to construct, configure, and build signable v1 transaction messages while enforcing no-address-lookup-table constraints, along with tests, docs, and a minor changeset. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Stacked on solana-foundation#169 (Upgrade to Kit v7) — base branch is
upgrade-kit-v7, so this diff shows only the v1 additions. This PR lives on the fork; once solana-foundation#169 merges intosolana-foundation:main, its base can be retargeted there.Adds an experimental, opt-in foundation for Solana version 1 (v1) transactions.
Key finding: v1 is runtime-ready but type-gated in Kit v7
MAX_SUPPORTED_TRANSACTION_VERSION === 1; v1 messages compile and encode to the wire (leading byte0x81).createTransactionMessageis typedExclude<TransactionVersion, 1>, and the low-levelsetTransactionMessageConfig/V1TransactionConfigare not re-exported.setTransactionMessageComputeUnitLimit,setTransactionMessagePriorityFeeLamports,setTransactionMessageHeapSize,setTransactionMessageLoadedAccountsDataSizeLimit) are public.So the only thing missing from the public API is a typed way to construct an empty v1 message — one isolated, documented assertion in
createV1TransactionMessage. Everything else uses public, typed, v1-aware APIs.What's included
src/features/transactionsV1.ts:createV1TransactionMessage()— the single documented cast.setV1TransactionConfig(config, message)— compute budget written to the message's nativeconfig(not Compute Budget instructions). Note v1 uses totalpriorityFeeLamports, not a per-CU price.buildV1TransactionMessage({ feePayer, lifetime, instructions, config })— assembles a signable v1 message; rejects address-lookup-table instructions (v1 usesInstructionWithoutLookupTables).transactionsV1.test.ts— construction, config-in-message, wire encoding (0x81), no-ALT guard. (4 tests)V1-TRANSACTIONS.md— full scope + follow-up phases (wiringversion: 1intoprepare(), priority-fee model, feature helpers, planner size accounting).@solana/clientminor, flagged experimental.Why experimental
It depends on Kit's v1 gating not changing shape. Should be revisited once Kit publishes the official v1 API (expected on the
8.xline), at which point the internal assertion can be dropped.Testing
pnpm --filter @solana/client typecheckpnpm --filter @solana/client test(v1 suite: 4 passed)pnpm --filter @solana/client lintpnpm --filter @solana/client buildSummary by Sourcery
Add experimental, opt-in support for constructing and configuring Solana v1 transaction messages in the client package while keeping it behind a clearly documented, gated API.
New Features:
Enhancements:
Documentation:
Tests:
Chores: