-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from immutable/feature/sdk-3286-transak-link
[sdk-3286] add marketplace package to support transak link
- Loading branch information
Showing
8 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Immutable.Marketplace", | ||
"rootNamespace": "Immutable.Marketplace", | ||
"references": [ | ||
"UniTask" | ||
], | ||
"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.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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" }, | ||
{ "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(string environment, string email, string address) | ||
{ | ||
_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 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", _address}, | ||
{"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.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.