solana-web3js-to-kit
Automatically migrate your codebase from @solana/web3.js v1 to @solana/kit.
bash
What It Does
10 deterministic transforms. ~85% automation coverage. Zero false positives.
| Transform | What changes |
|---|---|
01-imports | @solana/web3.js → @solana/kit named imports |
02-connection | new Connection(url) → createSolanaRpc(url) |
03-publickey | new PublicKey('str') → address('str') |
04-keypair-generate | Keypair.generate() → await generateKeyPairSigner() |
05-keypair-props | .publicKey → .address, .secretKey → .privateKey |
06-system-transfer | SystemProgram.transfer({...}) → getTransferSolInstruction({...}) |
07-send-confirm | sendAndConfirmTransaction(conn, tx, [s]) → kit signature |
08-cluster-api-url | clusterApiUrl('devnet') → 'https://api.devnet.solana.com' |
09-rpc-send | rpc.getBalance() → rpc.getBalance().send() (all 40+ RPC methods) |
10-type-annotations | PublicKey, Keypair, TransactionInstruction type annotations → kit equivalents |
Before / After
Before:
typescript
After:
typescript
What Requires Manual Review
These patterns are intentionally left for human review:
Keypair.fromSecretKey(bytes)→ usecreateKeyPairSignerFromBytes()new PublicKey(buffer)→ non-string PublicKey construction- Multi-instruction
Transaction.add().add()chains → rewrite topipe()pattern - Commitment level configuration → must move to per-call options
sendAndConfirmTransactionFactorywiring → requiresrpc+rpcSubscriptionsin scope
Running Individual Transforms
bash
Transforms are numbered — run them in order (01 → 10) if applying manually.
Tests
24 test fixtures across all 10 transforms. All passing.
bash
Source: github.com/thewoodfish/codemon