From 57b7374b7536247cfd49f628285c30d667d3aeb5 Mon Sep 17 00:00:00 2001 From: Jason Elie Bou Kheir <5115126+jasonboukheir@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:27:14 -0700 Subject: [PATCH] feat(algod): :sparkles: add `AlgodClientAsset` to be used for storing algod info --- .../Clients/Algod/AlgodClientAsset.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Runtime/Algorand.Unity/Clients/Algod/AlgodClientAsset.cs b/Runtime/Algorand.Unity/Clients/Algod/AlgodClientAsset.cs index e48f9de22..488286290 100644 --- a/Runtime/Algorand.Unity/Clients/Algod/AlgodClientAsset.cs +++ b/Runtime/Algorand.Unity/Clients/Algod/AlgodClientAsset.cs @@ -1,10 +1,27 @@ +using Cysharp.Threading.Tasks; using UnityEngine; namespace Algorand.Unity { + [HelpURL(DocUrl.Api + "Algorand.Unity.AlgodClientAsset.html")] [CreateAssetMenu(menuName = "Algorand/Algod Client")] public class AlgodClientAsset : ScriptableObject { + public AlgorandNetwork network; + + [ContextMenuItem("Test Connection", nameof(TestConnection))] public AlgodClient client; + + private void TestConnection() + { + TestConnectionAsync().Forget(); + } + + private async UniTaskVoid TestConnectionAsync() + { + var result = await client.HealthCheck(); + if (result.Error) Debug.LogError(result.Error); + else Debug.Log("Algod connection healthy."); + } } }