solana-kit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Skill based on Kit (anza-xyz/kit), generated 2026-02-25.
Concise reference for building Solana apps with Kit: functional API, tree-shakeable imports, RPC + RPC Subscriptions, signers, transaction messages, account fetch/decode, codecs, and program clients.
基于Kit(anza-xyz/kit)开发的Skill,生成于2026-02-25。
这是使用Kit构建Solana应用的简明参考文档,涵盖函数式API、可摇树导入、RPC及RPC订阅、签名器、交易消息、账户获取/解码、编解码器和程序客户端等内容。

Core References

核心参考

TopicDescriptionReference
SetupInstall, RPC/RPC Subscriptions, typed clientcore-setup
RPCHTTP client — getBalance, getAccountInfo, getLatestBlockhash, sendcore-rpc
RPC SubscriptionsWebSocket — accountNotifications, slotNotificationscore-rpc-subscriptions
Functionalpipe(), pipeline transformscore-functional
SignersKeyPairSigner, airdrop, wallet swap, no-opcore-signers
Transactionspipe, fee payer, lifetime, instructions, sign, send-and-confirmcore-transactions
Transaction confirmationBlock height exceedence, recent signature, nonce invalidation, timeoutcore-transaction-confirmation
AccountsfetchEncodedAccount, program fetch/decode (fetchMint, decodeMint)core-accounts
Address lookup tablesfetchLookupTables, compress message, decompile with lookupscore-address-lookup-tables
AddressesAddress type, validation, PDA derivation, codecscore-addresses
SysvarsFetch/decode Clock, Rent, EpochSchedule, etc.core-sysvars
主题描述参考文档
环境搭建安装、RPC/RPC订阅、类型化客户端core-setup
RPCHTTP客户端 —— getBalance、getAccountInfo、getLatestBlockhash、sendcore-rpc
RPC订阅WebSocket —— accountNotifications、slotNotificationscore-rpc-subscriptions
函数式编程pipe()、流水线转换core-functional
签名器KeyPairSigner、空投、钱包切换、无操作core-signers
交易pipe、付费方、生命周期、指令、签名、发送并确认core-transactions
交易确认区块高度超出、最新签名、随机数失效、超时core-transaction-confirmation
账户fetchEncodedAccount、程序获取/解码(fetchMint、decodeMint)core-accounts
地址查找表fetchLookupTables、消息压缩、结合查找表反编译core-address-lookup-tables
地址地址类型、验证、PDA推导、编解码器core-addresses
系统变量获取/解码Clock、Rent、EpochSchedule等core-sysvars

Features

功能特性

TopicDescriptionReference
InstructionsProgram clients — System, Token, Compute Budgetfeatures-instructions
Instruction plansSequential/parallel plans, planner, executorfeatures-instruction-plans
CodecsEncode/decode structs, program getXCodecfeatures-codecs
Compatible program clients@solana-program/*, Codama-generated clientsfeatures-compatible-clients
Compat (Web3.js)fromLegacyPublicKey, fromLegacyKeypair, fromVersionedTransactionfeatures-compat
ErrorsSolanaError, isSolanaError, contextfeatures-errors
GraphQLcreateSolanaRpcGraphQL, nested queries, caching/batchingfeatures-graphql
Key pairsgenerateKeyPair, import bytes, polyfillfeatures-keypairs
Offchain messagesBuild, sign, verify, encode/decode (sRFC 3)features-offchain-messages
Program errorsisProgramError — attribute tx failure to program/codefeatures-program-errors
ReactuseSignIn, useWalletAccountTransactionSigner, useSignAndSendTransactionfeatures-react
RPC transportsCustom transport — failover, retry, round-robin, shardingfeatures-rpc-transports
RPC API augmentationmainnet/devnet, cherry-pick methods, custom RPC methodsfeatures-rpc-api-augmentation
Create Solana programpnpm create solana-program, Codama-generated JS clientfeatures-create-solana-program
Unstable subscriptionscreateSolanaRpcSubscriptions_UNSTABLE, block/slotsUpdatesfeatures-unstable-subscriptions
主题描述参考文档
指令程序客户端 —— System、Token、Compute Budgetfeatures-instructions
指令计划顺序/并行计划、规划器、执行器features-instruction-plans
编解码器结构体编码/解码、program getXCodecfeatures-codecs
兼容程序客户端@solana-program/*、Codama生成的客户端features-compatible-clients
Web3.js兼容fromLegacyPublicKey、fromLegacyKeypair、fromVersionedTransactionfeatures-compat
错误处理SolanaError、isSolanaError、上下文features-errors
GraphQLcreateSolanaRpcGraphQL、嵌套查询、缓存/批处理features-graphql
密钥对generateKeyPair、导入字节、polyfillfeatures-keypairs
链下消息构建、签名、验证、编码/解码(sRFC 3)features-offchain-messages
程序错误isProgramError —— 将交易失败归因于程序/代码features-program-errors
React集成useSignIn、useWalletAccountTransactionSigner、useSignAndSendTransactionfeatures-react
RPC传输自定义传输 —— 故障转移、重试、轮询、分片features-rpc-transports
RPC API扩展主网/测试网、挑选方法、自定义RPC方法features-rpc-api-augmentation
创建Solana程序pnpm create solana-program、Codama生成的JS客户端features-create-solana-program
不稳定订阅createSolanaRpcSubscriptions_UNSTABLE、区块/槽位更新features-unstable-subscriptions

Best practices

最佳实践

TopicDescriptionReference
Abort RPC/subscriptionsAbortController, timeout, cancel on navigationbest-practices-abort-rpc
Tree-shakingNarrow imports, sub-packages, smaller bundlesbest-practices-tree-shaking
Upgrade from Web3.jsConnection → RPC, PublicKey → address, compatible clientsbest-practices-upgrade
主题描述参考文档
终止RPC/订阅AbortController、超时、导航时取消best-practices-abort-rpc
摇树优化窄导入、子包、更小的打包体积best-practices-tree-shaking
从Web3.js升级Connection → RPC、PublicKey → address、兼容客户端best-practices-upgrade