Skip to content

Commit

Permalink
docs(dotnet): add warning for using dotnet sdk clients with WebGL builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonboukheir committed Nov 26, 2022
1 parent 67d77b0 commit c184118
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Documentation~/integration_with_the_dotnet_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This SDK embeds the latest [.NET Algorand SDK](https://github.com/FrankSzendzielarz/dotnet-algorand-sdk) for usage with its models and classes. Most models and clients in the `Algorand.Unity.Algod` and `Algorand.Unity.Indexer` namespace have explicit conversions to corresponding models and apis in the `Algorand.Algod` and `Algorand.Indexer` namespaces.

> [!Warning]
> Using .NET SDK client types and signing methods are not supported for the WebGL build target.
For example, you can convert `Algorand.Unity.AlgodClient` to `Algorand.Algod.DefaultApi`:

```csharp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
using System.Collections;
using System.Threading;
using Cysharp.Threading.Tasks;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;

[TestFixture]
public class DotnetAlgodClientTest : AlgodClientTestFixture
{
[Test]
public void InstantiatingClientShouldThrowNoErrors()
{
var defaultAlgod = AlgoApiClientSettings.DefaultAlgod;
var api = (Algorand.Algod.DefaultApi)defaultAlgod;
}

[UnityTest]
public IEnumerator SendSimpleRequestShouldThrowNoErrors() => UniTask.ToCoroutine(async () =>
{
var defaultAlgod = AlgoApiClientSettings.DefaultAlgod;
var api = (Algorand.Algod.DefaultApi)defaultAlgod;
#if UNITY_WEBGL && !UNITY_EDITOR
Assert.Ignore("HttpClient is not supported in WebGL");
#else
SynchronizationContext.SetSynchronizationContext(new UniTaskSynchronizationContext());
var api = AlgoApiClientSettings.DefaultAlgod.ToDefaultApi();
var response = await api.GetStatusAsync();
Debug.Log($"Last Round: {response.LastRound}");
Assert.Greater(response.LastRound, 0);
#endif
});
}
}

0 comments on commit c184118

Please sign in to comment.