diff --git a/Runtime/Scripts-v2/API/TezosAPI.cs b/Runtime/Scripts-v2/API/TezosAPI.cs index f56e9424..dc2ecec8 100644 --- a/Runtime/Scripts-v2/API/TezosAPI.cs +++ b/Runtime/Scripts-v2/API/TezosAPI.cs @@ -87,14 +87,12 @@ await UnityMainThreadDispatcher.Instance().EnqueueAsync( public static async UniTask Disconnect() { - if (!IsConnected()) { TezosLogger.LogWarning("No connection found to disconnect"); return false; } - - + if (IsWalletConnected()) { var result = await _walletProviderController.Disconnect(); @@ -159,7 +157,7 @@ await UnityMainThreadDispatcher.Instance().EnqueueAsync( return result; } - public static UniTask RequestContractOrigination(OriginateContractRequest originateContractRequest) => ProviderFactory.GetConnectedProviderController().RequestContractOrigination(originateContractRequest); + public static UniTask DeployContract(DeployContractRequest deployContractRequest) => ProviderFactory.GetConnectedProviderController().DeployContract(deployContractRequest); /// /// Fetches the XTZ balance of a given wallet address asynchronously. diff --git a/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs b/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs new file mode 100644 index 00000000..9fe1a5aa --- /dev/null +++ b/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs @@ -0,0 +1,106 @@ +#if UNITY_EDITOR +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json; +using UnityEditor; +using UnityEditor.Compilation; +using UnityEngine; + +namespace Tezos.Editor +{ + public class ScopedRegistryEditor : AssetPostprocessor + { + private static bool _packageImported; + + private const string _registryName = "package.openupm.com"; + private const string _registryUrl = "https://package.openupm.com"; + private const string _nethereumScope = "com.nethereum"; + private const string _reownScope = "com.reown"; + + private static void OnPostprocessAllAssets( + string[] importedAssets, + string[] deletedAssets, + string[] movedAssets, + string[] movedFromAssetPaths + ) + { + if (_packageImported) return; + + foreach (string asset in importedAssets) + { + if (asset.Contains("com.trilitech.tezos-unity-sdk")) + { + Debug.Log("Tezos Wallet Connect imported, adding or updating scoped registries."); + AddOrUpdateScopedRegistry( + new ScopedRegistry + { + name = + _registryName, + url = _registryUrl, + scopes = new[] { _nethereumScope, _reownScope } + } + ); + _packageImported = true; + CompilationPipeline.RequestScriptCompilation(); + break; + } + } + } + + private static void AddOrUpdateScopedRegistry(ScopedRegistry newRegistry) + { + var manifestPath = Path.Combine(Application.dataPath, "..", "Packages/manifest.json"); + var manifestJson = File.ReadAllText(manifestPath); + + var manifest = JsonConvert.DeserializeObject(manifestJson); + + var existingRegistry = manifest.scopedRegistries + .FirstOrDefault( + reg => reg.name == newRegistry.name && + reg.url == newRegistry.url + ); + + if (existingRegistry != null) + { + var missingScopes = newRegistry.scopes.Except(existingRegistry.scopes).ToList(); + if (missingScopes.Count > 0) + { + existingRegistry.scopes = existingRegistry.scopes.Concat(missingScopes).ToArray(); + Debug.Log( + $"Updated scoped registry '{newRegistry.name}' with missing scopes: {string.Join(", ", missingScopes)}" + ); + } + else + { + Debug.Log( + $"No updates needed for scoped registry '{newRegistry.name}' as all scopes are already present." + ); + } + } + else + { + manifest.scopedRegistries.Add(newRegistry); + Debug.Log( + $"Added new scoped registry '{newRegistry.name}' with scopes: {string.Join(", ", newRegistry.scopes)}" + ); + } + + File.WriteAllText(manifestPath, JsonConvert.SerializeObject(manifest, Formatting.Indented)); + } + + public class ScopedRegistry + { + public string name; + public string url; + public string[] scopes; + } + + public class ManifestJson + { + public Dictionary dependencies = new(); + public List scopedRegistries = new(); + } + } +} +#endif \ No newline at end of file diff --git a/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs.meta b/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs.meta new file mode 100644 index 00000000..34bfe345 --- /dev/null +++ b/Runtime/Scripts-v2/Editor/ScopedRegistryEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e7a3efaefcd5448d8b42a108a10936d1 +timeCreated: 1728292718 \ No newline at end of file diff --git a/Runtime/Scripts-v2/Editor/TezosEditor.cs b/Runtime/Scripts-v2/Editor/TezosEditor.cs index 6c5888b8..49532f19 100644 --- a/Runtime/Scripts-v2/Editor/TezosEditor.cs +++ b/Runtime/Scripts-v2/Editor/TezosEditor.cs @@ -32,6 +32,9 @@ public void SetupConfigs() CopyAndMergeFolders(SourceWebGLTemplatesPath, Path.Combine(DestinationAssetsPath, "WebGLTemplates")); SetWebGLTemplate(WebGLTemplateName); CreateTezosConfigs(); + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); Debug.Log("Tezos setup completed."); } @@ -53,9 +56,6 @@ private static void CreateLinkerFile() File.WriteAllText(linkerFilePath, linkXmlContent); Debug.Log($"link.xml created/updated at: {linkerFilePath}"); - - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); } private static void CopyAndMergeFolders(string sourcePath, string destinationPath) @@ -73,7 +73,6 @@ private static void CopyAndMergeFolders(string sourcePath, string destinationPat } CopyDirectoryRecursively(sourcePath, destinationPath); - AssetDatabase.Refresh(); } private static void CopyDirectoryRecursively(string sourceDir, string targetDir) @@ -100,9 +99,6 @@ private static void SetWebGLTemplate(string templateName) { PlayerSettings.WebGL.template = templateName; Debug.Log($"Set WebGL template to: {templateName}"); - - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); } private static void CreateTezosConfigs() @@ -114,8 +110,6 @@ private static void CreateTezosConfigs() tezosConfig.DataProvider = dataProviderConfig; EditorUtility.SetDirty(tezosConfig); - AssetDatabase.SaveAssetIfDirty(tezosConfig); - AssetDatabase.Refresh(); Debug.Log("Tezos configs created and updated."); EditorGUIUtility.PingObject(tezosConfig); diff --git a/Runtime/Scripts-v2/Initializer/Tezos.Initializer.asmdef b/Runtime/Scripts-v2/Initializer/Tezos.Initializer.asmdef index 27619cb1..b5dea8d2 100644 --- a/Runtime/Scripts-v2/Initializer/Tezos.Initializer.asmdef +++ b/Runtime/Scripts-v2/Initializer/Tezos.Initializer.asmdef @@ -13,7 +13,8 @@ "GUID:a36d4ab4ac1445529d56bb1978202fe9", "GUID:a86c196fe46d49568cc834ea82f009c3", "GUID:67dfc283a3014520b1ae80c0cb8e8822", - "GUID:832ee16f9a74421fa64eac13167606ab" + "GUID:832ee16f9a74421fa64eac13167606ab", + "GUID:0c0f402fc1cb344ef87d37f5a81f2739" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Runtime/Scripts-v2/Operation/OriginateContractRequest.cs b/Runtime/Scripts-v2/Operation/DeployContractRequest.cs similarity index 69% rename from Runtime/Scripts-v2/Operation/OriginateContractRequest.cs rename to Runtime/Scripts-v2/Operation/DeployContractRequest.cs index 5ec49cc1..d6580339 100644 --- a/Runtime/Scripts-v2/Operation/OriginateContractRequest.cs +++ b/Runtime/Scripts-v2/Operation/DeployContractRequest.cs @@ -1,6 +1,6 @@ namespace Tezos.Operation { - public struct OriginateContractRequest + public struct DeployContractRequest { public string Script; public string DelegateAddress; diff --git a/Runtime/Scripts-v2/Operation/OriginateContractRequest.cs.meta b/Runtime/Scripts-v2/Operation/DeployContractRequest.cs.meta similarity index 100% rename from Runtime/Scripts-v2/Operation/OriginateContractRequest.cs.meta rename to Runtime/Scripts-v2/Operation/DeployContractRequest.cs.meta diff --git a/Runtime/Scripts-v2/Operation/OperationRequest.cs b/Runtime/Scripts-v2/Operation/OperationRequest.cs index 1f679079..a222eba0 100644 --- a/Runtime/Scripts-v2/Operation/OperationRequest.cs +++ b/Runtime/Scripts-v2/Operation/OperationRequest.cs @@ -3,6 +3,7 @@ namespace Tezos.Operation public struct OperationRequest { public string Destination; + public string ContractABI; public string EntryPoint; public string Arg; public string Amount; diff --git a/Runtime/Scripts-v2/Provider/IProviderController.cs b/Runtime/Scripts-v2/Provider/IProviderController.cs index bb55b655..19909d4c 100644 --- a/Runtime/Scripts-v2/Provider/IProviderController.cs +++ b/Runtime/Scripts-v2/Provider/IProviderController.cs @@ -9,8 +9,8 @@ public interface IProviderController : IController ProviderType ProviderType { get; } bool IsConnected { get; } UniTask GetBalance(); - UniTask RequestOperation(OperationRequest operationRequest); - UniTask RequestSignPayload(SignPayloadRequest signRequest); - UniTask RequestContractOrigination(OriginateContractRequest originationRequest); + UniTask RequestOperation(OperationRequest operationRequest); + UniTask RequestSignPayload(SignPayloadRequest signRequest); + UniTask DeployContract(DeployContractRequest originationRequest); } } \ No newline at end of file diff --git a/Runtime/Scripts-v2/Request/HttpClients/TezosClient.cs b/Runtime/Scripts-v2/Request/HttpClients/TezosClient.cs index 76e2935b..616dc504 100644 --- a/Runtime/Scripts-v2/Request/HttpClients/TezosClient.cs +++ b/Runtime/Scripts-v2/Request/HttpClients/TezosClient.cs @@ -1,6 +1,5 @@ using System; using System.Text; -using Dynamic.Json; using Newtonsoft.Json; using Tezos.Cysharp.Threading.Tasks; using Tezos.Logger; @@ -14,15 +13,7 @@ public class TezosClient private int RequestTimeout { get; } - private T DeserializeJson(string json) - { - if (typeof(T) == typeof(string)) - { - return (T)(object)DJson.Parse(json, JsonOptions.DefaultOptions); - } - - return JsonConvert.DeserializeObject(json); - } + private T DeserializeJson(string json) => JsonConvert.DeserializeObject(json); public async UniTask GetRequest(string endpoint) { @@ -59,7 +50,8 @@ public async UniTask PostRequest(string endpoint, object data) request.timeout = RequestTimeout; request.SetRequestHeader(HttpHeaders.Accept.Key, HttpHeaders.Accept.Value); request.SetRequestHeader(HttpHeaders.UserAgent.Key, HttpHeaders.UserAgent.Value); - request.SetRequestHeader(HttpHeaders.ContentType.Key, "application/json"); + request.SetRequestHeader(HttpHeaders.ContentType.Key, HttpHeaders.ContentType.Value); + var operation = request.SendWebRequest(); while (!operation.isDone) { diff --git a/Runtime/Scripts-v2/SocialLoginProvider/Interface/ISocialLoginProvider.cs b/Runtime/Scripts-v2/SocialLoginProvider/Interface/ISocialLoginProvider.cs index a0976c10..558e081a 100644 --- a/Runtime/Scripts-v2/SocialLoginProvider/Interface/ISocialLoginProvider.cs +++ b/Runtime/Scripts-v2/SocialLoginProvider/Interface/ISocialLoginProvider.cs @@ -13,6 +13,6 @@ public interface ISocialLoginProvider bool IsLoggedIn(); UniTask RequestOperation(OperationRequest operationRequest); UniTask RequestSignPayload(SignPayloadRequest signPayloadRequest); - UniTask RequestContractOrigination(OriginateContractRequest originateContractRequest); + UniTask RequestContractOrigination(DeployContractRequest deployContractRequest); } } \ No newline at end of file diff --git a/Runtime/Scripts-v2/SocialLoginProvider/Kukai/Mobile/KukaiMobileProvider.cs b/Runtime/Scripts-v2/SocialLoginProvider/Kukai/Mobile/KukaiMobileProvider.cs index d8acbec0..043e2467 100644 --- a/Runtime/Scripts-v2/SocialLoginProvider/Kukai/Mobile/KukaiMobileProvider.cs +++ b/Runtime/Scripts-v2/SocialLoginProvider/Kukai/Mobile/KukaiMobileProvider.cs @@ -310,6 +310,6 @@ public async UniTask RequestSignPayload(SignPayloadRequest return await _signPayloadTcs.WithTimeout(10 * 1000); } - public UniTask RequestContractOrigination(OriginateContractRequest originateContractRequest) => throw new NotSupportedException("Contract origination is not supported by Kukai wallet."); + public UniTask RequestContractOrigination(DeployContractRequest deployContractRequest) => throw new NotSupportedException("Contract origination is not supported by Kukai wallet."); } } \ No newline at end of file diff --git a/Runtime/Scripts-v2/SocialLoginProvider/Kukai/WebGL/KukaiWebGLProvider.cs b/Runtime/Scripts-v2/SocialLoginProvider/Kukai/WebGL/KukaiWebGLProvider.cs index 3a252429..35aabcf6 100644 --- a/Runtime/Scripts-v2/SocialLoginProvider/Kukai/WebGL/KukaiWebGLProvider.cs +++ b/Runtime/Scripts-v2/SocialLoginProvider/Kukai/WebGL/KukaiWebGLProvider.cs @@ -116,11 +116,11 @@ public UniTask LogIn(SocialProviderData data) _logInTcs = new(); TezosLogger.LogDebug($"Connect method entered"); - var tezosConfig = ConfigGetter.GetOrCreateConfig(); - var appConfig = ConfigGetter.GetOrCreateConfig(); + var dataProviderConfig = ConfigGetter.GetOrCreateConfig(); + var appConfig = ConfigGetter.GetOrCreateConfig(); JsInitWallet( - tezosConfig.Network.ToString(), tezosConfig.Rpc, SocialLoginType.ToString().ToLower(), appConfig.AppName, - appConfig.AppUrl, appConfig.AppIcon + dataProviderConfig.Network.ToString(), dataProviderConfig.BaseUrl, SocialLoginType.ToString().ToLower(), appConfig.AppName, + appConfig.AppUrl, appConfig.AppIcon ); JsConnectAccount(); @@ -146,7 +146,7 @@ public async UniTask RequestOperation(OperationRequest operat if (_operationTcs != null && _operationTcs.Task.Status == UniTaskStatus.Pending) return await _operationTcs.Task; _operationTcs = new(); - JsSendContractCall(operationRequest.Destination, operationRequest.Amount.ToString(), operationRequest.EntryPoint, operationRequest.Arg); + JsSendContractCall(operationRequest.Destination, operationRequest.Amount, operationRequest.EntryPoint, operationRequest.Arg); return await _operationTcs.WithTimeout(10 * 1000, "Request operation task timeout."); } @@ -159,7 +159,7 @@ public async UniTask RequestSignPayload(SignPayloadRequest return await _signPayloadTcs.WithTimeout(10 * 1000, "Sign payload task timeout."); } - public UniTask RequestContractOrigination(OriginateContractRequest originationRequest) + public UniTask RequestContractOrigination(DeployContractRequest originationRequest) { TezosLogger.LogDebug("RequestContractOrigination - BeaconWebGL"); JsRequestContractOrigination(originationRequest.Script, originationRequest.DelegateAddress); diff --git a/Runtime/Scripts-v2/SocialLoginProvider/SocialProviderController.cs b/Runtime/Scripts-v2/SocialLoginProvider/SocialProviderController.cs index 3a00f27b..205db04a 100644 --- a/Runtime/Scripts-v2/SocialLoginProvider/SocialProviderController.cs +++ b/Runtime/Scripts-v2/SocialLoginProvider/SocialProviderController.cs @@ -67,6 +67,6 @@ public async UniTask LogOut() public UniTask GetBalance() => _socialLoginProviders.Find(sp => sp.SocialLoginType == _socialProviderData?.SocialLoginType).GetBalance(_socialProviderData.WalletAddress); public UniTask RequestOperation(OperationRequest walletOperationRequest) => _socialLoginProviders.Find(sp => sp.SocialLoginType == _socialProviderData?.SocialLoginType).RequestOperation(walletOperationRequest); public UniTask RequestSignPayload(SignPayloadRequest signPayloadRequest) => _socialLoginProviders.Find(sp => sp.SocialLoginType == _socialProviderData?.SocialLoginType).RequestSignPayload(signPayloadRequest); - public UniTask RequestContractOrigination(OriginateContractRequest originateContractRequest) => _socialLoginProviders.Find(sp => sp.SocialLoginType == _socialProviderData?.SocialLoginType).RequestContractOrigination(originateContractRequest); + public UniTask DeployContract(DeployContractRequest deployContractRequest) => _socialLoginProviders.Find(sp => sp.SocialLoginType == _socialProviderData?.SocialLoginType).RequestContractOrigination(deployContractRequest); } } \ No newline at end of file diff --git a/Runtime/Scripts-v2/WalletProvider/Beacon/Mobile/BeaconMobileProvider.cs b/Runtime/Scripts-v2/WalletProvider/Beacon/Mobile/BeaconMobileProvider.cs index c42033b3..bbc117ae 100644 --- a/Runtime/Scripts-v2/WalletProvider/Beacon/Mobile/BeaconMobileProvider.cs +++ b/Runtime/Scripts-v2/WalletProvider/Beacon/Mobile/BeaconMobileProvider.cs @@ -186,7 +186,7 @@ public async UniTask Disconnect() return await _signPayloadTcs.WithTimeout(10 * 1000, "Sign payload task timeout."); } - public async UniTask RequestContractOrigination(OriginateContractRequest originationRequest) + public async UniTask DeployContract(DeployContractRequest originationRequest) { TezosLogger.LogDebug("RequestContractOrigination - BeaconDotNet"); await _operationRequestHandler.RequestContractOrigination(originationRequest.Script, originationRequest.DelegateAddress, BeaconDappClient); diff --git a/Runtime/Scripts-v2/WalletProvider/Beacon/WebGL/BeaconWebGLProvider.cs b/Runtime/Scripts-v2/WalletProvider/Beacon/WebGL/BeaconWebGLProvider.cs index 5e4e49b1..0e23d63d 100644 --- a/Runtime/Scripts-v2/WalletProvider/Beacon/WebGL/BeaconWebGLProvider.cs +++ b/Runtime/Scripts-v2/WalletProvider/Beacon/WebGL/BeaconWebGLProvider.cs @@ -123,11 +123,11 @@ public UniTask Connect(WalletProviderData data) _walletConnectionTcs = new(); TezosLogger.LogDebug($"Connect method entered"); - var tezosConfig = ConfigGetter.GetOrCreateConfig(); - var appConfig = ConfigGetter.GetOrCreateConfig(); + var dataProviderConfig = ConfigGetter.GetOrCreateConfig(); + var appConfig = ConfigGetter.GetOrCreateConfig(); JsInitWallet( - tezosConfig.Network.ToString(), tezosConfig.Rpc, WalletType.ToString().ToLower(), appConfig.AppName, - appConfig.AppUrl, appConfig.AppIcon + dataProviderConfig.Network.ToString(), dataProviderConfig.BaseUrl, WalletType.ToString().ToLower(), appConfig.AppName, + appConfig.AppUrl, appConfig.AppIcon ); JsConnectAccount(); @@ -164,7 +164,7 @@ public async UniTask RequestSignPayload(SignPayloadRequest return await _signPayloadTcs.WithTimeout(10 * 1000, "Sign payload task timeout."); } - public UniTask RequestContractOrigination(OriginateContractRequest originationRequest) + public UniTask DeployContract(DeployContractRequest originationRequest) { TezosLogger.LogDebug("RequestContractOrigination - BeaconWebGL"); JsRequestContractOrigination(originationRequest.Script, originationRequest.DelegateAddress); diff --git a/Runtime/Scripts-v2/WalletProvider/Interface/IWalletProvider.cs b/Runtime/Scripts-v2/WalletProvider/Interface/IWalletProvider.cs index fcaf0c06..5517d2f6 100644 --- a/Runtime/Scripts-v2/WalletProvider/Interface/IWalletProvider.cs +++ b/Runtime/Scripts-v2/WalletProvider/Interface/IWalletProvider.cs @@ -14,12 +14,12 @@ public interface IWalletProvider public event Action PairingRequested; public WalletType WalletType { get; } UniTask Init(); - UniTask GetBalance(string walletAddress); + UniTask GetBalance(string walletAddress); UniTask Connect(WalletProviderData data); UniTask Disconnect(); - UniTask RequestOperation(OperationRequest operationRequest); - UniTask RequestSignPayload(SignPayloadRequest signRequest); - UniTask RequestContractOrigination(OriginateContractRequest originationRequest); + UniTask RequestOperation(OperationRequest operationRequest); + UniTask RequestSignPayload(SignPayloadRequest signRequest); + UniTask DeployContract(DeployContractRequest originationRequest); bool IsAlreadyConnected(); } } \ No newline at end of file diff --git a/Runtime/Scripts-v2/WalletProvider/WalletProviderController.cs b/Runtime/Scripts-v2/WalletProvider/WalletProviderController.cs index c74eccea..8557958f 100644 --- a/Runtime/Scripts-v2/WalletProvider/WalletProviderController.cs +++ b/Runtime/Scripts-v2/WalletProvider/WalletProviderController.cs @@ -93,6 +93,6 @@ public async UniTask Disconnect() public UniTask GetBalance() => _walletProviders.Find(wp => wp.WalletType == _connectedWalletData?.WalletType).GetBalance(_connectedWalletData.WalletAddress); public UniTask RequestOperation(OperationRequest walletOperationRequest) => _walletProviders.Find(wp => wp.WalletType == _connectedWalletData?.WalletType).RequestOperation(walletOperationRequest); public UniTask RequestSignPayload(SignPayloadRequest walletSignPayloadRequest) => _walletProviders.Find(wp => wp.WalletType == _connectedWalletData?.WalletType).RequestSignPayload(walletSignPayloadRequest); - public UniTask RequestContractOrigination(OriginateContractRequest walletOriginateContractRequest) => _walletProviders.Find(wp => wp.WalletType == _connectedWalletData?.WalletType).RequestContractOrigination(walletOriginateContractRequest); + public UniTask DeployContract(DeployContractRequest walletDeployContractRequest) => _walletProviders.Find(wp => wp.WalletType == _connectedWalletData?.WalletType).DeployContract(walletDeployContractRequest); } } \ No newline at end of file diff --git a/Samples~/RefactorExample/RefactorExample.cs b/Samples~/RefactorExample/RefactorExample.cs index d96ebde8..ef344572 100644 --- a/Samples~/RefactorExample/RefactorExample.cs +++ b/Samples~/RefactorExample/RefactorExample.cs @@ -46,7 +46,7 @@ private async void Awake() private void OnWalletConnected(WalletProviderData walletProviderData) { - Debug.Log("OnWalletConnected received."); + Debug.Log($"OnWalletConnected received, walletAddress{walletProviderData.WalletAddress}"); _informationText.text = $"{walletProviderData.WalletAddress}"; } @@ -90,7 +90,7 @@ private async void OnSendOperationClicked() const string entryPoint = "fulfill_ask"; const string destination = "KT1MFWsAXGUZ4gFkQnjByWjrrVtuQi4Tya8G"; - const ulong amount = 1500000; + const string amount = "1500000"; var req = new OperationRequest { @@ -136,7 +136,8 @@ private async void OnSignPayloadClicked() } catch (Exception e) { - _payloadText.text = $"{e.Message}"; + _informationText.text = $"{e.Message}"; + _payloadText.text = $"{e.StackTrace}"; } } @@ -144,12 +145,14 @@ private async void OnFetchBalanceClicked() { try { - int convertedBalance = (int)(await TezosAPI.GetXTZBalance() / 1000000); + var balance = ulong.Parse(await TezosAPI.GetBalance()); + float convertedBalance = balance / 1000000f; _informationText.text = $"Balance: {convertedBalance}"; } catch (Exception e) { _informationText.text = e.Message; + _payloadText.text = e.StackTrace; } } @@ -157,7 +160,7 @@ private async void OnConnectClicked() { try { - var result = await TezosAPI.ConnectWallet(new WalletProviderData { WalletType = WalletType.BEACON }); + var result = await TezosAPI.ConnectWallet(new WalletProviderData { WalletType = WalletType.WALLETCONNECT }); OnWalletConnected(result); } catch (Exception e) diff --git a/Runtime/Scripts-v1~/Helpers/Logging/TezosLogger.cs.meta b/Samples~/Tutorials/Common/Scripts/ContractInfoUI.cs.meta similarity index 83% rename from Runtime/Scripts-v1~/Helpers/Logging/TezosLogger.cs.meta rename to Samples~/Tutorials/Common/Scripts/ContractInfoUI.cs.meta index b7ba76b8..f782ec36 100644 --- a/Runtime/Scripts-v1~/Helpers/Logging/TezosLogger.cs.meta +++ b/Samples~/Tutorials/Common/Scripts/ContractInfoUI.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 030e9d99bf5ef43dc86c0ae65bd8f9fd +guid: 23d29fd515bfd4817b761d7749d444d4 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples~/Tutorials/WalletConnection/Scripts/WalletBalanceUI.cs b/Samples~/Tutorials/WalletConnection/Scripts/WalletBalanceUI.cs index 837aff4b..649b286c 100644 --- a/Samples~/Tutorials/WalletConnection/Scripts/WalletBalanceUI.cs +++ b/Samples~/Tutorials/WalletConnection/Scripts/WalletBalanceUI.cs @@ -27,7 +27,8 @@ private void OnDestroy() private async void OnWalletConnected(WalletProviderData walletProviderData) { // Balance is in microtez, so we divide it by 1.000.000 to get tez - int convertedBalance = (int)(await TezosAPI.GetXTZBalance() / 1000000); + var balance = ulong.Parse(await TezosAPI.GetBalance()); + int convertedBalance = (int)(balance / 1000000); balanceText.text = convertedBalance + " XTZ"; } diff --git a/Samples~/Tutorials/WalletConnection/Scripts/WalletConnectionHandler.cs b/Samples~/Tutorials/WalletConnection/Scripts/WalletConnectionHandler.cs index 89ade1f1..320c5465 100644 --- a/Samples~/Tutorials/WalletConnection/Scripts/WalletConnectionHandler.cs +++ b/Samples~/Tutorials/WalletConnection/Scripts/WalletConnectionHandler.cs @@ -63,7 +63,8 @@ private async void OnWalletConnected(WalletProviderData walletProviderData) HandleKukaiOnlyObjects(); // Balance is in microtez, so we divide it by 1.000.000 to get tez - int convertedBalance = (int)(await TezosAPI.GetXTZBalance() / 1000000); + var balance = ulong.Parse(await TezosAPI.GetBalance()); + int convertedBalance = (int)(balance / 1000000); balanceText.text = convertedBalance + " XTZ"; }