Migrate.fun React SDK
@emblemvault/migratefun-reactReact hooks and components for integrating Migrate.fun project data into your application.
Installation
Quick Start
Wrap your app with MigrateFunProvider to enable all hooks and components.
Provider
MigrateFunProvider
Context provider that manages network state and caches project data. All hooks automatically use this context.
| Prop | Type | Default | Description |
|---|---|---|---|
| config.baseUrl | string | "https://emblemvault.dev" | Base URL for API calls |
| config.defaultNetwork | "mainnet" | "devnet" | "mainnet" | Default network for all hooks |
Context Hooks
Hooks
useProjects
Fetch all migrate.fun projects. Data is cached in the provider context.
Return Value
| Prop | Type | Default | Description |
|---|---|---|---|
| projects | ProjectSummary[] | - | Array of { id, name } |
| count | number | - | Total number of projects |
| isLoading | boolean | - | Loading state |
| error | Error | null | - | Error if fetch failed |
| cached | boolean | - | Whether data is from cache |
| cacheAge | number | undefined | - | Cache age in seconds |
| refetch | (opts?) => Promise | - | Refetch data |
useProject
Fetch a single project with full metadata including token info and images.
Project Object
| Prop | Type | Default | Description |
|---|---|---|---|
| projectId | string | - | Project ID (e.g., "mig121") |
| projectName | string | - | Human-readable name |
| oldTokenMint | string | - | Old token mint address |
| newTokenMint | string | - | New token mint address |
| oldTokenMeta | TokenMetadata | null | - | { name, symbol, uri, image } |
| newTokenMeta | TokenMetadata | null | - | { name, symbol, uri, image } |
useProjectSelect
Convenience hook for dropdown/select components. Returns options formatted for native selects or libraries like react-select.
useMintInfo
Fetch token mint details including decimals, program, and supply for both old and new tokens.
usePoolInfo
Fetch liquidity pool information including source pool type, output pool, and quote token details.
Pool Types: raydiumV4, raydiumCpmm, orca, meteora, pumpfun, moonshot
Components
ProjectSelect
Ready-to-use dropdown component for selecting migrate.fun projects.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | "" | Currently selected project ID |
| onChange | (id: string) => void | - | Callback when selection changes |
| network | "mainnet" | "devnet" | - | Network to fetch projects from |
| live | boolean | false | Force live fetch from chain |
| placeholder | string | "Select a project" | Placeholder text |
| disabled | boolean | false | Disable the select |
| className | string | - | Additional CSS classes |
| showLoading | boolean | true | Show loading indicator |
| loadingText | string | "Loading..." | Loading text |
| errorText | string | "Error loading" | Error text |
TypeScript Types
All types are exported for use in your TypeScript projects.
Type Definition Strings
For documentation purposes, the package exports type definition strings that can be rendered in your docs UI.
Using Without Provider
All hooks use useMigrateFunOptional internally, so they work without a provider. However, you lose shared state and network switching.
For full functionality including shared caching and network state, wrap your app with MigrateFunProvider.