Skip to main content

Bridging tokens

In this step, you'll integrate the bridge flow, enabling players to move tokens to and from Immutable zkEVM. This provides an additional method for players to add tokens to their wallets, complementing the on-ramp and swap flows and ensuring they have enough funds to purchase NFTs in your marketplace.
Bridging tokens in UnityBridging tokens in Unity
💡Prerequisite step
Before continuing with this step, ensure you have completed the previous swapping tokens step of this tutorial series.

Overview

The bridge flow, powered by Squid, allows players to transfer tokens between various blockchains and Immutable zkEVM.

With the Immutable Marketplace package, you can generate the bridge URL and open it in the player’s default browser using the Application.OpenURL(link) function, as demonstrated in our sample game.

💡Allowlisted tokens
Only tokens that have been verified will be displayed on the widgets. To allowlist an ERC-20 token please follow our Asset Verification procedure.
For additional questions, please contact our support team on Discord.
Bridge flow

Generating the bridge widget URL

To generate the bridge URL, specify the desired environment. In this example, we set the token to be transferred to your game’s ERC-20 token and the destination chain ID to Immutable zkEVM.

using UnityEngine;
using Immutable.Marketplace;
using Environment = Immutable.Marketplace.Environment;

public class Bridge : MonoBehaviour
{
public void OnBridgeClicked()
{
var link = LinkFactory.GenerateBridgeLink(
environment: Environment.Sandbox,
queryParams: new BridgeQueryParams
{
ToTokenAddress = "YOUR_GAME_ERC20_TOKEN_ADDRESS",
ToChainID = "13371"
}
);

Application.OpenURL(link);
}
}

For further customisation, refer to the Unity Bridge tokens documentation.

Next steps

Congratulations! You've enabled players to bridge tokens from other blockchains to Immutable zkEVM, providing them with another option to fund their wallet.

This completes the tutorial on building a marketplace with Immutable's Unity SDK. For more related topics, explore the articles below.


Related content