v0.10 release candidate · open source
Write Solana programs
in TypeScript.
TypeSOL compiles a TypeScript subset to native SBF with Anchor-compatible IDLs.
git clone https://github.com/typesol/typesol.gitimport { type Account, type Init, type Mut, type Pubkey, type Signer, type SystemProgram, type u8, type u64, require } from "typesol"; export interface Counter { authority: Pubkey; count: u64; bump: u8;} export enum CounterError { Unauthorized = "Only the counter's authority can change it",} /** Create the caller's counter at PDA ["counter", authority]. */export function initialize(authority: Mut<Signer>, counter: Init<Counter>, systemProgram: SystemProgram): void { counter.bump = counter.create(authority, ["counter", authority.key]); counter.authority = authority.key; counter.count = 0n;} export function increment(authority: Signer, counter: Mut<Counter>, by: u64): void { require(counter.authority === authority.key, CounterError.Unauthorized); counter.count += by;} /** Read-only check that callers can simulate. */export function assertAtLeast(counter: Account<Counter>, min: u64): void { require(counter.count >= min, "counter is below the expected minimum");} 29 linesMeasured against Anchor, native Rust and Pinocchio
310
tests passed
MIT
open source
The same programs, four ways
Counter and vault written in TypeSOL, Anchor, native Rust and Pinocchio, with the same instructions, the same account layout and identical final state. The table gives mean compute units in LiteSVM; lower is better. TypeSOL matches or beats hand-tuned Pinocchio on 4 of 6; Pinocchio is still faster on counter.increment and vault.shut.
counter.initialize
- TypeSOL3,048
- Native Rust4,601
- Anchor6,573
- Pinocchio3,186
counter.increment
- TypeSOL143
- Native Rust857
- Anchor2,323
- Pinocchio113
vault.open
- TypeSOL3,062
- Native Rust4,613
- Anchor6,627
- Pinocchio3,185
vault.deposit
- TypeSOL1,358
- Native Rust2,832
- Anchor4,355
- Pinocchio1,377
vault.withdraw
- TypeSOL352
- Native Rust1,176
- Anchor3,628
- Pinocchio370
vault.shut
- TypeSOL201
- Native Rust950
- Anchor2,024
- Pinocchio167
| Program | TypeSOL | Native Rust | Anchor | Pinocchio |
|---|---|---|---|---|
| counter.so | 12.3 | 27.9 | 145.2 | 19.6 |
| vault.so | 16.1 | 35.0 | 158.9 | 22.9 |
Fewer compute units are not a safety claim. Two programs are compared so far; more will be added as the benchmark suite grows.
No interpreter. No generated Rust.
Your .ts file becomes a native Solana program in five steps, on your machine.
Typecheck
The TypeScript compiler checks your file against the TypeSOL declarations. Your editor already understands it.
counter.tsSubset check
Anything outside the language, such as floats, closures or classes, is a file:line:col error, never half-supported.
0 errorsLower to C
Account checks, checked arithmetic, Borsh and CPIs come from a small C runtime.
counter.cBuild SBF
The same LLVM toolchain cargo-build-sbf uses links the program. Builds are reproducible.
counter.so · 12.3 KBEmit the IDL
An Anchor-compatible IDL, so Anchor clients, Codama and explorers work unchanged.
counter.json · spec 0.1.0
TypeSOL $TS
Supports TypeSOL development: audits and infrastructure.
- Chain
- Solana
- Launch
- Meteora DBC · SOL pair
- Status
- Pre-launch
- Contract
- Published here at launch
Only trust the contract address published on this page and in the GitHub repository. Nothing here is financial advice.
Built in public
The big milestones. Everything smaller lands in the changelog.
- Compiler 0.10Shipped
- AI-nativeNext
- Client SDKPlanned
- Verified buildsPlanned
- PlaygroundPlanned
- Audit & 1.0Planned