Skip to main content
Connect Passport, MetaMask, WalletConnect, and other EIP-1193 wallets. Connect Widget When to use:
  • Initial user authentication
  • Connecting wallets before transactions
  • Switching between wallets

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 connect flow
export async function connectWallet(elementId: string) {
  const widgets = await checkoutSDK.widgets({ config: { theme: WidgetTheme.DARK } });
  const widget = widgets.create(WidgetType.IMMUTABLE_COMMERCE);

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

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

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

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

  return widget;
}

// Wallet RDNS identifiers
export const WALLET_RDNS = {
  passport: 'com.immutable.passport',
  metamask: 'io.metamask',
  coinbase: 'com.coinbase.wallet',
} as const;

Parameters

ParameterTypeDescription
flow'CONNECT'Required. Specifies the connect flow
targetWalletRdnsstringOptional. Target specific wallet by RDNS
targetChainIdstringOptional. Target chain to connect to
blocklistWalletRdnsstring[]Optional. Wallets to hide from selection

Events

EventDescriptionPayload
SUCCESSWallet connected{ walletProviderName, provider }
FAILUREConnection failed{ error }
CLOSEUser closed widget

Supported Wallets

WalletRDNSNotes
Passportcom.immutable.passportRecommended for games
MetaMaskio.metamaskBrowser extension
WalletConnectMobile wallets
Coinbase Walletcom.coinbase.walletBrowser + mobile
Any EIP-1193 compatible wallet injected into the browser will appear automatically.

Next Steps