Skip to content

Commit

Permalink
feat(kmd): ✨ add KmdClientAsset to store kmd info
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonboukheir committed Oct 24, 2023
1 parent 30fb9e9 commit aba4efb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Runtime/Algorand.Unity/Clients/Kmd/KmdClientAsset.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
using Cysharp.Threading.Tasks;
using UnityEngine;

namespace Algorand.Unity
{
[HelpURL(DocUrl.Api + "Algorand.Unity.KmdClientAsset.html")]
[CreateAssetMenu(menuName = "Algorand/Kmd Client")]
public class KmdClientAsset : ScriptableObject
{
[ContextMenuItem("Test Connection", nameof(TestConnection))]
public KmdClient client;

private void TestConnection()
{
TestConnectionAsync().Forget();
}

private async UniTaskVoid TestConnectionAsync()
{
var (error, result) = await client.Versions();

if (error) Debug.LogError(error);
else Debug.Log($"Kmd connection healthy. Versions: [{string.Join(", ", result.Versions)}]");
}
}
}

0 comments on commit aba4efb

Please sign in to comment.