/solana-ai-kit:migrate-web3from solana-ai-kit
Migrates TypeScript code from @solana/web3.js 1.x to @solana/kit, with optional path/package scope via $ARGUMENTS. Handles dependency inventory, target selection, and incremental migration with type checking.
Ships in solana-ai-kit. Installing the plugin adds it to Claude Code.
Migrate @solana/web3.js 1.x code to @solana/kit. $ARGUMENTS can limit the scope to paths or packages; empty means the whole repo.
Read first: kit-web3-interop.md (choosing the target, dependency boundaries) and kit/overview.md (the current plugin-client API). Detailed mappings and edge cases: solana-kit-migration, with its resources/api-mappings.md and docs/edge-cases.md (install first: bash .claude/bin/skills.sh add sendai). Where it disagrees with kit/overview.md (older type names, no plugin client), follow kit/overview.md.
scripts/analyze-migration.sh <path>, or grep for @solana/web3.js and @solana/spl-token imports outside node_modules. List the dependencies that need v1 objects (Connection, sync Keypair), such as the Anchor TS client, wallet-adapter and protocol SDKs.createClient().use(...)) for code you own.@solana/web3.js@rc, the v1 classes rebuilt on Kit) as a stepping stone for a large v1 codebase. It is a release candidate, so pin exact versions; its official migration skill is linked from kit-web3-interop.md.@solana/compat (fromLegacyPublicKey, fromLegacyKeypair, fromLegacyTransactionInstruction, fromVersionedTransaction).npx tsc --noEmit after each file and the tests after each module.@solana/web3.js import remains outside the adapter, tests pass, and unused packages are gone from package.json.| web3.js 1.x | @solana/kit |
|---|---|
new Connection(url) | createClient().use(solanaRpc({ rpcUrl })), or createSolanaRpc(url) + createSolanaRpcSubscriptions(wsUrl); raw RPC calls end in .send() |
new PublicKey(s), .equals() | address(s): a branded string, compared with === |
Keypair.generate(), Keypair.fromSecretKey(b) | await generateKeyPairSigner(), await createKeyPairSignerFromBytes(b) (async, WebCrypto) |
new Transaction() + sendAndConfirmTransaction | client.sendTransaction([ix]), or pipe(createTransactionMessage({ version: 0 }), ...), then signTransactionMessageWithSigners and sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions }) |
TransactionInstruction | the Instruction type (IInstruction is the old name) |
SystemProgram.transfer | getTransferSolInstruction from @solana-program/system |
@solana/spl-token | @solana-program/token or @solana-program/token-2022 (Codama-generated) |
number lamports, LAMPORTS_PER_SOL | bigint: lamports(1_000_000_000n), solToLamports(sol('1.5')); RPC numbers come back as bigint |
bs58 | getBase58Codec() |
@solana/wallet-adapter-* | @solana/kit-plugin-wallet (hooks in /react) with @solana/react; see frontend.md |
@coral-xyz/anchor | @anchor-lang/core, which still uses v1 types: keep it behind the adapter or replace it with a Codama client (/generate-idl-client) |
web3.js 1.x cannot send v1 transactions. Kit plugin clients default to v0; moving to v1 is a separate decision that depends on wallet support: transactions-v1.md.
Files migrated, remaining web3.js usage with the reason for each, dependency changes, typecheck and test results.
Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
54 commands in this plugin
/add-skillAdd SkillInstall a pinned skill extension on demand (/add-skill <id>), or list core packs and extensions/advShort for /adversarial: run every task through proposer and adversary pairs, no triage/adversarialStepsPut a task's load-bearing claims and key decisions through a proposer and an adversary, with proofnpx claudepluginhub solanabr/ai-kit --plugin solana-ai-kitOther plugins' commands for the same job