Skip to content

chore: update version #395

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

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using AltWebSocketSharp;
using Immutable.Marketplace;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Environment = Immutable.Marketplace.Environment;

public class BridgeScript : MonoBehaviour
{
[SerializeField] private Dropdown EnvironmentDropdown;

[SerializeField] private InputField FromTokenAddress;
[SerializeField] private InputField FromChain;
[SerializeField] private InputField ToTokenAddress;
[SerializeField] private InputField ToChain;

[SerializeField] private Button OpenButton;

/// <summary>
/// Opens the bridge widget with specified inputs, defaulting to pre-set values when fields are empty.
/// </summary>
public void OpenWidget()
{
var environments = (Environment[])Enum.GetValues(typeof(Environment));
var environment = environments[EnvironmentDropdown.value];

var link = LinkFactory.GenerateBridgeLink(
environment: environment,
queryParams: new BridgeQueryParams
{
FromTokenAddress = FromTokenAddress.text.IsNullOrEmpty() ? null : FromTokenAddress.text,
FromChainID = FromChain.text.IsNullOrEmpty() ? null : FromChain.text,
ToTokenAddress = ToTokenAddress.text.IsNullOrEmpty() ? null : ToTokenAddress.text,
ToChainID = ToChain.text.IsNullOrEmpty() ? null : ToChain.text
}
);

Application.OpenURL(link);
}

/// <summary>
/// Returns to the marketplace scene.
/// </summary>
public void Cancel()
{
SceneManager.LoadScene("MarketplaceScene");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using UnityEngine;
using UnityEngine.SceneManagement;

public class MarketplaceScript : MonoBehaviour
{
public void OnRamp()
{
SceneManager.LoadScene("OnRampScene");
}

public void Swap()
{
SceneManager.LoadScene("SwapScene");
}

public void Bridge()
{
SceneManager.LoadScene("BridgeScene");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using AltWebSocketSharp;
using Immutable.Marketplace;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Environment = Immutable.Marketplace.Environment;

public class OnRampScript : MonoBehaviour
{
[SerializeField] private Dropdown EnvironmentDropdown;
[SerializeField] private InputField EmailInput;
[SerializeField] private InputField AddressInput;

[SerializeField] private InputField FiatCurrencyInput;
[SerializeField] private InputField FiatAmountInput;
[SerializeField] private InputField CryptoCurrency;
[SerializeField] private InputField CryptoCurrencyList;

[SerializeField] private Button OpenButton;

private void Start()
{
OpenButton.interactable = false;

// Enable the button when email and wallet address fields are populated
EmailInput.onValueChanged.AddListener(_ => ValidateInputFields());
AddressInput.onValueChanged.AddListener(_ => ValidateInputFields());
}

/// <summary>
/// Validates input fields and enables the open button if both email and address are entered.
/// </summary>
private void ValidateInputFields()
{
OpenButton.interactable = !EmailInput.text.IsNullOrEmpty() && !AddressInput.text.IsNullOrEmpty();
}

/// <summary>
/// Opens the on-ramp widget with specified inputs, defaulting to pre-set values when fields are empty.
/// </summary>
public void OpenWidget()
{
var environments = (Environment[])Enum.GetValues(typeof(Environment));
var environment = environments[EnvironmentDropdown.value];
var email = EmailInput.text;
var walletAddress = AddressInput.text;

var link = LinkFactory.GenerateOnRampLink(
environment: environment,
email: email,
walletAddress: walletAddress,
queryParams: new OnRampQueryParams
{
DefaultFiatCurrency = FiatCurrencyInput.text.IsNullOrEmpty() ? "USD" : FiatCurrencyInput.text,
DefaultFiatAmount = FiatAmountInput.text.IsNullOrEmpty() ? "50" : FiatAmountInput.text,
DefaultCryptoCurrency = CryptoCurrency.text.IsNullOrEmpty() ? "IMX" : CryptoCurrency.text,
CryptoCurrencyList = CryptoCurrencyList.text.IsNullOrEmpty() ? "imx,eth,usdc" : CryptoCurrencyList.text
},
extraQueryParams: new Dictionary<string, string> {
{"themeColor", "000000"}
}
);

Application.OpenURL(link);
}

/// <summary>
/// Returns to the marketplace scene.
/// </summary>
public void Cancel()
{
SceneManager.LoadScene("MarketplaceScene");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using AltWebSocketSharp;
using Immutable.Marketplace;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Environment = Immutable.Marketplace.Environment;

public class SwapScript : MonoBehaviour
{
[SerializeField] private Dropdown EnvironmentDropdown;
[SerializeField] private InputField KeyInput;

[SerializeField] private InputField FromTokenAddress;
[SerializeField] private InputField ToTokenAddress;

[SerializeField] private Button OpenButton;

private void Start()
{
OpenButton.interactable = false;

// Enable the button when publishable key field is populated
KeyInput.onValueChanged.AddListener(_ => ValidateInputFields());
}

/// <summary>
/// Validates input field and enables the open button if publishable key is entered.
/// </summary>
private void ValidateInputFields()
{
OpenButton.interactable = !KeyInput.text.IsNullOrEmpty();
}

/// <summary>
/// Opens the swap widget with specified inputs, defaulting to pre-set values when fields are empty.
/// </summary>
public void OpenWidget()
{
var environments = (Environment[])Enum.GetValues(typeof(Environment));
var environment = environments[EnvironmentDropdown.value];
var publishableKey = KeyInput.text;

var link = LinkFactory.GenerateSwapLink(
environment: environment,
publishableKey: publishableKey,
queryParams: new SwapQueryParams
{
FromTokenAddress = FromTokenAddress.text.IsNullOrEmpty() ? null : FromTokenAddress.text,
ToTokenAddress = ToTokenAddress.text.IsNullOrEmpty() ? null : ToTokenAddress.text
}
);

Application.OpenURL(link);
}

/// <summary>
/// Returns to the marketplace scene.
/// </summary>
public void Cancel()
{
SceneManager.LoadScene("MarketplaceScene");
}

}
2 changes: 1 addition & 1 deletion src/Packages/Marketplace/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.immutable.marketplace",
"version": "1.29.1",
"version": "1.30.0",
"description": "Marketplace package for the Immutable SDK for Unity",
"displayName": "Immutable Marketplace",
"author": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class SdkVersionInfoHelpers
{
public static string GetSdkVersionInfo()
{
return "1.29.1";
return "1.30.0";
}
}
}
Loading