-
Notifications
You must be signed in to change notification settings - Fork 12
[sdk-3286] add marketplace package to support transak link #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Immutable.Integrations", | ||
"rootNamespace": "Immutable.Integrations", | ||
"references": [ | ||
"UniTask", | ||
"Immutable.Browser.Core", | ||
"Immutable.Passport.Runtime.Public", | ||
"Immutable.Passport.Runtime.Private" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Cysharp.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace Immutable.Marketplace.OnRamp | ||
{ | ||
public class OnRamp | ||
{ | ||
private readonly Passport.Passport _passport; | ||
private static readonly Dictionary<string, string> TransakBaseUrls = new Dictionary<string, string> | ||
{ | ||
{ "sandbox", "https://global-stg.transak.com" }, | ||
{ "production", "https://global.transak.com/" } | ||
}; | ||
|
||
private static readonly Dictionary<string, string> TransakApiKeys = new Dictionary<string, string> | ||
{ | ||
{ "sandbox", "d14b44fb-0f84-4db5-affb-e044040d724b" }, // This can be hardcoded as it is a public API key | ||
{ "production", "ad1bca70-d917-4628-bb0f-5609537498bc" } | ||
}; | ||
|
||
public OnRamp(Passport.Passport passport) | ||
{ | ||
_passport = passport; | ||
} | ||
|
||
public async UniTask<string> GetLink( | ||
string fiatCurrency = "USD", | ||
string defaultFiatAmount = "50", | ||
string defaultCryptoCurrency = "IMX", | ||
string networks = "immutablezkevm", | ||
bool disableWalletAddressForm = true) | ||
{ | ||
await _passport.ConnectImx(); | ||
andrew-yangy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
string environment = _passport.GetPassportImpl().environment; | ||
|
||
string email = await _passport.GetEmail(); | ||
string walletAddress = await _passport.GetAddress(); | ||
string baseUrl = TransakBaseUrls[environment]; | ||
string apiKey = TransakApiKeys[environment]; | ||
|
||
var queryParams = new Dictionary<string, string> | ||
{ | ||
{"apiKey", apiKey}, | ||
{"network", networks}, | ||
{"defaultPaymentMethod", "credit_debit_card"}, | ||
{"disablePaymentMethods", ""}, | ||
{"productsAvailed", "buy"}, | ||
{"exchangeScreenTitle", "Buy"}, | ||
{"themeColor", "0D0D0D"}, | ||
{"defaultCryptoCurrency", defaultCryptoCurrency}, | ||
{"email", Uri.EscapeDataString(email)}, | ||
{"isAutoFillUserData", "true"}, | ||
{"disableWalletAddressForm", disableWalletAddressForm.ToString().ToLower()}, | ||
{"defaultFiatAmount", defaultFiatAmount}, | ||
{"defaultFiatCurrency", fiatCurrency}, | ||
{"walletAddress", walletAddress}, | ||
{"cryptoCurrencyList", "imx,eth,usdc"} | ||
}; | ||
|
||
string queryString = string.Join("&", queryParams.Select(kvp => $"{kvp.Key}={Uri.EscapeDataString(kvp.Value)}").ToArray()); | ||
return $"{baseUrl}?{queryString}"; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "com.immutable.marketplace", | ||
"version": "1.26.0", | ||
"description": "Marketplace package for the Immutable SDK for Unity", | ||
"displayName": "Immutable Marketplace", | ||
"author": { | ||
"name": "Immutable", | ||
"url": "https://immutable.com" | ||
}, | ||
"dependencies": { | ||
"com.cysharp.unitask": "2.3.3" | ||
}, | ||
"keywords": [ | ||
"unity", | ||
"immutable", | ||
"Marketplace" | ||
], | ||
"unity": "2021.3" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.