Magic Router SDK

The Magic Router SDK is a TypeScript library that simplifies transaction preparation and routing for MagicBlock’s Ephemeral Rollups infrastructure. Instead of manually determining whether transactions should execute on Solana mainnet or an Ephemeral Rollup, the SDK handles this complexity automatically through intelligent metadata analysis.

Purpose & Benefits

The Magic Router SDK abstracts away the complexity of MagicBlock’s dual-layer execution environment:
  • Automatic Routing: Transactions are intelligently routed to either Ephemeral Rollups or Solana based on account metadata
  • Simplified Integration: Single endpoint connection with no manual routing logic required
  • Optimized Performance: Transactions execute on the fastest available layer for immediate confirmation
  • Seamless Wallet Experience: Standard Solana transaction signing with enhanced routing capabilities

Key Features

Smart Transaction Preparation

The SDK automatically fetches the correct blockhash for your transaction’s writable accounts, ensuring compatibility with both Ephemeral Rollups and Solana mainnet.

Validator Discovery

Automatically identifies and connects to the closest available validator for optimal transaction performance.

Flexible Signing Options

Supports both browser wallet integration and programmatic signing with local signers or session keys.

Account Analysis

Built-in utilities to extract and analyze writable accounts from transactions for intelligent routing decisions.