Skip to main content

useMina

The useMina hook provides access to the Mina SDK instance and its initialization status.

Import

Signature

Parameters

This hook takes no parameters.

Returns

MinaContextValue

Basic Usage

Fetching Data

Use the SDK instance to fetch chains, tokens, and quotes:

Error Handling

Always handle the error state for a robust user experience:

Executing Transactions

Use the SDK to execute bridge transactions:

TypeScript Usage

The hook provides proper TypeScript types:

Provider Requirement

useMina must be used within a MinaProvider. Using it outside will throw an error.

Best Practices

Performance Tips:
  1. Check isReady before making SDK calls to avoid null reference errors
  2. Use the specialized hooks (useQuote, useTokenBalance, useTransactionStatus) for common operations - they handle loading states and caching automatically
  3. Memoize callbacks that use mina to prevent unnecessary re-renders
  4. Only use useMina directly when you need low-level SDK access

When to Use useMina vs Specialized Hooks

Next Steps

useQuote

Fetch bridge quotes with automatic debouncing

useTokenBalance

Track wallet token balances