Mina class is the main entry point for the Mina Bridge SDK. It provides a unified interface for bridging assets to HyperEVM and depositing to Hyperliquid L1.
Constructor
MinaConfig
| Parameter | Type | Required | Description |
|---|---|---|---|
integrator | string | Yes | Unique identifier for your application |
rpcUrls | Record<number, string> | No | Custom RPC URLs by chain ID |
autoDeposit | boolean | No | Enable automatic deposit to Hyperliquid L1 after bridge (default: true) |
defaultSlippage | number | No | Default slippage tolerance in decimal format (0.005 = 0.5%) |
Example
Chain Methods
getChains()
Get all supported source chains for bridging.ChainFetchError if API fails and no cache available.
Example:
getDestinationChains()
Get destination chains (HyperEVM).getChainsByRoutes(toChainId?)
Get chains with valid bridge routes to a specific destination.| Parameter | Type | Default | Description |
|---|---|---|---|
toChainId | number | 999 | Destination chain ID (HyperEVM) |
getChainById(chainId)
Get a specific chain by its ID.Token Methods
getTokens(chainId)
Get all available tokens for a specific chain.TokenFetchError if API fails and no cache available.
Example:
getBridgeableTokens(chainId)
Get tokens that can be bridged from a specific chain to HyperEVM.getDestinationTokens()
Get tokens available on HyperEVM destination.getTokenByAddress(chainId, tokenAddress)
Get a specific token by its address on a chain.Balance Methods
getBalance(chainId, tokenAddress, walletAddress)
Get token balance for a wallet address.BalanceFetchError if API fails and no cache available.
Example:
getBalances(walletAddress, chainIds, tokenAddresses?)
Get token balances across multiple chains in parallel.getChainBalances(walletAddress, chainId)
Get all supported token balances for a specific chain.Quote Methods
getQuote(params, timeoutMs?)
Get a single optimal bridge quote.| Parameter | Type | Required | Description |
|---|---|---|---|
fromChainId | number | Yes | Source chain ID |
toChainId | number | No | Destination chain ID (default: 999 HyperEVM) |
fromToken | string | Yes | Source token address |
toToken | string | Yes | Destination token address |
fromAmount | string | Yes | Amount in smallest unit (wei) |
fromAddress | string | Yes | User’s wallet address |
toAddress | string | No | Destination address (defaults to fromAddress) |
slippageTolerance | number | No | Slippage tolerance as percentage (0.5 = 0.5%) |
routePreference | RoutePreference | No | ’recommended’, ‘fastest’, or ‘cheapest’ |
InvalidQuoteParamsErrorif parameters are invalidNoRouteFoundErrorif no route is availableNetworkErrorif API request fails
getQuotes(params, timeoutMs?)
Get multiple bridge quotes for comparison.{ quotes: Quote[], recommendedIndex: number }
Example:
Execution Methods
execute(options)
Execute a bridge transaction.| Parameter | Type | Required | Description |
|---|---|---|---|
quote | Quote | Yes | Quote to execute |
signer | TransactionSigner | Yes | Wallet signer (viem WalletClient compatible) |
onStepChange | OnStepChange | No | Callback for step status updates |
onStatusChange | OnStatusChange | No | Callback for overall status updates |
onApprovalRequest | () => void | No | Callback before approval transaction |
onTransactionRequest | () => void | No | Callback before main transaction |
infiniteApproval | boolean | No | Allow infinite token approval |
QuoteExpiredErrorif the quote has expiredInvalidQuoteErrorif the quote is malformedTransactionFailedErrorif the transaction failsUserRejectedErrorif the user rejects the transaction
getExecutionStatus(executionId)
Get the status of an execution by ID.getStatus(txHash)
Get the status of a bridge transaction by transaction hash.Deposit Detection Methods
detectUsdcArrival(walletAddress, options?)
Detect USDC arrival on HyperEVM after a bridge transaction.| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | number | 300000 | Timeout in milliseconds (5 minutes) |
pollInterval | number | 5000 | Polling interval in milliseconds |
onPoll | (attempt, balance) => void | - | Callback for each poll attempt |
expectedAmount | string | - | Expected amount for validation |
snapshotUsdcBalance(walletAddress)
Take a snapshot of USDC balance on HyperEVM before bridging.detectUsdcArrivalFromSnapshot(walletAddress, previousBalance, options?)
Detect USDC arrival starting from a known balance snapshot.Event System
on(event, callback)
Subscribe to an SDK event.| Event | Payload | Description |
|---|---|---|
stepChanged | StepStatusPayload | Step status updated |
statusChanged | TransactionStatusPayload | Overall status updated |
executionStarted | { executionId, quoteId, timestamp } | Execution started |
executionCompleted | { executionId, txHash, receivedAmount } | Execution completed |
executionFailed | { executionId, error, step } | Execution failed |
approvalRequired | { tokenAddress, amount, spender } | Approval needed |
transactionSent | { txHash, chainId, stepType } | Transaction sent |
transactionConfirmed | { txHash, chainId, stepType } | Transaction confirmed |
off(event, callback)
Unsubscribe from an SDK event.once(event, callback)
Subscribe to an SDK event once (auto-unsubscribes after first call).getEmitter()
Get the internal event emitter (for advanced use).Cache Management
invalidateChainCache()
Force a fresh fetch on nextgetChains() call.
invalidateTokenCache(chainId?)
Force a fresh fetch on nextgetTokens() call.
| Parameter | Type | Description |
|---|---|---|
chainId | number | Optional chain ID to invalidate (invalidates all if not provided) |
invalidateBalanceCache(walletAddress?)
Force a fresh fetch on nextgetBalance() call.
invalidateQuoteCache()
Force fresh quotes on nextgetQuote() call.
Utility Methods
getConfig()
Get the current client configuration.isAutoDepositEnabled()
Check if auto-deposit is enabled.setAutoDeposit(enabled)
Set auto-deposit preference.validateQuote(quote)
Validate a quote before execution.QuoteExpiredErrorif the quote has expiredInvalidQuoteErrorif the quote is malformed
