Bridge tokens
For additional questions, please contact our support team on Discord.
Overview
The bridge widget, powered by Squid, enables players to transfer tokens between Immutable zkEVM and other chains.
The Immutable Marketplace package generates the URL needed to access the bridge widget.
Generating the bridge URL
To generate the bridge URL, provide the environment as shown in the example:
using Immutable.Marketplace;
using UnityEngine;
public class MarketplaceExample : MonoBehaviour
{
async void Start()
{
try
{
string link = LinkFactory.GenerateBridgeLink(environment: Environment.Sandbox);
Debug.Log($"Link: {link}");
// Open the generated link in the default browser
Application.OpenURL(link);
}
catch (System.Exception e)
{
Debug.LogError($"Error getting the bridge link: {e.Message}");
}
}
}
Configuration
You can pass optional configurations to the bridge widget using the GenerateBridgeLink
function. The main configurations are provided through the BridgeQueryParams
struct.
The BridgeQueryParams
struct allows you to define the configuration for the bridge flow. Here's a list of the available fields:
Parameter | Description |
---|---|
FromTokenAddress | The address of the token being moved from (default: null). |
FromChainID | The ID of the source blockchain (default: null). |
ToTokenAddress | The address of the token being moved to (default: null). |
ToChainID | The ID of the destination blockchain (default: null). |
Here's an example of how to use the GenerateBridgeLink
function with the BridgeQueryParams
struct:
var link = LinkFactory.GenerateBridgeLink(
environment: Environment.Sandbox,
queryParams: new BridgeQueryParams
{
FromTokenAddress = "0x1234...abcd",
FromChainID = "1",
ToTokenAddress = "0xabcd...1234",
ToChainID = "13371"
}
);
For more information, refer to Bridge tokens.