Skip to content

feat(sdk-kit): typed @solana/kit plugin with ts-rs generated types#602

Draft
amilz wants to merge 1 commit intosolana-foundation:feat/sdkfrom
amilz:feat/ts-rs-types
Draft

feat(sdk-kit): typed @solana/kit plugin with ts-rs generated types#602
amilz wants to merge 1 commit intosolana-foundation:feat/sdkfrom
amilz:feat/ts-rs-types

Conversation

@amilz
Copy link
Copy Markdown

@amilz amilz commented Mar 30, 2026

Summary

  • Adds ts-rs derives to Rust types in crates/types and crates/core to auto-generate TypeScript param/response types from the Rust source of truth
  • Introduces crates/sdk-kit — a typed @solana/kit plugin for all 22 Surfnet cheatcode RPC methods
  • 29 passing integration tests, typecheck clean

What's in crates/sdk-kit

  • surfpool() kit plugin that adds client.surfnet.* cheatcodes
  • createSurfpoolClient() batteries-included factory (rpc + subscriptions + surfnet + airdrop + payer + tx pipeline)
  • requestTransformer adds surfnet_ prefix on the wire so consumer code is clean: client.surfnet.timeTravel()
  • 26 auto-generated .ts type files from Rust via ts-rs
  • Hand-maintained SurfnetCheatcodesApi intersection type mapping method names to generated param/response types

How type generation works

TS_RS_LARGE_INT=number cargo test --features ts -p surfpool-types -p surfpool-core export_bindings

Generates .ts files from #[derive(ts_rs::TS)] annotations behind the ts feature flag. A post-gen script patches missing imports. See crates/sdk-kit/DEVELOPING.md for full details.

Test plan

  • cargo check -p surfpool-types -p surfpool-core — clean build without ts feature
  • cargo test --features ts -p surfpool-types — 68 tests pass (binding exports + existing)
  • bunx tsc --noEmit — zero type errors
  • bun test — 29 pass, 1 skip (writeProgram known surfpool crash), 0 fail

Add ts-rs derives to Rust types in crates/types and crates/core to
auto-generate TypeScript param/response types for the Surfnet cheatcode
RPC methods. Introduces crates/sdk-kit as a @solana/kit plugin package
with 29 passing integration tests.

- ts-rs v12 as optional dep behind `ts` feature flag
- 26 generated .ts files from Rust source of truth
- surfpool() kit plugin + createSurfpoolClient() factory
- requestTransformer adds surfnet_ prefix on the wire
- Full test suite covering all 22 cheatcode methods
@amilz amilz changed the base branch from main to feat/sdk March 30, 2026 20:43
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