On-ramp tokens
To request a new token is added, please follow Transak's On-ramp Token Listing Process.
Overview​
The Transak widget enables token on-ramping, allowing players to purchase tokens with fiat currency.
The Immutable Marketplace package provides a function to generate the Transak on-ramp widget URL.
Generating the on-ramp URL​
To generate the on-ramp URL, pass the environment, along with the player's email and wallet address, using the Passport package:
using Immutable.Marketplace;
using Immutable.Passport;
using Immutable.Passport.Model;
using System.Collections.Generic;
using UnityEngine;
public class MarketplaceExample : MonoBehaviour
{
async void Start()
{
try
{
string email = await Passport.Instance.GetEmail();
List<string> walletAddresses = await Passport.Instance.ZkEvmRequestAccounts();
string link = LinkFactory.GenerateOnRampLink(
environment: Environment.Sandbox,
email: email,
walletAddress: walletAddresses.FirstOrDefault()
);
Debug.Log($"Link: {link}");
// Open the generated link in the default browser
Application.OpenURL(link);
}
catch (System.Exception e)
{
Debug.LogError($"Error getting the on-ramp link: {e.Message}");
}
}
}
Configuration​
You can pass optional configurations to the on-ramp widget using the GenerateOnRampLink function. The main configurations are provided through the OnRampQueryParams struct, and you can also pass additional parameters through the extraQueryParams.
The OnRampQueryParams struct allows you to define the default configuration for the on-ramp flow. Here's a list of the available fields:
| Parameter | Description |
|---|---|
DefaultFiatCurrency | The fiat currency to be used (default: "USD"). |
DefaultFiatAmount | The default amount of fiat currency (default: "50"). |
DefaultCryptoCurrency | The default cryptocurrency to purchase (default: "IMX"). |
CryptoCurrencyList | A comma-separated list of available cryptocurrencies to purchase (default: "imx,eth,usdc"). |
Below is an example of how to use the GenerateOnRampLink function with OnRampQueryParams queryParams and Dictionary<string, string> extraQueryParams:
var link = LinkFactory.GenerateOnRampLink(
environment: Environment.Sandbox,
email: email,
walletAddress: walletAddresses.FirstOrDefault(),
queryParams: new OnRampQueryParams
{
DefaultFiatCurrency = "AUD",
DefaultFiatAmount = "100",
DefaultCryptoCurrency = "IMX"
},
extraQueryParams: new Dictionary<string, string>
{
{ "themeColor", "000000" },
{ "defaultFiatCurrency", "AUD" } // This will be ignored because DefaultFiatCurrency in OnRampQueryParams takes precedence
}
);
For a complete list of fields available in extraQueryParams, see the Transak documentation.
For more details about on-ramping tokens, see On-ramp tokens.