Skip to main content

Installation

Install the Mina SDK using your preferred package manager.

Package Managers

npm install @siphoyawe/mina-sdk

Peer Dependencies

The SDK requires viem as a peer dependency for Ethereum interactions:
npm install viem

React Integration

If you plan to use the React hooks, you also need React 18 or higher:
npm install @siphoyawe/mina-sdk viem react react-dom

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
{
  "compilerOptions": {
    "moduleResolution": "bundler", // or "node16"
    "target": "ES2020",
    "lib": ["ES2020", "DOM"]
  }
}

Import Paths

The SDK provides two entry points:
// Main SDK - client, services, types, errors
import { Mina, getChains, getTokens } from '@siphoyawe/mina-sdk';

// React hooks and provider
import { MinaProvider, useMina, useQuote } from '@siphoyawe/mina-sdk/react';

Bundle Formats

The SDK ships with both ESM and CommonJS bundles:
FormatFileUse Case
ESMindex.mjsModern bundlers (Vite, webpack 5, esbuild)
CJSindex.jsNode.js, older bundlers
Typesindex.d.tsTypeScript support

Verifying Installation

Create a simple test file to verify the SDK is installed correctly:
test.ts
import { Mina } from '@siphoyawe/mina-sdk';

const mina = new Mina({
  integrator: 'my-app'
});

// Fetch supported chains
const { chains } = await mina.getChains();
console.log(`SDK loaded. ${chains.length} chains available.`);
Run with:
npx tsx test.ts
You should see output like:
SDK loaded. 42 chains available.

Framework-Specific Setup

The SDK works with Next.js App Router and Pages Router. For server components, use the SDK in client components only:
'use client';

import { MinaProvider } from '@siphoyawe/mina-sdk/react';

export function Providers({ children }) {
  return (
    <MinaProvider config={{ integrator: 'my-app' }}>
      {children}
    </MinaProvider>
  );
}

Troubleshooting

Ensure you have installed the peer dependency viem:
npm install viem
Update your tsconfig.json to use moduleResolution: "bundler" or "node16".
Import from the /react subpath:
import { useMina } from '@siphoyawe/mina-sdk/react';

Next Steps

Now that the SDK is installed, proceed to the Quick Start guide to execute your first bridge transaction.