Skip to main content

Configuration Types

Types for configuring the Mina SDK client and bridge operations.

MinaConfig

Main configuration interface for initializing the Mina client.
interface MinaConfig {
  /** Unique identifier for the integrator */
  integrator: string;
  /** Custom RPC URLs by chain ID */
  rpcUrls?: Record<number, string>;
  /** Enable automatic deposit to Hyperliquid L1 after bridge */
  autoDeposit?: boolean;
  /** Default slippage tolerance (0.005 = 0.5%) */
  defaultSlippage?: number;
}

Properties

PropertyTypeRequiredDefaultDescription
integratorstringYes-Unique identifier for your application. Used for tracking and analytics.
rpcUrlsRecord<number, string>No-Custom RPC endpoints keyed by chain ID. Overrides default providers.
autoDepositbooleanNotrueAutomatically deposit bridged USDC to Hyperliquid L1 trading account.
defaultSlippagenumberNo0.005Default slippage tolerance in decimal format (0.005 = 0.5%).

Example

import { Mina } from '@mina-bridge/sdk';

const mina = new Mina({
  integrator: 'my-dapp',
  autoDeposit: true,
  defaultSlippage: 0.005,
  rpcUrls: {
    1: 'https://my-ethereum-rpc.com',
    42161: 'https://my-arbitrum-rpc.com',
  },
});

SlippagePreset

Predefined slippage tolerance values for common use cases.
type SlippagePreset = 0.1 | 0.5 | 1.0;

Values

ValueDescription
0.1Low slippage (0.1%) - Best for stablecoin pairs
0.5Default slippage (0.5%) - Recommended for most trades
1.0High slippage (1.0%) - For volatile markets or large trades

Example

import { SLIPPAGE_CONSTRAINTS } from '@mina-bridge/sdk';

// Use preset values
const slippage: SlippagePreset = 0.5;

// Check available presets
console.log(SLIPPAGE_CONSTRAINTS.PRESETS); // [0.1, 0.5, 1.0]

RoutePreference

Route selection preference for bridge quotes.
type RoutePreference = 'recommended' | 'fastest' | 'cheapest';

Values

ValueDescription
'recommended'Balance of speed and cost (default). LI.FI’s recommended route.
'fastest'Prioritize routes with lowest estimated execution time.
'cheapest'Prioritize routes with lowest total fees.

Example

const quote = await mina.getQuote({
  fromChainId: 1,
  toChainId: 999,
  fromToken: USDC_ADDRESS,
  toToken: HYPEREVM_USDC_ADDRESS,
  fromAmount: '1000000000',
  fromAddress: walletAddress,
  routePreference: 'fastest',
});

SLIPPAGE_CONSTRAINTS

Constant object containing slippage validation rules and defaults.
const SLIPPAGE_CONSTRAINTS = {
  /** Minimum slippage tolerance: 0.01% */
  MIN: 0.01,
  /** Maximum slippage tolerance: 5.0% */
  MAX: 5.0,
  /** Default slippage tolerance: 0.5% */
  DEFAULT: 0.5,
  /** Preset slippage values */
  PRESETS: [0.1, 0.5, 1.0] as const,
} as const;

Properties

PropertyTypeValueDescription
MINnumber0.01Minimum allowed slippage (0.01%)
MAXnumber5.0Maximum allowed slippage (5.0%)
DEFAULTnumber0.5Default slippage value (0.5%)
PRESETSreadonly [0.1, 0.5, 1.0][0.1, 0.5, 1.0]Common preset values

Usage

import { SLIPPAGE_CONSTRAINTS } from '@mina-bridge/sdk';

function validateSlippage(value: number): boolean {
  return value >= SLIPPAGE_CONSTRAINTS.MIN
      && value <= SLIPPAGE_CONSTRAINTS.MAX;
}

// Render slippage options
SLIPPAGE_CONSTRAINTS.PRESETS.map(preset => (
  <button key={preset}>{preset}%</button>
));

RouteComparison

Data for comparing alternative routes.
interface RouteComparison {
  /** Route preference classification */
  type: RoutePreference;
  /** Estimated execution time in seconds */
  estimatedTime: number;
  /** Total fees in USD */
  totalFees: string;
  /** Expected output amount */
  outputAmount: string;
  /** Route ID for reference */
  routeId: string;
}

Properties

PropertyTypeDescription
typeRoutePreferenceClassification of this route (fastest, cheapest, recommended)
estimatedTimenumberEstimated execution time in seconds
totalFeesstringTotal fees formatted in USD (e.g., “2.50”)
outputAmountstringExpected output amount in smallest units
routeIdstringUnique identifier for this route

Example

const quote = await mina.getQuote(params);

if (quote.alternativeRoutes) {
  quote.alternativeRoutes.forEach(alt => {
    console.log(`${alt.type}: ${alt.estimatedTime}s, $${alt.totalFees}`);
  });
}