Ssawera-mastoi

solana-v1-to-kit-codemod

AI-powered migration from Solana web3.js v1 to @solana/kit (v2).

Public
4 executions

Run locally

npx codemod solana-v1-to-kit-codemod

๐Ÿ—๏ธ Solana Kit Porter (v1 โ†’ v2)

Codemod Registry
License: MIT

Automate your migration from the legacy @solana/web3.js (v1.x) to the modular, high-performance @solana/kit (v2.x).

The Solana SDK has undergone a massive architectural shift. Manual migration is tedious and error-prone. Solana Kit Porter handles the heavy lifting, refactoring your RPC calls, transaction building logic, and address handling in seconds.


โœจ Features

  • ๐Ÿš€ Smart RPC Chains: Converts Connection methods into the new modular .send() functional chains.
  • ๐Ÿ”— Transaction Piping: Automatically refactors new Transaction().add() into the modern pipe() and appendTransactionMessageInstructions() pattern.
  • ๐Ÿ“ Address Handling: Precise transformation of new PublicKey(str) to the optimized address(str) helper.
  • ๐Ÿ”‘ Keypair Modernization: Migrates legacy Keypair generation to the new generateKeyPairSigner() and createKeyPairSignerFromBytes() APIs.
  • ๐Ÿค– AI-Powered Refinement: Uses context-aware AI to handle complex logic changes that deterministic rules might miss.

๐Ÿ› ๏ธ Quick Start

Ensure you have the Codemod CLI installed. Then, run this command in your project root:

bash

๐Ÿงช Verified on Real Projects

We have successfully tested this codemod on:

  • solana-labs/dapp-scaffold
  • solana-labs/solana-program-library (Client-side scripts)
  • Custom production dApps

๐Ÿ“ฆ What's Migrated?

FeatureLegacy (v1)Modern (v2)
Imports@solana/web3.js@solana/kit
RPCnew Connection(url)createSolanaRpc(url)
Callsconnection.getBalance(pubkey)connection.getBalance(pubkey).send()
Addressesnew PublicKey(str)address(str)
Transactionsnew Transaction().add(ix)pipe(createTransaction(), ...)
TransfersSystemProgram.transfer({...})getTransferInstruction({...})

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE for more information.


<p align="center"> Built with โค๏ธ for the <b>Boring AI Hackathon</b> </p>

Ready to contribute?

Build your own codemod and share it with the community.