Skip to main content
Move tokens from Ethereum mainnet to Immutable Chain. Bridge Widget When to use:
  • Bringing ETH or ERC-20 tokens to Immutable Chain
  • Players have assets on Ethereum they want to use in-game
  • L1 to L2 asset migration

Installation

npm install @imtbl/sdk

Quick Start

import { checkout } from '@imtbl/sdk';
import { Environment } from '@imtbl/sdk/config';

const { Checkout, WidgetType, WidgetTheme, CommerceFlowType, CommerceEventType } = checkout;

const checkoutSDK = new Checkout({
  baseConfig: {
    environment: Environment.SANDBOX,
    publishableKey: 'YOUR_PUBLISHABLE_KEY',
  },
});

// Basic bridge flow
export async function openBridge(elementId: string) {
  const widgets = await checkoutSDK.widgets({ config: { theme: WidgetTheme.DARK } });
  const widget = widgets.create(WidgetType.IMMUTABLE_COMMERCE);

  widget.mount(elementId, { flow: CommerceFlowType.BRIDGE });

  widget.addListener(CommerceEventType.SUCCESS, (data) => {
    console.log('Bridge initiated:', data);
    widget.unmount();
  });

  widget.addListener(CommerceEventType.FAILURE, (data) => {
    console.error('Bridge failed:', data);
    widget.unmount();
  });

  widget.addListener(CommerceEventType.CLOSE, () => {
    widget.unmount();
  });

  return widget;
}

// Bridge with pre-filled token and amount
export async function bridgeWithAmount(
  elementId: string,
  options: {
    tokenAddress: string;
    amount: string;
  }
) {
  const widgets = await checkoutSDK.widgets({ config: { theme: WidgetTheme.DARK } });
  const widget = widgets.create(WidgetType.IMMUTABLE_COMMERCE);

  widget.mount(elementId, {
    flow: CommerceFlowType.BRIDGE,
    tokenAddress: options.tokenAddress,
    amount: options.amount,
  });

  return widget;
}

Parameters

ParameterTypeDescription
flow'BRIDGE'Required. Specifies the bridge flow
tokenAddressstringToken to bridge (Ethereum address)
amountstringAmount to bridge

Events

EventDescriptionPayload
SUCCESSBridge initiated{ transactionHash, token, amount }
FAILUREBridge failed{ error }
CLOSEUser closed widget

Bridge Options

The widget uses different bridge providers based on optimal routes:
ProviderSpeedTokens
Immutable Bridge~20 minIMX, ETH, USDC
Squid~2-5 minVarious ERC-20s

How Bridging Works

1. User selects token and amount on Ethereum

2. Deposit transaction on Ethereum L1

3. Wait for confirmations (~12 blocks)

4. Tokens appear on Immutable Chain
Bridge transactions are one-way in the widget. To bridge back to Ethereum, users must use the Immutable Bridge directly.

Next Steps