diff --git a/Assets/Shared/Scripts/Domain/GetTokenBalanceUseCase.cs b/Assets/Shared/Scripts/Domain/GetTokenBalanceUseCase.cs index 917c3bad..1f794a8b 100644 --- a/Assets/Shared/Scripts/Domain/GetTokenBalanceUseCase.cs +++ b/Assets/Shared/Scripts/Domain/GetTokenBalanceUseCase.cs @@ -31,14 +31,14 @@ public async UniTask GetBalance() var rounded = Math.Round(Convert.ToDecimal(result.Quantity), 2); return rounded.ToString("F2"); } - + /// /// Gets the user's IMX balance /// public async UniTask GetImxBalance() { var balanceHex = await Passport.Instance.ZkEvmGetBalance(SaveManager.Instance.WalletAddress); - + var balance = BigInteger.Parse(balanceHex.Replace("0x", ""), NumberStyles.HexNumber); // Convert from smallest unit to main unit @@ -49,7 +49,7 @@ public async UniTask GetImxBalance() return roundedValue.ToString("F2"); } - + /// /// Gets the user's USDC balance /// diff --git a/Assets/Shared/Scripts/Model/Config.cs b/Assets/Shared/Scripts/Model/Config.cs index 9c94773b..c3b16ae7 100644 --- a/Assets/Shared/Scripts/Model/Config.cs +++ b/Assets/Shared/Scripts/Model/Config.cs @@ -9,8 +9,8 @@ public static class Config // public const string SERVER_URL = "http://localhost:6060"; public const string CLIENT_ID = "mp6rxfMDwwZDogcdgNrAaHnG0qMlXuMK"; // Testnet - // public const string CLIENT_ID = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc"; // WebGL - + // public const string CLIENT_ID = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc"; // WebGL + public const string ENVIRONMENT = "sandbox"; #if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX @@ -42,7 +42,7 @@ public static class Contract public const string SKIN = "0xc8df1b1693e2beffd2e484a825a357c6a3d998f2"; // Testnet team public const string TOKEN = "0xb237501b35dfdcad274299236a141425469ab9ba"; // Testnet team public const string PACK = "0x8525b5e782f3fbe6460057460be020146b63ed0f"; // Testnet team - + public const string USDC = "0x3B2d8A1931736Fc321C24864BceEe981B11c3c57"; // Transak Testnet USDC } } \ No newline at end of file diff --git a/Assets/Shared/Scripts/UI/AddFunds/AddFunds.cs b/Assets/Shared/Scripts/UI/AddFunds/AddFunds.cs index 315f29be..8ded9ef6 100644 --- a/Assets/Shared/Scripts/UI/AddFunds/AddFunds.cs +++ b/Assets/Shared/Scripts/UI/AddFunds/AddFunds.cs @@ -20,7 +20,7 @@ public class AddFunds : MonoBehaviour [SerializeField] Button m_SwapButton; [SerializeField] Button m_BridgeButton; [SerializeField] Button m_CancelButton; - + [SerializeField] TransakView m_TransakView; private Action m_OnDismiss; @@ -28,19 +28,19 @@ public class AddFunds : MonoBehaviour public void Show(Action onDismiss) { m_OnDismiss = onDismiss; - + m_FiatButton.onClick.RemoveListener(OnFiatButtonClicked); m_FiatButton.onClick.AddListener(OnFiatButtonClicked); - + m_SwapButton.onClick.RemoveListener(OnSwapButtonClicked); m_SwapButton.onClick.AddListener(OnSwapButtonClicked); - + m_BridgeButton.onClick.RemoveListener(OnBridgeButtonClicked); m_BridgeButton.onClick.AddListener(OnBridgeButtonClicked); - + m_CancelButton.onClick.RemoveListener(OnCancelButtonClicked); m_CancelButton.onClick.AddListener(OnCancelButtonClicked); - + m_Options.gameObject.SetActive(true); m_TransakView.gameObject.SetActive(false); gameObject.SetActive(true); @@ -51,7 +51,7 @@ private async void OnFiatButtonClicked() const string environment = Immutable.Passport.Model.Environment.SANDBOX; var email = await Passport.Instance.GetEmail(); var walletAddress = await Passport.Instance.ZkEvmRequestAccounts(); - + var onRamp = new OnRamp(environment, email, walletAddress.FirstOrDefault()); var link = onRamp.GetLink(); Debug.Log($"onRamp.GetOnRampLink: {link}"); @@ -69,7 +69,7 @@ private void OnSwapButtonClicked() var link = swap.GetLink(fromTokenAddress: Contract.USDC, toTokenAddress: Contract.TOKEN); Application.OpenURL(link); } - + private void OnBridgeButtonClicked() { // On supports mainnet diff --git a/Assets/Shared/Scripts/UI/AddFunds/TransakView.cs b/Assets/Shared/Scripts/UI/AddFunds/TransakView.cs index dc1cafcf..d3142ae6 100644 --- a/Assets/Shared/Scripts/UI/AddFunds/TransakView.cs +++ b/Assets/Shared/Scripts/UI/AddFunds/TransakView.cs @@ -20,10 +20,10 @@ public void Show(string url, UnityAction onClose) { m_CloseButton.onClick.RemoveListener(onClose); m_CloseButton.onClick.AddListener(onClose); - + m_Url = url; m_WebViewPrefab.InitialUrl = m_Url; - + gameObject.SetActive(true); } } diff --git a/Assets/Shared/Scripts/UI/BalanceObject.cs b/Assets/Shared/Scripts/UI/BalanceObject.cs index db60f038..a81c6c3a 100644 --- a/Assets/Shared/Scripts/UI/BalanceObject.cs +++ b/Assets/Shared/Scripts/UI/BalanceObject.cs @@ -17,7 +17,7 @@ public class BalanceObject : MonoBehaviour [SerializeField] private TextMeshProUGUI m_ImrValue; [SerializeField] private TextMeshProUGUI m_ImxValue; [SerializeField] private TextMeshProUGUI m_UsdcValue; - + [SerializeField] private HyperCasualButton m_AddFundsButton; [SerializeField] private AddFunds m_AddFunds; @@ -58,7 +58,7 @@ private void Start() gameObject.SetActive(true); } - + /// /// Displays or closes the panel /// @@ -69,7 +69,7 @@ private void TogglePanel() m_Panel.SetActive(false); return; } - + // Update balance #pragma warning disable CS4014 UpdateBalance(); @@ -85,7 +85,7 @@ private void TogglePanel() panelRectTransform.pivot = new Vector2(1, 1); panelRectTransform.anchoredPosition = new Vector2(-32, -88); - + m_Panel.SetActive(true); } @@ -97,7 +97,7 @@ private void ShowAddFunds() #pragma warning disable CS4014 m_AddFunds.Show(() => UpdateBalance()); #pragma warning restore CS4014 - + TogglePanel(); } @@ -114,11 +114,11 @@ private void ShowAddFunds() // IMR balance var imrBalance = await GetTokenBalanceUseCase.Instance.GetBalance(); m_ImrValue.text = imrBalance; - + // IMX balance var imxBalance = await GetTokenBalanceUseCase.Instance.GetImxBalance(); m_ImxValue.text = imxBalance; - + // USDC balance var usdcBalance = await GetTokenBalanceUseCase.Instance.GetUsdcBalance(); m_UsdcValue.text = usdcBalance; diff --git a/Assets/Shared/Scripts/UI/Inventory/InventoryScreen.cs b/Assets/Shared/Scripts/UI/Inventory/InventoryScreen.cs index 77615d9b..cacd2fe5 100644 --- a/Assets/Shared/Scripts/UI/Inventory/InventoryScreen.cs +++ b/Assets/Shared/Scripts/UI/Inventory/InventoryScreen.cs @@ -83,7 +83,7 @@ private void OnCreateItemView(int index, GameObject item) clickable.OnClick += () => { m_Balance.ClosePanel(); - + var view = UIManager.Instance.GetView(); UIManager.Instance.Show(view); view.Initialise(asset); diff --git a/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs b/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs index b867bb67..69796713 100644 --- a/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs +++ b/Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs @@ -132,7 +132,7 @@ private void OnCreateItemView(int index, GameObject item) clickable.OnClick += () => { m_Balance.ClosePanel(); - + var view = UIManager.Instance.GetView(); UIManager.Instance.Show(view); view.Initialise(stack); diff --git a/Assets/Shared/Scripts/UI/Shop/ShopScreen.cs b/Assets/Shared/Scripts/UI/Shop/ShopScreen.cs index 98e5c229..67b73cee 100644 --- a/Assets/Shared/Scripts/UI/Shop/ShopScreen.cs +++ b/Assets/Shared/Scripts/UI/Shop/ShopScreen.cs @@ -68,7 +68,7 @@ private void OnCreateItemView(int index, GameObject item) clickable.OnClick += () => { m_Balance.ClosePanel(); - + var view = UIManager.Instance.GetView(); UIManager.Instance.Show(view); view.Initialise(pack); @@ -138,7 +138,7 @@ private void OnBackButtonClick() // Trigger back button event m_BackEvent.Raise(); - + // Close balance panel m_Balance.ClosePanel(); }