Migrate.fun React SDK

@emblemvault/migratefun-react

React hooks and components for integrating Migrate.fun project data into your application.

Installation

BA
terminal
Loading...

Quick Start

Wrap your app with MigrateFunProvider to enable all hooks and components.

TS
App.tsx
Loading...

Provider

MigrateFunProvider

Context provider that manages network state and caches project data. All hooks automatically use this context.

PropTypeDefaultDescription
config.baseUrlstring"https://emblemvault.dev"Base URL for API calls
config.defaultNetwork"mainnet" | "devnet""mainnet"Default network for all hooks

Context Hooks

TS
context-hooks.tsx
Loading...

Hooks

useProjects

Fetch all migrate.fun projects. Data is cached in the provider context.

TS
useProjects.tsx
Loading...

Return Value

PropTypeDefaultDescription
projectsProjectSummary[]-Array of { id, name }
countnumber-Total number of projects
isLoadingboolean-Loading state
errorError | null-Error if fetch failed
cachedboolean-Whether data is from cache
cacheAgenumber | undefined-Cache age in seconds
refetch(opts?) => Promise-Refetch data

useProject

Fetch a single project with full metadata including token info and images.

TS
useProject.tsx
Loading...

Project Object

PropTypeDefaultDescription
projectIdstring-Project ID (e.g., "mig121")
projectNamestring-Human-readable name
oldTokenMintstring-Old token mint address
newTokenMintstring-New token mint address
oldTokenMetaTokenMetadata | null-{ name, symbol, uri, image }
newTokenMetaTokenMetadata | null-{ name, symbol, uri, image }

useProjectSelect

Convenience hook for dropdown/select components. Returns options formatted for native selects or libraries like react-select.

TS
useProjectSelect.tsx
Loading...

useMintInfo

Fetch token mint details including decimals, program, and supply for both old and new tokens.

TS
useMintInfo.tsx
Loading...

usePoolInfo

Fetch liquidity pool information including source pool type, output pool, and quote token details.

TS
usePoolInfo.tsx
Loading...

Pool Types: raydiumV4, raydiumCpmm, orca, meteora, pumpfun, moonshot

Components

ProjectSelect

Ready-to-use dropdown component for selecting migrate.fun projects.

TS
ProjectSelect.tsx
Loading...

Props

PropTypeDefaultDescription
valuestring""Currently selected project ID
onChange(id: string) => void-Callback when selection changes
network"mainnet" | "devnet"-Network to fetch projects from
livebooleanfalseForce live fetch from chain
placeholderstring"Select a project"Placeholder text
disabledbooleanfalseDisable the select
classNamestring-Additional CSS classes
showLoadingbooleantrueShow loading indicator
loadingTextstring"Loading..."Loading text
errorTextstring"Error loading"Error text

TypeScript Types

All types are exported for use in your TypeScript projects.

TY
types.ts
Loading...

Type Definition Strings

For documentation purposes, the package exports type definition strings that can be rendered in your docs UI.

TS
definitions.tsx
Loading...

Using Without Provider

All hooks use useMigrateFunOptional internally, so they work without a provider. However, you lose shared state and network switching.

TS
standalone.tsx
Loading...

For full functionality including shared caching and network state, wrap your app with MigrateFunProvider.