Installation
Install the Mina SDK using your preferred package manager.Package Managers
Peer Dependencies
The SDK requiresviem as a peer dependency for Ethereum interactions:
React Integration
If you plan to use the React hooks, you also need React 18 or higher:TypeScript Support
The SDK is written in TypeScript and includes type definitions. No additional@types packages are required.
Ensure your tsconfig.json includes:
tsconfig.json
Import Paths
The SDK provides two entry points:Bundle Formats
The SDK ships with both ESM and CommonJS bundles:| Format | File | Use Case |
|---|---|---|
| ESM | index.mjs | Modern bundlers (Vite, webpack 5, esbuild) |
| CJS | index.js | Node.js, older bundlers |
| Types | index.d.ts | TypeScript support |
Verifying Installation
Create a simple test file to verify the SDK is installed correctly:test.ts
Framework-Specific Setup
- Next.js
- Vite
- Node.js
The SDK works with Next.js App Router and Pages Router. For server components, use the SDK in client components only:
Troubleshooting
Module not found error
Module not found error
Ensure you have installed the peer dependency
viem:TypeScript errors with imports
TypeScript errors with imports
Update your
tsconfig.json to use moduleResolution: "bundler" or "node16".React hooks not available
React hooks not available
Import from the
/react subpath: