Solana 文档快速入门
根据您正在构建的内容选择所需的 Commerce Kit 软件包。每个软件包都可以独立安装,既可以单独使用,也可以与其他软件包组合使用。
系统要求
- Node.js:18 或更高版本(推荐使用 LTS 版本)
- 包管理器:pnpm、npm 或 yarn
- TypeScript:4.5+ 版本(推荐但非必需)
常见对等依赖
Solana Commerce Kit 构建于 Solana Kit 库之上,因此它与 Solana Kit、Gill、Solana 程序客户端以及 Codama 生成的 JS 客户端兼容。
pnpm add gill # or @solana/kitpnpm add @solana-program/token # or @solana-program/target-programpnpm add @my-program/codama-js-client
TypeScript 配置
如果使用 TypeScript,请确保您的 tsconfig.json 包含:
{"compilerOptions": {"module": "ESNext","target": "ES2020","lib": ["ES2020", "DOM", "DOM.Iterable"],"jsx": "react-jsx","moduleResolution": "bundler","resolveJsonModule": true,"esModuleInterop": true,"skipLibCheck": true}}
Next.js 配置
如果使用 Next.js,请更新 next.config.js 以转译 Commerce Kit 软件包:
/** @type {import('next').NextConfig} */const nextConfig = {transpilePackages: ["@solana-commerce/react","@solana-commerce/connector","@solana-commerce/headless","@solana-commerce/solana-pay","@solana-commerce/sdk"]};export default nextConfig;
Is this page helpful?