Skip to content

Commit

Permalink
feat(algod): ✨ add AlgodClientAsset to be used for storing algod info
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonboukheir committed Oct 24, 2023
1 parent f7a9fd7 commit 57b7374
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Runtime/Algorand.Unity/Clients/Algod/AlgodClientAsset.cs
Original file line number Diff line number Diff line change
@@ -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.");
}
}
}

0 comments on commit 57b7374

Please sign in to comment.