diff --git a/Assets/Treasure/TDK/Runtime/Common/Constants.cs b/Assets/Treasure/TDK/Runtime/Common/Constants.cs index b180c9be..1b7845be 100644 --- a/Assets/Treasure/TDK/Runtime/Common/Constants.cs +++ b/Assets/Treasure/TDK/Runtime/Common/Constants.cs @@ -100,5 +100,15 @@ public static class Constants { ChainId.ArbitrumSepolia, "arbitrum-sepolia" }, { ChainId.TreasureRuby, "treasure-ruby" }, }; + + public static Dictionary NameToChainId = new Dictionary() + { + { "unknown", ChainId.Unknown }, + { "ethereum", ChainId.Mainnet }, + { "sepolia", ChainId.Sepolia }, + { "arbitrum", ChainId.Arbitrum }, + { "arbitrum-sepolia", ChainId.ArbitrumSepolia }, + { "treasure-ruby", ChainId.TreasureRuby }, + }; } } diff --git a/Assets/Treasure/TDK/Runtime/Connect/Modals/LoginModal.cs b/Assets/Treasure/TDK/Runtime/Connect/Modals/LoginModal.cs index 89eaf90c..7d7b77b3 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/Modals/LoginModal.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/Modals/LoginModal.cs @@ -93,7 +93,7 @@ private async void ConnectSocial(SocialAuthProvider provider) catch (Exception ex) { Debug.LogError(ex.Message); - } + } } private void SetupFromSettings() @@ -133,8 +133,13 @@ private async void OnClickConnectwithEmail() catch (Exception e) { TDKLogger.LogError($"[LoginModal:OnClickConnectwithEmail] {e.Message}"); - errorText.text = e.Message; - errorText.gameObject.SetActive(true); + + // Ignore error display if user purposely closed the verification modal + if (e.Message != "User closed modal") + { + errorText.text = e.Message; + errorText.gameObject.SetActive(true); + } } connectButton.GetComponent().SetLoading(false); diff --git a/Assets/Treasure/TDK/Runtime/Connect/TDK.Connect.cs b/Assets/Treasure/TDK/Runtime/Connect/TDK.Connect.cs index 6578fa74..edbde065 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/TDK.Connect.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/TDK.Connect.cs @@ -67,7 +67,17 @@ public async Task GetChainId() if (_chainId == ChainId.Unknown) { #if TDK_THIRDWEB - _chainId = (ChainId)(int)await TDKServiceLocator.GetService().Wallet.GetChainId(); + // WebGL version of the Thirdweb SDK requires a wallet to be connected to call GetChainId() + var isConnected = await IsWalletConnected(); + if (Utils.IsWebGLBuild() && !isConnected) + { + var defaultChainIdentifier = TDK.Instance.AppConfig.GetModuleConfig().DefaultChainIdentifier; + _chainId = Constants.NameToChainId[defaultChainIdentifier]; + } + else + { + _chainId = (ChainId)(int)await TDKServiceLocator.GetService().Wallet.GetChainId(); + } #else _chainId = ChainId.Arbitrum; #endif diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 4b0ae1ab..8ca38328 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -549,7 +549,8 @@ PlayerSettings: openGLRequireES31: 0 openGLRequireES31AEP: 0 openGLRequireES32: 0 - m_TemplateCustomTags: {} + m_TemplateCustomTags: + HIDE_FULL_SCREEN_BUTTON: mobileMTRendering: Android: 1 iPhone: 1 @@ -822,7 +823,7 @@ PlayerSettings: webGLDebugSymbols: 0 webGLEmscriptenArgs: webGLModulesDirectory: - webGLTemplate: APPLICATION:Default + webGLTemplate: PROJECT:Thirdweb webGLAnalyzeBuildSize: 0 webGLUseEmbeddedResources: 0 webGLCompressionFormat: 1