11using System ;
22using System . Collections . Generic ;
33using System . Linq ;
4- using Cysharp . Threading . Tasks ;
54
65namespace Immutable . Marketplace . OnRamp
76{
7+ /// <summary>
8+ /// Provides functionality for generating an on-ramp link, allowing players to purchase tokens
9+ /// using fiat currency and transfer them directly to the Immutable zkEVM network.
10+ /// </summary>
811 public class OnRamp
912 {
1013 private readonly string _environment ;
1114 private readonly string _email ;
1215 private readonly string _address ;
13- private static readonly Dictionary < string , string > TransakBaseUrls = new Dictionary < string , string >
16+ private static readonly Dictionary < string , string > BaseUrls = new ( )
1417 {
1518 { "sandbox" , "https://global-stg.transak.com" } ,
16- { "production" , "https://global.transak.com/ " }
19+ { "production" , "https://global.transak.com" }
1720 } ;
1821
19- private static readonly Dictionary < string , string > TransakApiKeys = new Dictionary < string , string >
22+ private static readonly Dictionary < string , string > ApiKeys = new ( )
2023 {
2124 { "sandbox" , "d14b44fb-0f84-4db5-affb-e044040d724b" } , // This can be hardcoded as it is a public API key
2225 { "production" , "ad1bca70-d917-4628-bb0f-5609537498bc" }
2326 } ;
2427
28+ /// <summary>
29+ /// Initialises a new instance of the <see cref="OnRamp"/> class.
30+ /// </summary>
31+ /// <param name="environment">Specifies the environment (<c>sandbox</c> or <c>production</c>).</param>
32+ /// <param name="email">The user's email address, pre-filled in the on-ramp flow.</param>
33+ /// <param name="address">The user's wallet address, where tokens will be sent.</param>
2534 public OnRamp ( string environment , string email , string address )
2635 {
2736 _environment = environment ;
2837 _email = email ;
2938 _address = address ;
3039 }
3140
32- public async UniTask < string > GetLink (
41+ /// <summary>
42+ /// Generates a link for the on-ramp flow.
43+ /// </summary>
44+ /// <param name="fiatCurrency">The fiat currency to be used (default is "USD").</param>
45+ /// <param name="defaultFiatAmount">The default amount of fiat currency (default is "50").</param>
46+ /// <param name="defaultCryptoCurrency">The default cryptocurrency (default is "IMX")..</param>
47+ /// <param name="defaultCryptoCurrencyList">A comma-separated list of available cryptocurrencies to purchase (default is "imx,eth,usdc").</param>
48+ /// <returns>An on-ramp URL</returns>
49+ public string GetLink (
3350 string fiatCurrency = "USD" ,
3451 string defaultFiatAmount = "50" ,
3552 string defaultCryptoCurrency = "IMX" ,
3653 string defaultCryptoCurrencyList = "imx,eth,usdc"
3754 )
3855 {
39- string baseUrl = TransakBaseUrls [ _environment ] ;
40- string apiKey = TransakApiKeys [ _environment ] ;
56+ var baseUrl = BaseUrls [ _environment ] ;
57+ var apiKey = ApiKeys [ _environment ] ;
4158
4259 var queryParams = new Dictionary < string , string >
4360 {
@@ -58,7 +75,7 @@ public async UniTask<string> GetLink(
5875 { "cryptoCurrencyList" , defaultCryptoCurrencyList }
5976 } ;
6077
61- string queryString = string . Join ( "&" , queryParams . Select ( kvp => $ "{ kvp . Key } ={ Uri . EscapeDataString ( kvp . Value ) } ") . ToArray ( ) ) ;
78+ var queryString = string . Join ( "&" , queryParams . Select ( kvp => $ "{ kvp . Key } ={ Uri . EscapeDataString ( kvp . Value ) } ") . ToArray ( ) ) ;
6279 return $ "{ baseUrl } ?{ queryString } ";
6380 }
6481 }
0 commit comments