Skip to main content

Connect widget

The Connect widget is a drop-in solution for web-based games and marketplaces that offers users a friendly wallet interface, simplifying the process of linking their wallets and integrating onto the Immutable zkEVM network.

Connect widgetConnect widget

💡Supported wallets
Checkout widgets support Metamask and Immutable Passport wallets. However to support Passport as a wallet option you must integrate your application with Passport. Then follow our Passport integration docs.

Getting started

Once you have completed the widget setup, use the WidgetsFactory to create a connect widget. In order to mount the widget, call the mount() function and pass in the id attribute of the target element you wish to mount it to.

import { useEffect } from 'react';
import { checkout } from '@imtbl/sdk';

// create Checkout SDK
const checkoutSDK = new checkout.Checkout();

export function App() {
// Initialise widgets, create connect widget and mount
useEffect(() => {
(async () => {
const widgets = await checkoutSDK.widgets({
config: { theme: checkout.WidgetTheme.DARK },
const connect = widgets.create(checkout.WidgetType.CONNECT)
}, []);

return (<div id="connect" />);


The mount() function can also take in parameters to be passed into the widget.

Widget parameters

Parameters are treated as transient and will be reset after the widget is unmounted.


When you first create the widget, you can pass an optional configuration object to set it up. For example, passing in the theme will create the widget with that theme. If this is not passed the configuration will be set by default.

Widget configuration

Configuration will persist after the widget is unmounted. You can always update a widget's configuration later by calling the update() method.

ConnectWidgetConfigurationThe configuration type to be used with the Connect Widget.
import { checkout } from "@imtbl/sdk";

//@ts-ignore When creating the widget, pass in the configuration
const connect = widgets.create(checkout.WidgetType.CONNECT, { config: { theme: checkout.WidgetTheme.DARK }});

// Update the widget config by calling update()
connect.update({config: {theme: checkout.WidgetTheme.LIGHT}});

For more information on the configurations across all the Checkout Widgets (e.g. theme) review the Configuration section in our Setup page.


Connect widget events are emitted when critical actions have been taken by the user or key states have been reached. Below is a table of the possible events for the Connect Widget.

Event TypeDescriptionEvent Payload
ConnectEventType.SUCCESSA user successfully connected their wallet.ConnectionSuccess
ConnectEventType.FAILUREThere was a problem connecting a user's wallet. This should not occur if the user simply rejects the connection request. The widget will allow them to try again.ConnectionFailed
ConnectEventType.CLOSE_WIDGETThe user clicked the close button on the widget. This should usually be wired up to call the widget's unmount() function.

You can use the addListener() function to tap into the events and provider handlers. Use the removeListener() function to stop listening to that event.

import { checkout } from "@imtbl/sdk";

const connect = widgets.create(checkout.WidgetType.WALLET,
{ config: { theme: checkout.WidgetTheme.DARK }}

// add event listeners for the connect widget
connect.addListener(checkout.ConnectEventType.SUCCESS, (data: checkout.ConnectionSuccess) => {
console.log("success", data);

connect.addListener(checkout.ConnectEventType.FAILURE, (data: checkout.ConnectionFailed) => {
console.log("failure", data);

connect.addListener(checkout.ConnectEventType.CLOSE_WIDGET, () => {

// remove event listeners for the connect widget



Sample code

This sample code gives you a good starting point for integrating the connect widget into your application and listening to its events.

IMX Whitepaper IMX Tokenomics Block Explorer Careers Contact Us