Skip to content

Commit

Permalink
chore: not pass passport instance
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-yangy committed Sep 26, 2024
1 parent f3d0506 commit a63bf2f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
5 changes: 1 addition & 4 deletions src/Packages/Marketplace/Immutable.Marketplace.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"name": "Immutable.Marketplace",
"rootNamespace": "Immutable.Marketplace",
"references": [
"UniTask",
"Immutable.Browser.Core",
"Immutable.Passport.Runtime.Public",
"Immutable.Passport.Runtime.Private"
"UniTask"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
34 changes: 17 additions & 17 deletions src/Packages/Marketplace/OnRamp/OnRamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ namespace Immutable.Marketplace.OnRamp
{
public class OnRamp
{
private readonly Passport.Passport _passport;
private readonly string _environment;
private readonly string _email;
private readonly string _address;
private static readonly Dictionary<string, string> TransakBaseUrls = new Dictionary<string, string>
{
{ "sandbox", "https://global-stg.transak.com" },
Expand All @@ -21,25 +23,23 @@ public class OnRamp
{ "production", "ad1bca70-d917-4628-bb0f-5609537498bc" }
};

public OnRamp(Passport.Passport passport)
public OnRamp(string environment, string email, string address)
{
_passport = passport;
_environment = environment;
_email = email;
_address = address;
}

public async UniTask<string> GetLink(
string fiatCurrency = "USD",
string defaultFiatAmount = "50",
string defaultCryptoCurrency = "IMX",
string networks = "immutablezkevm",
bool disableWalletAddressForm = true)
string fiatCurrency = "USD",
string defaultFiatAmount = "50",
string defaultCryptoCurrency = "IMX",
string networks = "immutablezkevm",
bool disableWalletAddressForm = true
)
{
await _passport.ConnectImx();
string environment = _passport.GetPassportImpl().environment;

string email = await _passport.GetEmail();
string walletAddress = await _passport.GetAddress();
string baseUrl = TransakBaseUrls[environment];
string apiKey = TransakApiKeys[environment];
string baseUrl = TransakBaseUrls[_environment];
string apiKey = TransakApiKeys[_environment];

var queryParams = new Dictionary<string, string>
{
Expand All @@ -51,12 +51,12 @@ public async UniTask<string> GetLink(
{"exchangeScreenTitle", "Buy"},
{"themeColor", "0D0D0D"},
{"defaultCryptoCurrency", defaultCryptoCurrency},
{"email", Uri.EscapeDataString(email)},
{"email", Uri.EscapeDataString(_email)},
{"isAutoFillUserData", "true"},
{"disableWalletAddressForm", disableWalletAddressForm.ToString().ToLower()},
{"defaultFiatAmount", defaultFiatAmount},
{"defaultFiatCurrency", fiatCurrency},
{"walletAddress", walletAddress},
{"walletAddress", _address},
{"cryptoCurrencyList", "imx,eth,usdc"}
};

Expand Down

0 comments on commit a63bf2f

Please sign in to comment.