After you have finished setting up the widget, use the WidgetsFactory to create a cross-link bridge widget. To mount the widget, call the mount() function with the id attribute you wish to mount on the target element.
Parameters are treated as transient and reset after uninstalling the widget.
import { checkout } from "@imtbl/sdk";
// @ts-ignore
const bridge = widgets.create(checkout.WidgetType.BRIDGE,
{ config: { theme: checkout.WidgetTheme.DARK }}
);
// When calling the mount function, pass in the parameters to use
bridge.mount('bridge', { fromTokenAddress: '0x123', amount: '10' })
Deploy
When you first create a widget, you can pass an optional configuration object to set it up. For example, passing a theme will create the widget with that theme. if no configuration object is passed, it will be set by default.
Widget parameters
You can do this by calling the update() method.
import { checkout } from "@imtbl/sdk";
//@ts-ignore When creating the widget, pass in the configuration
const bridge = widgets.create(checkout.WidgetType.BRIDGE,
{ config: { theme: checkout.WidgetTheme.DARK }}
);
// Update the widget config by calling update()
bridge.update({ config: { theme: checkout.WidgetTheme.LIGHT }});
For more information on all Checkout Widget configurations (such as themes), see the Configuration section of the Settings page.
Cross-chain bridge A widget event is triggered when a user performs a critical action or reaches a critical state. Events. The following is a table of events that may occur for the Cross-chain bridge widget.
You can use the addListener() function to access event and provider handlers. Use theremoveListener() function to stop listening to the event.