Client Kit TypeScript
TypeScript client patterns for RPC and transactions (Kit / web3-style). Results appear in the same fence: same-line // comments when short, multiline // blocks below the sample when not.
Search across all documentation pages
TypeScript client patterns for RPC and transactions (Kit / web3-style). Results appear in the same fence: same-line // comments when short, multiline // blocks below the sample when not.
RPC connection with commitment.
// const connection = new Connection(url, "confirmed");
// connection.rpcEndpointNew random keypair (dev only for storage).
// const kp = Keypair.generate();
// kp.publicKey.toBase58()Send signed transaction.
// const sig = await connection.sendTransaction(tx, [payer]);
// sig is base58 stringWait for commitment.
// await connection.confirmTransaction(sig, "confirmed");Fetch account data.
// const info = await connection.getAccountInfo(pubkey);
// info?.lamportsLamport balance.
// const lamports = await connection.getBalance(pubkey);Recent blockhash for tx.
// const { blockhash } = await connection.getLatestBlockhash();Add instructions to a legacy Transaction.
// tx.add(ix1, ix2);Send v0 transaction.
// sendTransaction(vtx, { skipPreflight: false })Sign via wallet (browser).
// await wallet.sendTransaction(tx, connection)Decode account data with borsh/codama/anchor coder.
// program.coder.accounts.decode("State", data)Client ATA derivation.
// await getAssociatedTokenAddress(mint, owner)Request airdrop on dev clusters.
// await connection.requestAirdrop(pubkey, LAMPORTS_PER_SOL)Simulate before send.
// await connection.simulateTransaction(tx)@solana/kit style transaction messages.
// createTransactionMessage({ version: 0 })Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, Rust 1.91.1, and @solana/kit 7.0.0.
Reviewed by Chris St. John·Last updated Jul 18, 2026