generated from CareBoo/UPMTemplate-2020
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(algod): ✨ add
AlgodClientAsset
to be used for storing algod info
- Loading branch information
1 parent
f7a9fd7
commit 57b7374
Showing
1 changed file
with
17 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,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."); | ||
} | ||
} | ||
} |