generated from CareBoo/UPMTemplate-2020
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kmd): ✨ add
KmdClientAsset
to store kmd info
- Loading branch information
1 parent
30fb9e9
commit aba4efb
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}]"); | ||
} | ||
} | ||
} |